Skip to content

Commit

Permalink
Merge pull request #80 from Generative-Program-Analysis/spec-test
Browse files Browse the repository at this point in the history
even odd had the same problem, ignore ASSERT_INVALID
  • Loading branch information
ahuoguo authored Jan 29, 2025
2 parents 605609e + a5519c3 commit f1c8004
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
33 changes: 33 additions & 0 deletions benchmarks/wasm/return_call.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(module
(type (;0;) (func (param i64) (result i32)))
(type (;1;) (func))
(func (;0;) (type 0) (param i64) (result i32)
local.get 0
i64.eqz
if (result i32) ;; label = @1
i32.const 44
else
local.get 0
i64.const 1
i64.sub
return_call 1
end
)
(func (;1;) (type 0) (param i64) (result i32)
local.get 0
i64.eqz
if (result i32) ;; label = @1
i32.const 99
else
local.get 0
i64.const 1
i64.sub
return_call 0
end
)
(func (;2;) (type 1)
i64.const 100000
call 0
)
(start 2)
)
1 change: 1 addition & 0 deletions src/main/scala/wasm/MiniWasmScript.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ sealed class ScriptRunner {
cmd match {
case CmdModule(module) => instances += ModuleInstance(module)
case AssertReturn(action, expect) => assertReturn(action, expect)
case AssertInvalid() => ()
case CMdInstnace() => ()
case AssertTrap(action, message) => ???
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/wasm/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ class GSWasmVisitor extends WatParserBaseVisitor[WIR] {
}
AssertReturn(action, expect.toList)
} else if (ctx.ASSERT_INVALID != null ) {
// we simply ignore assert_invalid for now
// TODO: we simply ignore assert_invalid for now
AssertInvalid()
} else {
throw new RuntimeException("Unsupported")
Expand Down
5 changes: 4 additions & 1 deletion src/test/scala/genwasym/TestTFP.scala
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,12 @@ class TestTFP extends FunSuite {
testWastFile("./benchmarks/wasm/spectest/return_call.bin.wast")
}

// one of the failing test cases
// some of the failing test cases
test("count") {
testFile("./benchmarks/wasm/count.wat", None, ExpInt(0))
}
test("even_odd") {
testFile("./benchmarks/wasm/return_call.wat", None, ExpInt(44))
}

}

0 comments on commit f1c8004

Please sign in to comment.