@@ -518,11 +518,12 @@ def test_i64_varargs(self):
518
518
self .do_core_test ('test_i64_varargs.c' , args = 'waka fleefl asdfasdfasdfasdf' .split ())
519
519
520
520
@no_wasm2js ('wasm_bigint' )
521
+ @require_node
521
522
def test_i64_invoke_bigint (self ):
522
523
self .set_setting ('WASM_BIGINT' )
523
524
self .emcc_args += ['-fexceptions' ]
524
525
self .node_args += ['--experimental-wasm-bigint' ]
525
- self .do_core_test ('test_i64_invoke_bigint.cpp' , js_engines = [ config . NODE_JS ] )
526
+ self .do_core_test ('test_i64_invoke_bigint.cpp' )
526
527
527
528
def test_vararg_copy (self ):
528
529
self .do_run_in_out_file_test ('va_arg/test_va_copy.c' )
@@ -5404,15 +5405,17 @@ def test_proc_self_fd(self):
5404
5405
def test_fwrite_0 (self ):
5405
5406
self .do_core_test ('test_fwrite_0.c' )
5406
5407
5407
- def test_fgetc_ungetc (self ):
5408
+ @parameterized ({
5409
+ '' : (['MEMFS' ]),
5410
+ 'nodefs' : (['NODEFS' ])
5411
+ })
5412
+ def test_fgetc_ungetc (self , fs ):
5408
5413
print ('TODO: update this test once the musl ungetc-on-EOF-stream bug is fixed upstream and reaches us' )
5409
- orig_compiler_opts = self .emcc_args .copy ()
5410
- for fs in ['MEMFS' , 'NODEFS' ]:
5411
- print (fs )
5412
- self .emcc_args = orig_compiler_opts + ['-D' + fs ]
5413
- if fs == 'NODEFS' :
5414
- self .emcc_args += ['-lnodefs.js' ]
5415
- self .do_runf (test_file ('stdio/test_fgetc_ungetc.c' ), 'success' , js_engines = [config .NODE_JS ])
5414
+ self .emcc_args += ['-D' + fs ]
5415
+ if fs == 'NODEFS' :
5416
+ self .require_node ()
5417
+ self .emcc_args += ['-lnodefs.js' ]
5418
+ self .do_runf (test_file ('stdio/test_fgetc_ungetc.c' ), 'success' )
5416
5419
5417
5420
def test_fgetc_unsigned (self ):
5418
5421
src = r'''
@@ -5811,6 +5814,7 @@ def test_signals(self):
5811
5814
self .do_core_test (test_file ('test_signals.c' ))
5812
5815
5813
5816
@no_windows ('https://github.com/emscripten-core/emscripten/issues/8882' )
5817
+ @require_node
5814
5818
def test_unistd_access (self ):
5815
5819
self .uses_es6 = True
5816
5820
orig_compiler_opts = self .emcc_args .copy ()
@@ -5823,13 +5827,13 @@ def test_unistd_access(self):
5823
5827
self .emcc_args += ['-sFORCE_FILESYSTEM' ]
5824
5828
if fs == 'NODEFS' :
5825
5829
self .emcc_args += ['-lnodefs.js' ]
5826
- self .do_run_in_out_file_test ('unistd/access.c' , js_engines = [ config . NODE_JS ] )
5830
+ self .do_run_in_out_file_test ('unistd/access.c' )
5827
5831
# Node.js fs.chmod is nearly no-op on Windows
5828
5832
# TODO: NODERAWFS in WasmFS
5829
5833
if not WINDOWS and not self .get_setting ('WASMFS' ):
5830
5834
self .emcc_args = orig_compiler_opts
5831
5835
self .set_setting ('NODERAWFS' )
5832
- self .do_run_in_out_file_test ('unistd/access.c' , js_engines = [ config . NODE_JS ] )
5836
+ self .do_run_in_out_file_test ('unistd/access.c' )
5833
5837
5834
5838
def test_unistd_curdir (self ):
5835
5839
self .uses_es6 = True
@@ -5847,19 +5851,22 @@ def test_unistd_pipe(self):
5847
5851
def test_unistd_dup (self ):
5848
5852
self .do_run_in_out_file_test ('unistd/dup.c' )
5849
5853
5850
- def test_unistd_truncate (self ):
5854
+ @parameterized ({
5855
+ '' : (['MEMFS' ]),
5856
+ 'nodefs' : (['NODEFS' ])
5857
+ })
5858
+ def test_unistd_truncate (self , fs ):
5851
5859
self .uses_es6 = True
5852
5860
orig_compiler_opts = self .emcc_args .copy ()
5853
- for fs in ['MEMFS' , 'NODEFS' ]:
5854
- self .emcc_args = orig_compiler_opts + ['-D' + fs ]
5855
- if self .get_setting ('WASMFS' ):
5856
- if fs == 'NODEFS' :
5857
- # TODO: NODEFS in WasmFS
5858
- continue
5859
- self .emcc_args += ['-sFORCE_FILESYSTEM' ]
5861
+ self .emcc_args = orig_compiler_opts + ['-D' + fs ]
5862
+ if self .get_setting ('WASMFS' ):
5860
5863
if fs == 'NODEFS' :
5861
- self .emcc_args += ['-lnodefs.js' ]
5862
- self .do_run_in_out_file_test ('unistd/truncate.c' , js_engines = [config .NODE_JS ])
5864
+ self .skipTest ('TODO: NODEFS in WasmFS' )
5865
+ self .emcc_args += ['-sFORCE_FILESYSTEM' ]
5866
+ if fs == 'NODEFS' :
5867
+ self .emcc_args += ['-lnodefs.js' ]
5868
+ self .require_node ()
5869
+ self .do_run_in_out_file_test ('unistd/truncate.c' )
5863
5870
5864
5871
@no_windows ("Windows throws EPERM rather than EACCES or EINVAL" )
5865
5872
@unittest .skipIf (WINDOWS or os .geteuid () == 0 , "Root access invalidates this test by being able to write on readonly files" )
@@ -5884,33 +5891,36 @@ def test_unistd_sysconf_phys_pages(self):
5884
5891
self .do_runf (filename , str (expected ) + ', errno: 0' )
5885
5892
5886
5893
@no_windows ('https://github.com/emscripten-core/emscripten/issues/8882' )
5887
- def test_unistd_unlink (self ):
5888
- self .clear ()
5889
- orig_compiler_opts = self .emcc_args .copy ()
5890
- for fs in ['MEMFS' , 'NODEFS' ]:
5891
- if fs == 'NODEFS' and self .get_setting ('WASMFS' ):
5892
- # TODO: NODEFS in WasmFS
5893
- continue
5894
- self .emcc_args = orig_compiler_opts + ['-D' + fs ]
5895
- # symlinks on node.js on non-linux behave differently (e.g. on Windows they require administrative privileges)
5896
- # so skip testing those bits on that combination.
5897
- if fs == 'NODEFS' :
5898
- self .emcc_args += ['-lnodefs.js' ]
5899
- if WINDOWS :
5900
- self .emcc_args += ['-DNO_SYMLINK=1' ]
5901
- if MACOS :
5902
- continue
5903
- self .do_runf (test_file ('unistd/unlink.c' ), 'success' , js_engines = [config .NODE_JS ])
5894
+ @parameterized ({
5895
+ '' : (['MEMFS' ]),
5896
+ 'nodefs' : (['NODEFS' ]),
5897
+ 'noderawfs' : (['NODERAWFS' ]),
5898
+ })
5899
+ def test_unistd_unlink (self , fs ):
5900
+ if fs in ('NODEFS' , 'NODERAWFS' ):
5901
+ self .require_node ()
5902
+ if self .get_setting ('WASMFS' ):
5903
+ self .skipTest ('NODEFS in WasmFS' )
5904
+
5905
+ self .emcc_args += ['-D' + fs ]
5906
+ # symlinks on node.js on non-linux behave differently (e.g. on Windows they require administrative privileges)
5907
+ # so skip testing those bits on that combination.
5908
+ if fs == 'NODEFS' :
5909
+ self .emcc_args += ['-lnodefs.js' ]
5910
+ if WINDOWS :
5911
+ self .emcc_args += ['-DNO_SYMLINK=1' ]
5912
+ if MACOS :
5913
+ self .skipTest ()
5904
5914
5905
5915
# Several differences/bugs on non-linux including https://github.com/nodejs/node/issues/18014
5906
5916
# TODO: NODERAWFS in WasmFS
5907
- if not WINDOWS and not MACOS and not self . get_setting ( 'WASMFS' ) :
5908
- self .emcc_args = orig_compiler_opts + [ '-DNODERAWFS' ]
5917
+ if fs == 'NODERAWFS' :
5918
+ self .set_setting ( 'NODERAWFS' )
5909
5919
# 0 if root user
5910
5920
if os .geteuid () == 0 :
5911
5921
self .emcc_args += ['-DSKIP_ACCESS_TESTS' ]
5912
- self . set_setting ( 'NODERAWFS' )
5913
- self .do_runf (test_file ('unistd/unlink.c' ), 'success' , js_engines = [ config . NODE_JS ] )
5922
+
5923
+ self .do_runf (test_file ('unistd/unlink.c' ), 'success' )
5914
5924
5915
5925
@parameterized ({
5916
5926
'memfs' : (['-DMEMFS' ], False ),
@@ -5960,14 +5970,18 @@ def test_unistd_io(self):
5960
5970
self .do_run_in_out_file_test ('unistd/io.c' )
5961
5971
5962
5972
@no_windows ('https://github.com/emscripten-core/emscripten/issues/8882' )
5963
- def test_unistd_misc (self ):
5973
+ @parameterized ({
5974
+ '' : (['MEMFS' ]),
5975
+ 'nodefs' : (['NODEFS' ]),
5976
+ })
5977
+ def test_unistd_misc (self , fs ):
5964
5978
self .set_setting ('LLD_REPORT_UNDEFINED' )
5965
5979
orig_compiler_opts = self .emcc_args .copy ()
5966
- for fs in [ 'MEMFS' , 'NODEFS' ]:
5967
- self . emcc_args = orig_compiler_opts + [ '-D' + fs ]
5968
- if fs == 'NODEFS' :
5969
- self .emcc_args += ['-lnodefs.js' ]
5970
- self .do_run_in_out_file_test ('unistd/misc.c' , js_engines = [ config . NODE_JS ] , interleaved_output = False )
5980
+ self . emcc_args = orig_compiler_opts + [ '-D' + fs ]
5981
+ if fs == 'NODEFS' :
5982
+ self . require_node ()
5983
+ self .emcc_args += ['-lnodefs.js' ]
5984
+ self .do_run_in_out_file_test ('unistd/misc.c' , interleaved_output = False )
5971
5985
5972
5986
# i64s in the API, which we'd need to legalize for JS, so in standalone mode
5973
5987
# all we can test is wasm VMs
0 commit comments