summaryrefslogtreecommitdiff
path: root/src/tools/spectest-interp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/spectest-interp.cc')
-rw-r--r--src/tools/spectest-interp.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/tools/spectest-interp.cc b/src/tools/spectest-interp.cc
index 928a6110..643c10f2 100644
--- a/src/tools/spectest-interp.cc
+++ b/src/tools/spectest-interp.cc
@@ -1331,18 +1331,25 @@ void CommandRunner::TallyCommand(wabt::Result result) {
total_++;
}
-static wabt::Result ReadAndRunSpecJSON(string_view spec_json_filename) {
+static int ReadAndRunSpecJSON(string_view spec_json_filename) {
JSONParser parser;
- CHECK_RESULT(parser.ReadFile(spec_json_filename));
+ if (parser.ReadFile(spec_json_filename) == wabt::Result::Error) {
+ return 1;
+ }
Script script;
- CHECK_RESULT(parser.ParseScript(&script));
+ if (parser.ParseScript(&script) == wabt::Result::Error) {
+ return 1;
+ }
CommandRunner runner;
- wabt::Result result = runner.Run(script);
+ if (runner.Run(script) == wabt::Result::Error) {
+ return 1;
+ }
printf("%d/%d tests passed.\n", runner.passed(), runner.total());
- return result;
+ const int failed = runner.total() - runner.passed();
+ return failed;
}
} // namespace spectest
@@ -1352,10 +1359,7 @@ int ProgramMain(int argc, char** argv) {
s_stdout_stream = FileStream::CreateStdout();
ParseOptions(argc, argv);
-
- wabt::Result result;
- result = spectest::ReadAndRunSpecJSON(s_infile);
- return result != wabt::Result::Ok;
+ return spectest::ReadAndRunSpecJSON(s_infile);
}
int main(int argc, char** argv) {