Skip to content

Commit 773e6a1

Browse files
committed
Fix: wrong magic number in spec tests
Adds `--test` option
1 parent 8fe63e7 commit 773e6a1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

platforms/CLI-Emulator/main.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ void print_help() {
3939
fprintf(stdout,
4040
" --loop Let the runtime loop infinitely on exceptions "
4141
"(default: false)\n");
42+
fprintf(stdout,
43+
" --test Run in test mode with .wast file with module "
44+
"as argument\n");
4245
fprintf(stdout,
4346
" --asserts Name of file containing asserts to run against "
4447
"loaded module\n");
@@ -276,7 +279,7 @@ int main(int argc, const char *argv[]) {
276279
const char *asserts_file = nullptr;
277280
const char *watcompiler = "wat2wasm";
278281

279-
if (argc > 0) {
282+
if (argc > 0 && argv[0][0] != '-') {
280283
ARGV_GET(file_name);
281284

282285
dbg_info("=== LOAD MODULE INTO WARDUINO ===\n");
@@ -300,8 +303,10 @@ int main(int argc, const char *argv[]) {
300303
return 0;
301304
} else if (!strcmp("--loop", arg)) {
302305
return_exception = false;
303-
} else if (!strcmp("--asserts", arg)) {
306+
} else if (!strcmp("--test", arg)) {
304307
run_tests = true;
308+
ARGV_GET(file_name);
309+
} else if (!strcmp("--asserts", arg)) {
305310
ARGV_GET(asserts_file);
306311
} else if (!strcmp("--watcompiler", arg)) {
307312
ARGV_GET(watcompiler);

tests/integration/run_spec_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def main():
9797
base = "core/" + "".join(os.path.basename(filename).split(".")[:-2])
9898
print(base)
9999
status = subprocess.run(
100-
[args.interpreter, base + ".wast", "--asserts", base + ".asserts.wast", "--watcompiler", args.compiler],
100+
[args.interpreter, "--test", base + ".wast", "--asserts", base + ".asserts.wast", "--watcompiler", args.compiler],
101101
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
102102
if status.returncode == 0:
103103
print(f"{filename}: All tests passed.\n")

0 commit comments

Comments
 (0)