[PATCH] D42662: [WebAssembly] Reduce redundancy in tests
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 15:03:15 PST 2018
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.
sbc100 retitled this revision from "[WebAssembly] Cleanup command line tests" to "[WebAssembly] Reduce redundancy in tests".
sbc100 added reviewers: ruiu, ncw.
Add a simple start entry point input file and have the tests
reference that rather than duplicating these.
This allows more tests to be pure `.test` files rather than
`.ll`.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D42662
Files:
test/wasm/Inputs/start.ll
test/wasm/import-memory.test
test/wasm/invalid-stack-size.ll
test/wasm/invalid-stack-size.test
test/wasm/load-undefined.ll
test/wasm/load-undefined.test
test/wasm/strip-debug.test
Index: test/wasm/strip-debug.test
===================================================================
--- test/wasm/strip-debug.test
+++ test/wasm/strip-debug.test
@@ -1,5 +1,5 @@
-RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
-RUN: lld -flavor wasm --strip-debug --entry=ret32 -o %t.wasm %t.ret32.o
+RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+RUN: lld -flavor wasm --strip-debug -o %t.wasm %t.start.o
RUN: obj2yaml %t.wasm | FileCheck %s
# Check that there is no name section
Index: test/wasm/load-undefined.test
===================================================================
--- test/wasm/load-undefined.test
+++ test/wasm/load-undefined.test
@@ -3,18 +3,11 @@
;
; RUN: llc -filetype=obj %S/Inputs/ret64.ll -o %t.o
; RUN: llc -filetype=obj %S/Inputs/ret32.ll -o %t2.o
-; RUN: llc -filetype=obj %s -o %t3.o
+; RUN: llc -filetype=obj %S/Inputs/start.ll -o %t.start.o
; RUN: llvm-ar rcs %t2.a %t2.o
-; RUN: lld -flavor wasm %t3.o %t2.a %t.o -o %t.wasm -u ret32 --undefined ret64
+; RUN: lld -flavor wasm %t.start.o %t2.a %t.o -o %t.wasm -u ret32 --undefined ret64
; RUN: obj2yaml %t.wasm | FileCheck %s
-target triple = "wasm32-unknown-unknown-wasm"
-
-define i32 @_start() local_unnamed_addr {
-entry:
- ret i32 1
-}
-
; CHECK: - Type: EXPORT
; CHECK-NEXT: Exports:
; CHECK-NEXT: - Name: memory
@@ -36,8 +29,8 @@
; Verify that referencing a symbol that doesn't exist won't work
-; RUN: not lld -flavor wasm %t3.o -o %t.wasm -u symboldoesnotexist 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED1 %s
+; RUN: not lld -flavor wasm %t.start.o -o %t.wasm -u symboldoesnotexist 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED1 %s
; CHECK-UNDEFINED1: error: undefined symbol: symboldoesnotexist
-; RUN: not lld -flavor wasm %t3.o -o %t.wasm --undefined symboldoesnotexist --allow-undefined 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED2 %s
+; RUN: not lld -flavor wasm %t.start.o -o %t.wasm --undefined symboldoesnotexist --allow-undefined 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED2 %s
; CHECK-UNDEFINED2: function forced with --undefined not found: symboldoesnotexist
Index: test/wasm/invalid-stack-size.test
===================================================================
--- /dev/null
+++ test/wasm/invalid-stack-size.test
@@ -0,0 +1,4 @@
+; RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+; RUN: not lld -flavor wasm -o %t.wasm -z stack-size=1 %t.o 2>&1 | FileCheck %s
+
+; CHECK: error: stack size must be 16-byte aligned
Index: test/wasm/invalid-stack-size.ll
===================================================================
--- test/wasm/invalid-stack-size.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: not lld -flavor wasm -o %t.wasm -z stack-size=1 %t.o 2>&1 | FileCheck %s
-
-target triple = "wasm32-unknown-unknown-wasm"
-
-define i32 @_start() local_unnamed_addr #1 {
-entry:
- ret i32 0
-}
-
-; CHECK: error: stack size must be 16-byte aligned
Index: test/wasm/import-memory.test
===================================================================
--- test/wasm/import-memory.test
+++ test/wasm/import-memory.test
@@ -1,5 +1,5 @@
-# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
-# RUN: lld -flavor wasm -entry ret32 --import-memory -o %t.wasm %t.ret32.o
+# RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+# RUN: lld -flavor wasm --import-memory -o %t.wasm %t.start.o
# RUN: obj2yaml %t.wasm | FileCheck %s
# Verify the --import-memory flag creates a memory import
Index: test/wasm/Inputs/start.ll
===================================================================
--- /dev/null
+++ test/wasm/Inputs/start.ll
@@ -0,0 +1,6 @@
+target triple = "wasm32-unknown-unknown-wasm"
+
+define void @_start() local_unnamed_addr {
+entry:
+ ret void
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42662.131881.patch
Type: text/x-patch
Size: 3810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180129/7073761f/attachment.bin>
More information about the llvm-commits
mailing list