forked from e0404/matRad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.sh
48 lines (40 loc) · 1007 Bytes
/
runtests.sh
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
#!/usr/bin/env bash
## Make sure some failures are detected by the CI runners
function exitIfError {
# pass "$?" as argument: i.e. the exit status of the last call
if [ "$1" -ne 0 ]; then
exit $1;
fi
}
## Handle Runner and Switches variables
Runner=$1
Switches=$2
if [ -z "$Runner" ] ; then
Runner="octave"
fi
if [ -z "$Switches" ] ; then
case "$Runner" in
*matlab* )
Switches="-nodesktop -r"
;;
*octave* )
Switches="--no-gui --eval"
;;
* )
# Fall back to Octave switches
Switches="--no-gui --eval"
;;
esac
fi
## Make sure MATLAB/Octave know the intent
# note: the export is required
export CONTINUOUS_INTEGRATION=true
export CI=true
## Actually run the test suite
cd unitTest
TESTDIR=`pwd`
# also CD in MATLAB/Octave to make sure that startup files
# cannot play any role in setting the path
${Runner} ${Switches} "cd('${TESTDIR}'); matRad_runTests" > ../runtests.log #2> ../runtests.err put stdout to log, but let it print error messages
exitIfError $?
cd ..