Skip to content

Commit ffbc85a

Browse files
authored
Handle permissions when clearing test directories (#19485)
Without this, this failed on the second run: ./test/runner test_readdir_rawfs ./test/runner test_readdir_rawfs That test creates read-only files/directories, whose permissions we need to adjust.
1 parent 9585c64 commit ffbc85a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/common.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,11 @@ def force_delete_dir(dirname):
393393
utils.delete_dir(dirname)
394394

395395

396+
def force_delete_contents(dirname):
397+
make_dir_writeable(dirname)
398+
utils.delete_contents(dirname)
399+
400+
396401
def parameterized(parameters):
397402
"""
398403
Mark a test as parameterized.
@@ -683,7 +688,7 @@ def setUp(self):
683688
# expect this. --no-clean can be used to keep the old contents for the new test
684689
# run. This can be useful when iterating on a given test with extra files you want to keep
685690
# around in the output directory.
686-
utils.delete_contents(self.working_dir)
691+
force_delete_contents(self.working_dir)
687692
else:
688693
print('Creating new test output directory')
689694
ensure_dir(self.working_dir)
@@ -1165,7 +1170,7 @@ def get_library(self, name, generated_libs, configure=['sh', './configure'], #
11651170
cache_name, env_init=env_init, native=native)
11661171

11671172
def clear(self):
1168-
utils.delete_contents(self.get_dir())
1173+
force_delete_contents(self.get_dir())
11691174
if shared.EMSCRIPTEN_TEMP_DIR:
11701175
utils.delete_contents(shared.EMSCRIPTEN_TEMP_DIR)
11711176

0 commit comments

Comments
 (0)