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 OUTPUT=Output/$FILENAME.out
18 # create the output directory if it does not already exist
19 mkdir Output > /dev/null 2>&1
22 # If more than one parameter is passed in, there must be three parameters:
23 # The filename to read from (already processed), the command used to execute,
24 # and the file to output to.
33 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
36 /bin/sh $SCRIPT > $OUTPUT 2>&1 || (
37 echo "******************** TEST '$TESTNAME' FAILED! ********************"
43 echo "******************** TEST '$TESTNAME' FAILED! ********************"