6 # Syntax: ReplaceValuesprefTest.pl [<var1>=<Subst1> [<var2>=<Subst> ...]] [[ctest parameters]]
8 my $bindir = "@CMAKE_BINARY_DIR@";
10 my $userdir = "$bindir/Testing/.lyx";
13 "use_converter_needauth_forbidden" => ["true", "false"],
14 "use_converter_needauth" => ["true", "false"],
19 # Parse Arguments for strings to substitute
27 push(@ctestpars, $arg);
30 if ($arg =~ /^([^=]+)=(.*)$/) {
34 if (defined($allowedKeys{$key})) {
35 for my $val (@{$allowedKeys{$key}}) {
43 $Subst{$key} = [$value, 0];
46 die("invalid key or value specified in \"$arg\"");
51 push(@ctestpars, $arg);
55 if (%Subst) { # Try to do something only if a substitute is requested
56 if (open(FO, '>', "$userdir/preferences.tmp")) {
57 if (open(FI, "$userdir/preferences")) {
58 while (my $l = <FI>) {
59 for my $k (keys %Subst) {
60 if ($l =~ /^\\$k\b/) {
61 $l = "\\$k $Subst{$k}->[0]\n";
68 for my $k (keys %Subst) {
69 if ($Subst{$k}->[1] == 0) {
70 print FO "\\$k $Subst{$k}->[0]\n";
73 rename("$userdir/preferences.tmp", "$userdir/preferences");
79 $res = system("ctest", @ctestpars);