Skip to content

Commit

Permalink
[test] Use modern list format for -s setting. NFC (#21280)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Feb 7, 2024
1 parent bbbbdb1 commit e5516dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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







19 changes: 9 additions & 10 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# found in the LICENSE file.

import argparse
import json
import multiprocessing
import os
import random
Expand Down Expand Up @@ -1712,7 +1711,7 @@ def test_chunked_synchronous_xhr(self):
<body>
Chunked XHR Web Worker Test
<script>
var worker = new Worker(""" + json.dumps(worker_filename) + r""");
var worker = new Worker("%s");
var buffer = [];
worker.onmessage = (event) => {
if (event.data.channel === "stdout") {
Expand All @@ -1738,7 +1737,7 @@ def test_chunked_synchronous_xhr(self):
</script>
</body>
</html>
""" % self.port)
""" % (worker_filename, self.port))

create_file('worker_prejs.js', r"""
Module.arguments = ["/bigfile"];
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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'
])

Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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({
'': ([],),
Expand Down
2 changes: 1 addition & 1 deletion test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]
Expand Down
2 changes: 1 addition & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e5516dd

Please sign in to comment.