summaryrefslogtreecommitdiff
path: root/test/unit/test_dwarf.py
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-01-26 14:49:45 +0000
committerGitHub <noreply@github.com>2021-01-26 06:49:45 -0800
commit89164cdf1403a21a3d79ada0f0cf529d526c9de6 (patch)
tree0d503efd77225cffc44e54ea57d1b26091fa4bbd /test/unit/test_dwarf.py
parent9b6817c7e1b6436217b1c2acfd02c8dec74317bb (diff)
downloadbinaryen-89164cdf1403a21a3d79ada0f0cf529d526c9de6.tar.gz
binaryen-89164cdf1403a21a3d79ada0f0cf529d526c9de6.tar.bz2
binaryen-89164cdf1403a21a3d79ada0f0cf529d526c9de6.zip
Warn when running a pass not compatible with DWARF (#3506)
Previously the addDefault* methods would avoid adding opt passes that we know are incompatible with DWARF. However, that didn't handle the case of passes that are added in other ways. For example, when running Asyncify, emcc will run --flatten before, and that pass is not compatible with DWARF. This PR lets us warn on that by annotating the passes themselves. Then we use those annotation to either not run a pass at all (matching the previous behavior) or to show a warning when necessary. Fixes emscripten-core/emscripten#13288 . That is, concretely after this PR running asyncify + DWARF will show a warning to the user.
Diffstat (limited to 'test/unit/test_dwarf.py')
-rw-r--r--test/unit/test_dwarf.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/test_dwarf.py b/test/unit/test_dwarf.py
index 5078efeeb..37abf6b18 100644
--- a/test/unit/test_dwarf.py
+++ b/test/unit/test_dwarf.py
@@ -1,4 +1,5 @@
import os
+import subprocess
from scripts.test import shared
from . import utils
@@ -14,3 +15,14 @@ class DWARFTest(utils.BinaryenTestCase):
args = [os.path.join(path, name)] + \
['-g', '--dwarfdump', '--roundtrip', '--dwarfdump']
shared.run_process(shared.WASM_OPT + args, capture_output=True)
+
+ def test_dwarf_incompatibility(self):
+ warning = 'not fully compatible with DWARF'
+ path = self.input_path(os.path.join('dwarf', 'cubescript.wasm'))
+ args = [path, '-g']
+ # flatten warns
+ err = shared.run_process(shared.WASM_OPT + args + ['--flatten'], stderr=subprocess.PIPE).stderr
+ self.assertIn(warning, err)
+ # safe passes do not
+ err = shared.run_process(shared.WASM_OPT + args + ['--metrics'], stderr=subprocess.PIPE).stderr
+ self.assertNotIn(warning, err)