[llvm] [Debugify] Add 'error-test' mode for the debugify report script, for CI (PR #147574)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 06:59:09 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)
----------------
SLTozer wrote:
The `--error-test` switch means that we're checking to see whether the input file contains any errors - this script will normally simply fail with `1` if we don't have a valid JSON file as input, but in this specific case we want to pass if given the path to a non-existent file because that's what we expect in the case where there are no errors (as Clang will never open the results file to write to it).
https://github.com/llvm/llvm-project/pull/147574
More information about the llvm-commits
mailing list