diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2020-09-17 10:55:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 10:55:02 -0700 |
commit | 6116553a91b5da4fd877480bb27fc88b264b737f (patch) | |
tree | 0f96e01ec6e618fd012fa97a7b9bbcf4b3fb33d1 /src/tools | |
parent | 9f7a053bf0ca3185336eb4616f88d85df573adbf (diff) | |
download | binaryen-6116553a91b5da4fd877480bb27fc88b264b737f.tar.gz binaryen-6116553a91b5da4fd877480bb27fc88b264b737f.tar.bz2 binaryen-6116553a91b5da4fd877480bb27fc88b264b737f.zip |
Improve testing on Windows (#3142)
This PR contains:
- Changes that enable/disable tests on Windows to allow for better local testing.
- Also changes many abort() into Fatal() when it is really just exiting on error. This is because abort() generates a dialog window on Windows which is not great in automated scripts.
- Improvements to CMake to better work with the project in IDEs (VS).
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/execution-results.h | 2 | ||||
-rw-r--r-- | src/tools/wasm-as.cpp | 5 | ||||
-rw-r--r-- | src/tools/wasm-opt.cpp | 3 | ||||
-rw-r--r-- | src/tools/wasm-shell.cpp | 10 | ||||
-rw-r--r-- | src/tools/wasm2js.cpp | 3 |
5 files changed, 9 insertions, 14 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index 0881163f1..b63a276ae 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -99,7 +99,7 @@ struct ExecutionResults { optimizedResults.get(wasm); if (optimizedResults != *this) { std::cout << "[fuzz-exec] optimization passes changed execution results"; - abort(); + exit(1); } } diff --git a/src/tools/wasm-as.cpp b/src/tools/wasm-as.cpp index 3a907c4c3..be18ed355 100644 --- a/src/tools/wasm-as.cpp +++ b/src/tools/wasm-as.cpp @@ -54,9 +54,8 @@ int main(int argc, const char* argv[]) { Options::Arguments::One, [](Options* o, const std::string& argument) { if (argument != "web" && argument != "none" && argument != "wasm") { - std::cerr << "Valid arguments for --validate flag are 'wasm', " - "'web', and 'none'.\n"; - exit(1); + Fatal() << "Valid arguments for --validate flag are 'wasm', " + "'web', and 'none'.\n"; } o->extra["validate"] = argument; }) diff --git a/src/tools/wasm-opt.cpp b/src/tools/wasm-opt.cpp index 24ea9c31c..ecf4f1c7c 100644 --- a/src/tools/wasm-opt.cpp +++ b/src/tools/wasm-opt.cpp @@ -377,8 +377,7 @@ int main(int argc, const char* argv[]) { auto secondOutput = runCommand(extraFuzzCommand); std::cout << "[extra-fuzz-command second output:]\n" << firstOutput << '\n'; if (firstOutput != secondOutput) { - std::cerr << "extra fuzz command output differs\n"; - abort(); + Fatal() << "extra fuzz command output differs\n"; } } return 0; diff --git a/src/tools/wasm-shell.cpp b/src/tools/wasm-shell.cpp index 8ba6a4142..69670192b 100644 --- a/src/tools/wasm-shell.cpp +++ b/src/tools/wasm-shell.cpp @@ -192,8 +192,7 @@ static void run_asserts(Name moduleName, Colors::red(std::cerr); std::cerr << "[should have been invalid]\n"; Colors::normal(std::cerr); - std::cerr << &wasm << '\n'; - abort(); + Fatal() << &wasm << '\n'; } } else if (id == INVOKE) { assert(wasm); @@ -222,8 +221,7 @@ static void run_asserts(Name moduleName, } std::cerr << "seen " << result << ", expected " << expected << '\n'; if (expected != result) { - std::cout << "unexpected, should be identical\n"; - abort(); + Fatal() << "unexpected, should be identical\n"; } } if (id == ASSERT_TRAP) { @@ -314,8 +312,8 @@ int main(int argc, const char* argv[]) { bool valid = WasmValidator().validate(*modules[moduleName]); if (!valid) { WasmPrinter::printModule(modules[moduleName].get()); + Fatal() << "module failed to validate, see above"; } - assert(valid); run_asserts(moduleName, &i, &checked, @@ -329,7 +327,7 @@ int main(int argc, const char* argv[]) { } } catch (ParseException& p) { p.dump(std::cerr); - abort(); + exit(1); } if (checked) { diff --git a/src/tools/wasm2js.cpp b/src/tools/wasm2js.cpp index 524be4c5c..68334708f 100644 --- a/src/tools/wasm2js.cpp +++ b/src/tools/wasm2js.cpp @@ -630,8 +630,7 @@ Ref AssertionEmitter::emitAssertReturnFunc(Builder& wasmBuilder, } default: { - std::cerr << "Unhandled type in assert: " << resType << std::endl; - abort(); + Fatal() << "Unhandled type in assert: " << resType; } } } else { |