7 # Syntax: prefTest.pl [<var1>=<Subst1> [<var2>=<Subst> ...]] [[ctest parameters]]
9 my $bindir = "@CMAKE_BINARY_DIR@";
11 my $userdir = "$bindir/Testing/.lyx";
14 "use_converter_needauth_forbidden" => ["true", "false"],
15 "use_converter_needauth" => ["true", "false"],
20 # Parse Arguments for strings to substitute
28 push(@ctestpars, $arg);
31 if ($arg =~ /^([^=]+)=(.*)$/) {
35 if (defined($allowedKeys{$key})) {
36 for my $val (@{$allowedKeys{$key}}) {
44 $Subst{$key} = [$value, 0];
47 die("invalid key or value specified in \"$arg\"");
52 push(@ctestpars, $arg);
57 if (%Subst) { # Try to do something only if a substitute is requested
58 if (open(FO, '>', "$userdir/preferences.tmp")) {
59 if (open(FI, "$userdir/preferences")) {
60 while (my $l = <FI>) {
61 for my $k (keys %Subst) {
62 if ($l =~ /^\\$k\b/) {
63 $l = "\\$k $Subst{$k}->[0]\n";
70 for my $k (keys %Subst) {
71 if ($Subst{$k}->[1] == 0) {
72 print FO "\\$k $Subst{$k}->[0]\n";
75 rename("$userdir/preferences.tmp", "$userdir/preferences");
81 $res = system("ctest", @ctestpars);