23
23
from common import BrowserCore , RunnerCore , path_from_root , has_browser , EMTEST_BROWSER , Reporting
24
24
from common import create_file , parameterized , ensure_dir , disabled , test_file , WEBIDL_BINDER
25
25
from common import read_file , also_with_minimal_runtime , EMRUN , no_wasm64 , no_2gb , no_4gb
26
- from common import requires_wasm2js , also_with_wasm2js
26
+ from common import requires_wasm2js , also_with_wasm2js , parameterize
27
27
from tools import shared
28
28
from tools import ports
29
29
from tools import utils
@@ -78,6 +78,9 @@ def do_GET(s):
78
78
79
79
80
80
def also_with_wasmfs (f ):
81
+ assert callable (f )
82
+
83
+ @wraps (f )
81
84
def metafunc (self , wasmfs , * args , ** kwargs ):
82
85
if wasmfs :
83
86
self .set_setting ('WASMFS' )
@@ -86,9 +89,22 @@ def metafunc(self, wasmfs, *args, **kwargs):
86
89
else :
87
90
f (self , * args , ** kwargs )
88
91
89
- metafunc ._parameterize = {'' : (False ,),
90
- 'wasmfs' : (True ,)}
92
+ parameterize (metafunc , {'' : (False ,),
93
+ 'wasmfs' : (True ,)})
94
+
95
+ return metafunc
96
+
97
+
98
+ def also_with_proxying (f ):
99
+ assert callable (f )
100
+
101
+ @wraps (f )
102
+ def metafunc (self , proxied , * args , ** kwargs ):
103
+ self .proxied = proxied
104
+ f (self , * args , ** kwargs )
91
105
106
+ parameterize (metafunc , {'' : (False ,),
107
+ 'proxied' : (True ,)})
92
108
return metafunc
93
109
94
110
@@ -761,10 +777,11 @@ def test_sdl_image_jpeg(self):
761
777
])
762
778
763
779
@also_with_wasmfs
780
+ @also_with_proxying
764
781
def test_sdl_image_prepare (self ):
765
782
# load an image file, get pixel data.
766
783
shutil .copyfile (test_file ('screenshot.jpg' ), 'screenshot.not' )
767
- self .reftest ('test_sdl_image_prepare.c' , 'screenshot.jpg' , args = ['--preload-file' , 'screenshot.not' , '-lSDL' , '-lGL' ], also_proxied = True , manually_trigger_reftest = True )
784
+ self .reftest ('test_sdl_image_prepare.c' , 'screenshot.jpg' , args = ['--preload-file' , 'screenshot.not' , '-lSDL' , '-lGL' ], manually_trigger_reftest = True )
768
785
769
786
@parameterized ({
770
787
'' : ([],),
@@ -1957,8 +1974,9 @@ def test_sdl_glshader(self):
1957
1974
1958
1975
@no_wasm64 ('TODO: LEGACY_GL_EMULATION + wasm64' )
1959
1976
@requires_graphics_hardware
1977
+ @also_with_proxying
1960
1978
def test_sdl_glshader2 (self ):
1961
- self .btest_exit ('test_sdl_glshader2.c' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' , '-sGL_ENABLE_GET_PROC_ADDRESS' ], also_proxied = True )
1979
+ self .btest_exit ('test_sdl_glshader2.c' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' , '-sGL_ENABLE_GET_PROC_ADDRESS' ])
1962
1980
1963
1981
@requires_graphics_hardware
1964
1982
def test_gl_glteximage (self ):
@@ -1990,9 +2008,10 @@ def test_gl_ps_strides(self):
1990
2008
self .reftest ('gl_ps_strides.c' , 'gl_ps_strides.png' , args = ['--preload-file' , 'screenshot.png' , '-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' , '--use-preload-plugins' ])
1991
2009
1992
2010
@requires_graphics_hardware
2011
+ @also_with_proxying
1993
2012
def test_gl_ps_worker (self ):
1994
2013
shutil .copyfile (test_file ('screenshot.png' ), 'screenshot.png' )
1995
- self .reftest ('gl_ps_worker.c' , 'gl_ps.png' , args = ['--preload-file' , 'screenshot.png' , '-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' , '--use-preload-plugins' ], reference_slack = 1 , also_proxied = True )
2014
+ self .reftest ('gl_ps_worker.c' , 'gl_ps.png' , args = ['--preload-file' , 'screenshot.png' , '-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' , '--use-preload-plugins' ], reference_slack = 1 )
1996
2015
1997
2016
@requires_graphics_hardware
1998
2017
def test_gl_renderers (self ):
@@ -2013,8 +2032,9 @@ def test_gl_vertex_buffer(self):
2013
2032
self .reftest ('gl_vertex_buffer.c' , 'gl_vertex_buffer.png' , args = ['-sGL_UNSAFE_OPTS=0' , '-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ], reference_slack = 1 )
2014
2033
2015
2034
@requires_graphics_hardware
2035
+ @also_with_proxying
2016
2036
def test_gles2_uniform_arrays (self ):
2017
- self .btest ('gles2_uniform_arrays.cpp' , args = ['-sGL_ASSERTIONS' , '-lGL' , '-lSDL' ], expected = '1' , also_proxied = True )
2037
+ self .btest ('gles2_uniform_arrays.cpp' , args = ['-sGL_ASSERTIONS' , '-lGL' , '-lSDL' ], expected = '1' )
2018
2038
2019
2039
@requires_graphics_hardware
2020
2040
def test_gles2_conformance (self ):
@@ -2056,19 +2076,23 @@ def test_cubegeom_pre3(self):
2056
2076
'' : ([],),
2057
2077
'tracing' : (['-sTRACE_WEBGL_CALLS' ],),
2058
2078
})
2079
+ @also_with_proxying
2059
2080
@requires_graphics_hardware
2060
2081
def test_cubegeom (self , args ):
2061
- # proxy only in the simple, normal case (we can't trace GL calls when
2062
- # proxied)
2063
- self .reftest ('third_party/cubegeom/cubegeom.c' , 'third_party/cubegeom/cubegeom.png' , args = ['-O2' , '-g' , '-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ] + args , also_proxied = not args )
2082
+ if self .proxied and args :
2083
+ # proxy only in the simple, normal case (we can't trace GL calls when proxied)
2084
+ self .skipTest ('tracing + proxying not supported' )
2085
+ self .reftest ('third_party/cubegeom/cubegeom.c' , 'third_party/cubegeom/cubegeom.png' , args = ['-O2' , '-g' , '-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ] + args )
2064
2086
2065
2087
@requires_graphics_hardware
2088
+ @also_with_proxying
2066
2089
def test_cubegeom_regal (self ):
2067
- self .reftest ('third_party/cubegeom/cubegeom.c' , 'third_party/cubegeom/cubegeom.png' , args = ['-O2' , '-g' , '-DUSE_REGAL' , '-sUSE_REGAL' , '-lGL' , '-lSDL' , '-lc++' , '-lc++abi' ], also_proxied = True )
2090
+ self .reftest ('third_party/cubegeom/cubegeom.c' , 'third_party/cubegeom/cubegeom.png' , args = ['-O2' , '-g' , '-DUSE_REGAL' , '-sUSE_REGAL' , '-lGL' , '-lSDL' , '-lc++' , '-lc++abi' ])
2068
2091
2069
2092
@requires_graphics_hardware
2093
+ @also_with_proxying
2070
2094
def test_cubegeom_regal_mt (self ):
2071
- self .reftest ('third_party/cubegeom/cubegeom.c' , 'third_party/cubegeom/cubegeom.png' , args = ['-O2' , '-g' , '-pthread' , '-DUSE_REGAL' , '-pthread' , '-sUSE_REGAL' , '-lGL' , '-lSDL' , '-lc++' , '-lc++abi' ], also_proxied = False )
2095
+ self .reftest ('third_party/cubegeom/cubegeom.c' , 'third_party/cubegeom/cubegeom.png' , args = ['-O2' , '-g' , '-pthread' , '-DUSE_REGAL' , '-pthread' , '-sUSE_REGAL' , '-lGL' , '-lSDL' , '-lc++' , '-lc++abi' ])
2072
2096
2073
2097
@requires_graphics_hardware
2074
2098
@parameterized ({
@@ -2102,12 +2126,14 @@ def test_cubegeom_color(self):
2102
2126
self .reftest ('third_party/cubegeom/cubegeom_color.c' , 'third_party/cubegeom/cubegeom_color.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ])
2103
2127
2104
2128
@requires_graphics_hardware
2129
+ @also_with_proxying
2105
2130
def test_cubegeom_normal (self ):
2106
- self .reftest ('third_party/cubegeom/cubegeom_normal.c' , 'third_party/cubegeom/cubegeom_normal.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ], also_proxied = True )
2131
+ self .reftest ('third_party/cubegeom/cubegeom_normal.c' , 'third_party/cubegeom/cubegeom_normal.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ])
2107
2132
2108
2133
@requires_graphics_hardware
2134
+ @also_with_proxying
2109
2135
def test_cubegeom_normal_dap (self ): # draw is given a direct pointer to clientside memory, no element array buffer
2110
- self .reftest ('third_party/cubegeom/cubegeom_normal_dap.c' , 'third_party/cubegeom/cubegeom_normal.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ], also_proxied = True )
2136
+ self .reftest ('third_party/cubegeom/cubegeom_normal_dap.c' , 'third_party/cubegeom/cubegeom_normal.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ])
2111
2137
2112
2138
@requires_graphics_hardware
2113
2139
def test_cubegeom_normal_dap_far (self ): # indices do nto start from 0
@@ -2131,8 +2157,9 @@ def test_cubegeom_mt(self):
2131
2157
self .reftest ('third_party/cubegeom/cubegeom_mt.c' , 'third_party/cubegeom/cubegeom_mt.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ]) # multitexture
2132
2158
2133
2159
@requires_graphics_hardware
2160
+ @also_with_proxying
2134
2161
def test_cubegeom_color2 (self ):
2135
- self .reftest ('third_party/cubegeom/cubegeom_color2.c' , 'third_party/cubegeom/cubegeom_color2.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ], also_proxied = True )
2162
+ self .reftest ('third_party/cubegeom/cubegeom_color2.c' , 'third_party/cubegeom/cubegeom_color2.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ])
2136
2163
2137
2164
@requires_graphics_hardware
2138
2165
def test_cubegeom_texturematrix (self ):
@@ -2171,8 +2198,9 @@ def test_cubegeom_u4fv_2(self):
2171
2198
self .reftest ('third_party/cubegeom/cubegeom_u4fv_2.c' , 'third_party/cubegeom/cubegeom_u4fv_2.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ])
2172
2199
2173
2200
@requires_graphics_hardware
2201
+ @also_with_proxying
2174
2202
def test_cube_explosion (self ):
2175
- self .reftest ('cube_explosion.c' , 'cube_explosion.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ], also_proxied = True )
2203
+ self .reftest ('cube_explosion.c' , 'cube_explosion.png' , args = ['-sLEGACY_GL_EMULATION' , '-lGL' , '-lSDL' ])
2176
2204
2177
2205
@requires_graphics_hardware
2178
2206
def test_glgettexenv (self ):
@@ -3069,13 +3097,12 @@ def test_sdl2_threads(self):
3069
3097
self .btest_exit ('test_sdl2_threads.c' , args = ['-pthread' , '-sUSE_SDL=2' , '-sPROXY_TO_PTHREAD' ])
3070
3098
3071
3099
@requires_graphics_hardware
3072
- @parameterized ({
3073
- '' : ([], True ),
3074
- # fails on proxy
3075
- 'closure' : (['--closure=1' , '-g1' ], False ),
3076
- })
3077
- def test_sdl2_glshader (self , args , also_proxied ):
3078
- self .reftest ('test_sdl2_glshader.c' , 'test_sdl_glshader.png' , args = args + ['-sUSE_SDL=2' , '-O2' , '-sLEGACY_GL_EMULATION' ], also_proxied = also_proxied )
3100
+ @also_with_proxying
3101
+ def test_sdl2_glshader (self ):
3102
+ if not self .proxied :
3103
+ # closure build current fails on proxying
3104
+ self .emcc_args += ['--closure=1' , '-g1' ]
3105
+ self .reftest ('test_sdl2_glshader.c' , 'test_sdl_glshader.png' , args = ['-sUSE_SDL=2' , '-O2' , '-sLEGACY_GL_EMULATION' ])
3079
3106
3080
3107
@requires_graphics_hardware
3081
3108
def test_sdl2_canvas_blank (self ):
@@ -4781,8 +4808,9 @@ def test_load_js_from_blob_with_pthreads(self):
4781
4808
self .run_browser ('hello_thread_with_blob_url.html' , '/report_result?exit:0' )
4782
4809
4783
4810
# Tests that SINGLE_FILE works as intended in generated HTML (with and without Worker)
4811
+ @also_with_proxying
4784
4812
def test_single_file_html (self ):
4785
- self .btest ('single_file_static_initializer.cpp' , '19' , args = ['-sSINGLE_FILE' ], also_proxied = True )
4813
+ self .btest ('single_file_static_initializer.cpp' , '19' , args = ['-sSINGLE_FILE' ])
4786
4814
self .assertExists ('test.html' )
4787
4815
self .assertNotExists ('test.js' )
4788
4816
self .assertNotExists ('test.worker.js' )
@@ -4946,8 +4974,9 @@ def test_emscripten_request_animation_frame(self):
4946
4974
def test_emscripten_request_animation_frame_loop (self ):
4947
4975
self .btest_exit ('emscripten_request_animation_frame_loop.c' )
4948
4976
4977
+ @also_with_proxying
4949
4978
def test_request_animation_frame (self ):
4950
- self .btest_exit ('request_animation_frame.cpp' , also_proxied = True )
4979
+ self .btest_exit ('request_animation_frame.cpp' )
4951
4980
4952
4981
def test_emscripten_set_timeout (self ):
4953
4982
self .btest_exit ('emscripten_set_timeout.c' , args = ['-pthread' , '-sPROXY_TO_PTHREAD' ])
0 commit comments