@@ -15872,24 +15872,16 @@ def test_rlimit(self):
15872
15872
def test_mainScriptUrlOrBlob(self, es6):
15873
15873
# Use `foo.js` instead of the current script name when creating new threads
15874
15874
if es6:
15875
- self.emcc_args += ['-sEXPORT_ES6']
15876
- create_file('pre.js', '')
15877
- create_file('run.mjs', '(await import("./foo.mjs")).default({mainScriptUrlOrBlob:"./foo.mjs"});')
15878
- binfile = 'a.out.mjs'
15879
- real_binfile = 'foo.mjs'
15880
- runfile = 'run.mjs'
15881
- else:
15882
- create_file('pre.js', 'Module = { mainScriptUrlOrBlob: "./foo.js" }')
15883
- binfile = 'a.out.js'
15884
- real_binfile = 'foo.js'
15885
- runfile = binfile
15875
+ self.emcc_args += ['-sEXPORT_ES6', '--extern-post-js', test_file('modularize_post_js.js')]
15876
+
15877
+ create_file('pre.js', 'Module = { mainScriptUrlOrBlob: "./foo.js" }')
15886
15878
15887
- self.run_process([EMCC, test_file('hello_world.c'), '-sEXIT_RUNTIME', '-sPROXY_TO_PTHREAD', '-pthread', '--pre-js=pre.js', '-o', binfile ])
15879
+ self.run_process([EMCC, test_file('hello_world.c'), '-sEXIT_RUNTIME', '-sPROXY_TO_PTHREAD', '-pthread', '--pre-js=pre.js', '-o', 'a.out.js' ])
15888
15880
15889
- # First run without foo.{mjs,js} present to verify that the pthread creation fails
15890
- err = self.run_js(runfile , assert_returncode=NON_ZERO)
15881
+ # First run without foo.js present to verify that the pthread creation fails
15882
+ err = self.run_js('a.out.js' , assert_returncode=NON_ZERO)
15891
15883
self.assertContained('Cannot find module.*foo', err, regex=True)
15892
15884
15893
15885
# Now create foo.{mjs,js} and the program should run as expected.
15894
- shutil.copy(binfile, real_binfile )
15895
- self.assertContained('hello, world', self.run_js(runfile ))
15886
+ shutil.copy('a.out.js', 'foo.js' )
15887
+ self.assertContained('hello, world', self.run_js('a.out.js' ))
0 commit comments