diff options
author | Alon Zakai <azakai@google.com> | 2020-10-09 11:02:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-09 11:02:05 -0700 |
commit | 369b8bdd3d9d49e4d9e0edf62e14881c14d9e352 (patch) | |
tree | d192384a68923f0d41b72bf674fa7d379aa1a0c4 /scripts/test/support.py | |
parent | 13351616886ad7d31528c6349ea397dbc6100778 (diff) | |
download | binaryen-369b8bdd3d9d49e4d9e0edf62e14881c14d9e352.tar.gz binaryen-369b8bdd3d9d49e4d9e0edf62e14881c14d9e352.tar.bz2 binaryen-369b8bdd3d9d49e4d9e0edf62e14881c14d9e352.zip |
Fix split_wast on asserts before the first module (#3206)
Normally a wast file has a module and then asserts on it, but
some tests have just asserts without a module. In that case,
set the module to None.
(This can happen if the asserts do not refer to a module,
and are at the top of the wast file.)
Diffstat (limited to 'scripts/test/support.py')
-rw-r--r-- | scripts/test/support.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/test/support.py b/scripts/test/support.py index 8e4ef85e8..a4a61fc22 100644 --- a/scripts/test/support.py +++ b/scripts/test/support.py @@ -146,6 +146,12 @@ def split_wast(wastFile): elif chunk.startswith('(assert_invalid'): continue elif chunk.startswith(('(assert', '(invoke')): + # ret may be empty if there are some asserts before the first + # module. in that case these are asserts *without* a module, which + # are valid (they may check something that doesn't refer to a module + # in any way). + if not ret: + ret += [(None, [])] ret[-1][1].append(chunk) return ret |