2016-12-03 10:32:19 +00:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# -*- mode: perl; -*-
|
|
|
|
|
|
|
|
use strict;
|
2017-05-22 06:56:42 +00:00
|
|
|
use warnings;
|
2016-12-03 10:32:19 +00:00
|
|
|
|
2017-06-18 10:13:57 +00:00
|
|
|
# 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;
|
2016-12-03 10:32:19 +00:00
|
|
|
|
|
|
|
my $bindir = "@CMAKE_BINARY_DIR@";
|
|
|
|
|
|
|
|
my $userdir = "$bindir/Testing/.lyx";
|
|
|
|
|
|
|
|
my %allowedKeys = (
|
|
|
|
"use_converter_needauth_forbidden" => ["true", "false"],
|
|
|
|
"use_converter_needauth" => ["true", "false"],
|
2017-06-01 07:19:29 +00:00
|
|
|
"allow_geometry_session" => ["false"],
|
2020-08-19 20:28:50 +00:00
|
|
|
"use_converter_cache" => ["true", "false"],
|
|
|
|
"converter_cache_maxage" => "integer",
|
2016-12-03 10:32:19 +00:00
|
|
|
);
|
|
|
|
|
2017-06-16 09:39:26 +00:00
|
|
|
my %Converter = ();
|
|
|
|
|
2016-12-03 10:32:19 +00:00
|
|
|
chdir($bindir);
|
|
|
|
|
|
|
|
# Parse Arguments for strings to substitute
|
|
|
|
|
|
|
|
my %Subst = ();
|
|
|
|
|
|
|
|
my @ctestpars = ();
|
2017-06-16 09:39:26 +00:00
|
|
|
|
2017-06-18 10:13:57 +00:00
|
|
|
my $shell_escapes = 1;
|
|
|
|
my $handle_argv = "";
|
|
|
|
if (defined($ARGV[0]) && ($ARGV[0] =~ /^(test|default)$/)) {
|
|
|
|
$handle_argv = $1;
|
|
|
|
shift(@ARGV);
|
2016-12-03 10:32:19 +00:00
|
|
|
}
|
2017-04-24 15:50:49 +00:00
|
|
|
|
2017-06-18 10:13:57 +00:00
|
|
|
if ($handle_argv eq "test") {
|
|
|
|
@ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
|
|
|
|
"allow_geometry_session=false",
|
|
|
|
"use_converter_needauth_forbidden=false",
|
2020-08-19 20:28:50 +00:00
|
|
|
"use_converter_needauth=false",
|
|
|
|
"use_converter_cache=false",
|
|
|
|
"converter_cache_maxage=" . 180*24*60*60,
|
|
|
|
@ARGV);
|
2017-06-18 10:13:57 +00:00
|
|
|
}
|
|
|
|
elsif ($handle_argv eq "default") {
|
|
|
|
$shell_escapes = 0;
|
|
|
|
@ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
|
|
|
|
"allow_geometry_session=false",
|
|
|
|
"use_converter_needauth_forbidden=true",
|
2020-08-19 20:28:50 +00:00
|
|
|
"use_converter_needauth=true",
|
|
|
|
"use_converter_cache=true",
|
|
|
|
"converter_cache_maxage=" . 61*24*60*60,
|
|
|
|
@ARGV);
|
2016-12-03 10:32:19 +00:00
|
|
|
}
|
2017-06-18 10:13:57 +00:00
|
|
|
else {
|
|
|
|
@ctestpars = &getSubstitutes(\%allowedKeys, \%Subst,
|
|
|
|
"allow_geometry_session=false", @ARGV);
|
|
|
|
}
|
|
|
|
|
|
|
|
&getConverters($userdir, \%Converter, $shell_escapes);
|
|
|
|
|
|
|
|
&applyChanges($userdir, \%Subst, \%Converter, $shell_escapes);
|
2016-12-03 10:32:19 +00:00
|
|
|
|
|
|
|
my $res = 0;
|
|
|
|
if (@ctestpars) {
|
|
|
|
$res = system("ctest", @ctestpars);
|
|
|
|
}
|
|
|
|
|
|
|
|
exit($res);
|
2017-06-16 09:39:26 +00:00
|
|
|
|