Debian Codegraph @

bin/test-driver-ff

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 # test-driver-ff from test-driver - basic testsuite driver script.
3 # modif F. Hecht UPMC.
4
5 scriptversion=2025-02-21.16; # UTC
6
7 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 # This file is maintained in Automake, please report
28 # bugs to <[email protected]> or send patches to
29 # <[email protected]>.
30
31 # Make unconditional expansion of undefined variables an error. This
32 # helps a lot in preventing typo-related bugs.
33 set -u
34
35 usage_errorscip-shell shell shell-project 0.0.0 usage_error(). ()
36 {
37 echoscip-shell system . . echo. "$0: $*" >&2
38 print_usagescip-shell shell shell-project 0.0.0 print_usage(). >&2
39 exit 2
40 }
41
42 print_usagescip-shell shell shell-project 0.0.0 print_usage(). ()
43 {
44 catscip-shell system . . cat. <<END
45 Usage:
46 test-driver-ff --test-name=NAME --log-file=PATH --trs-file=PATH
47 [--expect-failure={yes|no}] [--color-tests={yes|no}]
48 [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
49 The '--test-name', '--log-file' and '--trs-file' options are mandatory.
50 END
51 }
52
53 # TODO: better error handling in option parsing (in particular, ensure
54 # TODO: $log_file, $trs_file and $test_name are defined).
55 test_name= # Used for reporting.
56 log_file= # Where to save the output of the test script.
57 trs_file= # Where to save the metadata of the test run.
58 expect_failure=no
59 color_tests=no
60 enable_hard_errors=yes
61 while testscip-shell system . . test. $# -gt 0; do
62 case $1 in
63 --help) print_usagescip-shell shell shell-project 0.0.0 print_usage().; exit $?;;
64 --version) echoscip-shell system . . echo. "test-driver $scriptversion"; exit $?;;
65 --test-name) test_name=$2; shift;;
66 --log-file) log_file=$2; shift;;
67 --trs-file) trs_file=$2; shift;;
68 --color-tests) color_tests=$2; shift;;
69 --expect-failure) expect_failure=$2; shift;;
70 --enable-hard-errors) enable_hard_errors=$2; shift;;
71 --) shift; break;;
72 -*) usage_errorscip-shell shell shell-project 0.0.0 usage_error(). "invalid option: '$1'";;
73 esac
74 shift
75 done
76
77 if testscip-shell system . . test. $color_tests = yes; then
78 # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
79 red='' # Red.
80 grn='' # Green.
81 lgn='' # Light green.
82 blu='' # Blue.
83 mgn='' # Magenta.
84 std='' # No color.
85 ora='' # orange
86 else
87 red= grn= lgn= blu= mgn= std= ora=
88 fi
89 if testscip-shell system . . test. -n "${LIST_CONDITIONAL:-}" ; then
90 SKIP=yes;
91 case " ${LIST_CONDITIONAL} " in
92 *" $test_name "*) SKIP=no;;
93 esac
94 elif testscip-shell system . . test. -n "${LIST_SKIP:-}" ; then
95 # echo LIST_SKIP:
96 case " $LIST_SKIP " in
97 *" $test_name "*) SKIP=yes;;
98 esac
99 #echo SKIP "${SKIP:-no}"
100 fi
101
102 if testscip-shell system . . test. "${SKIP:-no}" = yes; then
103 echoscip-shell system . . echo. SKIP ${TEST_FFPP} ${FLAGS_FFPP} "$@" >$log_file 2>&1
104 estatus=77
105 else
106 do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
107 trap "st=129; $do_exit" 1
108 trap "st=130; $do_exit" 2
109 trap "st=141; $do_exit" 13
110 trap "st=143; $do_exit" 15
111
112 # Test script is run here.
113
114 FFnp=`awkscip-shell system . . awk. '$1=="//" && $2=="NBPROC" { if( vv == ""){ print $3;}; vv=1}' "$@"`
115 FLAGS_FFPP_A=`awkscip-shell system . . awk. '$1=="//" && $2=="PARAM" { if( vv == ""){ for(i=3;i<=NF;++i)print $i;}; vv=1}' "$@"`
116 if [scip-shell system . . `[`. "0$FFnp" -gt 0 ] ; then
117 FLAGS_FFPP_B="-np $FFnp -nw"
118 else
119 FLAGS_FFPP_B="${FLAGS_FFPP}"
120 fi
121 export MPIEXEC_TIMEOUT=50
122 testscip-shell system . . test. -z "${COMMONPROGRAMFILES+x}" -a -z "${WINDIR+x}" && ulimit -t 60
123 ${TEST_FFPP} ${FLAGS_FFPP_B} "$@" ${FLAGS_FFPP_A}>$log_file 2>&1
124 estatus=$?
125 echoscip-shell system . . echo. "status " $estatus >>$log_file
126 FAIL_CPU_LIMIT=`tailscip-shell system . . tail. -100 $log_file|egrepscip-shell system . . egrep. -i 'Cputime limit exceeded|MPIEXEC_TIMEOUT|APPLICATION TIMED OUT|Timeout after'|wcscip-shell system . . wc. -l`
127 fi
128 # Catch ulimit timeout on Linux
129 if [scip-shell system . . `[`. $estatus -eq 137 ]; then
130 FAIL_CPU_LIMIT=2
131 fi
132 ## Add an error suffix in order to extract errored tests only
133 if [scip-shell system . . `[`. $estatus -ne 0 ] && [scip-shell system . . `[`. $estatus -ne 77 ]; then
134 cpscip-shell system . . cp. $log_file "${log_file}.err"
135 fi
136
137 if testscip-shell system . . test. $enable_hard_errors = no && testscip-shell system . . test. $estatus -eq 99; then
138 estatus=1
139 fi
140 if testscip-shell system . . test. "${FAIL_CPU_LIMIT:-0}" -ge 1 ; then
141 expect_failure=cpu;
142 fi
143 case $estatus:$expect_failure in
144 0:yes) col=$grn res=PASS recheck=yes gcopy=yes;;
145 0:*) col=$grn res=PASS recheck=no gcopy=no;;
146 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
147 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
148 *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
149 *:cpu) col=$ora res=CPU recheck=no gcopy=yes;;
150 *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
151 esac
152
153 # Report outcome to console.
154 echoscip-shell system . . echo. "${col}${res}${std}: $test_name"
155
156 # Register the test result, and other relevant metadata.
157 echoscip-shell system . . echo. ":test-result: $res" > $trs_file
158 echoscip-shell system . . echo. ":global-test-result: $res" >> $trs_file
159 echoscip-shell system . . echo. ":recheck: $recheck" >> $trs_file
160 echoscip-shell system . . echo. ":copy-in-global-log: $gcopy" >> $trs_file
161
162 # Local Variables:
163 # mode: shell-script
164 # sh-indentation: 2
165 # eval: (add-hook 'write-file-hooks 'time-stamp)
166 # time-stamp-start: "scriptversion="
167 # time-stamp-format: "%:y-%02m-%02d.%02H"
168 # time-stamp-time-zone: "UTC"
169 # time-stamp-end: "; # UTC"
170 # End: