Bladeren bron

In `test_clang_cpp`, if `CalledProcessError` is raised, log the stderr for easier debugging (#5595)

Found this is very useful for debugging since otherwise it's hard to
tell what happened in the process.
Based on similar logic in `scripts/target_determinator.py`.
Boaz Brickner 11 maanden geleden
bovenliggende
commit
fb33f7c481
1 gewijzigde bestanden met toevoegingen van 10 en 7 verwijderingen
  1. 10 7
      toolchain/install/llvm_symlinks_test.py

+ 10 - 7
toolchain/install/llvm_symlinks_test.py

@@ -86,13 +86,16 @@ class LLVMSymlinksTest(unittest.TestCase):
         # the test file and writing to stdout. We define a macro that we'll
         # check is expanded.
         bin = self.install_root / "lib/carbon/llvm/bin/clang-cpp"
-        run = subprocess.run(
-            [bin, "-D", "TEST=SUCCESS", text_file, "-"],
-            check=True,
-            capture_output=True,
-            text=True,
-        )
-
+        try:
+            run = subprocess.run(
+                [bin, "-D", "TEST=SUCCESS", text_file, "-"],
+                check=True,
+                capture_output=True,
+                text=True,
+            )
+        except subprocess.CalledProcessError as err:
+            print(err.stderr, file=sys.stderr)
+            raise
         self.assertEqual(run.stderr, "")
         self.assertRegex(run.stdout, r"(^|\n)SUCCESS\n")