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"],
16 "allow_geometry_session" => ["false"],
21 # Parse Arguments for strings to substitute
27 for my $arg ("allow_geometry_session=false", @ARGV) {
29 push(@ctestpars, $arg);
32 if ($arg =~ /^([^=]+)=(.*)$/) {
36 if (defined($allowedKeys{$key})) {
37 for my $val (@{$allowedKeys{$key}}) {
45 $Subst{$key} = [$value, 0];
48 die("invalid key or value specified in \"$arg\"");
53 push(@ctestpars, $arg);
58 if (%Subst) { # Try to do something only if a substitute is requested
59 if (open(FO, '>', "$userdir/preferences.tmp")) {
60 if (open(FI, "$userdir/preferences")) {
61 while (my $l = <FI>) {
62 for my $k (keys %Subst) {
63 if ($l =~ /^\\$k\b/) {
64 $l = "\\$k $Subst{$k}->[0]\n";
71 for my $k (keys %Subst) {
72 if ($Subst{$k}->[1] == 0) {
73 print FO "\\$k $Subst{$k}->[0]\n";
76 rename("$userdir/preferences.tmp", "$userdir/preferences");
82 $res = system("ctest", @ctestpars);