[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
This commit is contained in:
Amir Ayupov 2023-02-09 10:54:53 -08:00
parent ce87b03143
commit 701109b9b6

View File

@ -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,6 +350,7 @@ 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)
if not cfg.SKIP_BINARY_CMP:
# check if files exist
main_exists = os.path.exists(main_binary)
cmp_exists = os.path.exists(cmp_binary)
@ -362,7 +367,6 @@ def main():
assert not main_exists
exit(f"{main_binary} doesn't exist")
if not cfg.SKIP_BINARY_CMP:
cmp_proc = subprocess.run(['cmp', '-b', main_binary, cmp_binary],
capture_output=True, text=True)
if cmp_proc.returncode: