diff --git a/tests/benchmark_sse.py b/tests/benchmark_sse.py index 3f7ba8c28c9e3..4e4234b035ea6 100755 --- a/tests/benchmark_sse.py +++ b/tests/benchmark_sse.py @@ -46,7 +46,7 @@ def run_benchmark(benchmark_file, results_file, build_args): # Run emscripten build out_file = os.path.join(temp_dir, 'benchmark_sse_html.js') - cmd = [EMCC, benchmark_file, '-O3', '-s', 'TOTAL_MEMORY=536870912', '-o', out_file] + build_args + cmd = [EMCC, benchmark_file, '-O3', '-sTOTAL_MEMORY=536870912', '-o', out_file] + build_args print('Building Emscripten version of the benchmark:') print(' '.join(cmd)) run_process(cmd) diff --git a/tests/common.py b/tests/common.py index 0617cde783ac9..94521ae22c185 100644 --- a/tests/common.py +++ b/tests/common.py @@ -963,7 +963,7 @@ def _test_dylink_dso_needed(self, do_run): so = '.wasm' if self.is_wasm() else '.js' def ccshared(src, linkto=[]): - cmdv = [EMCC, src, '-o', shared.unsuffixed(src) + so, '-s', 'SIDE_MODULE'] + self.get_emcc_args() + cmdv = [EMCC, src, '-o', shared.unsuffixed(src) + so, '-sSIDE_MODULE'] + self.get_emcc_args() cmdv += linkto self.run_process(cmdv) @@ -1542,7 +1542,7 @@ def compile_btest(self, args, reporting=Reporting.FULL): # use REPORT_RESULT, and also adds a cpp file to be compiled alongside the testcase, which # contains the implementation of REPORT_RESULT (we can't just include that implementation in # the header as there may be multiple files being compiled here). - args += ['-s', 'IN_TEST_HARNESS'] + args += ['-sIN_TEST_HARNESS'] if reporting != Reporting.NONE: # For basic reporting we inject JS helper funtions to report result back to server. args += ['-DEMTEST_PORT_NUMBER=%d' % self.port, @@ -1589,7 +1589,7 @@ def btest(self, filename, expected=None, reference=None, expected = [str(i) for i in range(0, reference_slack + 1)] self.reftest(test_file(reference), manually_trigger=manually_trigger_reftest) if not manual_reference: - args += ['--pre-js', 'reftest.js', '-s', 'GL_TESTING'] + args += ['--pre-js', 'reftest.js', '-sGL_TESTING'] outfile = 'test.html' args += [filename, '-o', outfile] # print('all args:', args) @@ -1612,7 +1612,7 @@ def btest(self, filename, expected=None, reference=None, if 'WASM=0' not in original_args and (also_wasm2js or self.also_wasm2js): print('WASM=0') self.btest(filename, expected, reference, reference_slack, manual_reference, post_build, - original_args + ['-s', 'WASM=0'], message, also_proxied=False, timeout=timeout) + original_args + ['-sWASM=0'], message, also_proxied=False, timeout=timeout) if also_proxied: print('proxied...') @@ -1623,7 +1623,7 @@ def btest(self, filename, expected=None, reference=None, post_build = self.post_manual_reftest # run proxied self.btest(filename, expected, reference, reference_slack, manual_reference, post_build, - original_args + ['--proxy-to-worker', '-s', 'GL_TESTING'], message, timeout=timeout) + original_args + ['--proxy-to-worker', '-sGL_TESTING'], message, timeout=timeout) ################################################################################################### diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index 091b0f4f8bc30..a0edc4bf78e07 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -203,9 +203,9 @@ def build(self, parent, filename, args, shared_args, emcc_args, native_args, nat cmd = [ EMCC, filename, OPTIMIZATIONS, - '-s', 'INITIAL_MEMORY=256MB', - '-s', 'ENVIRONMENT=node,shell', - '-s', 'BENCHMARK=%d' % (1 if IGNORE_COMPILATION and not has_output_parser else 0), + '-sINITIAL_MEMORY=256MB', + '-sENVIRONMENT=node,shell', + '-sBENCHMARK=%d' % (1 if IGNORE_COMPILATION and not has_output_parser else 0), '-o', final ] + shared_args + LLVM_FEATURE_FLAGS if common.EMTEST_FORCE64: @@ -216,7 +216,7 @@ def build(self, parent, filename, args, shared_args, emcc_args, native_args, nat # above, such as minimal runtime cmd += emcc_args + self.extra_args if 'FORCE_FILESYSTEM' not in cmd: - cmd += ['-s', 'FILESYSTEM=0'] + cmd += ['-sFILESYSTEM=0'] if PROFILING: cmd += ['--profiling-funcs'] self.cmd = cmd @@ -253,9 +253,9 @@ def build(self, parent, filename, args, shared_args, emcc_args, native_args, nat # wasm2c doesn't want minimal runtime which the normal emscripten # benchmarker defaults to, as we don't have any JS anyhow emcc_args = emcc_args + [ - '-s', 'STANDALONE_WASM', - '-s', 'MINIMAL_RUNTIME=0', - '-s', 'WASM2C' + '-sSTANDALONE_WASM', + '-sMINIMAL_RUNTIME=0', + '-sWASM2C' ] global LLVM_FEATURE_FLAGS @@ -971,7 +971,7 @@ def lib_builder(name, native, env_init): self.do_benchmark('lua_' + benchmark, '', expected, force_c=True, args=[benchmark + '.lua', DEFAULT_ARG], - emcc_args=['--embed-file', benchmark + '.lua', '-s', 'FORCE_FILESYSTEM', '-s', 'MINIMAL_RUNTIME=0'], # not minimal because of files + emcc_args=['--embed-file', benchmark + '.lua', '-sFORCE_FILESYSTEM', '-sMINIMAL_RUNTIME=0'], # not minimal because of files lib_builder=lib_builder, native_exec=os.path.join('building', 'third_party', 'lua_native', 'src', 'lua'), output_parser=output_parser, args_processor=args_processor) @@ -1048,7 +1048,7 @@ def lib_builder(name, native, env_init): def test_zzz_sqlite(self): src = read_file(test_file('third_party/sqlite/sqlite3.c')) + read_file(test_file('sqlite/speedtest1.c')) self.do_benchmark('sqlite', src, 'TOTAL...', native_args=['-ldl', '-pthread'], shared_args=['-I' + test_file('third_party', 'sqlite')], - emcc_args=['-s', 'FILESYSTEM', '-s', 'MINIMAL_RUNTIME=0'], # not minimal because of files + emcc_args=['-sFILESYSTEM', '-sMINIMAL_RUNTIME=0'], # not minimal because of files force_c=True) def test_zzz_poppler(self): @@ -1097,7 +1097,7 @@ def lib_builder(name, native, env_init): # TODO: Fix poppler native build and remove skip_native=True self.do_benchmark('poppler', '', 'hashed printout', shared_args=['-I' + test_file('poppler', 'include'), '-I' + test_file('freetype', 'include')], - emcc_args=['-s', 'FILESYSTEM', '--pre-js', 'pre.js', '--embed-file', - test_file('poppler', 'emscripten_html5.pdf') + '@input.pdf', '-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0', - '-s', 'MINIMAL_RUNTIME=0'], # not minimal because of files + emcc_args=['-sFILESYSTEM', '--pre-js', 'pre.js', '--embed-file', + test_file('poppler', 'emscripten_html5.pdf') + '@input.pdf', '-sERROR_ON_UNDEFINED_SYMBOLS=0', + '-sMINIMAL_RUNTIME=0'], # not minimal because of files lib_builder=lib_builder, skip_native=True) diff --git a/tests/test_browser.py b/tests/test_browser.py index 12d4c669e1a86..945f3ccf57cf2 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -213,10 +213,10 @@ def test_sdl1_in_emscripten_nonstrict_mode(self): def test_sdl1(self): self.btest('hello_world_sdl.cpp', reference='htmltest.png', args=['-lSDL', '-lGL']) - self.btest('hello_world_sdl.cpp', reference='htmltest.png', args=['-s', 'USE_SDL', '-lGL']) # is the default anyhow + self.btest('hello_world_sdl.cpp', reference='htmltest.png', args=['-sUSE_SDL', '-lGL']) # is the default anyhow def test_sdl1_es6(self): - self.btest('hello_world_sdl.cpp', reference='htmltest.png', args=['-s', 'USE_SDL', '-lGL', '-s', 'EXPORT_ES6']) + self.btest('hello_world_sdl.cpp', reference='htmltest.png', args=['-sUSE_SDL', '-lGL', '-sEXPORT_ES6']) # Deliberately named as test_zzz_* to make this test the last one # as this test may take the focus away from the main test window @@ -467,7 +467,7 @@ def test_output_file_escaping(self): self.run_process([FILE_PACKAGER, data_file, '--use-preload-cache', '--indexedDB-name=testdb', '--preload', abs_txt + '@' + txt, '--js-output=' + data_js_file]) page_file = os.path.join(d, 'file with ' + tricky_part + '.html') abs_page_file = os.path.abspath(page_file) - self.compile_btest([cpp, '--pre-js', data_js_file, '-o', abs_page_file, '-s', 'FORCE_FILESYSTEM'], reporting=Reporting.JS_ONLY) + self.compile_btest([cpp, '--pre-js', data_js_file, '-o', abs_page_file, '-sFORCE_FILESYSTEM'], reporting=Reporting.JS_ONLY) self.run_browser(page_file, '|load me right before|.', '/report_result?exit:0') @parameterized({ @@ -522,7 +522,7 @@ def test_preload_caching(self, extra_size): self.skipTest('chrome bug') create_file('somefile.txt', '''load me right before running the code please''' + ('_' * extra_size)) print('size:', os.path.getsize('somefile.txt')) - self.compile_btest(['main.c', '--use-preload-cache', '--js-library', 'test.js', '--preload-file', 'somefile.txt', '-o', 'page.html', '-s', 'ALLOW_MEMORY_GROWTH'], reporting=Reporting.JS_ONLY) + self.compile_btest(['main.c', '--use-preload-cache', '--js-library', 'test.js', '--preload-file', 'somefile.txt', '-o', 'page.html', '-sALLOW_MEMORY_GROWTH'], reporting=Reporting.JS_ONLY) self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?exit:0') self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?exit:1') @@ -572,7 +572,7 @@ def make_main(path): make_main('somefile.txt') self.run_process([FILE_PACKAGER, 'somefile.data', '--use-preload-cache', '--indexedDB-name=testdb', '--preload', 'somefile.txt', '--js-output=' + 'somefile.js']) - self.compile_btest(['main.c', '--js-library', 'test.js', '--pre-js', 'somefile.js', '-o', 'page.html', '-s', 'FORCE_FILESYSTEM'], reporting=Reporting.JS_ONLY) + self.compile_btest(['main.c', '--js-library', 'test.js', '--pre-js', 'somefile.js', '-o', 'page.html', '-sFORCE_FILESYSTEM'], reporting=Reporting.JS_ONLY) self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?exit:0') self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?exit:1') @@ -763,7 +763,7 @@ def test_sdl_image_prepare(self): # add testing for closure on preloaded files + ENVIRONMENT=web (we must not # emit any node.js code here, see # https://github.com/emscripten-core/emscripten/issues/14486 - 'closure_webonly': (['--closure', '1', '-s', 'ENVIRONMENT=web'],) + 'closure_webonly': (['--closure', '1', '-sENVIRONMENT=web'],) }) def test_sdl_image_prepare_data(self, args): # load an image file, get pixel data. @@ -778,46 +778,46 @@ def test_sdl_image_must_prepare(self): def test_sdl_stb_image(self): # load an image file, get pixel data. shutil.copyfile(test_file('screenshot.jpg'), 'screenshot.not') - self.btest('sdl_stb_image.c', reference='screenshot.jpg', args=['-s', 'STB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) + self.btest('sdl_stb_image.c', reference='screenshot.jpg', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) def test_sdl_stb_image_bpp(self): # load grayscale image without alpha self.clear() shutil.copyfile(test_file('sdl-stb-bpp1.png'), 'screenshot.not') - self.btest('sdl_stb_image.c', reference='sdl-stb-bpp1.png', args=['-s', 'STB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) + self.btest('sdl_stb_image.c', reference='sdl-stb-bpp1.png', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) # load grayscale image with alpha self.clear() shutil.copyfile(test_file('sdl-stb-bpp2.png'), 'screenshot.not') - self.btest('sdl_stb_image.c', reference='sdl-stb-bpp2.png', args=['-s', 'STB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) + self.btest('sdl_stb_image.c', reference='sdl-stb-bpp2.png', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) # load RGB image self.clear() shutil.copyfile(test_file('sdl-stb-bpp3.png'), 'screenshot.not') - self.btest('sdl_stb_image.c', reference='sdl-stb-bpp3.png', args=['-s', 'STB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) + self.btest('sdl_stb_image.c', reference='sdl-stb-bpp3.png', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) # load RGBA image self.clear() shutil.copyfile(test_file('sdl-stb-bpp4.png'), 'screenshot.not') - self.btest('sdl_stb_image.c', reference='sdl-stb-bpp4.png', args=['-s', 'STB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) + self.btest('sdl_stb_image.c', reference='sdl-stb-bpp4.png', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) def test_sdl_stb_image_data(self): # load an image file, get pixel data. shutil.copyfile(test_file('screenshot.jpg'), 'screenshot.not') - self.btest('sdl_stb_image_data.c', reference='screenshot.jpg', args=['-s', 'STB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) + self.btest('sdl_stb_image_data.c', reference='screenshot.jpg', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL']) def test_sdl_stb_image_cleanup(self): shutil.copyfile(test_file('screenshot.jpg'), 'screenshot.not') - self.btest_exit('sdl_stb_image_cleanup.c', args=['-s', 'STB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL', '--memoryprofiler']) + self.btest_exit('sdl_stb_image_cleanup.c', args=['-sSTB_IMAGE', '--preload-file', 'screenshot.not', '-lSDL', '-lGL', '--memoryprofiler']) def test_sdl_canvas(self): self.clear() - self.btest_exit('sdl_canvas.c', args=['-s', 'LEGACY_GL_EMULATION', '-lSDL', '-lGL']) + self.btest_exit('sdl_canvas.c', args=['-sLEGACY_GL_EMULATION', '-lSDL', '-lGL']) # some extra coverage self.clear() - self.btest_exit('sdl_canvas.c', args=['-s', 'LEGACY_GL_EMULATION', '-O0', '-s', 'SAFE_HEAP', '-lSDL', '-lGL']) + self.btest_exit('sdl_canvas.c', args=['-sLEGACY_GL_EMULATION', '-O0', '-sSAFE_HEAP', '-lSDL', '-lGL']) self.clear() - self.btest_exit('sdl_canvas.c', args=['-s', 'LEGACY_GL_EMULATION', '-O2', '-s', 'SAFE_HEAP', '-lSDL', '-lGL']) + self.btest_exit('sdl_canvas.c', args=['-sLEGACY_GL_EMULATION', '-O2', '-sSAFE_HEAP', '-lSDL', '-lGL']) def post_manual_reftest(self, reference=None): self.reftest(test_file(self.reference if reference is None else reference)) @@ -847,7 +847,7 @@ def test_sdl_canvas_proxy(self): @requires_graphics_hardware def test_glgears_proxy_jstarget(self): # test .js target with --proxy-worker; emits 2 js files, client and worker - self.compile_btest([test_file('hello_world_gles_proxy.c'), '-o', 'test.js', '--proxy-to-worker', '-s', 'GL_TESTING', '-lGL', '-lglut']) + self.compile_btest([test_file('hello_world_gles_proxy.c'), '-o', 'test.js', '--proxy-to-worker', '-sGL_TESTING', '-lGL', '-lglut']) shell_with_script('shell_minimal.html', 'test.html', '') self.post_manual_reftest('gears.png') self.run_browser('test.html', None, '/report_result?0') @@ -870,7 +870,7 @@ def test_sdl_key(self): ]: for async_ in [ [], - ['-DTEST_SLEEP', '-s', 'ASSERTIONS', '-s', 'SAFE_HEAP', '-s', 'ASYNCIFY'] + ['-DTEST_SLEEP', '-sASSERTIONS', '-sSAFE_HEAP', '-sASYNCIFY'] ]: print(delay, defines, async_) @@ -889,7 +889,7 @@ def test_sdl_key(self): %s } ''' % ('setTimeout(function() {' if delay else '', '}, 1);' if delay else '', 'setTimeout(function() {' if delay else '', '}, 1);' if delay else '')) - self.compile_btest([test_file('sdl_key.c'), '-o', 'page.html'] + defines + async_ + ['--pre-js', 'pre.js', '-s', 'EXPORTED_FUNCTIONS=_main', '-lSDL', '-lGL']) + self.compile_btest([test_file('sdl_key.c'), '-o', 'page.html'] + defines + async_ + ['--pre-js', 'pre.js', '-sEXPORTED_FUNCTIONS=_main', '-lSDL', '-lGL']) self.run_browser('page.html', '', '/report_result?223092870') def test_sdl_key_proxy(self): @@ -930,7 +930,7 @@ def post(): ''') create_file('test.html', html) - self.btest('sdl_key_proxy.c', '223092870', args=['--proxy-to-worker', '--pre-js', 'pre.js', '-s', 'EXPORTED_FUNCTIONS=_main,_one', '-lSDL', '-lGL'], manual_reference=True, post_build=post) + self.btest('sdl_key_proxy.c', '223092870', args=['--proxy-to-worker', '--pre-js', 'pre.js', '-sEXPORTED_FUNCTIONS=_main,_one', '-lSDL', '-lGL'], manual_reference=True, post_build=post) def test_canvas_focus(self): self.btest_exit('canvas_focus.c') @@ -980,7 +980,7 @@ def post(): create_file('test.html', html) - self.btest('keydown_preventdefault_proxy.cpp', '300', args=['--proxy-to-worker', '-s', 'EXPORTED_FUNCTIONS=_main'], manual_reference=True, post_build=post) + self.btest('keydown_preventdefault_proxy.cpp', '300', args=['--proxy-to-worker', '-sEXPORTED_FUNCTIONS=_main'], manual_reference=True, post_build=post) def test_sdl_text(self): create_file('pre.js', ''' @@ -998,7 +998,7 @@ def test_sdl_text(self): } ''') - self.compile_btest([test_file('sdl_text.c'), '-o', 'page.html', '--pre-js', 'pre.js', '-s', 'EXPORTED_FUNCTIONS=_main,_one', '-lSDL', '-lGL']) + self.compile_btest([test_file('sdl_text.c'), '-o', 'page.html', '--pre-js', 'pre.js', '-sEXPORTED_FUNCTIONS=_main,_one', '-lSDL', '-lGL']) self.run_browser('page.html', '', '/report_result?1') def test_sdl_mouse(self): @@ -1242,7 +1242,7 @@ def test_glfw_joystick(self): }; ''') - self.btest_exit(test_file('test_glfw_joystick.c'), args=['-O2', '--minify=0', '-o', 'page.html', '--pre-js', 'pre.js', '-lGL', '-lglfw3', '-s', 'USE_GLFW=3']) + self.btest_exit(test_file('test_glfw_joystick.c'), args=['-O2', '--minify=0', '-o', 'page.html', '--pre-js', 'pre.js', '-lGL', '-lglfw3', '-sUSE_GLFW=3']) @requires_graphics_hardware def test_webgl_context_attributes(self): @@ -1286,7 +1286,7 @@ def test_webgl_context_attributes(self): # perform tests with attributes activated self.btest_exit('test_webgl_context_attributes_glut.c', args=['--js-library', 'check_webgl_attributes_support.js', '-DAA_ACTIVATED', '-DDEPTH_ACTIVATED', '-DSTENCIL_ACTIVATED', '-DALPHA_ACTIVATED', '-lGL', '-lglut', '-lGLEW']) self.btest_exit('test_webgl_context_attributes_sdl.c', args=['--js-library', 'check_webgl_attributes_support.js', '-DAA_ACTIVATED', '-DDEPTH_ACTIVATED', '-DSTENCIL_ACTIVATED', '-DALPHA_ACTIVATED', '-lGL', '-lSDL', '-lGLEW']) - self.btest_exit('test_webgl_context_attributes_sdl2.c', args=['--js-library', 'check_webgl_attributes_support.js', '-DAA_ACTIVATED', '-DDEPTH_ACTIVATED', '-DSTENCIL_ACTIVATED', '-DALPHA_ACTIVATED', '-lGL', '-s', 'USE_SDL=2', '-lGLEW']) + self.btest_exit('test_webgl_context_attributes_sdl2.c', args=['--js-library', 'check_webgl_attributes_support.js', '-DAA_ACTIVATED', '-DDEPTH_ACTIVATED', '-DSTENCIL_ACTIVATED', '-DALPHA_ACTIVATED', '-lGL', '-sUSE_SDL=2', '-lGLEW']) self.btest_exit('test_webgl_context_attributes_glfw.c', args=['--js-library', 'check_webgl_attributes_support.js', '-DAA_ACTIVATED', '-DDEPTH_ACTIVATED', '-DSTENCIL_ACTIVATED', '-DALPHA_ACTIVATED', '-lGL', '-lglfw', '-lGLEW']) # perform tests with attributes desactivated @@ -1304,38 +1304,38 @@ def test_webgl_parallel_shader_compile(self): @requires_graphics_hardware def test_webgl_explicit_uniform_location(self): - self.btest_exit('webgl_explicit_uniform_location.c', args=['-s', 'GL_EXPLICIT_UNIFORM_LOCATION=1', '-s', 'MIN_WEBGL_VERSION=2']) + self.btest_exit('webgl_explicit_uniform_location.c', args=['-sGL_EXPLICIT_UNIFORM_LOCATION=1', '-sMIN_WEBGL_VERSION=2']) @requires_graphics_hardware def test_webgl_sampler_layout_binding(self): - self.btest_exit('webgl_sampler_layout_binding.c', args=['-s', 'GL_EXPLICIT_UNIFORM_BINDING=1']) + self.btest_exit('webgl_sampler_layout_binding.c', args=['-sGL_EXPLICIT_UNIFORM_BINDING=1']) @requires_graphics_hardware def test_webgl2_ubo_layout_binding(self): - self.btest_exit('webgl2_ubo_layout_binding.c', args=['-s', 'GL_EXPLICIT_UNIFORM_BINDING=1', '-s', 'MIN_WEBGL_VERSION=2']) + self.btest_exit('webgl2_ubo_layout_binding.c', args=['-sGL_EXPLICIT_UNIFORM_BINDING=1', '-sMIN_WEBGL_VERSION=2']) # Test that -s GL_PREINITIALIZED_CONTEXT=1 works and allows user to set Module['preinitializedWebGLContext'] to a preinitialized WebGL context. @requires_graphics_hardware def test_preinitialized_webgl_context(self): - self.btest_exit('preinitialized_webgl_context.cpp', args=['-s', 'GL_PREINITIALIZED_CONTEXT', '--shell-file', test_file('preinitialized_webgl_context.html')]) + self.btest_exit('preinitialized_webgl_context.cpp', args=['-sGL_PREINITIALIZED_CONTEXT', '--shell-file', test_file('preinitialized_webgl_context.html')]) @requires_threads def test_emscripten_get_now(self): - for args in [[], ['-s', 'USE_PTHREADS'], ['-s', 'ENVIRONMENT=web', '-O2', '--closure=1']]: + for args in [[], ['-sUSE_PTHREADS'], ['-sENVIRONMENT=web', '-O2', '--closure=1']]: self.btest_exit('emscripten_get_now.cpp', args=args) def test_write_file_in_environment_web(self): - self.btest_exit('write_file.c', args=['-s', 'ENVIRONMENT=web', '-Os', '--closure=1']) + self.btest_exit('write_file.c', args=['-sENVIRONMENT=web', '-Os', '--closure=1']) def test_fflush(self): - self.btest('test_fflush.cpp', '0', args=['-s', 'EXIT_RUNTIME', '--shell-file', test_file('test_fflush.html')], reporting=Reporting.NONE) + self.btest('test_fflush.cpp', '0', args=['-sEXIT_RUNTIME', '--shell-file', test_file('test_fflush.html')], reporting=Reporting.NONE) def test_file_db(self): secret = str(time.time()) create_file('moar.txt', secret) self.btest('file_db.cpp', '1', args=['--preload-file', 'moar.txt', '-DFIRST']) shutil.copyfile('test.html', 'first.html') - self.btest('file_db.cpp', secret, args=['-s', 'FORCE_FILESYSTEM']) + self.btest('file_db.cpp', secret, args=['-sFORCE_FILESYSTEM']) shutil.copyfile('test.html', 'second.html') create_file('moar.txt', 'aliantha') self.btest('file_db.cpp', secret, args=['--preload-file', 'moar.txt']) # even with a file there, we load over it @@ -1344,13 +1344,13 @@ def test_file_db(self): def test_fs_idbfs_sync(self): for extra in [[], ['-DEXTRA_WORK']]: secret = str(time.time()) - self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DFIRST', '-DSECRET=\"' + secret + '\"', '-s', 'EXPORTED_FUNCTIONS=_main,_test,_success', '-lidbfs.js']) - self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DSECRET=\"' + secret + '\"', '-s', 'EXPORTED_FUNCTIONS=_main,_test,_success', '-lidbfs.js'] + extra) + self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DFIRST', '-DSECRET=\"' + secret + '\"', '-sEXPORTED_FUNCTIONS=_main,_test,_success', '-lidbfs.js']) + self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DSECRET=\"' + secret + '\"', '-sEXPORTED_FUNCTIONS=_main,_test,_success', '-lidbfs.js'] + extra) def test_fs_idbfs_sync_force_exit(self): secret = str(time.time()) - self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DFIRST', '-DSECRET=\"' + secret + '\"', '-s', 'EXPORTED_FUNCTIONS=_main,_test,_success', '-s', 'EXIT_RUNTIME', '-DFORCE_EXIT', '-lidbfs.js']) - self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DSECRET=\"' + secret + '\"', '-s', 'EXPORTED_FUNCTIONS=_main,_test,_success', '-s', 'EXIT_RUNTIME', '-DFORCE_EXIT', '-lidbfs.js']) + self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DFIRST', '-DSECRET=\"' + secret + '\"', '-sEXPORTED_FUNCTIONS=_main,_test,_success', '-sEXIT_RUNTIME', '-DFORCE_EXIT', '-lidbfs.js']) + self.btest(test_file('fs/test_idbfs_sync.c'), '1', args=['-lidbfs.js', '-DSECRET=\"' + secret + '\"', '-sEXPORTED_FUNCTIONS=_main,_test,_success', '-sEXIT_RUNTIME', '-DFORCE_EXIT', '-lidbfs.js']) def test_fs_idbfs_fsync(self): # sync from persisted state into memory before main() @@ -1367,13 +1367,13 @@ def test_fs_idbfs_fsync(self): }; ''') - args = ['--pre-js', 'pre.js', '-lidbfs.js', '-s', 'EXIT_RUNTIME', '-s', 'ASYNCIFY'] + args = ['--pre-js', 'pre.js', '-lidbfs.js', '-sEXIT_RUNTIME', '-sASYNCIFY'] secret = str(time.time()) - self.btest(test_file('fs/test_idbfs_fsync.c'), '1', args=args + ['-DFIRST', '-DSECRET=\"' + secret + '\"', '-s', 'EXPORTED_FUNCTIONS=_main,_success', '-lidbfs.js']) - self.btest(test_file('fs/test_idbfs_fsync.c'), '1', args=args + ['-DSECRET=\"' + secret + '\"', '-s', 'EXPORTED_FUNCTIONS=_main,_success', '-lidbfs.js']) + self.btest(test_file('fs/test_idbfs_fsync.c'), '1', args=args + ['-DFIRST', '-DSECRET=\"' + secret + '\"', '-sEXPORTED_FUNCTIONS=_main,_success', '-lidbfs.js']) + self.btest(test_file('fs/test_idbfs_fsync.c'), '1', args=args + ['-DSECRET=\"' + secret + '\"', '-sEXPORTED_FUNCTIONS=_main,_success', '-lidbfs.js']) def test_fs_memfs_fsync(self): - args = ['-s', 'ASYNCIFY', '-s', 'EXIT_RUNTIME'] + args = ['-sASYNCIFY', '-sEXIT_RUNTIME'] secret = str(time.time()) self.btest(test_file('fs/test_memfs_fsync.c'), '1', args=args + ['-DSECRET=\"' + secret + '\"']) @@ -1412,21 +1412,21 @@ def test_fs_lz4fs_package(self): # compress in emcc, -s LZ4=1 tells it to tell the file packager print('emcc-normal') - self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['-s', 'LZ4=1', '--preload-file', 'file1.txt', '--preload-file', 'subdir/file2.txt', '--preload-file', 'file3.txt']) + self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['-sLZ4=1', '--preload-file', 'file1.txt', '--preload-file', 'subdir/file2.txt', '--preload-file', 'file3.txt']) assert os.path.getsize('file1.txt') + os.path.getsize(Path('subdir/file2.txt')) + os.path.getsize('file3.txt') == 3 * 1024 * 128 * 10 + 1 assert os.path.getsize('test.data') < (3 * 1024 * 128 * 10) / 2 # over half is gone print(' emcc-opts') - self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['-s', 'LZ4=1', '--preload-file', 'file1.txt', '--preload-file', 'subdir/file2.txt', '--preload-file', 'file3.txt', '-O2']) + self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['-sLZ4=1', '--preload-file', 'file1.txt', '--preload-file', 'subdir/file2.txt', '--preload-file', 'file3.txt', '-O2']) # compress in the file packager, on the server. the client receives compressed data and can just use it. this is typical usage print('normal') out = subprocess.check_output([FILE_PACKAGER, 'files.data', '--preload', 'file1.txt', 'subdir/file2.txt', 'file3.txt', '--lz4']) open('files.js', 'wb').write(out) - self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['--pre-js', 'files.js', '-s', 'LZ4=1', '-s', 'FORCE_FILESYSTEM']) + self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['--pre-js', 'files.js', '-sLZ4=1', '-sFORCE_FILESYSTEM']) print(' opts') - self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['--pre-js', 'files.js', '-s', 'LZ4=1', '-s', 'FORCE_FILESYSTEM', '-O2']) + self.btest(Path('fs/test_lz4fs.cpp'), '2', args=['--pre-js', 'files.js', '-sLZ4=1', '-sFORCE_FILESYSTEM', '-O2']) print(' modularize') - self.compile_btest([test_file('fs/test_lz4fs.cpp'), '--pre-js', 'files.js', '-s', 'LZ4=1', '-s', 'FORCE_FILESYSTEM', '-s', 'MODULARIZE=1']) + self.compile_btest([test_file('fs/test_lz4fs.cpp'), '--pre-js', 'files.js', '-sLZ4=1', '-sFORCE_FILESYSTEM', '-sMODULARIZE=1']) create_file('a.html', ''' ') self.run_browser('test.html', None, '/report_result?0') self.assertExists('test.js') @@ -4922,7 +4922,7 @@ def test_single_file_worker_js(self): @requires_threads def test_pthreads_started_in_worker(self): self.set_setting('EXIT_RUNTIME') - self.compile_btest([test_file('pthread/test_pthread_atomics.cpp'), '-o', 'test.js', '-s', 'INITIAL_MEMORY=64MB', '-s', 'USE_PTHREADS', '-s', 'PTHREAD_POOL_SIZE=8'], reporting=Reporting.JS_ONLY) + self.compile_btest([test_file('pthread/test_pthread_atomics.cpp'), '-o', 'test.js', '-sINITIAL_MEMORY=64MB', '-sUSE_PTHREADS', '-sPTHREAD_POOL_SIZE=8'], reporting=Reporting.JS_ONLY) create_file('test.html', '''