Skip to content

Commit 8b1711e

Browse files
committed
Apply review comments to test
1 parent cad0ddf commit 8b1711e

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

test/fs/test_stat_unnamed_file_descriptor.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,27 @@ void changedir(const char *dir) {
1818
assert(rtn == 0);
1919
}
2020

21-
22-
int main() {
23-
makedir("working");
21+
void setup() {
2422
#if defined(__EMSCRIPTEN__) && defined(NODEFS)
25-
EM_ASM(FS.mount(NODEFS, { root: '.' }, 'working'));
23+
makedir("working");
24+
EM_ASM(FS.mount(NODEFS, { root: '.' }, 'working'));
25+
changedir("working");
2626
#endif
27-
changedir("working");
28-
int fd = open("file.txt", O_RDWR | O_CREAT, 0666);
29-
unlink("file.txt");
30-
int res;
31-
struct stat buf;
32-
res = fstat(fd, &buf);
33-
assert(res == 0);
34-
assert(buf.st_atime > 1000000000);
35-
res = fchmod(fd, 0777);
36-
assert(res == 0);
37-
res = ftruncate(fd, 10);
38-
assert(res == 0);
39-
printf("success\n");
27+
}
28+
29+
30+
int main() {
31+
setup();
32+
int fd = open("file.txt", O_RDWR | O_CREAT, 0666);
33+
unlink("file.txt");
34+
int res;
35+
struct stat buf;
36+
res = fstat(fd, &buf);
37+
assert(res == 0);
38+
assert(buf.st_atime > 1000000000);
39+
res = fchmod(fd, 0777);
40+
assert(res == 0);
41+
res = ftruncate(fd, 10);
42+
assert(res == 0);
43+
printf("success\n");
4044
}

test/test_core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5928,13 +5928,12 @@ def test_fs_64bit(self):
59285928
'noderawfs':(['-sNODERAWFS'],),
59295929
})
59305930
def test_fs_stat_unnamed_file_descriptor(self, args):
5931-
self.emcc_args += args
59325931
nodefs = '-DNODEFS' in args or '-DNODERAWFS' in args
59335932
if self.get_setting('WASMFS'):
59345933
if nodefs:
59355934
self.skipTest('NODEFS in WasmFS')
59365935
self.set_setting('FORCE_FILESYSTEM')
5937-
self.do_runf('fs/test_stat_unnamed_file_descriptor.c', 'success')
5936+
self.do_runf('fs/test_stat_unnamed_file_descriptor.c', 'success', emcc_args=args)
59385937

59395938
def test_sigalrm(self):
59405939
self.do_runf('test_sigalrm.c', 'Received alarm!')

0 commit comments

Comments
 (0)