From e9a6609b7d4aedffa9109bb26ce1bee31d92dbb6 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Fri, 20 Oct 2023 02:13:04 -0700 Subject: [PATCH 1/2] If INDUCE_FAILURE_IN_FORMATTER appears in file list, cause darker/clang-format failure --- llvm/utils/git/code-format-helper.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index c45bb4d935d47..db2d4c5c52273 100644 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -148,6 +148,11 @@ def format_run( args.end_rev, "--", ] + cpp_files + + # For manual testing purposes... + if "INDUCE_FAILURE_IN_FORMATTER" in " ".join(cpp_files): + cf_cmd.insert(1, "--induce-failure") + print(f"Running: {' '.join(cf_cmd)}") self.cf_cmd = cf_cmd proc = subprocess.run(cf_cmd, capture_output=True) @@ -192,6 +197,11 @@ def format_run( "-r", f"{args.start_rev}..{args.end_rev}", ] + py_files + + # For manual testing purposes... + if "INDUCE_FAILURE_IN_FORMATTER" in " ".join(py_files): + darker_cmd += ["--induce-failure"] + print(f"Running: {' '.join(darker_cmd)}") self.darker_cmd = darker_cmd proc = subprocess.run(darker_cmd, capture_output=True) From 70a79c93d440699ceb87caf5f7c330615b1522b3 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Fri, 20 Oct 2023 14:29:49 -0700 Subject: [PATCH 2/2] New C++ and Python file: neither needs reformatting --- llvm/utils/git/test1.cpp | 3 +++ llvm/utils/git/test1.py | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 llvm/utils/git/test1.cpp create mode 100644 llvm/utils/git/test1.py diff --git a/llvm/utils/git/test1.cpp b/llvm/utils/git/test1.cpp new file mode 100644 index 0000000000000..45269d1d40959 --- /dev/null +++ b/llvm/utils/git/test1.cpp @@ -0,0 +1,3 @@ +int main() { + return 42; +} diff --git a/llvm/utils/git/test1.py b/llvm/utils/git/test1.py new file mode 100644 index 0000000000000..2b0aadd82aa62 --- /dev/null +++ b/llvm/utils/git/test1.py @@ -0,0 +1,2 @@ +def main(): + return 42