# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version
-scratchdir="`pwd`"/testtmp
-echo " scratchdir=$scratchdir"
+# Prefix for scratch directory. We create separate directories for
+# each test case, so that they can be left behind in case of failure
+# to aid investigation.
+scratchbase="`pwd`"/testtmp
+echo " scratchbase=$scratchbase"
- else
- case $? in
- 77)
- echo "----- $testbase skipped"
- skipped=`expr $skipped + 1`
- ;;
- *)
- echo "----- $testbase failed: log follows"
- cat "$scratchdir/test.log"
- echo "----- $testbase log ends"
- failed=`expr $failed + 1`
- if [ "x$nopersist" = "xyes" ]
- then
- exit 1
- fi
- esac
- fi
+ discard_scratch
+ ;;
+ 77)
+ echo "----- $testbase skipped"
+ skipped=`expr $skipped + 1`
+ discard_scratch
+ ;;
+ *)
+ echo "----- $testbase failed: log follows"
+ cat "$scratchdir/test.log"
+ echo "----- $testbase log ends"
+ failed=`expr $failed + 1`
+ if [ "x$nopersist" = "xyes" ]
+ then
+ exit 1
+ fi
+ esac