Skip to content

Commit 539e100

Browse files
committed
[WasmFS] Add testcases for absolute path handling with NODERAWFS
These currently fail. A quick inspection suggests that absolute paths are being incorrectly prefixed with `./`.
1 parent a524013 commit 539e100

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

test/test_other.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10474,15 +10474,39 @@ def test_noderawfs_disables_embedding(self):
1047410474
err = self.expect_fail(base + ['--embed-file', 'somefile'])
1047510475
self.assertContained(expected, err)
1047610476

10477-
def test_noderawfs_access_abspath(self):
10477+
@crossplatform
10478+
@parameterized({
10479+
'': ([],),
10480+
'wasmfs': (['-sWASMFS'],),
10481+
})
10482+
def test_noderawfs_access_abspath(self, args):
1047810483
create_file('foo', 'bar')
1047910484
create_file('access.c', r'''
1048010485
#include <unistd.h>
1048110486
int main(int argc, char** argv) {
1048210487
return access(argv[1], F_OK);
1048310488
}
1048410489
''')
10485-
self.run_process([EMCC, 'access.c', '-sNODERAWFS'])
10490+
self.run_process([EMCC, 'access.c', '-sNODERAWFS'] + args)
10491+
self.run_js('a.out.js', args=[os.path.abspath('foo')])
10492+
10493+
@crossplatform
10494+
@parameterized({
10495+
'': ([],),
10496+
'wasmfs': (['-sWASMFS'],),
10497+
})
10498+
def test_noderawfs_open_abspath(self, args):
10499+
create_file('foo', 'bar')
10500+
create_file('open.c', r'''
10501+
#include <fcntl.h>
10502+
#include <unistd.h>
10503+
int main(int argc, char** argv) {
10504+
int fd = open(argv[1], O_RDONLY, 0644);
10505+
if (fd == -1) return 1;
10506+
return close(fd) == -1;
10507+
}
10508+
''')
10509+
self.run_process([EMCC, 'open.c', '-sNODERAWFS'] + args)
1048610510
self.run_js('a.out.js', args=[os.path.abspath('foo')])
1048710511

1048810512
def test_noderawfs_readfile_prerun(self):

0 commit comments

Comments
 (0)