File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ let package = Package(
2121 ] ) ,
2222 . executableTarget( name: " FuzzDifferential " , dependencies: [
2323 . product( name: " WasmKit " , package : " WasmKit " ) ,
24+ . product( name: " WAT " , package : " WasmKit " ) ,
2425 " WasmCAPI " ,
2526 ] ) ,
2627 . target( name: " WasmCAPI " ) ,
Original file line number Diff line number Diff line change 11import WasmCAPI
22import WasmKit
3+ import WAT
34import SystemPackage
45import Foundation
56
@@ -257,8 +258,13 @@ struct ReferenceEngine: Engine {
257258 WasmKitEngine ( ) ,
258259 ReferenceEngine ( )
259260 ]
260- let moduleBytes = try Data ( contentsOf: URL ( fileURLWithPath: moduleFile) )
261- let results = try engines. map { try $0. run ( moduleBytes: Array ( moduleBytes) ) }
261+ let moduleBytes : [ UInt8 ]
262+ if moduleFile. hasSuffix ( " .wat " ) {
263+ moduleBytes = try wat2wasm ( String ( contentsOf: URL ( fileURLWithPath: moduleFile) ) )
264+ } else {
265+ moduleBytes = try Array ( Data ( contentsOf: URL ( fileURLWithPath: moduleFile) ) )
266+ }
267+ let results = try engines. map { try $0. run ( moduleBytes: moduleBytes) }
262268 guard results. count > 1 else {
263269 throw ExecError ( " Expected at least two engines " )
264270 }
You can’t perform that action at this time.
0 commit comments