From 188177cef6b821266969ebbd818975ffc957d5c3 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 17 Mar 2020 12:22:58 +0100 Subject: [PATCH] mavsdk_tests: print error on failure --- test/mavsdk_tests/mavsdk_test_runner.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/mavsdk_tests/mavsdk_test_runner.py b/test/mavsdk_tests/mavsdk_test_runner.py index 0f95de3da9..d1e4f5623c 100755 --- a/test/mavsdk_tests/mavsdk_test_runner.py +++ b/test/mavsdk_tests/mavsdk_test_runner.py @@ -323,9 +323,9 @@ class Tester: runner.start() max_name = max(len(runner.name) for runner in self.active_runners) + logfile_path = self.determine_logfile_path(log_dir, 'combined') - self.start_combined_log( - self.determine_logfile_path(log_dir, 'combined')) + self.start_combined_log(logfile_path) while test_runner.time_elapsed_s() < test['timeout_min']*60: returncode = test_runner.poll() @@ -360,9 +360,7 @@ class Tester: test['cases'][case]['results'].append(result) if not is_success: - # TODO: print error and logfiles - pass - + print(self.get_combined_log(logfile_path)) return is_success def start_combined_log(self, filename: str) -> None: @@ -374,6 +372,10 @@ class Tester: def add_to_combined_log(self, output: str) -> None: self.log_fd.write(output) + def get_combined_log(self, filename: str) -> str: + with open(filename, 'r') as f: + return f.read() + @staticmethod def add_name_prefix(width: int, name: str, text: str) -> str: return colorize("[" + name.ljust(width) + "] " + text, color.RESET)