-// RUN: rm -f %t1.bc
-// RUN: not clang-cc %s -emit-llvm-bc -o %t1.bc
+// RUN: rm -f %t1.bc &&
+// RUN: not clang-cc %s -emit-llvm-bc -o %t1.bc &&
// RUN: not test -f %t1.bc
void f() {
// RUN: clang-cc -emit-llvm < %s -o %t &&
-// RUN: grep addrspace\(2\) %t | count 4
+// RUN: grep addrspace\(2\) %t | count 4 &&
// RUN: grep addrspace\(3\) %t | count 4
// Check the load and store are using the correct address space to access
__asm__ volatile("T7 NAMED: %[input]" : "+r"(a): [input] "i" (4));
}
-// RUN: grep "T8 NAMED MODIFIER: \${0:c}" %t
+// RUN: grep "T8 NAMED MODIFIER: \${0:c}" %t &&
void t8() {
__asm__ volatile("T8 NAMED MODIFIER: %c[input]" :: [input] "i" (4));
}
// RUN: grep '@t11().*section "SECT"' %t &&
// RUN: grep '@t12 =.*section "SECT"' %t &&
// RUN: grep '@t13 =.*section "SECT"' %t &&
-// RUN: grep '@t14.x =.*section "SECT"' %t
+// RUN: grep '@t14.x =.*section "SECT"' %t &&
// RUN: grep 'declare extern_weak i32 @t15()' %t &&
// RUN: grep '@t16 = extern_weak global i32' %t &&
-// RUN: clang-cc -g %s -emit-llvm -o %t -fblocks
+// RUN: clang-cc -g %s -emit-llvm -o %t -fblocks &&
// RUN: grep "func.start" %t | count 4
// 1 declaration, 1 bar, 1 test_block_dbg and 1 for the block.
-// RUN: clang-cc -emit-llvm -o - %s > %t
-// RUN: ! grep "__builtin" %t
+// RUN: clang-cc -emit-llvm -o - %s > %t &&
+// RUN: not grep "__builtin" %t
#include <stdio.h>
-// RUN: clang-cc -emit-llvm -o - %s > %t
-// RUN: ! grep "__builtin" %t
+// RUN: clang-cc -emit-llvm -o - %s > %t &&
+// RUN: not grep "__builtin" %t
#include <stdio.h>
#include <stdlib.h>
-// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix LSB %s
+// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix LSB %s &&
// CHECK-LSB: @.str = private constant [8 x i8] c"string0\00"
// CHECK-LSB: @.str1 = private constant [8 x i8] c"string1\00", section "__TEXT,__cstring,cstring_literals"
-// RUN: clang-cc %s -emit-llvm -o - | not grep 'extractelement'
-// RUN: clang-cc %s -emit-llvm -o - | not grep 'insertelement'
+// RUN: clang-cc %s -emit-llvm -o - | not grep 'extractelement' &&
+// RUN: clang-cc %s -emit-llvm -o - | not grep 'insertelement' &&
// RUN: clang-cc %s -emit-llvm -o - | grep 'shufflevector'
typedef __attribute__(( ext_vector_type(2) )) float float2;
-// RUN: clang-cc -emit-llvm < %s | grep 'fastcallcc' | count 4
+// RUN: clang-cc -emit-llvm < %s | grep 'fastcallcc' | count 4 &&
// RUN: clang-cc -emit-llvm < %s | grep 'stdcallcc' | count 4
void __attribute__((fastcall)) f1(void);
-// RUN: clang-cc < %s -emit-llvm > %t1 -triple=i686-apple-darwin9
+// RUN: clang-cc < %s -emit-llvm > %t1 -triple=i686-apple-darwin9 &&
// Run grep "STest1 = type <{ i32, \[4 x i16\], double }>" %t1 &&
// RUN: grep "STest2 = type <{ i16, i16, i32, i32 }>" %t1 &&
// RUN: grep "STest3 = type <{ i8, i8, i16, i32 }>" %t1 &&
// RUN: grep 'define internal void @f_deferred()' %t &&
// RUN: grep 'define protected i32 @f_def()' %t &&
// RUN: clang-cc -triple i386-unknown-unknown -fvisibility=hidden -emit-llvm -o %t %s &&
-// RUN: grep '@g_com = common hidden global i32 0' %t &&a
+// RUN: grep '@g_com = common hidden global i32 0' %t &&
// RUN: grep '@g_def = hidden global i32 0' %t &&
// RUN: grep '@g_ext = external global i32' %t &&
// RUN: grep '@g_deferred = internal global' %t &&
-// RUN: clang-cc %s -triple=i686-pc-linux-gnu -emit-llvm -o - > %t1
+// RUN: clang-cc %s -triple=i686-pc-linux-gnu -emit-llvm -o - > %t1 &&
// RUN: grep "ax" %t1 &&
// RUN: grep "bx" %t1 &&
// RUN: grep "cx" %t1 &&
-// RUN: clang-cc -g -S -o %t %s
+// RUN: clang-cc -g -S -o %t %s &&
// RUN: not grep 001 %t
@interface F
// RUN: clang-cc -fgnu-runtime --emit-llvm -o %t %s &&
// RUN: grep "objc_msg_lookup" %t | count 6 &&
// RUN: clang-cc -fgnu-runtime -fobjc-sender-dependent-dispatch --emit-llvm -o %t %s &&
-// RUN: grep "objc_msg_lookup_sender" %t | count 6
+// RUN: grep "objc_msg_lookup_sender" %t | count 6 &&
// RUN: true
typedef struct {
-// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s
+// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s &&
// RUN: grep -e "SiSetOtherThings:" %t
@interface A
-// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm 2> %t.log
+// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm 2> %t.log &&
// RUN: grep '"-triple" "i386-unknown-unknown"' %t.log &&
// RUN: grep '"-S"' %t.log &&
// RUN: grep '"-disable-free"' %t.log &&
// RUN: grep '"-Os"' %t.log &&
// RUN: grep '"-o" .*clang-translation.*' %t.log &&
// RUN: grep '"--asm-verbose"' %t.log &&
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log
+// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log &&
// RUN: grep '"--mcpu=yonah"' %t.log &&
-// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log
+// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log &&
// RUN: grep '"--mcpu=core2"' %t.log &&
// RUN: true
-// RUN: clang -ccc-host-triple i386-unknown-unknown -m64 -v 2> %t
+// RUN: clang -ccc-host-triple i386-unknown-unknown -m64 -v 2> %t &&
// RUN: grep 'Target: x86_64-unknown-unknown' %t &&
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc -m64 -v 2> %t
+// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc -m64 -v 2> %t &&
// RUN: grep 'Target: powerpc64-apple-darwin9' %t &&
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc64 -m32 -v 2> %t
+// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc64 -m32 -v 2> %t &&
// RUN: grep 'Target: powerpc-apple-darwin9' %t
// RUN: clang -mno-red-zone %s -S -emit-llvm -o %t.log &&
-// RUN: grep 'noredzone' %t.log
+// RUN: grep 'noredzone' %t.log &&
// RUN: clang -mred-zone %s -S -emit-llvm -o %t.log &&
// RUN: grep -v 'noredzone' %t.log
-// RUN: clang-cc -E - < /dev/null > %t
+// RUN: clang-cc -E - < /dev/null > %t &&
// RUN: grep '<built-in>' %t
// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:16:7 -print-refs > %t &&
// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:22:3,' %t
+// RUN: grep 't1.c:22:3,' %t &&
// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:7:11 -print-refs > %t &&
// RUN: cat %t | count 2 &&
// RUN: clang-cc -dump-tokens %s 2> %t &&
-// RUN: grep "identifier '\$A'" %t
+// RUN: grep "identifier '\$A'" %t &&
// RUN: clang-cc -dump-tokens -x assembler-with-cpp %s 2> %t &&
// RUN: grep "identifier 'A'" %t
// PR3808
-// RUN: clang -E %s "-DX=A
+// RUN: clang -E %s "-DX=A &&
// RUN: THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT" > %t &&
// RUN: grep "GOOD: A" %t &&
// RUN: not grep THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT %t
// Test the GNU comma swallowing extension.
// RUN: clang-cc %s -E | grep 'foo{A, }' &&
// RUN: clang-cc %s -E | grep 'fo2{A,}' &&
-// RUN: clang-cc %s -E | grep '{foo}'
+// RUN: clang-cc %s -E | grep '{foo}' &&
#define X(Y) foo{A, Y}
X()
-// RUN: clang-cc -P -E -fms-extensions %s | sed '/^#.\+/d' | tr -d '\n' |
-// RUN: grep '^int foo;int bar;int baz;$' | count 1
+// RUN: clang-cc -P -E -fms-extensions %s | sed '/^#.\+/d' | tr -d '\n' > %t &&
+// RUN: grep '^int foo;int bar;int baz;$' %t | count 1
// This horrible stuff should preprocess into (other than whitespace):
// int foo;
// int bar;
('%t',TEMPOUTPUT),
(' clang ', ' ' + CLANG + ' '),
(' clang-cc ', ' ' + CLANGCC + ' ')]
+
+ # Collect the test lines from the script.
scriptLines = []
xfailLines = []
for ln in open(scriptFile):
if 'RUN:' in ln:
- # Isolate run parameters
+ # Isolate the command to run.
index = ln.index('RUN:')
ln = ln[index+4:]
-
- # Apply substitutions
- for a,b in substitutions:
- ln = ln.replace(a,b)
-
- if useDGCompat:
- ln = re.sub(r'\{(.*)\}', r'"\1"', ln)
- scriptLines.append(ln)
+
+ # Strip whitespace and append.
+ scriptLines.append(ln.strip())
elif 'XFAIL' in ln:
xfailLines.append(ln)
+
+ # FIXME: Support something like END, in case we need to process large
+ # files.
+
+ # Validate interior lines for '&&', a lovely historical artifact.
+ for i in range(len(scriptLines) - 1):
+ ln = scriptLines[i]
+
+ if not ln.endswith('&&'):
+ print >>output, "MISSING \'&&\': %s" % ln
+ print >>output, "FOLLOWED BY : %s" % scriptLines[i + 1]
+ return TestStatus.Fail
+
+ # Strip off '&&'
+ scriptLines[i] = ln[:-2]
+
+ # Apply substitutions to the script.
+ def processLine(ln):
+ # Apply substitutions
+ for a,b in substitutions:
+ ln = ln.replace(a,b)
+
+ if useDGCompat:
+ ln = re.sub(r'\{(.*)\}', r'"\1"', ln)
+ return ln
+ scriptLines = map(processLine, scriptLines)
if xfailLines:
print >>output, "XFAILED '%s':"%(TESTNAME,)
# Write script file
f = open(SCRIPT,'w')
- f.write(''.join(scriptLines))
+ f.write(' &&\n'.join(scriptLines))
f.close()
outputFile = open(OUTPUT,'w')