@@ -200,7 +200,22 @@ def decorated(self, threads, *args, **kwargs):
200
200
f (self , * args , ** kwargs )
201
201
202
202
parameterize (decorated , {'' : (False ,),
203
- 'pthreads' : (True ,)})
203
+ 'pthread' : (True ,)})
204
+
205
+ return decorated
206
+
207
+
208
+ def also_with_proxy_to_pthread (f ):
209
+ assert callable (f )
210
+
211
+ @wraps (f )
212
+ def decorated (self , threads , * args , ** kwargs ):
213
+ if threads :
214
+ self .emcc_args += ['-pthread' , '-sPROXY_TO_PTHREAD' ]
215
+ f (self , * args , ** kwargs )
216
+
217
+ parameterize (decorated , {'' : (False ,),
218
+ 'pthread' : (True ,)})
204
219
205
220
return decorated
206
221
@@ -496,14 +511,11 @@ def make_main_two_files(path1, path2, nonexistingpath):
496
511
self .btest_exit ('main.c' , args = ['--pre-js' , 'pre.js' , '--use-preload-plugins' ])
497
512
498
513
# Tests that user .html shell files can manually download .data files created with --preload-file cmdline.
499
- @parameterized ({
500
- '' : ([],),
501
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sEXIT_RUNTIME' ],),
502
- })
503
- def test_preload_file_with_manual_data_download (self , args ):
514
+ @also_with_proxy_to_pthread
515
+ def test_preload_file_with_manual_data_download (self ):
504
516
create_file ('file.txt' , 'Hello!' )
505
517
506
- self .compile_btest ('browser/test_manual_download_data.c' , ['-sEXIT_RUNTIME' , '-o' , 'out.js' , '--preload-file' , 'file.txt@/file.txt' ] + args )
518
+ self .compile_btest ('browser/test_manual_download_data.c' , ['-sEXIT_RUNTIME' , '-o' , 'out.js' , '--preload-file' , 'file.txt@/file.txt' ])
507
519
shutil .copy (test_file ('browser/test_manual_download_data.html' ), '.' )
508
520
509
521
# Move .data file out of server root to ensure that getPreloadedPackage is actually used
@@ -1603,12 +1615,9 @@ def test_glfw_time(self):
1603
1615
def test_egl (self , args ):
1604
1616
self .btest_exit ('test_egl.c' , args = ['-O2' , '-lEGL' , '-lGL' , '-sGL_ENABLE_GET_PROC_ADDRESS' ] + args )
1605
1617
1606
- @parameterized ({
1607
- '' : ([],),
1608
- 'proxy_to_pthread' : (['-pthread' , '-sPROXY_TO_PTHREAD' ],),
1609
- })
1610
- def test_egl_width_height (self , args ):
1611
- self .btest_exit ('test_egl_width_height.c' , args = ['-O2' , '-lEGL' , '-lGL' ] + args )
1618
+ @also_with_proxy_to_pthread
1619
+ def test_egl_width_height (self ):
1620
+ self .btest_exit ('test_egl_width_height.c' , args = ['-O2' , '-lEGL' , '-lGL' ])
1612
1621
1613
1622
@requires_graphics_hardware
1614
1623
def test_egl_createcontext_error (self ):
@@ -1901,27 +1910,17 @@ def test_emscripten_fs_api2(self):
1901
1910
self .btest_exit ('emscripten_fs_api_browser2.c' , args = ['-sASSERTIONS=0' ])
1902
1911
self .btest_exit ('emscripten_fs_api_browser2.c' , args = ['-sASSERTIONS=1' ])
1903
1912
1904
- @parameterized ({
1905
- '' : ([],),
1906
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sEXIT_RUNTIME' ],),
1907
- })
1908
- def test_emscripten_main_loop (self , args ):
1909
- self .btest_exit ('test_emscripten_main_loop.c' , args = args )
1913
+ @also_with_proxy_to_pthread
1914
+ def test_emscripten_main_loop (self ):
1915
+ self .btest_exit ('test_emscripten_main_loop.c' )
1910
1916
1911
- @parameterized ({
1912
- '' : ([],),
1913
- # test pthreads + AUTO_JS_LIBRARIES mode as well
1914
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sAUTO_JS_LIBRARIES=0' ],),
1915
- })
1916
- def test_emscripten_main_loop_settimeout (self , args ):
1917
- self .btest_exit ('test_emscripten_main_loop_settimeout.c' , args = args )
1917
+ @also_with_proxy_to_pthread
1918
+ def test_emscripten_main_loop_settimeout (self ):
1919
+ self .btest_exit ('test_emscripten_main_loop_settimeout.c' , args = ['-sAUTO_JS_LIBRARIES=0' ])
1918
1920
1919
- @parameterized ({
1920
- '' : ([],),
1921
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' ],),
1922
- })
1923
- def test_emscripten_main_loop_and_blocker (self , args ):
1924
- self .btest_exit ('test_emscripten_main_loop_and_blocker.c' , args = args )
1921
+ @also_with_proxy_to_pthread
1922
+ def test_emscripten_main_loop_and_blocker (self ):
1923
+ self .btest_exit ('test_emscripten_main_loop_and_blocker.c' )
1925
1924
1926
1925
def test_emscripten_main_loop_and_blocker_exit (self ):
1927
1926
# Same as above but tests that EXIT_RUNTIME works with emscripten_main_loop. The
@@ -1977,13 +1976,10 @@ def test_sdl_glshader2(self):
1977
1976
def test_gl_glteximage (self ):
1978
1977
self .btest ('gl_teximage.c' , '1' , args = ['-lGL' , '-lSDL' ])
1979
1978
1980
- @parameterized ({
1981
- '' : ([],),
1982
- 'pthreads' : (['-pthread' , '-sPROXY_TO_PTHREAD' , '-sOFFSCREEN_FRAMEBUFFER' ],),
1983
- })
1984
1979
@requires_graphics_hardware
1985
- def test_gl_textures (self , args ):
1986
- self .btest_exit ('gl_textures.c' , args = ['-lGL' , '-g' , '-sSTACK_SIZE=1MB' ] + args )
1980
+ @also_with_proxy_to_pthread
1981
+ def test_gl_textures (self ):
1982
+ self .btest_exit ('gl_textures.c' , args = ['-lGL' , '-g' , '-sSTACK_SIZE=1MB' , '-sOFFSCREEN_FRAMEBUFFER' ])
1987
1983
1988
1984
@requires_graphics_hardware
1989
1985
def test_gl_ps (self ):
@@ -2618,10 +2614,10 @@ def test_html5_core(self, opts):
2618
2614
self .emcc_args .append ('--pre-js=pre.js' )
2619
2615
self .btest_exit ('test_html5_core.c' , args = opts )
2620
2616
2617
+ @also_with_proxy_to_pthread
2621
2618
@parameterized ({
2622
2619
'' : ([],),
2623
2620
'closure' : (['-O2' , '-g1' , '--closure=1' ],),
2624
- 'pthread' : (['-pthread' , '-sPROXY_TO_PTHREAD' ],),
2625
2621
})
2626
2622
def test_html5_gamepad (self , args ):
2627
2623
self .btest_exit ('test_gamepad.c' , args = args )
@@ -4932,24 +4928,28 @@ def test_emscripten_request_animation_frame_loop(self):
4932
4928
def test_request_animation_frame (self ):
4933
4929
self .btest_exit ('test_request_animation_frame.c' )
4934
4930
4931
+ @also_with_proxy_to_pthread
4935
4932
def test_emscripten_set_timeout (self ):
4936
- self .btest_exit ('emscripten_set_timeout.c' , args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4933
+ self .btest_exit ('emscripten_set_timeout.c' )
4937
4934
4935
+ @also_with_proxy_to_pthread
4938
4936
def test_emscripten_set_timeout_loop (self ):
4939
- self .btest_exit ('emscripten_set_timeout_loop.c' , args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4937
+ self .btest_exit ('emscripten_set_timeout_loop.c' )
4940
4938
4941
4939
def test_emscripten_set_immediate (self ):
4942
4940
self .btest_exit ('emscripten_set_immediate.c' )
4943
4941
4944
4942
def test_emscripten_set_immediate_loop (self ):
4945
4943
self .btest_exit ('emscripten_set_immediate_loop.c' )
4946
4944
4945
+ @also_with_proxy_to_pthread
4947
4946
def test_emscripten_set_interval (self ):
4948
- self .btest_exit ('emscripten_set_interval.c' , args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4947
+ self .btest_exit ('emscripten_set_interval.c' )
4949
4948
4950
4949
# Test emscripten_performance_now() and emscripten_date_now()
4950
+ @also_with_proxy_to_pthread
4951
4951
def test_emscripten_performance_now (self ):
4952
- self .btest ('emscripten_performance_now.c' , '0' , args = [ '-pthread' , '-sPROXY_TO_PTHREAD' ] )
4952
+ self .btest_exit ('emscripten_performance_now.c' )
4953
4953
4954
4954
def test_embind_with_pthreads (self ):
4955
4955
self .btest_exit ('embind/test_pthreads.cpp' , args = ['-lembind' , '-pthread' , '-sPTHREAD_POOL_SIZE=2' ])
@@ -5021,12 +5021,9 @@ def test_minimal_runtime_loader_shell(self, args):
5021
5021
def test_minimal_runtime_hello_world (self , args ):
5022
5022
self .btest_exit ('small_hello_world.c' , args = args + ['-sMINIMAL_RUNTIME' ])
5023
5023
5024
- @parameterized ({
5025
- '' : ([],),
5026
- 'pthread' : (['-sPROXY_TO_PTHREAD' , '-pthread' ],)
5027
- })
5028
- def test_offset_converter (self , args ):
5029
- self .btest_exit ('test_offset_converter.c' , args = ['-sUSE_OFFSET_CONVERTER' , '-gsource-map' ] + args )
5024
+ @also_with_proxy_to_pthread
5025
+ def test_offset_converter (self ):
5026
+ self .btest_exit ('test_offset_converter.c' , args = ['-sUSE_OFFSET_CONVERTER' , '-gsource-map' ])
5030
5027
5031
5028
# Tests emscripten_unwind_to_js_event_loop() behavior
5032
5029
def test_emscripten_unwind_to_js_event_loop (self ):
0 commit comments