Chris Lattner | 9a3c2b5 | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 3 | # TestRunner.sh - This script is used to run the deja-gnu tests exactly like |
| 4 | # deja-gnu does, by executing the Tcl script specified in the test case's |
| 5 | # RUN: lines. This is made possible by a simple make target supported by the |
| 6 | # test/Makefile. All this script does is invoke that make target. |
Chris Lattner | 9a3c2b5 | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 7 | # |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 8 | # Usage: |
| 9 | # TestRunner.sh {script_names} |
Chris Lattner | dec2d79 | 2003-05-14 18:39:57 +0000 | [diff] [blame] | 10 | # |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 11 | # This script is typically used by cd'ing to a test directory and then |
| 12 | # running TestRunner.sh with a list of test file names you want to run. |
Chris Lattner | 9a3c2b5 | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 13 | # |
Reid Spencer | 562744c | 2007-05-16 17:56:56 +0000 | [diff] [blame] | 14 | TESTPATH=`pwd` |
| 15 | SUBDIR="" |
Dan Gohman | 171f3dc | 2008-07-28 18:41:03 +0000 | [diff] [blame] | 16 | if test `dirname $1` = "." ; then |
Reid Spencer | e01236a | 2007-05-18 02:06:03 +0000 | [diff] [blame] | 17 | while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do |
| 18 | tmp=`basename $TESTPATH` |
| 19 | SUBDIR="$tmp/$SUBDIR" |
| 20 | TESTPATH=`dirname $TESTPATH` |
| 21 | done |
| 22 | fi |
Reid Spencer | 562744c | 2007-05-16 17:56:56 +0000 | [diff] [blame] | 23 | |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 24 | for TESTFILE in "$@" ; do |
Dan Gohman | 171f3dc | 2008-07-28 18:41:03 +0000 | [diff] [blame] | 25 | if test `dirname $TESTFILE` = . ; then |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 26 | if test -d "$TESTPATH" ; then |
| 27 | cd $TESTPATH |
| 28 | make check-one TESTONE="$SUBDIR$TESTFILE" |
Reid Spencer | 562744c | 2007-05-16 17:56:56 +0000 | [diff] [blame] | 29 | cd $PWD |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 30 | else |
| 31 | echo "Can't find llvm/test directory in " `pwd` |
| 32 | fi |
Reid Spencer | 4142579 | 2007-04-15 06:47:49 +0000 | [diff] [blame] | 33 | else |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 34 | make check-one TESTONE=$TESTFILE |
Reid Spencer | 4142579 | 2007-04-15 06:47:49 +0000 | [diff] [blame] | 35 | fi |
Reid Spencer | 0e72512 | 2007-04-26 03:59:24 +0000 | [diff] [blame] | 36 | done |