mavsdk_tests: print error on failure

This commit is contained in:
Julian Oes 2020-03-17 12:22:58 +01:00 committed by Nuno Marques
parent ab2186f126
commit 188177cef6
1 changed files with 7 additions and 5 deletions

View File

@ -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)