@@ -1562,7 +1562,7 @@ def test_egl_width_height_with_proxy_to_pthread(self):
1562
1562
def test_egl_createcontext_error (self ):
1563
1563
self .btest ('test_egl_createcontext_error.c' , '1' , args = ['-lEGL' , '-lGL' ])
1564
1564
1565
- def do_test_worker (self , args = [] ):
1565
+ def test_worker (self ):
1566
1566
# Test running in a web worker
1567
1567
create_test_file ('file.dat' , 'data for worker' )
1568
1568
html_file = open ('main.html' , 'w' )
@@ -1585,14 +1585,12 @@ def do_test_worker(self, args=[]):
1585
1585
html_file .close ()
1586
1586
1587
1587
for file_data in [1 , 0 ]:
1588
- cmd = [EMCC , path_from_root ('tests' , 'hello_world_worker.cpp' ), '-o' , 'worker.js' ] + (['--preload-file' , 'file.dat' ] if file_data else []) + args
1588
+ cmd = [EMCC , path_from_root ('tests' , 'hello_world_worker.cpp' ), '-o' , 'worker.js' ] + (['--preload-file' , 'file.dat' ] if file_data else [])
1589
1589
print (cmd )
1590
1590
subprocess .check_call (cmd )
1591
1591
self .assertExists ('worker.js' )
1592
1592
self .run_browser ('main.html' , '' , '/report_result?hello from worker, and :' + ('data for w' if file_data else '' ) + ':' )
1593
1593
1594
- def test_worker (self ):
1595
- self .do_test_worker ()
1596
1594
self .assertContained ('you should not see this text when in a worker!' , self .run_js ('worker.js' )) # code should run standalone too
1597
1595
1598
1596
@no_firefox ('keeps sending OPTIONS requests, and eventually errors' )
@@ -2000,7 +1998,7 @@ def test_cubegeom_proc(self):
2000
1998
}
2001
1999
''' )
2002
2000
# also test -Os in wasm, which uses meta-dce, which should not break legacy gl emulation hacks
2003
- for opts in [[], ['-O1' ], ['-Os' , '-s' , 'WASM=1' ]]:
2001
+ for opts in [[], ['-O1' ], ['-Os' ]]:
2004
2002
self .btest ('cubegeom_proc.c' , reference = 'cubegeom.png' , args = opts + ['side.c' , '-s' , 'LEGACY_GL_EMULATION=1' , '-lGL' , '-lSDL' ])
2005
2003
2006
2004
@requires_graphics_hardware
@@ -2404,7 +2402,7 @@ def test_preload_module(self):
2404
2402
return 42;
2405
2403
}
2406
2404
''' )
2407
- self .compile_btest (['library.c' , '-s' , 'SIDE_MODULE=1' , '-O2' , '-o' , 'library.wasm' , '-s' , 'WASM=1' , '-s' , ' EXPORT_ALL=1' ])
2405
+ self .compile_btest (['library.c' , '-s' , 'SIDE_MODULE=1' , '-O2' , '-o' , 'library.wasm' , '-s' , 'EXPORT_ALL=1' ])
2408
2406
os .rename ('library.wasm' , 'library.so' )
2409
2407
main = r'''
2410
2408
#include <dlfcn.h>
@@ -2435,7 +2433,7 @@ def test_preload_module(self):
2435
2433
'''
2436
2434
self .btest (
2437
2435
main ,
2438
- args = ['-s' , 'MAIN_MODULE=1' , '--preload-file' , '.@/' , '-O2' , '-s' , 'WASM=1' , '- -use-preload-plugins' , '-s' , 'EXPORT_ALL=1' ],
2436
+ args = ['-s' , 'MAIN_MODULE=1' , '--preload-file' , '.@/' , '-O2' , '--use-preload-plugins' , '-s' , 'EXPORT_ALL=1' ],
2439
2437
expected = '0' )
2440
2438
2441
2439
def test_mmap_file (self ):
@@ -3349,7 +3347,7 @@ def test_modularize_network_error(self):
3349
3347
src = open (path_from_root ('tests' , 'browser_test_hello_world.c' )).read ()
3350
3348
create_test_file ('test.c' , src )
3351
3349
browser_reporting_js_path = path_from_root ('tests' , 'browser_reporting.js' )
3352
- self .compile_btest (['test.c' , '-s' , 'MODULARIZE=1' , '-s' , 'WASM=1' , '-s' , ' EXPORT_NAME="createModule"' , '--extern-pre-js' , browser_reporting_js_path ])
3350
+ self .compile_btest (['test.c' , '-s' , 'MODULARIZE=1' , '-s' , 'EXPORT_NAME="createModule"' , '--extern-pre-js' , browser_reporting_js_path ])
3353
3351
create_test_file ('a.html' , '''
3354
3352
<script src="a.out.js"></script>
3355
3353
<script>
@@ -3460,16 +3458,16 @@ def test_dynamic_link(self):
3460
3458
create_test_file ('pre.js' , '''
3461
3459
var Module = { dynamicLibraries: ['side.wasm'] };
3462
3460
''' )
3463
- self .run_process ([EMCC , 'side.cpp' , '-s' , 'SIDE_MODULE=1' , '-O2' , '-o' , 'side.wasm' , '-s' , 'WASM=1' , '-s' , ' EXPORT_ALL=1' ])
3464
- self .btest (self .in_dir ('main.cpp' ), '2' , args = ['-s' , 'MAIN_MODULE=1' , '-O2' , '--pre-js' , 'pre.js' , '-s' , 'WASM=1' , '- -proxy-to-worker' , '-s' , 'EXPORT_ALL=1' ])
3461
+ self .run_process ([EMCC , 'side.cpp' , '-s' , 'SIDE_MODULE=1' , '-O2' , '-o' , 'side.wasm' , '-s' , 'EXPORT_ALL=1' ])
3462
+ self .btest (self .in_dir ('main.cpp' ), '2' , args = ['-s' , 'MAIN_MODULE=1' , '-O2' , '--pre-js' , 'pre.js' , '--proxy-to-worker' , '-s' , 'EXPORT_ALL=1' ])
3465
3463
3466
3464
print ('wasm (will auto-preload since no sync binary reading)' )
3467
3465
3468
3466
create_test_file ('pre.js' , '''
3469
3467
Module.dynamicLibraries = ['side.wasm'];
3470
3468
''' )
3471
3469
# same wasm side module works
3472
- self .btest (self .in_dir ('main.cpp' ), '2' , args = ['-s' , 'MAIN_MODULE=1' , '-O2' , '--pre-js' , 'pre.js' , '-s' , 'WASM=1' , '-s' , ' EXPORT_ALL=1' ])
3470
+ self .btest (self .in_dir ('main.cpp' ), '2' , args = ['-s' , 'MAIN_MODULE=1' , '-O2' , '--pre-js' , 'pre.js' , '-s' , 'EXPORT_ALL=1' ])
3473
3471
3474
3472
# verify that dynamic linking works in all kinds of in-browser environments.
3475
3473
# don't mix different kinds in a single test.
@@ -4087,15 +4085,12 @@ def test_manual_wasm_instantiate(self):
4087
4085
shutil .copyfile (path_from_root ('tests' , 'manual_wasm_instantiate.html' ), 'manual_wasm_instantiate.html' )
4088
4086
self .run_browser ('manual_wasm_instantiate.html' , 'wasm instantiation succeeded' , '/report_result?1' )
4089
4087
4090
- def test_binaryen_worker (self ):
4091
- self .do_test_worker (['-s' , 'WASM=1' ])
4092
-
4093
4088
def test_wasm_locate_file (self ):
4094
4089
# Test that it is possible to define "Module.locateFile(foo)" function to locate where worker.js will be loaded from.
4095
4090
ensure_dir ('cdn' )
4096
4091
create_test_file ('shell2.html' , open (path_from_root ('src' , 'shell.html' )).read ().replace ('var Module = {' , 'var Module = { locateFile: function(filename) { if (filename == "test.wasm") return "cdn/test.wasm"; else return filename; }, ' ))
4097
4092
create_test_file ('src.cpp' , self .with_report_result (open (path_from_root ('tests' , 'browser_test_hello_world.c' )).read ()))
4098
- self .compile_btest (['src.cpp' , '--shell-file' , 'shell2.html' , '-s' , 'WASM=1' , '- o' , 'test.html' ])
4093
+ self .compile_btest (['src.cpp' , '--shell-file' , 'shell2.html' , '-o' , 'test.html' ])
4099
4094
shutil .move ('test.wasm' , os .path .join ('cdn' , 'test.wasm' ))
4100
4095
self .run_browser ('test.html' , '' , '/report_result?0' )
4101
4096
@@ -4526,7 +4521,6 @@ def test_load_js_from_blob_with_pthreads(self):
4526
4521
4527
4522
# Tests that base64 utils work in browser with no native atob function
4528
4523
def test_base64_atob_fallback (self ):
4529
- opts = ['-s' , 'SINGLE_FILE=1' , '-s' , 'WASM=1' ]
4530
4524
src = r'''
4531
4525
#include <stdio.h>
4532
4526
#include <emscripten.h>
@@ -4539,7 +4533,7 @@ def test_base64_atob_fallback(self):
4539
4533
# generate a dummy file
4540
4534
create_test_file ('dummy_file' , 'dummy' )
4541
4535
# compile the code with the modularize feature and the preload-file option enabled
4542
- self .compile_btest (['test.c' , '-s' , 'MODULARIZE=1' , '-s' , 'EXPORT_NAME="Foo"' , '--preload-file' , 'dummy_file' ] + opts )
4536
+ self .compile_btest (['test.c' , '-s' , 'MODULARIZE=1' , '-s' , 'EXPORT_NAME="Foo"' , '--preload-file' , 'dummy_file' , '-s' , 'SINGLE_FILE=1' ] )
4543
4537
create_test_file ('a.html' , '''
4544
4538
<script>
4545
4539
atob = undefined;
@@ -4554,7 +4548,7 @@ def test_base64_atob_fallback(self):
4554
4548
4555
4549
# Tests that SINGLE_FILE works as intended in generated HTML (with and without Worker)
4556
4550
def test_single_file_html (self ):
4557
- self .btest ('single_file_static_initializer.cpp' , '19' , args = ['-s' , 'SINGLE_FILE=1' , '-s' , 'WASM=1' ], also_proxied = True )
4551
+ self .btest ('single_file_static_initializer.cpp' , '19' , args = ['-s' , 'SINGLE_FILE=1' ], also_proxied = True )
4558
4552
self .assertExists ('test.html' )
4559
4553
self .assertNotExists ('test.js' )
4560
4554
self .assertNotExists ('test.worker.js' )
@@ -4585,8 +4579,8 @@ def test_single_file_locate_file(self):
4585
4579
for wasm_enabled in [True , False ]:
4586
4580
args = ['src.cpp' , '-o' , 'test.js' , '-s' , 'SINGLE_FILE=1' ]
4587
4581
4588
- if wasm_enabled :
4589
- args += ['-s' , 'WASM=1 ' ]
4582
+ if not wasm_enabled :
4583
+ args += ['-s' , 'WASM=0 ' ]
4590
4584
4591
4585
self .compile_btest (args )
4592
4586
@@ -4610,7 +4604,7 @@ def test_single_file_locate_file(self):
4610
4604
# Tests that SINGLE_FILE works as intended in a Worker in JS output
4611
4605
def test_single_file_worker_js (self ):
4612
4606
create_test_file ('src.cpp' , self .with_report_result (open (path_from_root ('tests' , 'browser_test_hello_world.c' )).read ()))
4613
- self .compile_btest (['src.cpp' , '-o' , 'test.js' , '--proxy-to-worker' , '-s' , 'SINGLE_FILE=1' , '-s' , 'WASM=1' ])
4607
+ self .compile_btest (['src.cpp' , '-o' , 'test.js' , '--proxy-to-worker' , '-s' , 'SINGLE_FILE=1' ])
4614
4608
create_test_file ('test.html' , '<script src="test.js"></script>' )
4615
4609
self .run_browser ('test.html' , None , '/report_result?0' )
4616
4610
self .assertExists ('test.js' )
@@ -4634,12 +4628,12 @@ def test_pthreads_started_in_worker(self):
4634
4628
def test_access_file_after_heap_resize (self ):
4635
4629
create_test_file ('test.txt' , 'hello from file' )
4636
4630
create_test_file ('page.c' , self .with_report_result (open (path_from_root ('tests' , 'access_file_after_heap_resize.c' ), 'r' ).read ()))
4637
- self .compile_btest (['page.c' , '-s' , 'WASM=1' , '-s' , ' ALLOW_MEMORY_GROWTH=1' , '--preload-file' , 'test.txt' , '-o' , 'page.html' ])
4631
+ self .compile_btest (['page.c' , '-s' , 'ALLOW_MEMORY_GROWTH=1' , '--preload-file' , 'test.txt' , '-o' , 'page.html' ])
4638
4632
self .run_browser ('page.html' , 'hello from file' , '/report_result?15' )
4639
4633
4640
4634
# with separate file packager invocation
4641
4635
self .run_process ([PYTHON , FILE_PACKAGER , 'data.js' , '--preload' , 'test.txt' , '--js-output=' + 'data.js' ])
4642
- self .compile_btest (['page.c' , '-s' , 'WASM=1' , '-s' , ' ALLOW_MEMORY_GROWTH=1' , '--pre-js' , 'data.js' , '-o' , 'page.html' , '-s' , 'FORCE_FILESYSTEM=1' ])
4636
+ self .compile_btest (['page.c' , '-s' , 'ALLOW_MEMORY_GROWTH=1' , '--pre-js' , 'data.js' , '-o' , 'page.html' , '-s' , 'FORCE_FILESYSTEM=1' ])
4643
4637
self .run_browser ('page.html' , 'hello from file' , '/report_result?15' )
4644
4638
4645
4639
def test_unicode_html_shell (self ):
0 commit comments