Skip to content

Commit d4533be

Browse files
author
Vasileios Karakasis
committed
WIP: Dont restage
1 parent 072b358 commit d4533be

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

reframe/core/runtime.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def _makedir(self, *dirs, wipeout=False):
4242
return ret
4343

4444
def _format_dirs(self, *dirs):
45+
if not self.get_option('general/0/clean_stagedir'):
46+
# If stagedir is to be reused, no new stage directories will be
47+
# used for retries
48+
return dirs
49+
4550
try:
4651
last = dirs[-1]
4752
except IndexError:
@@ -134,11 +139,13 @@ def stage_prefix(self):
134139

135140
return os.path.abspath(ret)
136141

137-
def make_stagedir(self, *dirs, wipeout=True):
142+
def make_stagedir(self, *dirs):
143+
wipeout = self.get_option('general/0/clean_stagedir')
138144
return self._makedir(self.stage_prefix,
139145
*self._format_dirs(*dirs), wipeout=wipeout)
140146

141-
def make_outputdir(self, *dirs, wipeout=True):
147+
def make_outputdir(self, *dirs):
148+
wipeout = self.get_option('general/0/clean_stagedir')
142149
return self._makedir(self.output_prefix,
143150
*self._format_dirs(*dirs), wipeout=wipeout)
144151

reframe/frontend/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ def main():
126126
help='Keep stage directories even for successful checks',
127127
envvar='RFM_KEEP_STAGE_FILES', configvar='general/keep_stage_files'
128128
)
129+
output_options.add_argument(
130+
'--dont-restage', action='store_false', dest='clean_stagedir',
131+
help='Reuse the test stage directory',
132+
envvar='RFM_CLEAN_STAGEDIR', configvar='general/clean_stagedir'
133+
)
129134
output_options.add_argument(
130135
'--save-log-files', action='store_true', default=False,
131136
help='Save ReFrame log files to the output directory',

reframe/schemas/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@
350350
"items": {"type": "string"}
351351
},
352352
"check_search_recursive": {"type": "boolean"},
353+
"clean_stagedir": {"type": "boolean"},
353354
"colorize": {"type": "boolean"},
354355
"ignore_check_conflicts": {"type": "boolean"},
355356
"keep_stage_files": {"type": "boolean"},
@@ -394,6 +395,7 @@
394395
"environments/target_systems": ["*"],
395396
"general/check_search_path": ["${RFM_INSTALL_PREFIX}/checks/"],
396397
"general/check_search_recursive": false,
398+
"general/clean_stagedir": true,
397399
"general/colorize": true,
398400
"general/ignore_check_conflicts": false,
399401
"general/keep_stage_files": false,

unittests/test_cli.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,31 @@ def test_check_sanity_failure(run_reframe, tmp_path):
221221
)
222222

223223

224+
def test_dont_restage(run_reframe, tmp_path):
225+
run_reframe(
226+
checkpath=['unittests/resources/checks/frontend_checks.py'],
227+
more_options=['-t', 'SanityFailureCheck']
228+
)
229+
230+
# Place a random file in the test's stage directory and rerun with
231+
# `--dont-restage` and `--max-retries`
232+
stagedir = (tmp_path / 'stage' / 'generic' / 'default' /
233+
'builtin-gcc' / 'SanityFailureCheck')
234+
(stagedir / 'foobar').touch()
235+
returncode, stdout, stderr = run_reframe(
236+
checkpath=['unittests/resources/checks/frontend_checks.py'],
237+
more_options=['-t', 'SanityFailureCheck',
238+
'--dont-restage', '--max-retries=1']
239+
)
240+
assert os.path.exists(stagedir / 'foobar')
241+
assert not os.path.exists(f'{stagedir}_retry1')
242+
243+
# And some standard assertions
244+
assert 'Traceback' not in stdout
245+
assert 'Traceback' not in stderr
246+
assert returncode != 0
247+
248+
224249
def test_checkpath_symlink(run_reframe, tmp_path):
225250
# FIXME: This should move to test_loader.py
226251
checks_symlink = tmp_path / 'checks_symlink'

0 commit comments

Comments
 (0)