Add a 'test verifier' sub-test.
This test runs the verifier on each function and matches the resulting verifier error against the "error:" annotation. Move the existing verifier test into filetests/verifier/ and use the new syntex.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
; For testing cfg generation. This code is nonsense.
|
||||
test print-cfg
|
||||
test verifier
|
||||
|
||||
function nonsense(i32, i32) -> f32 {
|
||||
; check: digraph nonsense {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
; For testing cfg generation. This code explores the implications of encountering
|
||||
; a terminating instruction before any connections have been made.
|
||||
test print-cfg
|
||||
test verifier
|
||||
|
||||
function nonsense(i32) {
|
||||
; check: digraph nonsense {
|
||||
|
||||
ebb0(v1: i32):
|
||||
trap
|
||||
trap ; error: terminator instruction was encountered before the end
|
||||
brnz v1, ebb2 ; unordered: ebb0:inst1 -> ebb2
|
||||
jump ebb1 ; unordered: ebb0:inst2 -> ebb1
|
||||
|
||||
|
||||
19
cranelift/filetests/verifier/bad_layout.cton
Normal file
19
cranelift/filetests/verifier/bad_layout.cton
Normal file
@@ -0,0 +1,19 @@
|
||||
test verifier
|
||||
|
||||
function test(i32) {
|
||||
ebb0(v0: i32):
|
||||
jump ebb1 ; error: terminator
|
||||
return
|
||||
ebb1:
|
||||
jump ebb2
|
||||
brz v0, ebb3
|
||||
ebb2:
|
||||
jump ebb3
|
||||
ebb3:
|
||||
return
|
||||
}
|
||||
|
||||
function test(i32) { ; Ok
|
||||
ebb0(v0: i32):
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user