llvm.org GIT mirror llvm / edca80b
For PR1319: Upgrade to new test harness git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36073 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 13 years ago
38 changed file(s) with 108 addition(s) and 104 deletion(s). Raw diff Collapse all Expand all
11
22 ; RUN: llvm-as > %t1.bc < /dev/null
33 ; RUN: llvm-upgrade < %s | llvm-as > %t2.bc
4 ; RUN: llvm-link %t[12].bc
4 ; RUN: llvm-link %t1.bc %t2.bc
55
66 %work = global int (int, int)* %zip
77
0 ; This fails because the linker renames the external symbol not the internal
11 ; one...
22
3 ; RUN: echo "implementation internal int %foo() { ret int 7 }" | llvm-upgrade |\
4 ; RUN: llvm-as > %t.1.bc
5 ; RUN: llvm-upgrade < %s | llvm-as -o %t.2.bc -f
6 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep '@foo()' | grep -v internal
3 ; RUN: echo {define internal i32 @foo() \{ ret i32 7 \} } | llvm-as > %t.1.bc
4 ; RUN: llvm-as < %s -o %t.2.bc -f
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep @foo() | grep -v internal
76
8 implementation
9 int %foo() { ret int 0 }
7 define i32 @foo() { ret i32 0 }
108
0 ; This fails because the linker renames the non-opaque type not the opaque
11 ; one...
22
3 ; RUN: echo "%Ty = type opaque %GV = external global %Ty*" | llvm-as > %t.1.bc
3 ; RUN: echo {%Ty = type opaque @GV = external global %Ty*} | llvm-as > %t.1.bc
44 ; RUN: llvm-as < %s > %t.2.bc
5 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep '%Ty ' | not grep opaque
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {%Ty } | not grep opaque
66
7 %Ty = type int
7 %Ty = type i32
88
None ; RUN: echo "%X = linkonce global int 5 implementation linkonce int %foo() { ret int 7 }" | llvm-upgrade | llvm-as > %t.1.bc
1 ; RUN: llvm-upgrade < %s | llvm-as -o %t.2.bc -f
2 ; RUN: llvm-link %t.[12].bc
3 %X = external global int
0 ; RUN: echo {@X = linkonce global i32 5 \
1 ; RUN: define linkonce i32 @foo() \{ ret i32 7 \} } | llvm-as > %t.1.bc
2 ; RUN: llvm-as < %s -o %t.2.bc -f
3 ; RUN: llvm-link %t.1.bc %t.2.bc
4 @X = external global i32
45
5 implementation
6 declare i32 @foo()
67
7 declare int %foo()
8
9 void %bar() {
10 load int* %X
11 call int %foo()
8 define void @bar() {
9 load i32* @X
10 call i32 @foo()
1211 ret void
1312 }
1413
0 ; This fails because the linker renames the non-opaque type not the opaque
11 ; one...
22
3 ; RUN: echo "implementation linkonce void %foo() { ret void } " | llvm-upgrade|\
4 ; RUN: llvm-as -o %t.2.bc -f
5 ; RUN: llvm-upgrade < %s | llvm-as -o %t.1.bc -f
6 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep foo | grep linkonce
3 ; RUN: echo { define linkonce void @foo() \{ ret void \} } | \
4 ; RUN: llvm-as -o %t.2.bc -f
5 ; RUN: llvm-as < %s -o %t.1.bc -f
6 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep foo | grep linkonce
77
8 declare void %foo()
8 declare void @foo()
9
0 ; This one fails because the LLVM runtime is allowing two null pointers of
11 ; the same type to be created!
22
3 ; RUN: echo "%T = type int" | llvm-upgrade | llvm-as > %t.2.bc
3 ; RUN: echo {%T = type int} | llvm-upgrade | llvm-as > %t.2.bc
44 ; RUN: llvm-upgrade < %s | llvm-as -f > %t.1.bc
5 ; RUN: llvm-link %t.[12].bc
5 ; RUN: llvm-link %t.1.bc %t.2.bc
66
77 %T = type opaque
88
0 ; This one fails because the LLVM runtime is allowing two null pointers of
11 ; the same type to be created!
22
3 ; RUN: echo "%S = type { %T*} %T = type opaque" | llvm-upgrade | llvm-as > %t.2.bc
3 ; RUN: echo {%S = type \{ %T*\} %T = type opaque} | llvm-as > %t.2.bc
44 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
5 ; RUN: llvm-link %t.[12].bc
5 ; RUN: llvm-link %t.1.bc %t.2.bc
66
77 %S = type { %T* }
88 %T = type int
None ; The funcresolve pass will (intentionally) llvm-link an _internal_ function body with an
1 ; external declaration. Because of this, if we LINK an internal function body into
2 ; a program that already has an external declaration for the function name, we must
3 ; rename the internal function to something that does not conflict.
0 ; The funcresolve pass will (intentionally) llvm-link an _internal_ function
1 ; body with an external declaration. Because of this, if we LINK an internal
2 ; function body into a program that already has an external declaration for
3 ; the function name, we must rename the internal function to something that
4 ; does not conflict.
45
5 ; RUN: echo "implementation internal int %foo() { ret int 7 }" | llvm-as > %t.1.bc
6 ; RUN: echo { define internal i32 @foo() \{ ret i32 7 \} } | llvm-as > %t.1.bc
67 ; RUN: llvm-as < %s > %t.2.bc
7 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep 'internal' | not grep '%foo('
8 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep internal | not grep %foo(
89
9 implementation
10 declare int %foo()
10 declare i32 @foo()
1111
12 int %test() {
13 %X = call int %foo()
14 ret int %X
12 define i32 @test() {
13 %X = call i32 @foo()
14 ret i32 %X
1515 }
1616
None ; RUN: echo "%T = type opaque" | llvm-upgrade | llvm-as > %t.2.bc
0 ; RUN: echo {%T = type opaque} | llvm-upgrade | llvm-as > %t.2.bc
11 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
2 ; RUN: llvm-link %t.[12].bc
2 ; RUN: llvm-link %t.1.bc %t.2.bc
33
44 %T = type opaque
55 %a = constant { %T* } { %T* null }
None ; RUN: echo "%T = type int" | llvm-upgrade | llvm-as > %t.1.bc
0 ; RUN: echo {%T = type int} | llvm-upgrade | llvm-as > %t.1.bc
11 ; RUN: llvm-upgrade < %s | llvm-as > %t.2.bc
2 ; RUN: llvm-link %t.[12].bc
2 ; RUN: llvm-link %t.1.bc %t.2.bc
33
44 %T = type opaque
55
None
1 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
2 ; RUN: echo "%S = type { int, int* }" | llvm-upgrade | llvm-as > %t.out2.bc
3 ; RUN: llvm-link %t.out[12].bc
1 ; RUN: echo {%S = type \{ int, int* \} } | llvm-upgrade | llvm-as > %t.out2.bc
2 ; RUN: llvm-link %t.out1.bc %t.out2.bc
43
54 %T = type opaque
65 %S = type { int, %T* }
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
1 ; RUN: echo "%S = external global { int, opaque* } declare void %F(opaque*)" | llvm-upgrade | llvm-as > %t.out2.bc
2 ; RUN: llvm-link %t.out[12].bc | llvm-dis | not grep opaque
1 ; RUN: echo {%S = external global \{ int, opaque* \} declare void %F(opaque*)}\
2 ; RUN: | llvm-upgrade | llvm-as > %t.out2.bc
3 ; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | not grep opaque
34
45 ; After linking this testcase, there should be no opaque types left. The two
56 ; S's should cause the opaque type to be resolved to 'int'.
22
33 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
44 ; RUN: echo "%S = type { %S*, int* }" | llvm-upgrade | llvm-as > %t.out2.bc
5 ; RUN: llvm-link %t.out[12].bc
5 ; RUN: llvm-link %t.out1.bc %t.out2.bc
66
77 %S = type { %S*, opaque* }
None ; Linking these a module with a specified pointer size to one without a
0 ; Linking a module with a specified pointer size to one without a
11 ; specified pointer size should not cause a warning!
22
33 ; RUN: llvm-as < %s > %t.out1.bc
4 ; RUN: echo "" | llvm-as > %t.out2.bc
5 ; RUN: llvm-link %t.out[12].bc 2>&1 | not grep WARNING
4 ; RUN: echo {} | llvm-as > %t.out2.bc
5 ; RUN: llvm-link %t.out1.bc %t.out2.bc |& not grep warning
66
7 target pointersize = 64
7 target datalayout = "e-p:64:64"
88
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
11 ; RUN: echo "%S = type int" | llvm-upgrade | llvm-as > %t.out2.bc
2 ; RUN: llvm-link %t.out[21].bc
2 ; RUN: llvm-link %t.out2.bc %t.out1.bc
33
44 %S = type opaque
55
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
11 ; RUN: echo "%S = type int" | llvm-upgrade | llvm-as > %t.out2.bc
2 ; RUN: llvm-link %t.out[21].bc
2 ; RUN: llvm-link %t.out2.bc %t.out1.bc
33
44 %S = type opaque
55
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
11 ; RUN: echo "%S = type int" | llvm-upgrade | llvm-as > %t.out2.bc
2 ; RUN: llvm-link %t.out[21].bc
2 ; RUN: llvm-link %t.out2.bc %t.out1.bc
33
44 %S = type opaque
55
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
1 ; RUN: echo "%S = type [8 x int] external global %S " | llvm-upgrade | llvm-as > %t.out2.bc
2 ; RUN: llvm-link %t.out[12].bc | llvm-dis | grep %S | grep '{'
1 ; RUN: echo { %S = type \[8 x i32\] external global %S } | llvm-as > %t.out2.bc
2 ; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | grep %S | grep \{
33
44 %S = type { int }
55
22
33 ; RUN: echo "%X = global int 7" | llvm-upgrade | llvm-as > %t.2.bc
44 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
5 ; RUN: llvm-link %t.[12].bc
5 ; RUN: llvm-link %t.1.bc %t.2.bc
66
77 %X = linkonce global int 7
55
66 ; RUN: llvm-upgrade %s | llvm-as > %t.out2.bc
77 ; RUN: echo "%T1 = type opaque @GVar = external global %T1*" | llvm-as > %t.out1.bc
8 ; RUN: llvm-link %t.out[12].bc
8 ; RUN: llvm-link %t.out1.bc %t.out2.bc
99
1010 %T1 = type opaque
1111 %T2 = type int
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.out2.bc
11 ; RUN: echo "%me = global int* null" | llvm-upgrade | llvm-as > %t.out1.bc
2 ; RUN: llvm-link %t.out[12].bc -o /dev/null -f
2 ; RUN: llvm-link %t.out1.bc %t.out2.bc -o /dev/null -f
33
44 %me = weak global int * null
55
0 ; RUN: llvm-upgrade < %s | llvm-as -f -o %t1.bc
1 ; RUN: llvm-upgrade < `dirname %s`/2004-05-07-TypeResolution2.ll | \
1 ; RUN: llvm-upgrade < %p/2004-05-07-TypeResolution2.ll | \
22 ; RUN: llvm-as -o %t2.bc -f
33 ; RUN: llvm-link -f -o %t3.bc %t1.bc %t2.bc
44
None ; RUN: echo "%G = weak global {{{{double}}}} zeroinitializer" | llvm-as > %t.out2.bc
0 ; RUN: echo {@G = weak global \{\{\{\{double\}\}\}\} zeroinitializer } | \
1 ; RUN: llvm-as > %t.out2.bc
12 ; RUN: llvm-as < %s > %t.out1.bc
2 ; RUN: llvm-link %t.out[12].bc | llvm-dis | not grep '\}'
3 ; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | not grep {\}}
34
45 ; When linked, the global above should be eliminated, being merged with the
56 ; global below.
67
7 %G = global double 1.0
8 @G = global double 1.0
0 ; Test that a prototype can be marked const, and the definition is allowed
11 ; to be nonconst.
22
3 ; RUN: echo "%X = external constant int" | llvm-upgrade | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
5 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep 'global i32 7'
3 ; RUN: echo {@X = external constant i32} | llvm-as > %t.2.bc
4 ; RUN: llvm-as < %s > %t.1.bc
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {global i32 7}
66
7 %X = global int 7
7 @X = global i32 7
0 ; Test that a prototype can be marked const, and the definition is allowed
11 ; to be nonconst.
22
3 ; RUN: echo "%X = global int 7" | llvm-upgrade | llvm-as > %t.2.bc
3 ; RUN: echo {@X = global i32 7} | llvm-as > %t.2.bc
44 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
5 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep 'global i32 7'
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {global i32 7}
66
7 %X = external constant int
7 @X = external constant i32
None ; RUN: echo "@G = appending global [0 x i32] zeroinitializer" | \
0 ; RUN: echo { @G = appending global \[0 x i32\] zeroinitializer } | \
11 ; RUN: llvm-as > %t.out2.bc
22 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
3 ; RUN: llvm-link %t.out[12].bc | llvm-dis | grep '@G ='
3 ; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | grep {@G =}
44
55 ; When linked, the globals should be merged, and the result should still
66 ; be named '@G'.
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %s.bc ; llvm-link -f -o %s.linked %s.bc
0 ; RUN: llvm-upgrade < %s | llvm-as -f -o %s.bc
1 ; RUN: llvm-link -f -o %s.linked %s.bc
12
23 target endian = big
34 target pointersize = 32
0 ; The linker should choose the largest alignment when linking.
11
2 ; RUN: echo "%X = global int 7, align 8" | llvm-upgrade | llvm-as > %t.2.bc
3 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
4 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep 'align 8'
2 ; RUN: echo {@X = global i32 7, align 8} | llvm-as > %t.2.bc
3 ; RUN: llvm-as < %s > %t.1.bc
4 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {align 8}
55
6 %X = weak global int 7, align 4
6 @X = weak global i32 7, align 4
0 ; Test that appending linkage works correctly.
11
2 ; RUN: echo "%X = appending global [1x int] [int 8]" | llvm-upgrade | \
3 ; RUN: llvm-as > %t.2.bc
2 ; RUN: echo {%X = appending global \[1 x int\] \[int 8\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
44 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
5 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep 7 | grep 4 | grep 8
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep 7 | grep 4 | grep 8
66
77 %X = appending global [2 x int] [int 7, int 4]
88
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo "%X = appending global [1x int] [int 8]" | llvm-upgrade | llvm-as > %t.2.bc
2 ; RUN: echo {%X = appending global \[1 x int\] \[int 8\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
34 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
4 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep 7 | grep 8
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep 7 | grep 8
56
67 %X = appending global [1 x int] [int 7]
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo "%X = constant [1x int] [int 8]" | llvm-upgrade | llvm-as > %t.2.bc
2 ; RUN: echo {%X = constant \[1 x int\] \[int 8\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
34 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
4 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep constant
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant
56
67 %X = uninitialized global [1 x int]
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo "%X = external global [1x int]" | llvm-upgrade | llvm-as > %t.2.bc
2 ; RUN: echo {%X = external global \[1 x int\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
34 ; RUN: llvm-upgrade %s -o - | llvm-as > %t.1.bc
4 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep constant
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant
56
67 %X = constant [1 x int] [ int 12 ]
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo "%X = external constant [1x int]" | llvm-upgrade | llvm-as > %t.2.bc
2 ; RUN: echo {%X = external constant \[1 x int\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
34 ; RUN: llvm-upgrade %s | llvm-as > %t.1.bc
4 ; RUN: llvm-link %t.[12].bc | llvm-dis | grep constant
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant
56
67 %X = uninitialized global [1 x int]
22
33 ; RUN: echo "%X = linkonce global int 8" | llvm-upgrade | llvm-as > %t.2.bc
44 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
5 ; RUN: llvm-link %t.[12].bc | llvm-dis
5 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis
66
77 %X = linkonce global int 7
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
11 ; in different modules.
22 ; RUN: llvm-as %s -o %t.foo1.bc -f
33 ; RUN: llvm-as %s -o %t.foo2.bc -f
4 ; RUN: echo "define void @foo(i32 %x) { ret void }" | llvm-as -o %t.foo3.bc -f
5 ; RUN: llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc 2>&1 | \
6 ; RUN: grep "Function is already defined"
7 ; RUN: llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc 2>&1 | \
8 ; RUN: grep "Function 'foo' defined as both"
4 ; RUN: echo {define void @foo(i32 %x) { ret void }} | llvm-as -o %t.foo3.bc -f
5 ; RUN: ignore llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc |& \
6 ; RUN: grep {Function is already defined}
7 ; RUN: ignore llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc |& \
8 ; RUN: grep {Function 'foo' defined as both}
99 define void @foo() { ret void }
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.bc
1 ; RUN: llvm-upgrade < `dirname %s`/testlink2.ll | llvm-as > %t2.bc
1 ; RUN: llvm-upgrade < %p/testlink2.ll | llvm-as > %t2.bc
22 ; RUN: llvm-link %t.bc %t2.bc
33
44 %MyVar = external global int
0 ; RUN: llvm-upgrade < %s | llvm-as > %t.bc
1 ; RUN: llvm-upgrade < `dirname %s`/testlink1.ll | llvm-as > %t2.bc
1 ; RUN: llvm-upgrade < %p/testlink1.ll | llvm-as > %t2.bc
22 ; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc -f
3 ; RUN: llvm-dis < %t1.bc | grep "kallsyms_names = extern_weak" &&
4 ; RUN: llvm-dis < %t1.bc | grep "MyVar = external global i32" &&
5 ; RUN: llvm-dis < %t1.bc | grep "Inte = global i32"
3 ; RUN: llvm-dis < %t1.bc | grep {kallsyms_names = extern_weak}
4 ; RUN: llvm-dis < %t1.bc | grep {MyVar = external global i32}
5 ; RUN: llvm-dis < %t1.bc | grep {Inte = global i32}
66
77 %kallsyms_names = extern_weak global [0 x ubyte]
88 %MyVar = extern_weak global int