From 5af65b7359b0919875cf7da23b3aa2f2e73eda68 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 19 Dec 2024 17:54:46 +0100 Subject: [PATCH 1/4] Run test_chmod in nodefs. NFC --- test/stat/test_chmod.c | 4 ++++ test/test_core.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/stat/test_chmod.c b/test/stat/test_chmod.c index b9428255efdbf..d5db77b9aad77 100644 --- a/test/stat/test_chmod.c +++ b/test/stat/test_chmod.c @@ -137,6 +137,9 @@ void test() { lstat("file-link", &s); assert(s.st_mode == link_mode); + // TODO: lchmod is not supported in NODEFS but it chmods the link target + // instead of raising an error. Will fix in a follow up to #23058. + #ifndef NODEFS // // chmod the actual symlink // @@ -148,6 +151,7 @@ void test() { // make sure the file it references didn't change stat("file-link", &s); assert(s.st_mode == (S_IRUSR | S_IFREG)); + #endif #endif // WASMFS puts("success"); diff --git a/test/test_core.py b/test/test_core.py index ba51f97e69200..87be2467c5c40 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -5524,7 +5524,7 @@ def test_fstatat(self): @crossplatform @also_with_wasmfs - @also_with_noderawfs + @also_with_nodefs_both def test_stat_chmod(self): if self.get_setting('NODERAWFS') and WINDOWS: self.skipTest('mode bits work differently on windows') From 16d1ccd45213f377f1d39a2c3c0097cf724b97dd Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 19 Dec 2024 19:11:58 +0100 Subject: [PATCH 2/4] Use with_all_fs --- test/test_core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_core.py b/test/test_core.py index 87be2467c5c40..5fba3ed575480 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -5523,8 +5523,7 @@ def test_fstatat(self): self.do_runf('stat/test_fstatat.c', 'success') @crossplatform - @also_with_wasmfs - @also_with_nodefs_both + @with_all_fs def test_stat_chmod(self): if self.get_setting('NODERAWFS') and WINDOWS: self.skipTest('mode bits work differently on windows') From aa3ec3d3caa04d08ab2ab288c8e6cce13c7287c5 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Tue, 24 Dec 2024 15:46:41 +0100 Subject: [PATCH 3/4] Apply review comment --- test/stat/test_chmod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/stat/test_chmod.c b/test/stat/test_chmod.c index d5db77b9aad77..75e4bbe0134f6 100644 --- a/test/stat/test_chmod.c +++ b/test/stat/test_chmod.c @@ -139,7 +139,7 @@ void test() { // TODO: lchmod is not supported in NODEFS but it chmods the link target // instead of raising an error. Will fix in a follow up to #23058. - #ifndef NODEFS +#ifndef NODEFS // // chmod the actual symlink // @@ -151,7 +151,7 @@ void test() { // make sure the file it references didn't change stat("file-link", &s); assert(s.st_mode == (S_IRUSR | S_IFREG)); - #endif +#endif #endif // WASMFS puts("success"); From d419fba237dcb453c0d6f29f284cac1ad93e79b9 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Mon, 6 Jan 2025 10:36:11 +0100 Subject: [PATCH 4/4] Fix test on windows --- test/test_core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_core.py b/test/test_core.py index 5fba3ed575480..d29bbf637b6b7 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -5525,9 +5525,10 @@ def test_fstatat(self): @crossplatform @with_all_fs def test_stat_chmod(self): - if self.get_setting('NODERAWFS') and WINDOWS: + nodefs = '-DNODEFS' in self.emcc_args or '-DNODERAWFS' in self.emcc_args + if nodefs and WINDOWS: self.skipTest('mode bits work differently on windows') - if self.get_setting('WASMFS') and self.get_setting('NODERAWFS'): + if nodefs and self.get_setting('WASMFS'): self.skipTest('test requires symlink creation which currently missing from wasmfs+noderawfs') self.do_runf('stat/test_chmod.c', 'success')