@@ -199,7 +199,22 @@ def decorated(self, threads, *args, **kwargs):
199
199
f (self , * args , ** kwargs )
200
200
201
201
parameterize (decorated , {'' : (False ,),
202
- 'pthreads' : (True ,)})
202
+ 'pthread' : (True ,)})
203
+
204
+ return decorated
205
+
206
+
207
+ def also_with_proxy_to_pthread (f ):
208
+ assert callable (f )
209
+
210
+ @wraps (f )
211
+ def decorated (self , threads , * args , ** kwargs ):
212
+ if threads :
213
+ self .emcc_args += ['-pthread' , '-sPROXY_TO_PTHREAD' ]
214
+ f (self , * args , ** kwargs )
215
+
216
+ parameterize (decorated , {'' : (False ,),
217
+ 'pthread' : (True ,)})
203
218
204
219
return decorated
205
220
@@ -495,14 +510,11 @@ def make_main_two_files(path1, path2, nonexistingpath):
495
510
self .btest_exit ('main.c' , emcc_args = ['--pre-js' , 'pre.js' , '--use-preload-plugins' ])
496
511
497
512
# Tests that user .html shell files can manually download .data files created with --preload-file cmdline.
498
- @parameterized ({
499
- '' : ([],),
500
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sEXIT_RUNTIME' ],),
501
- })
502
- def test_preload_file_with_manual_data_download (self , args ):
513
+ @also_with_proxy_to_pthread
514
+ def test_preload_file_with_manual_data_download (self ):
503
515
create_file ('file.txt' , 'Hello!' )
504
516
505
- self .compile_btest ('browser/test_manual_download_data.c' , ['-sEXIT_RUNTIME' , '-o' , 'out.js' , '--preload-file' , 'file.txt@/file.txt' ] + args )
517
+ self .compile_btest ('browser/test_manual_download_data.c' , ['-sEXIT_RUNTIME' , '-o' , 'out.js' , '--preload-file' , 'file.txt@/file.txt' ])
506
518
shutil .copy (test_file ('browser/test_manual_download_data.html' ), '.' )
507
519
508
520
# Move .data file out of server root to ensure that getPreloadedPackage is actually used
@@ -1602,12 +1614,9 @@ def test_glfw_time(self):
1602
1614
def test_egl (self , args ):
1603
1615
self .btest_exit ('test_egl.c' , emcc_args = ['-O2' , '-lEGL' , '-lGL' , '-sGL_ENABLE_GET_PROC_ADDRESS' ] + args )
1604
1616
1605
- @parameterized ({
1606
- '' : ([],),
1607
- 'proxy_to_pthread' : (['-pthread' , '-sPROXY_TO_PTHREAD' ],),
1608
- })
1609
- def test_egl_width_height (self , args ):
1610
- self .btest_exit ('test_egl_width_height.c' , emcc_args = ['-O2' , '-lEGL' , '-lGL' ] + args )
1617
+ @also_with_proxy_to_pthread
1618
+ def test_egl_width_height (self ):
1619
+ self .btest_exit ('test_egl_width_height.c' , emcc_args = ['-O2' , '-lEGL' , '-lGL' ])
1611
1620
1612
1621
@requires_graphics_hardware
1613
1622
def test_egl_createcontext_error (self ):
@@ -1891,27 +1900,17 @@ def setup():
1891
1900
def test_emscripten_api_infloop (self ):
1892
1901
self .btest_exit ('emscripten_api_browser_infloop.cpp' )
1893
1902
1894
- @parameterized ({
1895
- '' : ([],),
1896
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sEXIT_RUNTIME' ],),
1897
- })
1898
- def test_emscripten_main_loop (self , args ):
1899
- self .btest_exit ('test_emscripten_main_loop.c' , emcc_args = args )
1903
+ @also_with_proxy_to_pthread
1904
+ def test_emscripten_main_loop (self ):
1905
+ self .btest_exit ('test_emscripten_main_loop.c' )
1900
1906
1901
- @parameterized ({
1902
- '' : ([],),
1903
- # test pthreads + AUTO_JS_LIBRARIES mode as well
1904
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sAUTO_JS_LIBRARIES=0' ],),
1905
- })
1906
- def test_emscripten_main_loop_settimeout (self , args ):
1907
- self .btest_exit ('test_emscripten_main_loop_settimeout.c' , emcc_args = args )
1907
+ @also_with_proxy_to_pthread
1908
+ def test_emscripten_main_loop_settimeout (self ):
1909
+ self .btest_exit ('test_emscripten_main_loop_settimeout.c' , emcc_args = ['-sAUTO_JS_LIBRARIES=0' ])
1908
1910
1909
- @parameterized ({
1910
- '' : ([],),
1911
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' ],),
1912
- })
1913
- def test_emscripten_main_loop_and_blocker (self , args ):
1914
- self .btest_exit ('test_emscripten_main_loop_and_blocker.c' , emcc_args = args )
1911
+ @also_with_proxy_to_pthread
1912
+ def test_emscripten_main_loop_and_blocker (self ):
1913
+ self .btest_exit ('test_emscripten_main_loop_and_blocker.c' )
1915
1914
1916
1915
def test_emscripten_main_loop_and_blocker_exit (self ):
1917
1916
# Same as above but tests that EXIT_RUNTIME works with emscripten_main_loop. The
@@ -1967,13 +1966,10 @@ def test_sdl_glshader2(self):
1967
1966
def test_gl_glteximage (self ):
1968
1967
self .btest ('gl_teximage.c' , '1' , emcc_args = ['-lGL' , '-lSDL' ])
1969
1968
1970
- @parameterized ({
1971
- '' : ([],),
1972
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sOFFSCREEN_FRAMEBUFFER' ],),
1973
- })
1974
1969
@requires_graphics_hardware
1975
- def test_gl_textures (self , args ):
1976
- self .btest_exit ('gl_textures.c' , emcc_args = ['-lGL' , '-g' , '-sSTACK_SIZE=1MB' ] + args )
1970
+ @also_with_proxy_to_pthread
1971
+ def test_gl_textures (self ):
1972
+ self .btest_exit ('gl_textures.c' , args = ['-lGL' , '-g' , '-sSTACK_SIZE=1MB' ])
1977
1973
1978
1974
@requires_graphics_hardware
1979
1975
def test_gl_ps (self ):
@@ -2632,10 +2628,10 @@ def test_html5_core(self, opts):
2632
2628
self .emcc_args .append ('--pre-js=pre.js' )
2633
2629
self .btest_exit ('test_html5_core.c' , emcc_args = opts )
2634
2630
2631
+ @also_with_proxy_to_pthread
2635
2632
@parameterized ({
2636
2633
'' : ([],),
2637
2634
'closure' : (['-O2' , '-g1' , '--closure=1' ],),
2638
- 'pthread' : (['-pthread' , '-sPROXY_TO_PTHREAD' ],),
2639
2635
})
2640
2636
def test_html5_gamepad (self , args ):
2641
2637
self .btest_exit ('test_gamepad.c' , emcc_args = args )
@@ -4965,24 +4961,28 @@ def test_emscripten_request_animation_frame_loop(self):
4965
4961
def test_request_animation_frame (self ):
4966
4962
self .btest_exit ('test_request_animation_frame.c' )
4967
4963
4964
+ @also_with_proxy_to_pthread
4968
4965
def test_emscripten_set_timeout (self ):
4969
- self .btest_exit ('emscripten_set_timeout.c' , emcc_args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4966
+ self .btest_exit ('emscripten_set_timeout.c' )
4970
4967
4968
+ @also_with_proxy_to_pthread
4971
4969
def test_emscripten_set_timeout_loop (self ):
4972
- self .btest_exit ('emscripten_set_timeout_loop.c' , emcc_args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4970
+ self .btest_exit ('emscripten_set_timeout_loop.c' )
4973
4971
4974
4972
def test_emscripten_set_immediate (self ):
4975
4973
self .btest_exit ('emscripten_set_immediate.c' )
4976
4974
4977
4975
def test_emscripten_set_immediate_loop (self ):
4978
4976
self .btest_exit ('emscripten_set_immediate_loop.c' )
4979
4977
4978
+ @also_with_proxy_to_pthread
4980
4979
def test_emscripten_set_interval (self ):
4981
- self .btest_exit ('emscripten_set_interval.c' , emcc_args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4980
+ self .btest_exit ('emscripten_set_interval.c' )
4982
4981
4983
4982
# Test emscripten_performance_now() and emscripten_date_now()
4983
+ @also_with_proxy_to_pthread
4984
4984
def test_emscripten_performance_now (self ):
4985
- self .btest ('emscripten_performance_now.c' , '0' , emcc_args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4985
+ self .btest_exit ('emscripten_performance_now.c' )
4986
4986
4987
4987
def test_embind_with_pthreads (self ):
4988
4988
self .btest_exit ('embind/test_pthreads.cpp' , emcc_args = ['-lembind' , '-pthread' , '-sPTHREAD_POOL_SIZE=2' ])
@@ -5054,12 +5054,9 @@ def test_minimal_runtime_loader_shell(self, args):
5054
5054
def test_minimal_runtime_hello_world (self , args ):
5055
5055
self .btest_exit ('small_hello_world.c' , emcc_args = args + ['-sMINIMAL_RUNTIME' ])
5056
5056
5057
- @parameterized ({
5058
- '' : ([],),
5059
- 'pthread' : (['-sPROXY_TO_PTHREAD' , '-pthread' ],),
5060
- })
5061
- def test_offset_converter (self , args ):
5062
- self .btest_exit ('test_offset_converter.c' , emcc_args = ['-sUSE_OFFSET_CONVERTER' , '-gsource-map' ] + args )
5057
+ @also_with_proxy_to_pthread
5058
+ def test_offset_converter (self ):
5059
+ self .btest_exit ('test_offset_converter.c' , emcc_args = ['-sUSE_OFFSET_CONVERTER' , '-gsource-map' ])
5063
5060
5064
5061
# Tests emscripten_unwind_to_js_event_loop() behavior
5065
5062
def test_emscripten_unwind_to_js_event_loop (self ):
0 commit comments