validate:launcher: Do not dump on failure test we will retry

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1113>
This commit is contained in:
Thibault Saunier 2021-10-08 12:09:47 -03:00 committed by GStreamer Marge Bot
parent ee67bd8e8b
commit 7dfaac92fa

View file

@ -708,7 +708,7 @@ class Test(Loggable):
extra_logs.append(shutil.copy(logfile, path)) extra_logs.append(shutil.copy(logfile, path))
self.extra_logfiles = extra_logs self.extra_logfiles = extra_logs
def test_end(self): def test_end(self, retry_on_failures=False):
self.kill_subprocess() self.kill_subprocess()
self.thread.join() self.thread.join()
self.time_taken = time.time() - self._starting_time self.time_taken = time.time() - self._starting_time
@ -717,10 +717,7 @@ class Test(Loggable):
signal.signal(signal.SIGINT, self.previous_sigint_handler) signal.signal(signal.SIGINT, self.previous_sigint_handler)
self.finalize_logfiles() self.finalize_logfiles()
message = None if self.options.dump_on_failure and not retry_on_failures and not self.max_retries:
end = "\n"
if self.options.dump_on_failure:
if self.result not in [Result.PASSED, Result.KNOWN_ERROR, Result.NOT_RUN]: if self.result not in [Result.PASSED, Result.KNOWN_ERROR, Result.NOT_RUN]:
self._dump_log_files() self._dump_log_files()
@ -1490,7 +1487,7 @@ class TestsManager(Loggable):
max_retries = failure_def.get('allow_flakiness', failure_def.get('max_retries')) max_retries = failure_def.get('allow_flakiness', failure_def.get('max_retries'))
if max_retries: if max_retries:
test.max_retries = int(max_retries) test.max_retries = int(max_retries)
self.debug(f"{test.classname} allow {test.max_retries}") self.debug(f"{test.classname} allow {test.max_retries} retries.")
else: else:
for issue in failure_def['issues']: for issue in failure_def['issues']:
issue['bug'] = bugid issue['bug'] = bugid
@ -2068,8 +2065,8 @@ class _TestsLauncher(Loggable):
return True return True
def print_result(self, current_test_num, test, total_num_tests, retry_on_failure=False): def print_result(self, current_test_num, test, total_num_tests, retry_on_failures=False):
if test.result != Result.PASSED and (not retry_on_failure or test.max_retries): if test.result != Result.PASSED and (not retry_on_failures or test.max_retries):
printc(str(test), color=utils.get_color_for_result(test.result)) printc(str(test), color=utils.get_color_for_result(test.result))
length = 80 length = 80
@ -2138,17 +2135,17 @@ class _TestsLauncher(Loggable):
test = self.tests_wait() test = self.tests_wait()
jobs_running -= 1 jobs_running -= 1
current_test_num += 1 current_test_num += 1
res = test.test_end() res = test.test_end(retry_on_failures=retry_on_failures)
to_report = True to_report = True
if res not in [Result.PASSED, Result.SKIPPED, Result.KNOWN_ERROR]: if res not in [Result.PASSED, Result.SKIPPED, Result.KNOWN_ERROR]:
if self.options.forever or self.options.fatal_error: if self.options.forever or self.options.fatal_error:
self.print_result(current_test_num - 1, test, retry_on_failure=retry_on_failures, self.print_result(current_test_num - 1, test, retry_on_failures=retry_on_failures,
total_num_tests=total_num_tests) total_num_tests=total_num_tests)
self.reporter.after_test(test) self.reporter.after_test(test)
return False return False
if retry_on_failures or test.max_retries: if retry_on_failures or test.max_retries:
if not self.options.redirect_logs and test.max_retries: if not self.options.redirect_logs:
test.copy_logfiles() test.copy_logfiles()
to_retry.append(test) to_retry.append(test)
@ -2157,7 +2154,7 @@ class _TestsLauncher(Loggable):
test.max_retries -= 1 test.max_retries -= 1
to_report = False to_report = False
self.print_result(current_test_num - 1, test, self.print_result(current_test_num - 1, test,
retry_on_failure=retry_on_failures, retry_on_failures=retry_on_failures,
total_num_tests=total_num_tests) total_num_tests=total_num_tests)
if to_report: if to_report:
self.reporter.after_test(test) self.reporter.after_test(test)