]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server-testcase/run.sh
a6e2120468d258ff9dfd698f8293b52cbb2acb53
[divverent/nexuiz.git] / data / qcsrc / server-testcase / run.sh
1 #!/bin/sh
2
3 if [ "$#" -lt 3 ]; then
4         echo "Usage: $0 'float test() { if(fail) return 0; else if(good) return 1; else return -1; }' ./darkplaces-dedicated basement +sv_cheats 1"
5         exit 125
6 fi
7
8 case "$0" in
9         */*)
10                 dir=${0%/*}
11                 ;;
12         *)
13                 dir=`pwd`
14                 ;;
15 esac
16 testcase=$1; shift
17 engine=$1; shift
18 map=$1; shift
19 echo "$testcase" > "$dir/testcase.qc"
20 if ( cd $dir && fteqcc ); then
21         r=`"$engine" -nexuiz -basedir "$dir/../../.." +sv_progs progs-testcase.dat "$@" +map "$map" | tee /dev/stderr`
22         case "$r" in
23                 *"TESTCASE: PASS"*)
24                         echo "PASS detected"
25                         exit 0
26                         ;;
27                 *"TESTCASE: FAIL"*)
28                         echo "FAIL detected"
29                         exit 1
30                         ;;
31                 *"TESTCASE: INVALID"*)
32                         echo "INVALID detected"
33                         exit 125
34                         ;;
35                 *)
36                         echo "Running failed"
37                         exit 125
38                         ;;
39         esac
40 else
41         echo "Compilation failed"
42         exit 125
43 fi