blob: 4f04d81aac64807458161d477465195ef6669571 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001#!/bin/sh
2#
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.
7#
8# Usage:
9# TestRunner.sh {script_names}
10#
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.
13#
14TESTPATH=`pwd`
15SUBDIR=""
Dan Gohman1d475792008-07-28 18:41:03 +000016if test `dirname $1` = "." ; then
Dan Gohmanf17a25c2007-07-18 16:29:46 +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
23
24for TESTFILE in "$@" ; do
Dan Gohman1d475792008-07-28 18:41:03 +000025 if test `dirname $TESTFILE` = . ; then
Dan Gohmanf17a25c2007-07-18 16:29:46 +000026 if test -d "$TESTPATH" ; then
27 cd $TESTPATH
28 make check-one TESTONE="$SUBDIR$TESTFILE"
29 cd $PWD
30 else
31 echo "Can't find llvm/test directory in " `pwd`
32 fi
33 else
34 make check-one TESTONE=$TESTFILE
35 fi
36done