@@ -5664,15 +5664,17 @@ def test_rollup(self):
56645664 shutil .copy ('hello.wasm' , 'dist/' )
56655665 self .run_browser ('index.html' , '/report_result?exit:0' )
56665666
5667+ # Use different ports for each parameterized version so they can be run in
5668+ # parallel and not conflict.
56675669 @parameterized ({
5668- '' : ([],),
5669- 'es6' : (['-sEXPORT_ES6' , '--extern-post-js' , test_file ('modularize_post_js.js' )],),
5670+ '' : ([], 9998 ),
5671+ 'es6' : (['-sEXPORT_ES6' , '--extern-post-js' , test_file ('modularize_post_js.js' )], 9999 ),
56705672 })
5671- def test_cross_origin (self , args ):
5673+ def test_cross_origin (self , args , port ):
56725674 # Verfies that the emscripten-generted JS and Wasm can be hosted on a different origin.
5673- # This test create a second HTTP server running on port 9999 that servers files from `subdir`.
5675+ # This test create a second HTTP server running a different port that servers files from `subdir`.
56745676 # The main html is the servers from the normal 8888 server while the JS and Wasm are hosted
5675- # on at 9999 .
5677+ # on the port specified above .
56765678 os .mkdir ('subdir' )
56775679 create_file ('subdir/foo.txt' , 'hello' )
56785680 self .compile_btest ('hello_world.c' , ['-o' , 'subdir/hello.js' , '-sRUNTIME_DEBUG' , '-sCROSS_ORIGIN' , '-sPROXY_TO_PTHREAD' , '-pthread' , '-sEXIT_RUNTIME' ] + args )
@@ -5697,11 +5699,11 @@ def end_headers(self):
56975699 return SimpleHTTPRequestHandler .end_headers (self )
56985700
56995701 if '-sEXPORT_ES6' in args :
5700- create_file ('test.html' , '<script src="http://localhost:9999 /hello.js" type="module"></script>' )
5702+ create_file ('test.html' , f '<script src="http://localhost:{ port } /hello.js" type="module"></script>' )
57015703 else :
5702- create_file ('test.html' , '<script src="http://localhost:9999 /hello.js"></script>' )
5704+ create_file ('test.html' , f '<script src="http://localhost:{ port } /hello.js"></script>' )
57035705
5704- server = HttpServerThread (ThreadingHTTPServer (('localhost' , 9999 ), MyReqestHandler ))
5706+ server = HttpServerThread (ThreadingHTTPServer (('localhost' , port ), MyReqestHandler ))
57055707 server .start ()
57065708 try :
57075709 self .run_browser ('test.html' , '/report_result?exit:0' )
0 commit comments