diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2016-05-14 00:42:30 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2016-05-14 00:42:30 +0000 |
commit | 4728cf7e852a4378a1b26508d5881ff2137bb3a3 (patch) | |
tree | e23b9d4078a045664eb57ed4ed2b87caf020f84a /lldb/packages/Python/lldbsuite/test_event/build_exception.py | |
parent | 0c020d11afaf188e5ecf6da20a37f29beb82223d (diff) | |
download | bcm5719-llvm-4728cf7e852a4378a1b26508d5881ff2137bb3a3.tar.gz bcm5719-llvm-4728cf7e852a4378a1b26508d5881ff2137bb3a3.zip |
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
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test_event/build_exception.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test_event/build_exception.py | 14 |
1 files changed, 14 insertions, 0 deletions
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", "<command unavailable>") + self.build_error = called_process_error.lldb_extensions.get("stderr_content", "<error output unavailable>") + + 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) |