blob: 725846752c1f14219246ad4512ede277ad32442b [file] [log] [blame]
Chris Lattner0f342da2002-02-01 04:24:47 +00001#!/bin/sh
2#
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.
6#
7# This runner recognizes and replaces the following strings in the command:
8# %s - Replaced with the input name of the program
9#
10
11PROGRAM=`grep 'RUN:' $1 | sed "s/^.*RUN:\(.*\)$/\1/g;s/%s/$1/g" | head -n 1`
12OUTPUT=Output/$1.out
13
14($PROGRAM) > $OUTPUT 2>&1 || (
15 echo "******************** TEST '$1' FAILED! ********************"
16 echo "Command: " $PROGRAM
17 echo "Output:"
18 cat $OUTPUT
19 rm $OUTPUT
20 echo "******************** TEST '$1' FAILED! ********************"
21)
22