From 4728cf7e852a4378a1b26508d5881ff2137bb3a3 Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Sat, 14 May 2016 00:42:30 +0000 Subject: surface build error content through test event system Summary: print build errors nicely in test output This test infrastructure change adds a new Python exception for test subject builds that fail. The output of the build command is captured and propagated to both the textual test output display code and to the test event system. The ResultsFormatter objects have been modified to do something more useful with this information. The xUnit formatter now replaces the non-informative Python build error stacktrace with the build error content. The curses ResultsFormatter prints a 'B' for build errors rather than 'E'. The xUnit output, in particular, makes it much easier for developers to track down test subject build errors that cause test failures when reports come in from CI. Reviewers: granata.enrico Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20252 llvm-svn: 269525 --- .../Python/lldbsuite/test_event/build_exception.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lldb/packages/Python/lldbsuite/test_event/build_exception.py (limited to 'lldb/packages/Python/lldbsuite/test_event/build_exception.py') diff --git a/lldb/packages/Python/lldbsuite/test_event/build_exception.py b/lldb/packages/Python/lldbsuite/test_event/build_exception.py new file mode 100644 index 00000000000..4a7c5f4a9d3 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test_event/build_exception.py @@ -0,0 +1,14 @@ +class BuildError(Exception): + def __init__(self, called_process_error): + super(BuildError, self).__init__("Error when building test subject") + self.command = called_process_error.lldb_extensions.get("command", "") + self.build_error = called_process_error.lldb_extensions.get("stderr_content", "") + + def __str__(self): + return self.format_build_error(self.command, self.build_error) + + @staticmethod + def format_build_error(command, command_output): + return "Error when building test subject.\n\nBuild Command:\n{}\n\nBuild Command Output:\n{}".format( + command, + command_output) -- cgit v1.2.3