Skip to content

Commit b751e0e

Browse files
committed
tidy other.test_mainScriptUrlOrBlob
Per @sbc100 review, reduce differences across conditions
1 parent 333581e commit b751e0e

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

test/test_other.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15872,24 +15872,16 @@ def test_rlimit(self):
1587215872
def test_mainScriptUrlOrBlob(self, es6):
1587315873
# Use `foo.js` instead of the current script name when creating new threads
1587415874
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" }')
1588615878

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'])
1588815880

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)
1589115883
self.assertContained('Cannot find module.*foo', err, regex=True)
1589215884

1589315885
# 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

Comments
 (0)