[llvm] [Debugify] Add 'error-test' mode for the debugify report script, for CI (PR #147574)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 03:32:27 PDT 2025


================
@@ -442,10 +497,20 @@ def Main():
     parser = argparse.ArgumentParser()
     opts = parse_program_args(parser)
 
-    if not opts.html_file.endswith(".html"):
+    if opts.report_file is not None and not opts.report_file.endswith(".html"):
         print("error: The output file must be '.html'.")
         sys.exit(1)
 
+    if opts.error_test:
+        if os.path.isdir(opts.file_name):
+            print(f"error: Directory passed as input file: '{opts.file_name}'")
+            sys.exit(1)
+        if not os.path.exists(opts.file_name):
+            # We treat an empty input file as a success, as debugify will generate an output file iff any errors are
+            # found, meaning we expect 0 errors to mean that the expected file does not exist.
+            print(f"No errors detected for: {opts.file_name}")
+            sys.exit(0)
----------------
jmorse wrote:

Why is this needed -- a switch enables code-paths to be tested that otherwise are never run?

https://github.com/llvm/llvm-project/pull/147574


More information about the llvm-commits mailing list