Rewrite test/Linker tests to use FileCheck instead of grep.
authorEli Bendersky <eliben@google.com>
Tue, 9 Apr 2013 16:51:13 +0000 (16:51 +0000)
committerEli Bendersky <eliben@google.com>
Tue, 9 Apr 2013 16:51:13 +0000 (16:51 +0000)
Some translations here are not 1x1 because there are grep|grep
chains that are non-trivial to implement in terms of FileCheck features. I
made an effort for the tests to remain as similar as possible; do let me know
if you notice anything fishy. The good news are that some buggy tests were
fixed (grep | not grep - a bug waiting to happen).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179102 91177308-0d34-0410-b5e6-96231b3b80d8

25 files changed:
test/Linker/2003-01-30-LinkerRename.ll
test/Linker/2003-01-30-LinkerTypeRename.ll
test/Linker/2003-04-23-LinkOnceLost.ll
test/Linker/2003-05-31-LinkerRename.ll
test/Linker/2003-08-23-GlobalVarLinking.ll
test/Linker/2003-08-24-InheritPtrSize.ll
test/Linker/2004-12-03-DisagreeingType.ll
test/Linker/2005-02-12-ConstantGlobals-2.ll
test/Linker/2005-02-12-ConstantGlobals.ll
test/Linker/2005-12-06-AppendingZeroLengthArrays.ll
test/Linker/2006-06-15-GlobalVarAlignment.ll
test/Linker/2008-03-07-DroppedSection_a.ll
test/Linker/2008-03-07-DroppedSection_b.ll
test/Linker/2008-06-26-AddressSpace.ll
test/Linker/2011-08-18-unique-class-type.ll
test/Linker/2011-08-18-unique-debug-type.ll
test/Linker/AppendingLinkage.ll
test/Linker/AppendingLinkage2.ll
test/Linker/ConstantGlobals1.ll
test/Linker/ConstantGlobals2.ll
test/Linker/ConstantGlobals3.ll
test/Linker/link-global-to-func.ll
test/Linker/linknamedmdnode.ll
test/Linker/redefinition.ll
test/Linker/weakextern.ll

index e7431ec1588655ce5e6e8819a6cf1d526f464573..cbf754133411e3222705336f175234f984006ce9 100644 (file)
@@ -3,7 +3,8 @@
 
 ; RUN: echo "define internal i32 @foo() { ret i32 7 } " | llvm-as > %t.1.bc
 ; RUN: llvm-as %s -o %t.2.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep "@foo()" | grep -v internal
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: internal{{.*}}@foo{{[0-9]}}()
 
 define i32 @foo() { ret i32 0 }
 
index 94fb5e0826c5d49395ee5dbbd723c97e61e80014..d61eb6d7abb3c43b99b6f986dc2d235192811cbf 100644 (file)
@@ -3,8 +3,9 @@
 
 ; RUN: echo "%%Ty = type opaque @GV = external global %%Ty*" | llvm-as > %t.1.bc
 ; RUN: llvm-as < %s > %t.2.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep "%%Ty " | not grep opaque
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: = global %Ty
 
 %Ty = type {i32}
 
-@GV = global %Ty* null
\ No newline at end of file
+@GV = global %Ty* null
index 98a943a5344bd2895f05e4d5a7f2c99928398461..e4528906e0243aa41bf30bd9be7d5c09932ab726 100644 (file)
@@ -4,7 +4,8 @@
 ; RUN: echo " define linkonce void @foo() { ret void } " | \
 ; RUN:   llvm-as -o %t.2.bc
 ; RUN: llvm-as %s -o %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep foo | grep linkonce
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: linkonce{{.*}}foo
 
 declare void @foo()
 
index dff861dc4bb19568ab4e299f90c926f9e8a5a4dd..2e734beba6d96dab063753dd56d96c2db3d7cede 100644 (file)
@@ -6,7 +6,8 @@
 
 ; RUN: echo " define internal i32 @foo() { ret i32 7 } " | llvm-as > %t.1.bc
 ; RUN: llvm-as < %s > %t.2.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep internal | not grep "@foo("
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: internal {{.*}} @foo{{[0-9]}}(
 
 declare i32 @foo() 
 
index e934836a6135067ba6810358747382a2207598bf..122bc41f554e908631279f5005a1927a890d0392 100644 (file)
@@ -1,7 +1,8 @@
 ; RUN: llvm-as < %s > %t.out1.bc
 ; RUN: echo "%%T1 = type opaque %%T2 = type opaque @S = external global { i32, %%T1* } declare void @F(%%T2*)"\
 ; RUN:   | llvm-as > %t.out2.bc
-; RUN: llvm-link %t.out1.bc %t.out2.bc -S | not grep opaque
+; RUN: llvm-link %t.out1.bc %t.out2.bc -S | FileCheck %s
+; CHECK-NOT: opaque
 
 ; After linking this testcase, there should be no opaque types left.  The two
 ; S's should cause the opaque type to be resolved to 'int'.
index 51d544b83f9061511615d1686b1751296c294140..dbaf9bc111b7531a089b19c23080b98e391a1cad 100644 (file)
@@ -3,7 +3,8 @@
 
 ; RUN: llvm-as < %s > %t.out1.bc
 ; RUN: echo "" | llvm-as > %t.out2.bc
-; RUN: llvm-link %t.out1.bc %t.out2.bc 2>&1 | not grep warning
+; RUN: llvm-link %t.out1.bc %t.out2.bc 2>&1 | FileCheck %s 
+; CHECK-NOT: warning
 
 target datalayout = "e-p:64:64"
 
index 73d7a4055046db138c0618b9c8414d09c3deed40..63e15299252dbd1c8546dd8fe4ecfcdbfd9ce44c 100644 (file)
@@ -1,7 +1,8 @@
 ; RUN: echo "@G = weak global {{{{double}}}} zeroinitializer " | \
 ; RUN:   llvm-as > %t.out2.bc
 ; RUN: llvm-as < %s > %t.out1.bc
-; RUN: llvm-link %t.out1.bc %t.out2.bc -S | not grep "}"
+; RUN: llvm-link %t.out1.bc %t.out2.bc -S | FileCheck %s
+; CHECK-NOT: }
 
 ; When linked, the global above should be eliminated, being merged with the 
 ; global below.
index 30bfafeb13b52af8eee3fe7c1f477a778943b8af..7d2e813146512857f2536db623755d3fce285057 100644 (file)
@@ -3,6 +3,7 @@
 
 ; RUN: echo "@X = external constant i32" | llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep "global i32 7"
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: global i32 7
 
 @X = global i32 7
index 93709cf50bedce424a6372cff2550df871de898d..db990604d9a8fb5f138a8449db0d1c25128f6c4d 100644 (file)
@@ -3,6 +3,7 @@
 
 ; RUN: echo "@X = global i32 7" | llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep "global i32 7"
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: global i32 7
 
 @X = external constant i32             ; <i32*> [#uses=0]
index d7a34c841e63b7dd8095ec28e69329f6b91e5a63..b99b3a823755c2d5545f8cdbfbee1bd374dc4c40 100644 (file)
@@ -1,7 +1,8 @@
 ; RUN: echo " @G = appending global [0 x i32] zeroinitializer " | \
 ; RUN:   llvm-as > %t.out2.bc
 ; RUN: llvm-as < %s > %t.out1.bc
-; RUN: llvm-link %t.out1.bc %t.out2.bc -S | grep "@G ="
+; RUN: llvm-link %t.out1.bc %t.out2.bc -S | FileCheck %s
+; CHECK: @G =
 
 ; When linked, the globals should be merged, and the result should still 
 ; be named '@G'.
index eec8f637be0d4522a2908b6117d09f58d7e478ba..c9f9b0e2ab43ca2c5efd1e64185fa43f077f61d9 100644 (file)
@@ -2,6 +2,7 @@
 
 ; RUN: echo "@X = global i32 7, align 8" | llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep "align 8"
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: align 8
 
 @X = weak global i32 7, align 4
index ec9d5c26ed3da4761934d0391922b274e3e2cbb6..58baad95e49877591b5a63efedf0d05d86736852 100644 (file)
@@ -1,7 +1,8 @@
 ; RUN: llvm-as < %s > %t.bc
 ; RUN: llvm-as < %p/2008-03-07-DroppedSection_b.ll > %t2.bc
 ; RUN: llvm-link %t.bc %t2.bc -o %t3.bc
-; RUN: llvm-dis < %t3.bc | grep ".data.init_task"
+; RUN: llvm-dis < %t3.bc | FileCheck %s
+; CHECK: .data.init_task
 
 ; ModuleID = 't.bc'
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
index 63b64f6aa1aa1b9e75e3d346564e5a1540c130a1..9bcb80d796d175aaf850689d9754d26cfce2adc4 100644 (file)
@@ -1,7 +1,8 @@
 ; RUN: llvm-as < %s > %t.bc
 ; RUN: llvm-as < %p/2008-03-07-DroppedSection_a.ll > %t2.bc
 ; RUN: llvm-link %t.bc %t2.bc -o %t3.bc
-; RUN: llvm-dis < %t3.bc | grep ".data.init_task"
+; RUN: llvm-dis < %t3.bc | FileCheck %s
+; CHECK: .data.init_task
 
 ; ModuleID = 'u.bc'
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
index e1d35741e7f1f60ccfc88914cff58adcc1938ef0..d4310bc816e27f1003bf7898896d9cf23986da80 100644 (file)
@@ -2,8 +2,9 @@
 ; in different modules.
 ; RUN: llvm-as %s -o %t.foo1.bc
 ; RUN: echo | llvm-as -o %t.foo2.bc
-; RUN: llvm-link %t.foo2.bc %t.foo1.bc -S | grep "addrspace(2)"
-; RUN: llvm-link %t.foo1.bc %t.foo2.bc -S | grep "addrspace(2)"
+; RUN: llvm-link %t.foo2.bc %t.foo1.bc -S | FileCheck %s
+; RUN: llvm-link %t.foo1.bc %t.foo2.bc -S | FileCheck %s
+; CHECK: addrspace(2)
 ; rdar://6038021
 
 @G = addrspace(2) global i32 256 
index cae1245522ef142ed4d47dee3fcd708d0b5500e4..328e83bd07b948f05440ca5e44df1855f84d4192 100644 (file)
@@ -1,4 +1,6 @@
-; RUN: llvm-link %s %p/2011-08-18-unique-class-type2.ll -S -o - | grep DW_TAG_class_type | count 1
+; RUN: llvm-link %s %p/2011-08-18-unique-class-type2.ll -S -o - | FileCheck %s
+; CHECK: DW_TAG_class_type
+; CHECK-NOT: DW_TAG_class_type
 ; Test to check there is only one MDNode for class A after linking.
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
index 696fdb3108b8f60708b609f4708613003b45724a..cc0df4d0165e3c3ce2f2b1eae03bbb8f5ed1b948 100644 (file)
@@ -1,6 +1,6 @@
-
-; RUN: llvm-link %s %p/2011-08-18-unique-debug-type2.ll -S -o - | grep "int" | grep -v "^; ModuleID" | count 1
+; RUN: llvm-link %s %p/2011-08-18-unique-debug-type2.ll -S -o - | FileCheck %s
 ; Test to check only one MDNode for "int" after linking.
+; CHECK: !"int"
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.7.0"
 
index 014ead91bd109d4d910566662e0913340455de28..5beff5a10777e0f7684e3ff041b136551ef0cbf0 100644 (file)
@@ -3,7 +3,8 @@
 ; RUN: echo "@X = appending global [1 x i32] [i32 8] " | \
 ; RUN:   llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep 7 | grep 4 | grep 8
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: [i32 7, i32 4, i32 8]
 
 @X = appending global [2 x i32] [ i32 7, i32 4 ]               ; <[2 x i32]*> [#uses=2]
 @Y = global i32* getelementptr ([2 x i32]* @X, i64 0, i64 0)           ; <i32**> [#uses=0]
index 7385efb1f9b0b33a3720da735153b67e6b2507e7..341ca1606b811baafe75b4c60fc131da2bed8ab6 100644 (file)
@@ -3,6 +3,7 @@
 ; RUN: echo "@X = appending global [1 x i32] [i32 8] " | \
 ; RUN:   llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep 7 | grep 8
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: [i32 7, i32 8]
 
 @X = appending global [1 x i32] [ i32 7 ]              ; <[1 x i32]*> [#uses=0]
index 716eb3d02e92fc2f7adbf2c01793ba827a52aef9..a2bb6fbfba8a803f32f22cce13f2da2fc26ea478 100644 (file)
@@ -3,7 +3,8 @@
 ; RUN: echo "@X = constant [1 x i32] [i32 8] " | \
 ; RUN:   llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep constant
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: constant
 
 @X = external global [1 x i32]         ; <[1 x i32]*> [#uses=0]
 
index ad0f8e25f2c6053e42c0cb5a9af63b5df4750a46..47137799871396f05f1c8a9c831edaeff12b099f 100644 (file)
@@ -3,7 +3,8 @@
 ; RUN: echo "@X = external global [1 x i32] " | \
 ; RUN:   llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep constant
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: constant
 
 @X = constant [1 x i32] [ i32 12 ]             ; <[1 x i32]*> [#uses=0]
 
index 5aa26bc29b090eee393621268779158358af10f2..6b4ed24c31cf914ee67bdec81437b58973b3f274 100644 (file)
@@ -3,6 +3,7 @@
 ; RUN: echo "@X = external constant [1 x i32] " | \
 ; RUN:   llvm-as > %t.2.bc
 ; RUN: llvm-as < %s > %t.1.bc
-; RUN: llvm-link %t.1.bc %t.2.bc -S | grep constant
+; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s
+; CHECK: constant
 
 @X = external global [1 x i32]         ; <[1 x i32]*> [#uses=0]
index 9d969d768dff125d297527e3f321040e4dee5e14..4d83fe59e894788de38a0df82bda5e5f4ec99319 100644 (file)
@@ -1,7 +1,8 @@
 ; RUN: llvm-as %s -o %t1.bc
 ; RUN: echo "declare void @__eprintf(i8*, i8*, i32, i8*) noreturn     define void @foo() {      tail call void @__eprintf( i8* undef, i8* undef, i32 4, i8* null ) noreturn nounwind       unreachable }" | llvm-as -o %t2.bc
-; RUN: llvm-link %t2.bc %t1.bc -S | grep __eprintf
-; RUN: llvm-link %t1.bc %t2.bc -S | grep __eprintf
+; RUN: llvm-link %t2.bc %t1.bc -S | FileCheck %s
+; RUN: llvm-link %t1.bc %t2.bc -S | FileCheck %s
+; CHECK: __eprintf
 
 ; rdar://6072702
 
index e6b779f1fc5d69c4dce489921dd894360295e7e1..73e7554a9077bb066317bf45abb28cf851bb51bc 100644 (file)
@@ -1,6 +1,7 @@
 ; RUN: llvm-as < %s > %t.bc
 ; RUN: llvm-as < %p/linknamedmdnode2.ll > %t2.bc
-; RUN: llvm-link %t.bc %t2.bc -S | grep "!llvm.stuff = !{!0, !1}"
+; RUN: llvm-link %t.bc %t2.bc -S | FileCheck %s
+; CHECK: !llvm.stuff = !{!0, !1}
 
 !0 = metadata !{i32 42}
 !llvm.stuff = !{!0}
index 23ba6a100f06a98ea268d3c3d29b253c543827f6..64a8c341fedbecb6e9c7ffc09c4b7c22bb1cdc65 100644 (file)
@@ -3,8 +3,7 @@
 ; RUN: llvm-as %s -o %t.foo1.bc
 ; RUN: llvm-as %s -o %t.foo2.bc
 ; RUN: echo "define void @foo(i32 %x) { ret void }" | llvm-as -o %t.foo3.bc
-; RUN: not llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc 2>&1 | \
-; RUN:   grep "symbol multiply defined"
-; RUN: not llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc 2>&1 | \
-; RUN:   grep "symbol multiply defined"
+; RUN: not llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc 2>&1 | FileCheck %s
+; RUN: not llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc 2>&1 | FileCheck %s
+; CHECK: symbol multiply defined
 define void @foo() { ret void }
index 3a72a48aae00d4daaeeda7ca6b2aa88c09dda221..b9f2584c7eef9c2af4e2196d8039aef8e329c2be 100644 (file)
@@ -1,9 +1,10 @@
 ; RUN: llvm-as < %s > %t.bc
 ; RUN: llvm-as < %p/testlink1.ll > %t2.bc
 ; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc
-; RUN: llvm-dis < %t1.bc | grep "kallsyms_names = extern_weak"
-; RUN: llvm-dis < %t1.bc | grep "MyVar = external global i32"
-; RUN: llvm-dis < %t1.bc | grep "Inte = global i32"
+; RUN: llvm-dis < %t1.bc | FileCheck %s
+; CHECK: kallsyms_names = extern_weak
+; CHECK: Inte = global i32
+; CHECK: MyVar = external global i32
 
 @kallsyms_names = extern_weak global [0 x i8]          ; <[0 x i8]*> [#uses=0]
 @MyVar = extern_weak global i32                ; <i32*> [#uses=0]