validate:launcher: Do not dump to big log files

Avoiding ' The script exceeded the maximum execution time set for the job' in GitLab
This commit is contained in:
Thibault Saunier 2019-04-20 10:21:07 -04:00
parent 1d52eb0260
commit 7161b21334
2 changed files with 11 additions and 0 deletions

View file

@ -175,6 +175,15 @@ class Test(Loggable):
self.kill_subprocess()
self.process = None
def should_dump_on_failure(self):
if not self.options.dump_on_failure:
return False
try:
return os.path.getsize(self.logfile) < self.options.max_dump_size * 1024 * 1024
except FileNotFoundError:
return False
def __str__(self):
string = self.classname
if self.result != Result.NOT_RUN:

View file

@ -464,6 +464,8 @@ class LauncherConfig(Loggable):
action="store_true", default=False,
help="Dump logs to stdout when a test fails."
" Note that mdv is used to enhance output if avalaible, install with `pip install mdv`.")
parser.add_argument("--max-dump-size", dest="max_dump_size", type=float,
default=0.5, help="Maximum size of logs to dump on stdout in MB.")
parser.add_argument("-c", "--config", dest="config",
help="This is DEPRECATED, prefer using the testsuite format"
" to configure testsuites")