]> git.lyx.org Git - lyx.git/blob - lib/scripts/prefTest.pl.in
ext_copy: bug when creating the error string.
[lyx.git] / lib / scripts / prefTest.pl.in
1 #! /usr/bin/env perl
2 # -*- mode: perl; -*-
3
4 use strict;
5 use warnings;
6
7 # Syntax: prefTest.pl [test|default] [<var1>=<Subst1> [<var2>=<Subst> ...]] [[ctest parameters]]
8 # If the first parameter is "test"
9 #       allow use of -shell-escape in converters and
10 #       allow use of external programs
11 # If the first parameter is "default"
12 #       remove "-shell-escape" from converters and
13 #       forbid use of external programs
14 # Else
15 #       allow use of -shell-escape in converters and
16 #       do not change handling the use of external programs
17 ############################################################
18
19 BEGIN  {
20   unshift(@INC, "@CMAKE_CURRENT_SOURCE_DIR@");
21 }
22
23 use prefTest;
24
25 my $bindir = "@CMAKE_BINARY_DIR@";
26
27 my $userdir = "$bindir/Testing/.lyx";
28
29 my %allowedKeys = (
30   "use_converter_needauth_forbidden" => ["true", "false"],
31   "use_converter_needauth" => ["true", "false"],
32   "allow_geometry_session" => ["false"],
33   "use_converter_cache" => ["true", "false"],
34   "converter_cache_maxage" => "integer",
35     );
36
37 my %Converter = ();
38
39 chdir($bindir);
40
41 # Parse Arguments for strings to substitute
42
43 my %Subst = ();
44
45 my @ctestpars = ();
46
47 my $shell_escapes = 1;
48 my $handle_argv = "";
49 if (defined($ARGV[0]) && ($ARGV[0] =~ /^(test|default)$/)) {
50   $handle_argv = $1;
51   shift(@ARGV);
52 }
53
54 if ($handle_argv eq "test") {
55   @ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
56                                "allow_geometry_session=false",
57                                "use_converter_needauth_forbidden=false",
58                                "use_converter_needauth=false",
59                                "use_converter_cache=false",
60                                "converter_cache_maxage=" . 180*24*60*60,
61                                @ARGV);
62 }
63 elsif ($handle_argv eq "default") {
64   $shell_escapes = 0;
65   @ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
66                                "allow_geometry_session=false",
67                                "use_converter_needauth_forbidden=true",
68                                "use_converter_needauth=true",
69                                "use_converter_cache=true",
70                                "converter_cache_maxage=" . 61*24*60*60,
71                                @ARGV);
72 }
73 else {
74   @ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
75                                "allow_geometry_session=false", @ARGV);
76 }
77
78 &getConverters($userdir, \%Converter, $shell_escapes);
79
80 &applyChanges($userdir, \%Subst, \%Converter, $shell_escapes);
81
82 my $res = 0;
83 if (@ctestpars) {
84   $res = system("ctest", @ctestpars);
85 }
86
87 exit($res);
88