mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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`.
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user