3 # TestRunner.sh - This script is used to run arbitrary unit tests. Unit
4 # tests must contain the command used to run them in the input file, starting
5 # immediately after a "RUN:" string.
7 # This runner recognizes and replaces the following strings in the command:
9 # %s - Replaced with the input name of the program, or the program to
10 # execute, as appropriate.
16 FILENAME_ONLY
=`basename $1`
17 OUTPUT
=Output
/$FILENAME_ONLY.out
19 # create the output directory if it does not already exist
20 mkdir Output
> /dev
/null
2>&1
23 # If more than one parameter is passed in, there must be three parameters:
24 # The filename to read from (already processed), the command used to execute,
25 # and the file to output to.
34 grep 'RUN:' $FILENAME |
sed "s|^.*RUN:\(.*\)$|\1|g;s|%s|$SUBST|g;s|%llvmgcc|llvm-gcc -emit-llvm|g;s|%llvmgxx|llvm-g++ -emit-llvm|g;s|%prcontext|prcontext.tcl|g" > $SCRIPT
37 /bin
/sh
$SCRIPT > $OUTPUT 2>&1 ||
(
38 echo "******************** TEST '$TESTNAME' FAILED! ********************"
44 echo "******************** TEST '$TESTNAME' FAILED! ********************"