Skip to content

Commit e1a3bc5

Browse files
authored
Merge pull request #3553 from vkarak/bugfix/dry-run-outputdir
[bugfix] Do not wipe the output dir of a test if run with `--dry-run`
2 parents 6d30b7e + a332dec commit e1a3bc5

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

reframe/core/pipeline.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,10 +1737,11 @@ def _setup_paths(self):
17371737
self.current_system.name, self._current_partition.name,
17381738
self._current_environ.name, self.short_name
17391739
)
1740-
self._outputdir = runtime.make_outputdir(
1741-
self.current_system.name, self._current_partition.name,
1742-
self._current_environ.name, self.short_name
1743-
)
1740+
if not self.is_dry_run():
1741+
self._outputdir = runtime.make_outputdir(
1742+
self.current_system.name, self._current_partition.name,
1743+
self._current_environ.name, self.short_name
1744+
)
17441745
except OSError as e:
17451746
raise PipelineError('failed to set up paths') from e
17461747

unittests/test_cli.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,19 @@ def test_check_success(run_reframe, tmp_path, run_action):
162162
'reports' / 'run-report-0.json')
163163

164164

165+
def test_outputdir_dry_run(run_reframe, tmp_path):
166+
# We need to make sure that outputdir is maintained if the same test is
167+
# rerun with `--dry-run`
168+
169+
run_reframe(action='run', more_options=['-n', '^HelloTest'])
170+
run_reframe(action='dry_run', more_options=['-n', '^HelloTest'])
171+
prefix = (tmp_path / 'output' / 'generic' / 'default' /
172+
'builtin' / 'HelloTest')
173+
for path in ('rfm_build.err', 'rfm_build.out', 'rfm_build.sh',
174+
'rfm_job.err', 'rfm_job.out', 'rfm_job.sh'):
175+
assert (prefix / path).exists()
176+
177+
165178
def test_check_restore_session_failed(run_reframe, tmp_path):
166179
run_reframe(
167180
checkpath=['unittests/resources/checks_unlisted/deps_complex.py']

0 commit comments

Comments
 (0)