diff options
author | Alon Zakai <azakai@google.com> | 2022-04-26 12:26:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-26 12:26:56 -0700 |
commit | b337a11b0d2ac2af1b8c0241854e600be480792a (patch) | |
tree | ef7628af28809806f07f756901e8e9993ef11760 /scripts/foreach.py | |
parent | 20938231c095b7d71c1f41c6c664991d822ee097 (diff) | |
download | binaryen-b337a11b0d2ac2af1b8c0241854e600be480792a.tar.gz binaryen-b337a11b0d2ac2af1b8c0241854e600be480792a.tar.bz2 binaryen-b337a11b0d2ac2af1b8c0241854e600be480792a.zip |
Lit tests: print failing module index (#4614)
When a .wat file has lots of modules inside it, printing the index of the
module is helpful to find which is erroring.
Diffstat (limited to 'scripts/foreach.py')
-rwxr-xr-x | scripts/foreach.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/foreach.py b/scripts/foreach.py index 536741c22..f2e4b3464 100755 --- a/scripts/foreach.py +++ b/scripts/foreach.py @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import sys import subprocess @@ -31,6 +32,7 @@ def main(): tempfile = sys.argv[2] cmd = sys.argv[3:] returncode = 0 + all_modules = open(infile).read() for i, (module, asserts) in enumerate(support.split_wast(infile)): tempname = tempfile + '.' + str(i) with open(tempname, 'w') as temp: @@ -39,6 +41,9 @@ def main(): result = subprocess.run(new_cmd) if result.returncode != 0: returncode = result.returncode + module_char_start = all_modules.find(module) + module_line_start = all_modules[:module_char_start].count(os.linesep) + print(f'[Failing module at line {module_line_start}]', file=sys.stderr) sys.exit(returncode) |