blob: 4f04d81aac64807458161d477465195ef6669571 [file] [log] [blame]
Chris Lattner9a3c2b52002-02-01 04:24:47 +00001#!/bin/sh
2#
Reid Spencer0e725122007-04-26 03:59:24 +00003# 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 Lattner9a3c2b52002-02-01 04:24:47 +00007#
Reid Spencer0e725122007-04-26 03:59:24 +00008# Usage:
9# TestRunner.sh {script_names}
Chris Lattnerdec2d792003-05-14 18:39:57 +000010#
Reid Spencer0e725122007-04-26 03:59:24 +000011# 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 Lattner9a3c2b52002-02-01 04:24:47 +000013#
Reid Spencer562744c2007-05-16 17:56:56 +000014TESTPATH=`pwd`
15SUBDIR=""
Dan Gohman171f3dc2008-07-28 18:41:03 +000016if test `dirname $1` = "." ; then
Reid Spencere01236a2007-05-18 02:06:03 +000017 while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do
18 tmp=`basename $TESTPATH`
19 SUBDIR="$tmp/$SUBDIR"
20 TESTPATH=`dirname $TESTPATH`
21 done
22fi
Reid Spencer562744c2007-05-16 17:56:56 +000023
Reid Spencer0e725122007-04-26 03:59:24 +000024for TESTFILE in "$@" ; do
Dan Gohman171f3dc2008-07-28 18:41:03 +000025 if test `dirname $TESTFILE` = . ; then
Reid Spencer0e725122007-04-26 03:59:24 +000026 if test -d "$TESTPATH" ; then
27 cd $TESTPATH
28 make check-one TESTONE="$SUBDIR$TESTFILE"
Reid Spencer562744c2007-05-16 17:56:56 +000029 cd $PWD
Reid Spencer0e725122007-04-26 03:59:24 +000030 else
31 echo "Can't find llvm/test directory in " `pwd`
32 fi
Reid Spencer41425792007-04-15 06:47:49 +000033 else
Reid Spencer0e725122007-04-26 03:59:24 +000034 make check-one TESTONE=$TESTFILE
Reid Spencer41425792007-04-15 06:47:49 +000035 fi
Reid Spencer0e725122007-04-26 03:59:24 +000036done