Skip to content

Commit 5b4cc6b

Browse files
author
Vasileios Karakasis
committed
Document the clean_stagedir config and cmd option
Plus a minor fix in the implementation along with unit test adaptation.
1 parent 7d45217 commit 5b4cc6b

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

docs/config_reference.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,16 @@ General Configuration
10371037

10381038

10391039

1040+
.. js:attribute:: .general[].clean_stagedir
1041+
1042+
:required: No
1043+
:default: ``true``
1044+
1045+
Clean stage directory of tests before populating it.
1046+
1047+
.. versionadded:: 3.1
1048+
1049+
10401050
.. js:attribute:: .general[].colorize
10411051

10421052
:required: No

docs/manpage.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ Options controlling ReFrame output
219219

220220
This option can also be set using the :envvar:`RFM_KEEP_STAGE_FILES` environment variable or the :js:attr:`keep_stage_files` general configuration parameter.
221221

222+
.. option:: --dont-restage
223+
224+
Do not restage a test if its stage directory exists.
225+
Normally, if the stage directory of a test exists, ReFrame will remove it and recreate it.
226+
This option disables this behavior.
227+
228+
.. versionadded:: 3.1
229+
222230
.. option:: --save-log-files
223231

224232
Save ReFrame log files in the output directory before exiting.
@@ -585,6 +593,21 @@ Here is an alphabetical list of the environment variables recognized by ReFrame:
585593
================================== ==================
586594

587595

596+
.. envvar:: RFM_CLEAN_STAGEDIR
597+
598+
Clean stage directory of tests before populating it.
599+
600+
.. versionadded:: 3.1
601+
602+
.. table::
603+
:align: left
604+
605+
================================== ==================
606+
Associated command line option :option:`--dont-restage`
607+
Associated configuration parameter :js:attr:`clean_stagedir` general configuration parameter
608+
================================== ==================
609+
610+
588611
.. envvar:: RFM_COLORIZE
589612

590613
Enable output coloring.

reframe/utility/os_ext.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=shutil.copy2,
124124

125125
for d in subdirs:
126126
if d not in ignore_paths:
127-
copytree(os.path.join(src, d), os.path.join(dst, d), symlinks,
128-
ignore, copy_function, ignore_dangling_symlinks)
127+
copytree(os.path.join(src, d), os.path.join(dst, d),
128+
symlinks, ignore, copy_function,
129+
ignore_dangling_symlinks, dirs_exist_ok)
129130

130131
return dst
131132

unittests/test_utility.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ def setUp(self):
276276
open(os.path.join(self.prefix, 'bar.txt'), 'w').close()
277277
open(os.path.join(self.prefix, 'foo.txt'), 'w').close()
278278

279+
# Create also a subdirectory in target, so as to check the recursion
280+
os.makedirs(os.path.join(self.target, 'foo'), exist_ok=True)
281+
279282
def verify_target_directory(self, file_links=[]):
280283
'''Verify the directory structure'''
281284
assert os.path.exists(os.path.join(self.target, 'bar', 'bar.txt'))
@@ -296,6 +299,10 @@ def test_virtual_copy_nolinks(self):
296299
os_ext.copytree_virtual(self.prefix, self.target, dirs_exist_ok=True)
297300
self.verify_target_directory()
298301

302+
def test_virtual_copy_nolinks_dirs_exist(self):
303+
with pytest.raises(FileExistsError):
304+
os_ext.copytree_virtual(self.prefix, self.target)
305+
299306
def test_virtual_copy_valid_links(self):
300307
file_links = ['bar/', 'foo/bar.txt', 'foo.txt']
301308
os_ext.copytree_virtual(self.prefix, self.target,

0 commit comments

Comments
 (0)