From f927a004df016ad234b65e4f4b130f22a3044626 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 8 Aug 2024 10:07:47 +0200 Subject: [PATCH] Address feedback --- test/test_other.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/test/test_other.py b/test/test_other.py index bcc90bd2c834a..1de074816503e 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -1689,6 +1689,18 @@ def test_stdin(self, args): os.system(f'cat in.txt | {cmd} > out.txt') self.assertContained('abcdef\nghijkl\neof', read_file('out.txt')) + @also_with_noderawfs + @crossplatform + def test_module_stdin(self): + self.set_setting('FORCE_FILESYSTEM') + self.set_setting('EXIT_RUNTIME') + create_file('pre.js', ''' +const data = 'hello, world!\\n'.split('').map(c => c.charCodeAt(0)); +Module['stdin'] = () => data.shift() || null; +''') + self.emcc_args += ['--pre-js', 'pre.js'] + self.do_runf(test_file('module/test_stdin.c'), 'hello, world!') + def test_ungetc_fscanf(self): create_file('main.c', r''' #include @@ -9762,6 +9774,7 @@ def test_ioctl(self): # ioctl requires filesystem self.do_other_test('test_ioctl.c', emcc_args=['-sFORCE_FILESYSTEM']) + @also_with_noderawfs def test_ioctl_termios(self): # ioctl requires filesystem self.do_other_test('test_ioctl_termios.c', emcc_args=['-sFORCE_FILESYSTEM']) @@ -13497,18 +13510,6 @@ def test_noderawfs_override_standard_streams(self): self.emcc_args += ['--pre-js', 'pre.js'] self.do_runf(test_file('hello_world.c')) - @requires_node - def test_noderawfs_override_stdin(self): - self.set_setting('NODERAWFS') - self.set_setting('FORCE_FILESYSTEM') - self.set_setting('EXIT_RUNTIME') - create_file('pre.js', ''' -const data = 'hello, world!\\n'.split('').map(c => c.charCodeAt(0)); -Module['stdin'] = () => data.shift() || null; -''') - self.emcc_args += ['--pre-js', 'pre.js'] - self.do_runf(test_file('module/test_stdin.c'), 'hello, world!') - # WASMFS tests # TODO: This test will only work with the new file system.