Skip to content

Commit 954de4e

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[test] Cleanup i31 tests
Change-Id: I63cb4c1f7aef06240729a3879eb20ab3ef452549 Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/8911776 Auto-Submit: Matthias Liedtke <[email protected]> Reviewed-by: Pawel Krawczyk <[email protected]> Commit-Queue: Matthias Liedtke <[email protected]>
1 parent 7b9f695 commit 954de4e

File tree

1 file changed

+5
-37
lines changed

1 file changed

+5
-37
lines changed

Tests/FuzzilliTests/WasmTests.swift

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4817,17 +4817,18 @@ class WasmGCTests: XCTestCase {
48174817
try refNullAbstractTypes(sharedRef: false)
48184818
}
48194819

4820-
func testi31RefFromJs() throws {
4820+
func i31Ref(shared: Bool) throws {
48214821
let runner = try GetJavaScriptExecutorOrSkipTest(type: .any, withArguments: ["--experimental-wasm-shared"])
48224822
let liveTestConfig = Configuration(logLevel: .error, enableInspection: true)
48234823
let fuzzer = makeMockFuzzer(config: liveTestConfig, environment: JavaScriptEnvironment())
48244824
let b = fuzzer.makeBuilder()
4825+
let i31RefT = ILType.wasmI31Ref(shared: shared)
48254826

48264827
let module = b.buildWasmModule { wasmModule in
4827-
wasmModule.addWasmFunction(with: [.wasmi32] => [.wasmI31Ref()]) { function, label, args in
4828-
[function.wasmRefI31(args[0])]
4828+
wasmModule.addWasmFunction(with: [.wasmi32] => [i31RefT]) { function, label, args in
4829+
[function.wasmRefI31(args[0], shared: shared)]
48294830
}
4830-
wasmModule.addWasmFunction(with: [.wasmI31Ref()] => [.wasmi32, .wasmi32]) { function, label, args in
4831+
wasmModule.addWasmFunction(with: [i31RefT] => [.wasmi32, .wasmi32]) { function, label, args in
48314832
[function.wasmI31Get(args[0], isSigned: true),
48324833
function.wasmI31Get(args[0], isSigned: false)]
48334834
}
@@ -4851,39 +4852,6 @@ class WasmGCTests: XCTestCase {
48514852
testForOutput(program: jsProg, runner: runner, outputString: "42\n-42\n42,42\n-42,2147483606\n")
48524853
}
48534854

4854-
func i31Ref(shared: Bool) throws {
4855-
let runner = try GetJavaScriptExecutorOrSkipTest(type: .any, withArguments: shared ? ["--experimental-wasm-shared", "--experimental-wasm-stringref"] : [])
4856-
let liveTestConfig = Configuration(logLevel: .error, enableInspection: true)
4857-
let fuzzer = makeMockFuzzer(config: liveTestConfig, environment: JavaScriptEnvironment())
4858-
let b: ProgramBuilder = fuzzer.makeBuilder()
4859-
let i31RefType = ILType.wasmI31Ref(shared: shared)
4860-
4861-
let module = b.buildWasmModule { wasmModule in
4862-
let createReferenceOf = wasmModule.addWasmFunction(with: [.wasmi32] => [i31RefType]) { function, label, args in
4863-
[function.wasmRefI31(args[0], shared: shared)]
4864-
}
4865-
let dereference = wasmModule.addWasmFunction(with: [i31RefType] => [.wasmi32, .wasmi32]) { function, label, args in
4866-
[function.wasmI31Get(args[0], isSigned: true),
4867-
function.wasmI31Get(args[0], isSigned: false)]
4868-
}
4869-
wasmModule.addWasmFunction(with: [] => [.wasmi32, .wasmi32]) { function, label, args in
4870-
let const = function.consti32(-42)
4871-
let constRef = function.wasmCallDirect(signature: [.wasmi32] => [i31RefType], function: createReferenceOf, functionArgs: [const])
4872-
let dereferencedConst = function.wasmCallDirect(signature: [i31RefType] => [.wasmi32, .wasmi32], function: dereference, functionArgs: constRef)
4873-
return dereferencedConst
4874-
}
4875-
}
4876-
4877-
let exports = module.loadExports()
4878-
let outputFunc = b.createNamedVariable(forBuiltin: "output")
4879-
let result = b.callMethod(module.getExportedMethod(at: 2), on: exports, withArgs: [b.loadInt(42)])
4880-
b.callFunction(outputFunc, withArgs: [result])
4881-
4882-
let prog = b.finalize()
4883-
let jsProg = fuzzer.lifter.lift(prog)
4884-
testForOutput(program: jsProg, runner: runner, outputString: "-42,2147483606\n")
4885-
}
4886-
48874855
func testi31RefShared() throws {
48884856
try i31Ref(shared: true)
48894857
}

0 commit comments

Comments
 (0)