From 019b143854c8df626d9d70eea1aeb736b01d9a80 Mon Sep 17 00:00:00 2001 From: Andrew Dennison Date: Fri, 20 Oct 2023 12:09:08 +1100 Subject: [PATCH] test_targets: capture output of failed tests --- test/test_targets.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/test_targets.py b/test/test_targets.py index dbc8bdcb6..fa2f3b417 100644 --- a/test/test_targets.py +++ b/test/test_targets.py @@ -67,7 +67,10 @@ python3 -m litex_boards.targets.simple litex_boards.platforms.{} \ --no-compile \ --uart-name="stub" \ """.format(name) - subprocess.check_call(cmd, shell=True) + try: + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True) + except subprocess.CalledProcessError as exc: + raise self.failureException(exc.output) from None # Build default configuration for all targets. def test_targets(self): @@ -90,4 +93,10 @@ python3 -m litex_boards.targets.{} \ --build \ --no-compile \ """.format(name) - subprocess.check_call(cmd, shell=True) + try: + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True) + except subprocess.CalledProcessError as exc: + raise self.failureException(exc.output) from None + +if __name__ == '__main__': + unittest.main()