Skip to content

Commit 506a826

Browse files
Add regression test for failed fuzz cases
1 parent 035d055 commit 506a826

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import XCTest
2+
import WasmKit
3+
4+
final class FuzzTranslatorRegressionTests: XCTestCase {
5+
func testRunAll() async throws {
6+
let failCasesDir = URL(fileURLWithPath: #filePath)
7+
.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()
8+
.appendingPathComponent("FuzzTesting/FailCases/FuzzTranslator")
9+
10+
for file in try FileManager.default.contentsOfDirectory(atPath: failCasesDir.path) {
11+
let path = failCasesDir.appendingPathComponent(file).path
12+
print("Fuzz regression test: \(path)")
13+
14+
let data = try Data(contentsOf: URL(fileURLWithPath: path))
15+
do {
16+
var module = try WasmKit.parseWasm(bytes: Array(data))
17+
try module.materializeAll()
18+
} catch {
19+
// Explicit errors are ok
20+
}
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)