[WebAssembly] Reduce redundancy in tests

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`.

Differential Revision: https://reviews.llvm.org/D42662

llvm-svn: 323838
This commit is contained in:
Sam Clegg 2018-01-31 00:13:26 +00:00
parent d3fad26588
commit 5489b9f1cf
6 changed files with 18 additions and 26 deletions

View File

@ -0,0 +1,6 @@
target triple = "wasm32-unknown-unknown-wasm"
define void @_start() local_unnamed_addr {
entry:
ret void
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 @@ entry:
; 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

View File

@ -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