diff options
author | Amir Ayupov <aaupov@fb.com> | 2023-02-09 10:54:53 -0800 |
---|---|---|
committer | Amir Ayupov <aaupov@fb.com> | 2023-02-09 10:55:12 -0800 |
commit | 701109b9b626f380546e479b61bd3be672faed5e (patch) | |
tree | 603a0ced23f526960f23ccfb3e0dafee2aff8ae8 /bolt | |
parent | ce87b031437071f011026bb850a2fb2e5f9a72b4 (diff) | |
download | llvm-701109b9b626f380546e479b61bd3be672faed5e.tar.gz |
[BOLT][Wrapper] Don't compare output upon error exit code
Fix llvm-bolt-wrapper to skip output file checks if llvm-bolt exits with error
code.
Test Plan:
- checkout to revision with invalid NFC mismatch in `is-strip.s` test
(e.g. 056af487831fb573e6895901d1e48f93922f9635~)
- run `nfc-check-setup.py`
- run `bin/llvm-lit -a tools/bolt/test/X86/is-strip.s`
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D143614
Diffstat (limited to 'bolt')
-rwxr-xr-x | bolt/utils/llvm-bolt-wrapper.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/bolt/utils/llvm-bolt-wrapper.py b/bolt/utils/llvm-bolt-wrapper.py index 379d5f40e390..652cc6074462 100755 --- a/bolt/utils/llvm-bolt-wrapper.py +++ b/bolt/utils/llvm-bolt-wrapper.py @@ -324,6 +324,10 @@ def main(): print(tmp) exit("exitcode mismatch") + # don't compare output upon unsuccessful exit + if main_bolt.returncode != 0: + cfg.SKIP_BINARY_CMP = True + # compare logs, skip_end=1 skips the line with time out = compare_logs(main_out, cmp_out, skip_end=1, str_input=False) if cfg.COMPARE_OUTPUT else None if out: @@ -346,23 +350,23 @@ def main(): # report binary timing as csv: output binary; base bolt real; cmp bolt real report_real_time(main_binary, main_out, cmp_out, cfg) - # check if files exist - main_exists = os.path.exists(main_binary) - cmp_exists = os.path.exists(cmp_binary) - if main_exists and cmp_exists: - # proceed to comparison - pass - elif not main_exists and not cmp_exists: - # both don't exist, assume it's intended, skip comparison - clean_exit(tmp, main_out, main_bolt.returncode, cfg) - elif main_exists: - assert not cmp_exists - exit(f"{cmp_binary} doesn't exist") - else: - assert not main_exists - exit(f"{main_binary} doesn't exist") - if not cfg.SKIP_BINARY_CMP: + # check if files exist + main_exists = os.path.exists(main_binary) + cmp_exists = os.path.exists(cmp_binary) + if main_exists and cmp_exists: + # proceed to comparison + pass + elif not main_exists and not cmp_exists: + # both don't exist, assume it's intended, skip comparison + clean_exit(tmp, main_out, main_bolt.returncode, cfg) + elif main_exists: + assert not cmp_exists + exit(f"{cmp_binary} doesn't exist") + else: + assert not main_exists + exit(f"{main_binary} doesn't exist") + cmp_proc = subprocess.run(['cmp', '-b', main_binary, cmp_binary], capture_output=True, text=True) if cmp_proc.returncode: |