File: prefTest.pl.in

package info (click to toggle)
lyx 2.4.3-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 130,280 kB
  • sloc: cpp: 259,444; ansic: 106,595; xml: 72,791; python: 32,859; sh: 7,176; makefile: 6,144; pascal: 2,129; perl: 2,007; objc: 1,084; tcl: 163; sed: 16
file content (87 lines) | stat: -rwxr-xr-x 2,289 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /usr/bin/perl
# -*- mode: perl; -*-

use strict;
use warnings;

# Syntax: prefTest.pl [test|default] [<var1>=<Subst1> [<var2>=<Subst> ...]] [[ctest parameters]]
# If the first parameter is "test"
#       allow use of -shell-escape in converters and
#       allow use of external programs
# If the first parameter is "default"
#       remove "-shell-escape" from converters and
#       forbid use of external programs
# Else
#       allow use of -shell-escape in converters and
#       do not change handling the use of external programs
############################################################

BEGIN  {
  unshift(@INC, "@CMAKE_CURRENT_SOURCE_DIR@");
}

use prefTest;

my $bindir = "@CMAKE_BINARY_DIR@";

my $userdir = "$bindir/Testing/.lyx";

my %allowedKeys = (
  "use_converter_needauth_forbidden" => ["true", "false"],
  "use_converter_needauth" => ["true", "false"],
  "allow_geometry_session" => ["false"],
  "use_converter_cache" => ["true", "false"],
  "converter_cache_maxage" => "integer",
    );

my %Converter = ();

chdir($bindir);

# Parse Arguments for strings to substitute

my %Subst = ();

my @ctestpars = ();

my $shell_escapes = 1;
my $handle_argv = "";
if (defined($ARGV[0]) && ($ARGV[0] =~ /^(test|default)$/)) {
  $handle_argv = $1;
  shift(@ARGV);
}

if ($handle_argv eq "test") {
  @ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
			       "allow_geometry_session=false",
			       "use_converter_needauth_forbidden=false",
			       "use_converter_needauth=false",
			       "use_converter_cache=false",
			       "converter_cache_maxage=" . 180*24*60*60,
			       @ARGV);
}
elsif ($handle_argv eq "default") {
  $shell_escapes = 0;
  @ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
			       "allow_geometry_session=false",
			       "use_converter_needauth_forbidden=true",
			       "use_converter_needauth=true",
			       "use_converter_cache=true",
			       "converter_cache_maxage=" . 61*24*60*60,
			       @ARGV);
}
else {
  @ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
			       "allow_geometry_session=false", @ARGV);
}

&getConverters($userdir, \%Converter, $shell_escapes);

&applyChanges($userdir, \%Subst, \%Converter, $shell_escapes);

my $res = 0;
if (@ctestpars) {
  $res = system("ctest", @ctestpars);
}

exit($res);