Skip to content

Commit c902bf9

Browse files
committed
[wasm64]: run simple sdl and egl tests also with wasm64
1 parent b9669d4 commit c902bf9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/test_browser.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,11 @@ def test():
766766
def test_dev_random(self):
767767
self.btest_exit(Path('filesystem/dev_random.cpp'))
768768

769+
@also_with_wasm64
769770
def test_sdl_swsurface(self):
770771
self.btest_exit('test_sdl_swsurface.c', args=['-lSDL', '-lGL'])
771772

773+
@also_with_wasm64
772774
def test_sdl_surface_lock_opts(self):
773775
# Test Emscripten-specific extensions to optimize SDL_LockSurface and SDL_UnlockSurface.
774776
self.btest('hello_world_sdl.cpp', reference='htmltest.png', args=['-DTEST_SDL_LOCK_OPTS', '-lSDL', '-lGL'])
@@ -854,6 +856,7 @@ def test_sdl_stb_image_cleanup(self):
854856
shutil.copyfile(test_file('screenshot.jpg'), 'screenshot.not')
855857
self.btest_exit('test_sdl_stb_image_cleanup.c', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL', '--memoryprofiler'])
856858

859+
@also_with_wasm64
857860
def test_sdl_canvas(self):
858861
self.btest_exit('test_sdl_canvas.c', args=['-sLEGACY_GL_EMULATION', '-lSDL', '-lGL'])
859862
# some extra coverage
@@ -882,6 +885,7 @@ def post_manual_reftest(self):
882885
</body>''' % read_file('reftest.js'))
883886
create_file('test.html', html)
884887

888+
@also_with_wasm64
885889
def test_sdl_canvas_proxy(self):
886890
create_file('data.txt', 'datum')
887891
self.btest('test_sdl_canvas_proxy.c', reference='browser/test_sdl_canvas_proxy.png', args=['--proxy-to-worker', '--preload-file', 'data.txt', '-lSDL', '-lGL'], manual_reference=True, post_build=self.post_manual_reftest)
@@ -895,6 +899,7 @@ def test_glgears_proxy_jstarget(self):
895899
self.post_manual_reftest()
896900
self.run_browser('test.html', '/report_result?0')
897901

902+
@also_with_wasm64
898903
def test_sdl_canvas_alpha(self):
899904
# N.B. On Linux with Intel integrated graphics cards, this test needs Firefox 49 or newer.
900905
# See https://github.com/emscripten-core/emscripten/issues/4069.
@@ -937,6 +942,7 @@ def test_sdl_key(self, delay):
937942
''' % ('setTimeout(function() {' if delay else '', '}, 1);' if delay else '', 'setTimeout(function() {' if delay else '', '}, 1);' if delay else ''))
938943
self.btest_exit('test_sdl_key.c', 223092870, args=defines + async_ + ['--pre-js=pre.js', '-lSDL', '-lGL'])
939944

945+
@also_with_wasm64
940946
def test_sdl_key_proxy(self):
941947
create_file('pre.js', '''
942948
Module.postRun = () => {
@@ -976,9 +982,11 @@ def post():
976982

977983
self.btest_exit('test_sdl_key_proxy.c', 223092870, args=['--proxy-to-worker', '--pre-js', 'pre.js', '-sEXPORTED_FUNCTIONS=_main,_one', '-lSDL', '-lGL'], post_build=post)
978984

985+
@also_with_wasm64
979986
def test_canvas_focus(self):
980987
self.btest_exit('canvas_focus.c')
981988

989+
@also_with_wasm64
982990
def test_keydown_preventdefault_proxy(self):
983991
def post():
984992
html = read_file('test.html')
@@ -1026,6 +1034,7 @@ def post():
10261034

10271035
self.btest('keydown_preventdefault_proxy.cpp', '300', args=['--proxy-to-worker', '-sEXPORTED_FUNCTIONS=_main'], post_build=post)
10281036

1037+
@also_with_wasm64
10291038
def test_sdl_text(self):
10301039
create_file('pre.js', '''
10311040
Module.postRun = () => {
@@ -1044,6 +1053,7 @@ def test_sdl_text(self):
10441053

10451054
self.btest_exit('test_sdl_text.c', args=['--pre-js', 'pre.js', '-lSDL', '-lGL'])
10461055

1056+
@also_with_wasm64
10471057
def test_sdl_mouse(self):
10481058
create_file('pre.js', '''
10491059
function simulateMouseEvent(x, y, button) {
@@ -1075,6 +1085,7 @@ def test_sdl_mouse(self):
10751085

10761086
self.btest_exit('test_sdl_mouse.c', args=['-O2', '--minify=0', '--pre-js', 'pre.js', '-lSDL', '-lGL'])
10771087

1088+
@also_with_wasm64
10781089
def test_sdl_mouse_offsets(self):
10791090
create_file('pre.js', '''
10801091
function simulateMouseEvent(x, y, button) {
@@ -1169,6 +1180,7 @@ def test_glut_glutget(self):
11691180
self.btest_exit('glut_glutget.c', args=['-lglut', '-lGL'])
11701181
self.btest_exit('glut_glutget.c', args=['-lglut', '-lGL', '-DAA_ACTIVATED', '-DDEPTH_ACTIVATED', '-DSTENCIL_ACTIVATED', '-DALPHA_ACTIVATED'])
11711182

1183+
@also_with_wasm64
11721184
def test_sdl_joystick_1(self):
11731185
# Generates events corresponding to the Working Draft of the HTML5 Gamepad API.
11741186
# http://www.w3.org/TR/2012/WD-gamepad-20120529/#gamepad-interface
@@ -1201,6 +1213,7 @@ def test_sdl_joystick_1(self):
12011213

12021214
self.btest_exit('test_sdl_joystick.c', args=['-O2', '--minify=0', '-o', 'page.html', '--pre-js', 'pre.js', '-lSDL', '-lGL'])
12031215

1216+
@also_with_wasm64
12041217
def test_sdl_joystick_2(self):
12051218
# Generates events corresponding to the Editor's Draft of the HTML5 Gamepad API.
12061219
# https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#idl-def-Gamepad
@@ -1533,6 +1546,7 @@ def test_idbstore_sync_worker(self):
15331546
def test_force_exit(self):
15341547
self.btest_exit('force_exit.c', assert_returncode=10)
15351548

1549+
@also_with_wasm64
15361550
def test_sdl_pumpevents(self):
15371551
# key events should be detected using SDL_PumpEvents
15381552
create_file('pre.js', '''
@@ -1543,20 +1557,24 @@ def test_sdl_pumpevents(self):
15431557
''')
15441558
self.btest_exit('test_sdl_pumpevents.c', assert_returncode=7, args=['--pre-js', 'pre.js', '-lSDL', '-lGL'])
15451559

1560+
@also_with_wasm64
15461561
def test_sdl_canvas_size(self):
15471562
self.btest_exit('test_sdl_canvas_size.c',
15481563
args=['-O2', '--minify=0', '--shell-file',
15491564
test_file('browser/test_sdl_canvas_size.html'), '-lSDL', '-lGL'])
15501565

1566+
@also_with_wasm64
15511567
@requires_graphics_hardware
15521568
def test_sdl_gl_read(self):
15531569
# SDL, OpenGL, readPixels
15541570
self.btest_exit('test_sdl_gl_read.c', args=['-lSDL', '-lGL'])
15551571

1572+
@also_with_wasm64
15561573
@requires_graphics_hardware
15571574
def test_sdl_gl_mapbuffers(self):
15581575
self.btest_exit('test_sdl_gl_mapbuffers.c', args=['-sFULL_ES3', '-lSDL', '-lGL'])
15591576

1577+
@also_with_wasm64
15601578
@requires_graphics_hardware
15611579
def test_sdl_ogl(self):
15621580
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
@@ -1569,49 +1587,57 @@ def test_sdl_ogl_regal(self):
15691587
self.btest('test_sdl_ogl.c', reference='screenshot-gray-purple.png', reference_slack=1,
15701588
args=['-O2', '--minify=0', '--preload-file', 'screenshot.png', '-sUSE_REGAL', '-DUSE_REGAL', '--use-preload-plugins', '-lSDL', '-lGL'])
15711589

1590+
@also_with_wasm64
15721591
@requires_graphics_hardware
15731592
def test_sdl_ogl_defaultmatrixmode(self):
15741593
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
15751594
self.btest('test_sdl_ogl_defaultMatrixMode.c', reference='screenshot-gray-purple.png', reference_slack=1,
15761595
args=['--minify=0', '--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '--use-preload-plugins', '-lSDL', '-lGL'])
15771596

1597+
@also_with_wasm64
15781598
@requires_graphics_hardware
15791599
def test_sdl_ogl_p(self):
15801600
# Immediate mode with pointers
15811601
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
15821602
self.btest('test_sdl_ogl_p.c', reference='screenshot-gray.png', reference_slack=1,
15831603
args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '--use-preload-plugins', '-lSDL', '-lGL'])
15841604

1605+
@also_with_wasm64
15851606
@requires_graphics_hardware
15861607
def test_sdl_ogl_proc_alias(self):
15871608
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
15881609
self.btest('test_sdl_ogl_proc_alias.c', reference='screenshot-gray-purple.png', reference_slack=1,
15891610
args=['-O2', '-g2', '-sINLINING_LIMIT', '--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '--use-preload-plugins', '-lSDL', '-lGL'])
15901611

1612+
@also_with_wasm64
15911613
@requires_graphics_hardware
15921614
def test_sdl_fog_simple(self):
15931615
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
15941616
self.btest('test_sdl_fog_simple.c', reference='screenshot-fog-simple.png',
15951617
args=['-O2', '--minify=0', '--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '--use-preload-plugins', '-lSDL', '-lGL'])
15961618

1619+
@also_with_wasm64
15971620
@requires_graphics_hardware
15981621
def test_sdl_fog_negative(self):
15991622
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
16001623
self.btest('test_sdl_fog_negative.c', reference='screenshot-fog-negative.png',
16011624
args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '--use-preload-plugins', '-lSDL', '-lGL'])
16021625

1626+
@also_with_wasm64
16031627
@requires_graphics_hardware
16041628
def test_sdl_fog_density(self):
16051629
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
16061630
self.btest('test_sdl_fog_density.c', reference='screenshot-fog-density.png',
16071631
args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '--use-preload-plugins', '-lSDL', '-lGL'])
16081632

1633+
@also_with_wasm64
16091634
@requires_graphics_hardware
16101635
def test_sdl_fog_exp2(self):
16111636
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
16121637
self.btest('test_sdl_fog_exp2.c', reference='screenshot-fog-exp2.png',
16131638
args=['--preload-file', 'screenshot.png', '-sLEGACY_GL_EMULATION', '--use-preload-plugins', '-lSDL', '-lGL'])
16141639

1640+
@also_with_wasm64
16151641
@requires_graphics_hardware
16161642
def test_sdl_fog_linear(self):
16171643
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
@@ -1637,6 +1663,7 @@ def test_glfw_time(self):
16371663
def _test_egl_base(self, *args):
16381664
self.btest_exit('test_egl.c', args=['-O2', '-lEGL', '-lGL'] + list(args))
16391665

1666+
@also_with_wasm64
16401667
@requires_graphics_hardware
16411668
def test_egl(self):
16421669
self._test_egl_base()
@@ -1649,13 +1676,16 @@ def test_egl_with_proxy_to_pthread(self):
16491676
def _test_egl_width_height_base(self, *args):
16501677
self.btest_exit('test_egl_width_height.c', args=['-O2', '-lEGL', '-lGL'] + list(args))
16511678

1679+
@also_with_wasm64
16521680
def test_egl_width_height(self):
16531681
self._test_egl_width_height_base()
16541682

1683+
# @also_with_wasm64 FIXME: LinkError: WebAssembly.instantiate(): cannot import memory32 as memory64
16551684
@requires_threads
16561685
def test_egl_width_height_with_proxy_to_pthread(self):
16571686
self._test_egl_width_height_base('-pthread', '-sPROXY_TO_PTHREAD')
16581687

1688+
@also_with_wasm64
16591689
@requires_graphics_hardware
16601690
def test_egl_createcontext_error(self):
16611691
self.btest_exit('test_egl_createcontext_error.c', args=['-lEGL', '-lGL'])
@@ -1779,6 +1809,7 @@ def test_chunked_synchronous_xhr(self):
17791809
if WINDOWS:
17801810
time.sleep(2)
17811811

1812+
@also_with_wasm64
17821813
@requires_graphics_hardware
17831814
def test_glgears(self, extra_args=[]): # noqa
17841815
self.btest('hello_world_gles.c', reference='gears.png', reference_slack=3,
@@ -1801,6 +1832,7 @@ def test_glgears_long(self, args):
18011832
args += ['-DHAVE_BUILTIN_SINCOS', '-DLONGTEST', '-lGL', '-lglut', '-DANIMATE']
18021833
self.btest('hello_world_gles.c', expected='0', args=args)
18031834

1835+
@also_with_wasm64
18041836
@requires_graphics_hardware
18051837
def test_glgears_animation(self):
18061838
for filename in ['hello_world_gles.c', 'hello_world_gles_full.c', 'hello_world_gles_full_944.c']:
@@ -1817,6 +1849,7 @@ def test_glgears_animation(self):
18171849
def test_fulles2_sdlproc(self):
18181850
self.btest_exit('full_es2_sdlproc.c', assert_returncode=1, args=['-sGL_TESTING', '-DHAVE_BUILTIN_SINCOS', '-sFULL_ES2', '-lGL', '-lSDL', '-lglut'])
18191851

1852+
@also_with_wasm64
18201853
@requires_graphics_hardware
18211854
def test_glgears_deriv(self):
18221855
self.btest('hello_world_gles_deriv.c', reference='gears.png', reference_slack=2,

0 commit comments

Comments
 (0)