1818from urllib .request import urlopen
1919
2020import common
21- from common import BrowserCore , RunnerCore , path_from_root , has_browser , Reporting , is_chrome , is_firefox , CHROMIUM_BASED_BROWSERS
21+ from common import BrowserCore , RunnerCore , path_from_root , has_browser , Reporting , is_chrome , is_firefox , is_safari , CHROMIUM_BASED_BROWSERS
2222from common import create_file , parameterized , ensure_dir , disabled , flaky , test_file , WEBIDL_BINDER
2323from common import read_file , EMRUN , no_wasm64 , no_2gb , no_4gb , copytree , skip_if , skip_if_simple
2424from common import requires_wasm2js , parameterize , find_browser_test_file , with_all_sjlj
@@ -40,7 +40,12 @@ def sendheaders(s, extra=None, length=None):
4040 s .send_header ("Content-Length" , str (length ))
4141 s .send_header ("Access-Control-Allow-Origin" , "http://localhost:%s" % port )
4242 s .send_header ('Cross-Origin-Resource-Policy' , 'cross-origin' )
43- s .send_header ('Cache-Control' , 'no-cache, no-store, must-revalidate' )
43+
44+ s .send_header ('Cache-Control' , 'no-cache, no-store, must-revalidate, private, max-age=0' )
45+ s .send_header ('Expires' , '0' )
46+ s .send_header ('Pragma' , 'no-cache' )
47+ s .send_header ('Vary' , '*' ) # Safari insists on caching if this header is not present in addition to the above
48+
4449 s .send_header ("Access-Control-Expose-Headers" , "Content-Length, Accept-Ranges" )
4550 s .send_header ("Content-type" , "application/octet-stream" )
4651 if support_byte_ranges :
@@ -142,6 +147,8 @@ def is_swiftshader(_):
142147
143148no_firefox = skip_if ('no_firefox' , lambda _ : is_firefox (), 'firefox is not supported' )
144149
150+ no_safari = skip_if ('no_safari' , lambda _ : is_safari (), 'safari is not supported' )
151+
145152
146153def is_jspi (args ):
147154 return '-sASYNCIFY=2' in args
@@ -2797,6 +2804,7 @@ def test_webgl2_pbo(self):
27972804 self .btest_exit ('webgl2_pbo.c' , cflags = ['-sMAX_WEBGL_VERSION=2' , '-lGL' ])
27982805
27992806 @no_firefox ('fails on CI likely due to GPU drivers there' )
2807+ @no_safari ('TODO: Fails with report_result?5' ) # Safari 17.6 (17618.3.11.11.7, 17618)
28002808 @requires_graphics_hardware
28012809 def test_webgl2_sokol_mipmap (self ):
28022810 self .reftest ('third_party/sokol/mipmap-emsc.c' , 'third_party/sokol/mipmap-emsc.png' ,
@@ -2955,6 +2963,7 @@ def test_sdl2_image_jpeg(self):
29552963 @also_with_wasmfs
29562964 @requires_graphics_hardware
29572965 @with_all_sjlj
2966+ @no_safari ('Test enables Wasm exceptions, so will not run in Safari 17.6 (17618.3.11.11.7, 17618)' ) # Safari 17.6 (17618.3.11.11.7, 17618)
29582967 def test_sdl2_image_formats (self ):
29592968 shutil .copy (test_file ('screenshot.png' ), '.' )
29602969 shutil .copy (test_file ('screenshot.jpg' ), '.' )
@@ -3356,6 +3365,7 @@ def test_async_returnvalue(self, args):
33563365 create_file ('filey.txt' , 'sync_tunnel\n sync_tunnel_bool\n ' )
33573366 self .btest ('test_async_returnvalue.c' , '0' , cflags = ['-sASSERTIONS' , '-sASYNCIFY' , '-sASYNCIFY_IGNORE_INDIRECT' , '--js-library' , test_file ('browser/test_async_returnvalue.js' )] + args )
33583367
3368+ @no_safari ('TODO: Never reports a result, so times out' ) # Safari 17.6 (17618.3.11.11.7, 17618)
33593369 def test_async_bad_list (self ):
33603370 self .btest ('test_async_bad_list.c' , '0' , cflags = ['-sASYNCIFY' , '-sASYNCIFY_ONLY=waka' , '--profiling' ])
33613371
@@ -3408,6 +3418,7 @@ def test_modularize(self, args, code, opts):
34083418 self .run_browser ('a.html' , '/report_result?0' )
34093419
34103420 @no_firefox ('source phase imports not implemented yet in firefox' )
3421+ @no_safari ('croaks on line "import source wasmModule from \' ./out.wasm\' ;"' ) # Safari 17.6 (17618.3.11.11.7, 17618)
34113422 def test_source_phase_imports (self ):
34123423 self .compile_btest ('browser_test_hello_world.c' , ['-sEXPORT_ES6' , '-sSOURCE_PHASE_IMPORTS' , '-Wno-experimental' , '-o' , 'out.mjs' ])
34133424 create_file ('a.html' , '''
@@ -3794,6 +3805,7 @@ def test_pthread_gcc_64bit_atomic_fetch_and_op(self):
37943805
37953806 # Test the old GCC atomic __sync_op_and_fetch builtin operations.
37963807 @also_with_wasm2js
3808+ @no_safari ('TODO: browser.test_pthread_gcc_atomic_op_and_fetch_wasm2js fails with "abort:Assertion failed: nand_and_fetch_data == -1"' ) # Safari 17.6 (17618.3.11.11.7, 17618)
37973809 def test_pthread_gcc_atomic_op_and_fetch (self ):
37983810 self .cflags += ['-Wno-sync-fetch-and-nand-semantics-changed' ]
37993811 self .btest_exit ('pthread/test_pthread_gcc_atomic_op_and_fetch.c' , cflags = ['-O3' , '-pthread' , '-sPTHREAD_POOL_SIZE=8' ])
@@ -3891,6 +3903,7 @@ def test_pthread_cleanup(self):
38913903 '' : ([],),
38923904 'spinlock' : (['-DSPINLOCK_TEST' ],),
38933905 })
3906+ @no_safari ('TODO: browser.test_pthread_mutex and browser.test_pthread_mutex_spinlock both hang Safari' ) # Safari 17.6 (17618.3.11.11.7, 17618)
38943907 def test_pthread_mutex (self , args ):
38953908 self .btest_exit ('pthread/test_pthread_mutex.c' , cflags = ['-O3' , '-pthread' , '-sPTHREAD_POOL_SIZE=8' ] + args )
38963909
@@ -4078,6 +4091,7 @@ def test_pthread_safe_stack(self):
40784091 'no_leak' : ['test_pthread_lsan_no_leak' , []],
40794092 })
40804093 @no_firefox ('https://github.com/emscripten-core/emscripten/issues/15978' )
4094+ @no_safari ('TODO: browser.test_pthread_lsan_leak fails with /report_result?0' ) # Safari 17.6 (17618.3.11.11.7, 17618)
40814095 def test_pthread_lsan (self , name , args ):
40824096 self .btest (Path ('pthread' , name + '.cpp' ), expected = '1' , cflags = ['-fsanitize=leak' , '-pthread' , '-sPROXY_TO_PTHREAD' , '--pre-js' , test_file ('pthread' , name + '.js' )] + args )
40834097
@@ -4089,6 +4103,7 @@ def test_pthread_lsan(self, name, args):
40894103 'leak' : ['test_pthread_lsan_leak' , ['-gsource-map' ]],
40904104 'no_leak' : ['test_pthread_lsan_no_leak' , []],
40914105 })
4106+ @no_safari ('TODO: browser.test_pthread_asan_leak fails with /report_result?0' ) # Safari 17.6 (17618.3.11.11.7, 17618)
40924107 def test_pthread_asan (self , name , args ):
40934108 self .btest (Path ('pthread' , name + '.cpp' ), expected = '1' , cflags = ['-fsanitize=address' , '-pthread' , '-sPROXY_TO_PTHREAD' , '--pre-js' , test_file ('pthread' , name + '.js' )] + args )
40944109
@@ -4102,6 +4117,7 @@ def test_pthread_asan_use_after_free(self):
41024117 @no_2gb ('ASAN + GLOBAL_BASE' )
41034118 @no_4gb ('ASAN + GLOBAL_BASE' )
41044119 @no_firefox ('https://github.com/emscripten-core/emscripten/issues/20006' )
4120+ @no_safari ('TODO: Hangs' ) # Safari Version 18.5 (20621.2.5.11.8)
41054121 @also_with_wasmfs
41064122 def test_pthread_asan_use_after_free_2 (self ):
41074123 # similiar to test_pthread_asan_use_after_free, but using a pool instead
@@ -4120,6 +4136,7 @@ def test_pthread_exit_process(self):
41204136 args += ['--pre-js' , test_file ('core/pthread/test_pthread_exit_runtime.pre.js' )]
41214137 self .btest ('core/pthread/test_pthread_exit_runtime.c' , expected = 'onExit status: 42' , cflags = args )
41224138
4139+ @no_safari ('TODO: Fails with report_result?unexpected: [object ErrorEvent]' ) # Safari 17.6 (17618.3.11.11.7, 17618)
41234140 def test_pthread_trap (self ):
41244141 create_file ('pre.js' , '''
41254142 if (typeof window === 'object' && window) {
@@ -5376,6 +5393,7 @@ def test_wasmfs_fetch_backend_threaded(self, args):
53765393 'jspi' : (['-Wno-experimental' , '-sASYNCIFY=2' ],),
53775394 'jspi_wasm_bigint' : (['-Wno-experimental' , '-sASYNCIFY=2' , '-sWASM_BIGINT' ],),
53785395 })
5396+ @no_safari ('TODO: Fails with abort:Assertion failed: err == 0' ) # Safari 17.6 (17618.3.11.11.7, 17618)
53795397 def test_wasmfs_opfs (self , args ):
53805398 if '-sASYNCIFY=2' in args :
53815399 self .require_jspi ()
@@ -5385,6 +5403,7 @@ def test_wasmfs_opfs(self, args):
53855403 self .btest_exit (test , cflags = args + ['-DWASMFS_RESUME' ])
53865404
53875405 @no_firefox ('no OPFS support yet' )
5406+ @no_safari ('TODO: Fails with exception:Did not get expected EIO when unlinking file' ) # Safari 17.6 (17618.3.11.11.7, 17618)
53885407 def test_wasmfs_opfs_errors (self ):
53895408 test = test_file ('wasmfs/wasmfs_opfs_errors.c' )
53905409 postjs = test_file ('wasmfs/wasmfs_opfs_errors_post.js' )
@@ -5459,6 +5478,7 @@ def test_manual_pthread_proxy_hammer(self, args):
54595478 def test_assert_failure (self ):
54605479 self .btest ('test_assert_failure.c' , 'abort:Assertion failed: false && "this is a test"' )
54615480
5481+ @no_safari ('TODO: Fails with report_result?exception:rejected! / undefined' ) # Safari 17.6 (17618.3.11.11.7, 17618)
54625482 def test_pthread_unhandledrejection (self ):
54635483 # Check that an unhandled promise rejection is propagated to the main thread
54645484 # as an error. This test is failing if it hangs!
0 commit comments