[PATCH] D143614: [BOLT][Wrapper] Don't compare output upon error exit code

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 10:55:23 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG701109b9b626: [BOLT][Wrapper] Don't compare output upon error exit code (authored by Amir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143614/new/

https://reviews.llvm.org/D143614

Files:
  bolt/utils/llvm-bolt-wrapper.py


Index: bolt/utils/llvm-bolt-wrapper.py
===================================================================
--- bolt/utils/llvm-bolt-wrapper.py
+++ bolt/utils/llvm-bolt-wrapper.py
@@ -324,6 +324,10 @@
         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 @@
     # 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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143614.496184.patch
Type: text/x-patch
Size: 2123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230209/d2b2ec56/attachment.bin>


More information about the llvm-commits mailing list