diff options
author | Alon Zakai <azakai@google.com> | 2019-11-15 16:53:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-15 16:53:35 -0800 |
commit | 28dfa0e0238bc0bdb3958e3884e45189ec34e47a (patch) | |
tree | 62fec5280a5cb4560aab0e478e2682d4d6a00032 /test/unit/test_warnings.py | |
parent | 89530ffd9a1b2d0b07bd9f0b91a96665afca3262 (diff) | |
download | binaryen-28dfa0e0238bc0bdb3958e3884e45189ec34e47a.tar.gz binaryen-28dfa0e0238bc0bdb3958e3884e45189ec34e47a.tar.bz2 binaryen-28dfa0e0238bc0bdb3958e3884e45189ec34e47a.zip |
Warning improvements (#2438)
If wasm-opt is run with no passes, warn, as we've gotten reports that people
assume a tool called "wasm-opt" should optimize automatically (but we follow
llvm's opt convention of not doing so).
Add a --quiet (-q) flag that suppresses this minor warning, and the other minor
warning where there is no output file.
Diffstat (limited to 'test/unit/test_warnings.py')
-rw-r--r-- | test/unit/test_warnings.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/test_warnings.py b/test/unit/test_warnings.py new file mode 100644 index 000000000..9fb43a12b --- /dev/null +++ b/test/unit/test_warnings.py @@ -0,0 +1,18 @@ +import subprocess + +from scripts.test.shared import WASM_OPT, run_process +from .utils import BinaryenTestCase + + +class WarningsText(BinaryenTestCase): + def test_warn_on_no_passes(self): + err = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '-o', 'a.wasm'], stderr=subprocess.PIPE).stderr + self.assertIn('warning: no passes specified, not doing any work', err) + + def test_warn_on_no_output(self): + err = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '-O1'], stderr=subprocess.PIPE).stderr + self.assertIn('warning: no output file specified, not emitting output', err) + + def test_quiet_suppresses_warnings(self): + err = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '-q'], stderr=subprocess.PIPE).stderr + self.assertNotIn('warning', err) |