Skip to content

Commit aeaecab

Browse files
authored
Add some testing of mainScriptUrlOrBlob under node. NFC (#23891)
1 parent 0de7eee commit aeaecab

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/test_other.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15804,3 +15804,16 @@ def test_rollup(self):
1580415804

1580515805
def test_rlimit(self):
1580615806
self.do_other_test('test_rlimit.c', emcc_args=['-O1'])
15807+
15808+
def test_mainScriptUrlOrBlob(self):
15809+
# Use `foo.js` instead of the current script name when creating new threads
15810+
create_file('pre.js', 'Module = { mainScriptUrlOrBlob: "./foo.js" }')
15811+
self.run_process([EMCC, test_file('hello_world.c'), '-sEXIT_RUNTIME', '-sPROXY_TO_PTHREAD', '-pthread', '--pre-js=pre.js'])
15812+
15813+
# First run without foo.js present to verify that the pthread creation fails
15814+
err = self.run_js('a.out.js', assert_returncode=NON_ZERO)
15815+
self.assertContained('Cannot find module.*foo.js', err, regex=True)
15816+
15817+
# Now create foo.js and the program should run as expected.
15818+
shutil.copy('a.out.js', 'foo.js')
15819+
self.assertContained('hello, world', self.run_js('a.out.js'))

0 commit comments

Comments
 (0)