diff options
author | Alon Zakai <azakai@google.com> | 2019-10-17 17:29:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-17 17:29:32 -0700 |
commit | d2550891e41ad0215b1cae46fa711bc1e264166a (patch) | |
tree | 7d102696ad01ff5eb76de33cf7a89eb3068d9350 /src/tools | |
parent | 83f61457fd10feffe8cdcc6c278bc79cfb1667aa (diff) | |
download | binaryen-d2550891e41ad0215b1cae46fa711bc1e264166a.tar.gz binaryen-d2550891e41ad0215b1cae46fa711bc1e264166a.tar.bz2 binaryen-d2550891e41ad0215b1cae46fa711bc1e264166a.zip |
Fix autoreducing when not in the binaryen directory (#2390)
This uses argv[0] as the default way to find the location
of the wasm binaries (wasm-reduce needs to call wasm-opt).
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/wasm-reduce.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index 8923b5eec..ba9f10264 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -1033,6 +1033,8 @@ struct Reducer int main(int argc, const char* argv[]) { std::string input, test, working, command; + // By default, look for binaries alongside our own binary. + std::string binDir = Path::getDirName(argv[0]); bool binary = true, deNan = false, verbose = false, debugInfo = false, force = false; Options options("wasm-reduce", @@ -1066,7 +1068,7 @@ int main(int argc, const char* argv[]) { Options::Arguments::One, [&](Options* o, const std::string& argument) { // Add separator just in case - Path::setBinaryenBinDir(argument + Path::getPathSeparator()); + binDir = argument + Path::getPathSeparator(); }) .add("--text", "-S", @@ -1121,10 +1123,13 @@ int main(int argc, const char* argv[]) { Colors::setEnabled(false); } + Path::setBinaryenBinDir(binDir); + std::cerr << "|wasm-reduce\n"; std::cerr << "|input: " << input << '\n'; std::cerr << "|test: " << test << '\n'; std::cerr << "|working: " << working << '\n'; + std::cerr << "|bin dir: " << binDir << '\n'; // get the expected output copy_file(input, test); |