Allow running spec tests on wasm port
@@ -170,7 +170,23 @@ from queue import Queue, Empty
class Wasm3():
def __init__(self, executable):
- self.exe = executable
+ if executable.endswith(".wasm"):
+ (engine, executable) = executable.split(maxsplit=1)
+
+ if engine == "wasmer":
+ self.exe = [engine, "run", "--dir=.", executable, "--"]
+ #elif engine == "wasmer-js":
+ # self.exe = [engine, "run", executable]
+ elif engine == "wasirun":
+ self.exe = [engine, executable]
+ elif engine == "wasmtime":
+ self.exe = [engine, "--dir=.", "--optimize", executable, "--"]
+ elif engine == "iwasm":
+ self.exe = [engine, "--dir=.", executable]
+ else:
+ fatal(f"Don't know how to run engine {engine}")
+ else:
+ self.exe = [executable]
self.p = None
self.timeout = 3.0
@@ -180,7 +196,7 @@ class Wasm3():
self.loaded = fn
self.p = Popen(
- [self.exe, "--repl", fn],
+ self.exe + ["--repl", fn],
shell = False,
bufsize=0, stdin=PIPE, stdout=PIPE, stderr=STDOUT
)
