Skip to content

Commit 57f2318

Browse files
author
Vasileios Karakasis
committed
Fine tune frontend output for the --ci-generate option
1 parent 66e85a3 commit 57f2318

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

reframe/core/exceptions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,8 @@ def is_severe(exc_type, exc_value, tb):
308308
'''Check if exception is a severe one.'''
309309

310310
soft_errors = (ReframeError,
311-
ConnectionError,
312-
FileExistsError,
313-
FileNotFoundError,
314-
IsADirectoryError,
311+
OSError,
315312
KeyboardInterrupt,
316-
NotADirectoryError,
317-
PermissionError,
318313
TimeoutError)
319314
if isinstance(exc_value, soft_errors):
320315
return False

reframe/frontend/cli.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def list_checks(testcases, printer, detailed=False):
120120
printer.info(
121121
'\n'.join(format_check(c, deps[c.name], detailed) for c in checks)
122122
)
123-
printer.info(f'Found {len(checks)} check(s)')
123+
printer.info(f'Found {len(checks)} check(s)\n')
124124

125125

126126
def logfiles_message():
@@ -273,6 +273,11 @@ def main():
273273
'-r', '--run', action='store_true',
274274
help='Run the selected checks'
275275
)
276+
action_options.add_argument(
277+
'--ci-generate', action='store', metavar='FILE',
278+
help=('Generate into FILE a Gitlab CI pipeline '
279+
'for the selected tests and exit'),
280+
)
276281

277282
# Run options
278283
run_options.add_argument(
@@ -335,10 +340,6 @@ def main():
335340
'--disable-hook', action='append', metavar='NAME', dest='hooks',
336341
default=[], help='Disable a pipeline hook for this run'
337342
)
338-
run_options.add_argument(
339-
'--ci-generate', action='store', metavar='FILE',
340-
help="Store ci pipeline in yaml FILE",
341-
)
342343

343344
# Environment options
344345
env_options.add_argument(
@@ -793,12 +794,6 @@ def _case_failed(t):
793794
)
794795
printer.verbose(f'Final number of test cases: {len(testcases)}')
795796

796-
if options.ci_generate:
797-
with open(options.ci_generate, 'wt') as fp:
798-
ci.emit_pipeline(fp, testcases)
799-
800-
sys.exit(0)
801-
802797
# Disable hooks
803798
for tc in testcases:
804799
for h in options.hooks:
@@ -809,9 +804,23 @@ def _case_failed(t):
809804
list_checks(testcases, printer, options.list_detailed)
810805
sys.exit(0)
811806

807+
if options.ci_generate:
808+
list_checks(testcases, printer)
809+
printer.info('[Generate CI]')
810+
with open(options.ci_generate, 'wt') as fp:
811+
ci.emit_pipeline(fp, testcases)
812+
813+
printer.info(
814+
f' Gitlab pipeline generated successfully '
815+
f'in {options.ci_generate!r}.\n'
816+
)
817+
sys.exit(0)
818+
812819
if not options.run:
813-
printer.error(f"No action specified. Please specify `-l'/`-L' for "
814-
f"listing or `-r' for running. "
820+
printer.error("No action option specified. Available options:\n"
821+
" - `-l'/`-L' for listing\n"
822+
" - `-r' for running\n"
823+
" - `--ci-generate' for generating a CI pipeline\n"
815824
f"Try `{argparser.prog} -h' for more options.")
816825
sys.exit(1)
817826

0 commit comments

Comments
 (0)