From e5516dd092146ac4dc67eafca9780ebeae3f9e48 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 6 Feb 2024 18:33:22 -0800 Subject: [PATCH] [test] Use modern list format for `-s` setting. NFC (#21280) --- ...s-Virtual-XHR-Backed-File-System-Usage.rst | 9 +-------- test/test_browser.py | 19 +++++++++---------- test/test_core.py | 2 +- test/test_other.py | 2 +- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/site/source/docs/porting/files/Synchronous-Virtual-XHR-Backed-File-System-Usage.rst b/site/source/docs/porting/files/Synchronous-Virtual-XHR-Backed-File-System-Usage.rst index 5e3a75aad100..c8904f3f530e 100644 --- a/site/source/docs/porting/files/Synchronous-Virtual-XHR-Backed-File-System-Usage.rst +++ b/site/source/docs/porting/files/Synchronous-Virtual-XHR-Backed-File-System-Usage.rst @@ -64,12 +64,5 @@ Instructions .. include:: ../../../../../test/test_browser.py :literal: :start-after: create_file('main.html', - :end-before: """ % self.port) + :end-before: """ % (worker_filename, self.port)) :code: html - - - - - - - diff --git a/test/test_browser.py b/test/test_browser.py index 5e3f6e93bf8f..cf766bda1985 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -5,7 +5,6 @@ # found in the LICENSE file. import argparse -import json import multiprocessing import os import random @@ -1712,7 +1711,7 @@ def test_chunked_synchronous_xhr(self): Chunked XHR Web Worker Test - """ % self.port) + """ % (worker_filename, self.port)) create_file('worker_prejs.js', r""" Module.arguments = ["/bigfile"]; @@ -3020,12 +3019,12 @@ def test_sdl2_image_formats(self): self.btest_exit('test_sdl2_image.c', 512, args=[ '--preload-file', 'screenshot.png', '-DSCREENSHOT_DIRNAME="/"', '-DSCREENSHOT_BASENAME="screenshot.png"', '-DNO_PRELOADED', - '-sUSE_SDL=2', '-sUSE_SDL_IMAGE=2', '-sSDL2_IMAGE_FORMATS=["png"]' + '-sUSE_SDL=2', '-sUSE_SDL_IMAGE=2', '-sSDL2_IMAGE_FORMATS=png' ]) self.btest_exit('test_sdl2_image.c', 600, args=[ '--preload-file', 'screenshot.jpg', '-DSCREENSHOT_DIRNAME="/"', '-DSCREENSHOT_BASENAME="screenshot.jpg"', '-DBITSPERPIXEL=24', '-DNO_PRELOADED', - '-sUSE_SDL=2', '-sUSE_SDL_IMAGE=2', '-sSDL2_IMAGE_FORMATS=["jpg"]' + '-sUSE_SDL=2', '-sUSE_SDL_IMAGE=2', '-sSDL2_IMAGE_FORMATS=jpg' ]) @no_wasm64('SDL2 + wasm64') @@ -3423,11 +3422,11 @@ def test_sdl2_mixer_music(self, formats, flags, music_name): shutil.copyfile(test_file('sounds', music_name), music_name) self.btest_exit('test_sdl2_mixer_music.c', args=[ '--preload-file', music_name, - '-DSOUND_PATH=' + json.dumps(music_name), + '-DSOUND_PATH="%s"' % music_name, '-DFLAGS=' + flags, '-sUSE_SDL=2', '-sUSE_SDL_MIXER=2', - '-sSDL2_MIXER_FORMATS=' + json.dumps(formats), + '-sSDL2_MIXER_FORMATS=' + ','.join(formats), '-sINITIAL_MEMORY=33554432' ]) @@ -3510,7 +3509,7 @@ def test_async_iostream(self): # ASYNCIFY_IMPORTS. # To make the test more precise we also use ASYNCIFY_IGNORE_INDIRECT here. @parameterized({ - 'normal': (['-sASYNCIFY_IMPORTS=[sync_tunnel, sync_tunnel_bool]'],), # noqa + 'normal': (['-sASYNCIFY_IMPORTS=sync_tunnel,sync_tunnel_bool'],), # noqa 'pattern_imports': (['-sASYNCIFY_IMPORTS=[sync_tun*]'],), # noqa 'response': (['-sASYNCIFY_IMPORTS=@filey.txt'],), # noqa 'nothing': (['-DBAD'],), # noqa @@ -3523,7 +3522,7 @@ def test_async_returnvalue(self, args): self.btest('async_returnvalue.cpp', '0', args=['-sASYNCIFY', '-sASYNCIFY_IGNORE_INDIRECT', '--js-library', test_file('browser/async_returnvalue.js')] + args + ['-sASSERTIONS']) def test_async_bad_list(self): - self.btest('async_bad_list.cpp', '0', args=['-sASYNCIFY', '-sASYNCIFY_ONLY=[waka]', '--profiling']) + self.btest('async_bad_list.cpp', '0', args=['-sASYNCIFY', '-sASYNCIFY_ONLY=waka', '--profiling']) # Tests that when building with -sMINIMAL_RUNTIME, the build can use -sMODULARIZE as well. def test_minimal_runtime_modularize(self): @@ -4538,7 +4537,7 @@ def test_utf8_textdecoder(self): @also_with_threads def test_utf16_textdecoder(self): - self.btest_exit('benchmark/benchmark_utf16.cpp', 0, args=['--embed-file', test_file('utf16_corpus.txt') + '@/utf16_corpus.txt', '-sEXPORTED_RUNTIME_METHODS=[UTF16ToString,stringToUTF16,lengthBytesUTF16]']) + self.btest_exit('benchmark/benchmark_utf16.cpp', 0, args=['--embed-file', test_file('utf16_corpus.txt') + '@/utf16_corpus.txt', '-sEXPORTED_RUNTIME_METHODS=UTF16ToString,stringToUTF16,lengthBytesUTF16']) @parameterized({ '': ([],), diff --git a/test/test_core.py b/test/test_core.py index 89aab5d63203..52f9cc2f565c 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -9554,7 +9554,7 @@ def test_embind_lib_with_asyncify(self, args): self.emcc_args += [ '-lembind', '-sASYNCIFY', - '-sASYNCIFY_IMPORTS=["sleep_and_return"]', + '-sASYNCIFY_IMPORTS=sleep_and_return', '-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=$ASSERTIONS', '--post-js', test_file('core/embind_lib_with_asyncify.test.js'), ] diff --git a/test/test_other.py b/test/test_other.py index aba5e0e557c4..8b1387159e00 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -12319,7 +12319,7 @@ def test_split_module(self, customLoader, jspi): self.emcc_args += ['--pre-js', test_file('other/test_load_split_module.pre.js')] if jspi: self.require_jspi() - self.emcc_args += ['-g', '-sASYNCIFY_EXPORTS=[\'say_hello\']'] + self.emcc_args += ['-g', '-sASYNCIFY_EXPORTS=say_hello'] self.emcc_args += ['-sEXPORTED_FUNCTIONS=_malloc,_free'] output = self.do_other_test('test_split_module.c') if jspi: