From: Argyrios Kyrtzidis Date: Mon, 6 Jul 2009 00:03:47 +0000 (+0000) Subject: Having tests that depend on previously created files is bad idea. Fix them to be... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=921bd2615956bda58dd71d610ed2533cc16e30cf;p=clang Having tests that depend on previously created files is bad idea. Fix them to be self-sufficient. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74810 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Index/_init.c b/test/Index/_init.c deleted file mode 100644 index 24caaefcb1..0000000000 --- a/test/Index/_init.c +++ /dev/null @@ -1,2 +0,0 @@ -// RUN: clang-cc -emit-pch %S/t1.c -o %T/t1.ast && -// RUN: clang-cc -emit-pch %S/t2.c -o %T/t2.ast diff --git a/test/Index/find-decls.c b/test/Index/find-decls.c index 06b52e96d7..eb3ff895e5 100644 --- a/test/Index/find-decls.c +++ b/test/Index/find-decls.c @@ -1,7 +1,9 @@ -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:8:7 -print-decls | count 3 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:8:7 -print-decls | grep 'foo.h:4:6,' | count 2 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:8:7 -print-decls | grep 't2.c:5:6,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:5:47 -print-decls | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:5:47 -print-decls | grep 't1.c:5:12,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:6:20 -print-decls | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:6:20 -print-decls | grep 't1.c:3:19,' +// RUN: clang-cc -emit-pch %S/t1.c -o %t1.ast && +// RUN: clang-cc -emit-pch %S/t2.c -o %t2.ast && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls | count 3 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls | grep 'foo.h:4:6,' | count 2 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls | grep 't2.c:5:6,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:47 -print-decls | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:47 -print-decls | grep 't1.c:5:12,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:6:20 -print-decls | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:6:20 -print-decls | grep 't1.c:3:19,' diff --git a/test/Index/find-defs.c b/test/Index/find-defs.c index d17dc0b142..5e034bbec6 100644 --- a/test/Index/find-defs.c +++ b/test/Index/find-defs.c @@ -1,8 +1,10 @@ -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:1:14 -print-defs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:1:14 -print-defs | grep 't2.c:3:5,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:3:9 -print-defs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:3:9 -print-defs | grep 't1.c:3:6,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:4:9 -print-defs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:4:9 -print-defs | grep 't2.c:5:6,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:8:7 -print-defs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:8:7 -print-defs | grep 't2.c:5:6,' +// RUN: clang-cc -emit-pch %S/t1.c -o %t1.ast && +// RUN: clang-cc -emit-pch %S/t2.c -o %t2.ast && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-defs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-defs | grep 't2.c:3:5,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-defs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-defs | grep 't1.c:3:6,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-defs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-defs | grep 't2.c:5:6,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-defs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-defs | grep 't2.c:5:6,' diff --git a/test/Index/find-refs.c b/test/Index/find-refs.c index fea1f752fb..29bf650805 100644 --- a/test/Index/find-refs.c +++ b/test/Index/find-refs.c @@ -1,16 +1,18 @@ -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:1:14 -print-refs | count 3 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't1.c:4:19,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't2.c:6:3,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't2.c:7:12,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:3:9 -print-refs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:3:9 -print-refs | grep 't2.c:7:3,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:4:9 -print-refs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/foo.h:4:9 -print-refs | grep 't1.c:8:3,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:3:22 -print-refs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:3:22 -print-refs | grep 't1.c:6:17,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:4:11 -print-refs | count 1 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:4:11 -print-refs | grep 't1.c:6:5,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:5:30 -print-refs | count 3 && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:5:27,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:5:44,' && -// RUN: index-test %T/t1.ast %T/t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:6:26,' +// RUN: clang-cc -emit-pch %S/t1.c -o %t1.ast && +// RUN: clang-cc -emit-pch %S/t2.c -o %t2.ast && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | count 3 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't1.c:4:19,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't2.c:6:3,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't2.c:7:12,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-refs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-refs | grep 't2.c:7:3,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-refs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-refs | grep 't1.c:8:3,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:3:22 -print-refs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:3:22 -print-refs | grep 't1.c:6:17,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:4:11 -print-refs | count 1 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:4:11 -print-refs | grep 't1.c:6:5,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | count 3 && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:5:27,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:5:44,' && +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:6:26,' diff --git a/test/TestRunner.sh b/test/TestRunner.sh index 07451eb485..bb20728578 100755 --- a/test/TestRunner.sh +++ b/test/TestRunner.sh @@ -11,7 +11,6 @@ # %S - Replaced with the directory where the input file resides # %prcontext - prcontext.tcl script # %t - temporary file name (derived from testcase name) -# %T - directory of temporary file name # FILENAME=$1 @@ -20,7 +19,6 @@ SUBST=$1 FILEDIR=`dirname $TESTNAME` OUTPUT=Output/$1.out -OUTPUTDIR=`dirname $OUTPUT` # create the output directory if it does not already exist mkdir -p `dirname $OUTPUT` > /dev/null 2>&1 @@ -88,7 +86,6 @@ grep 'RUN:' $FILENAME | \ -e "s|%s|$SUBST|g" \ -e "s|%S|$FILEDIR|g" \ -e "s|%prcontext|prcontext.tcl|g" \ - -e "s|%T|$OUTPUTDIR|g" \ -e "s|%t|$TEMPOUTPUT|g" > $SCRIPT IS_XFAIL=0 diff --git a/utils/test/TestRunner.py b/utils/test/TestRunner.py index 5625cb3c5b..9020622350 100755 --- a/utils/test/TestRunner.py +++ b/utils/test/TestRunner.py @@ -13,7 +13,6 @@ # %llvmgxx - llvm-g++ command # %prcontext - prcontext.tcl script # %t - temporary file name (derived from testcase name) -# %T - directory of temporary file name # import errno @@ -117,7 +116,6 @@ def runOneTest(FILENAME, SUBST, OUTPUT, TESTNAME, CLANG, CLANGCC, ('%llvmgxx','llvm-g++ -emit-llvm -w'), ('%prcontext','prcontext.tcl'), ('%t',TEMPOUTPUT), - ('%T',os.path.dirname(TEMPOUTPUT)), (' clang ', ' ' + CLANG + ' '), (' clang-cc ', ' ' + CLANGCC + ' ')] scriptLines = []