validate: launcher: Remove log files for passing tests by default

Adding an option to keep them no matter what.
Log files are often pretty large and keeping them around can be annoying,
usually people won't look at logs files for passing tests, and we do not
even print them out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9127>
This commit is contained in:
Thibault Saunier 2024-09-24 09:48:54 -03:00 committed by GStreamer Marge Bot
parent b51dadf6f1
commit 07bac2b40a

View File

@ -2321,6 +2321,12 @@ class _TestsLauncher(Loggable):
if test.max_retries:
test.max_retries -= 1
to_report = False
elif not self.options.keep_logs:
for logfile in set([test.logfile]) | test.extra_logfiles:
try:
os.remove(logfile)
except FileNotFoundError as e:
self.error(f"{logfile} doesn't exist {e}, can't remove")
self.print_result(current_test_num - 1, test,
retry_on_failures=retry_on_failures,
total_num_tests=total_num_tests)