GDB_ME env variable runs a test case in gdb now
authordiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Sat, 27 Feb 2010 17:38:13 +0000 (17:38 +0000)
committerdiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Sat, 27 Feb 2010 17:38:13 +0000 (17:38 +0000)
git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8677 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

data/qcsrc/server-testcase/framework.qc
data/qcsrc/server-testcase/run.sh

index b387d30..d9f1add 100644 (file)
@@ -7,6 +7,7 @@ float test();
 void spawnfunc_worldspawn()
 {
        float r;
+       dprint("TESTCASE: START\n");
        r = test();
        if(r == 1)
                error("TESTCASE: PASS"); 
index a6e2120..520d4a3 100755 (executable)
@@ -18,7 +18,21 @@ engine=$1; shift
 map=$1; shift
 echo "$testcase" > "$dir/testcase.qc"
 if ( cd $dir && fteqcc ); then
-       r=`"$engine" -nexuiz -basedir "$dir/../../.." +sv_progs progs-testcase.dat "$@" +map "$map" | tee /dev/stderr`
+       set -- "$engine" -nexuiz -basedir "$dir/../../.." +sv_progs progs-testcase.dat "$@" +map "$map"
+       if [ -n "$GDB_ME" ]; then
+               cmdfile=`mktemp`
+               {
+                       echo "break VM_dprint"
+                       echo "run"
+                       echo "delete 1"
+                       echo "finish"
+               } > "$cmdfile"
+               gdb -x "$cmdfile" --args "$@"
+               rm -f "$cmdfile"
+               exit 0
+       else
+               r=`"$@" | tee /dev/stderr`
+       fi
        case "$r" in
                *"TESTCASE: PASS"*)
                        echo "PASS detected"