Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Exit successfully if --duration limit is reached #3328

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1638,9 +1638,12 @@ def module_unuse(*paths):
if options.max_retries and runner.stats.failed(run=0):
printer.retry_report(report)

# Print a failure report if we had failures in the last run
# Print a failure report in case of failures.
# If `--duration` or `--reruns` is used then take into account
# all runs, else (i.e., `--max-retries`) only the last run.
success = True
if runner.stats.failed():
runid = None if options.duration or options.reruns else -1
if runner.stats.failed(run=runid):
success = False
printer.failure_report(
report,
Expand Down Expand Up @@ -1734,6 +1737,12 @@ def module_unuse(*paths):
sys.exit(1)

sys.exit(0)
except errors.RunSessionTimeout as err:
printer.warning(f'run session stopped: {err}')
if not success:
sys.exit(1)
else:
sys.exit(0)
except (Exception, KeyboardInterrupt, errors.ReframeFatalError):
exc_info = sys.exc_info()
tb = ''.join(traceback.format_exception(*exc_info))
Expand Down
7 changes: 7 additions & 0 deletions unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,13 @@ def test_reruns_with_duration(run_reframe):
assert returncode == 1


def test_exitcode_timeout(run_reframe):
assert_no_crash(*run_reframe(
more_options=['--duration=5s', '-n^HelloTest'],
checkpath=['unittests/resources/checks/hellocheck.py']
))


@pytest.fixture(params=['name', 'rname', 'uid', 'ruid', 'random'])
def exec_order(request):
return request.param
Expand Down
Loading