Skip to content

Commit 9c93641

Browse files
authored
[test] Remove some unneeded -sINITIAL_MEMORY settings. NFC (#21295)
I think the reason a lot of these are no longer needed is because the default pthread stack size is less that it used to be.
1 parent 3bb85de commit 9c93641

File tree

1 file changed

+35
-37
lines changed

1 file changed

+35
-37
lines changed

test/test_browser.py

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ def test_idbstore_sync(self, asyncify):
15241524

15251525
def test_idbstore_sync_worker(self):
15261526
secret = str(time.time())
1527-
self.btest('test_idbstore_sync_worker.c', expected='0', args=['-lidbstore.js', f'-DSECRET="{secret}"', '-O3', '-g2', '--proxy-to-worker', '-sINITIAL_MEMORY=80MB', '-sASYNCIFY'])
1527+
self.btest('test_idbstore_sync_worker.c', expected='0', args=['-lidbstore.js', f'-DSECRET="{secret}"', '-O3', '-g2', '--proxy-to-worker', '-sASYNCIFY'])
15281528

15291529
def test_force_exit(self):
15301530
self.btest_exit('force_exit.c', assert_returncode=10)
@@ -2273,10 +2273,10 @@ def test_sdl_canvas_palette_2(self):
22732273
self.btest('test_sdl_canvas_palette_2.c', reference='browser/test_sdl_canvas_palette_b.png', args=['--pre-js', 'pre.js', '--pre-js', 'args-b.js', '-lSDL', '-lGL'])
22742274

22752275
def test_sdl_ttf_render_text_solid(self):
2276-
self.btest('test_sdl_ttf_render_text_solid.c', reference='browser/test_sdl_ttf_render_text_solid.png', args=['-O2', '-sINITIAL_MEMORY=16MB', '-lSDL', '-lGL'])
2276+
self.btest('test_sdl_ttf_render_text_solid.c', reference='browser/test_sdl_ttf_render_text_solid.png', args=['-O2', '-lSDL', '-lGL'])
22772277

22782278
def test_sdl_alloctext(self):
2279-
self.btest_exit('test_sdl_alloctext.c', args=['-sINITIAL_MEMORY=16MB', '-lSDL', '-lGL'])
2279+
self.btest_exit('test_sdl_alloctext.c', args=['-lSDL', '-lGL'])
22802280

22812281
def test_sdl_surface_refcount(self):
22822282
self.btest_exit('test_sdl_surface_refcount.c', args=['-lSDL'])
@@ -3240,7 +3240,7 @@ def test_sdl2_canvas_palette_2(self):
32403240

32413241
@no_wasm64('SDL2 + wasm64')
32423242
def test_sdl2_swsurface(self):
3243-
self.btest_exit('test_sdl2_swsurface.c', args=['-sUSE_SDL=2', '-sINITIAL_MEMORY=64MB'])
3243+
self.btest_exit('test_sdl2_swsurface.c', args=['-sUSE_SDL=2'])
32443244

32453245
@no_wasm64('SDL2 + wasm64')
32463246
@requires_graphics_hardware
@@ -3406,7 +3406,7 @@ def test_sdl2_misc_via_object(self):
34063406
@requires_sound_hardware
34073407
def test_sdl2_mixer_wav(self, flags):
34083408
shutil.copyfile(test_file('sounds/the_entertainer.wav'), 'sound.wav')
3409-
self.btest_exit('test_sdl2_mixer_wav.c', args=['--preload-file', 'sound.wav', '-sINITIAL_MEMORY=33554432'] + flags)
3409+
self.btest_exit('test_sdl2_mixer_wav.c', args=['--preload-file', 'sound.wav'] + flags)
34103410

34113411
@no_wasm64('SDL2 + wasm64')
34123412
@parameterized({
@@ -3427,7 +3427,6 @@ def test_sdl2_mixer_music(self, formats, flags, music_name):
34273427
'-sUSE_SDL=2',
34283428
'-sUSE_SDL_MIXER=2',
34293429
'-sSDL2_MIXER_FORMATS=' + ','.join(formats),
3430-
'-sINITIAL_MEMORY=33554432'
34313430
])
34323431

34333432
@requires_graphics_hardware
@@ -3907,7 +3906,7 @@ def test_pthread_in_pthread_pool_size_strict(self):
39073906
})
39083907
@requires_threads
39093908
def test_pthread_atomics(self, args):
3910-
self.btest_exit('pthread/test_pthread_atomics.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8', '-g1'] + args)
3909+
self.btest_exit('pthread/test_pthread_atomics.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8', '-g1'] + args)
39113910

39123911
# Test 64-bit atomics.
39133912
@requires_threads
@@ -3963,7 +3962,7 @@ def test_pthread_gcc_atomic_fetch_and_op(self):
39633962
for debug in [[], ['-g']]:
39643963
args = opt + debug
39653964
print(args)
3966-
self.btest_exit('pthread/test_pthread_gcc_atomic_fetch_and_op.cpp', args=args + ['-sINITIAL_MEMORY=64MB', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
3965+
self.btest_exit('pthread/test_pthread_gcc_atomic_fetch_and_op.cpp', args=args + ['-pthread', '-sPTHREAD_POOL_SIZE=8'])
39673966

39683967
# 64 bit version of the above test.
39693968
@also_with_wasm2js
@@ -3972,14 +3971,14 @@ def test_pthread_gcc_64bit_atomic_fetch_and_op(self):
39723971
if not self.is_wasm():
39733972
self.skipTest('https://github.com/WebAssembly/binaryen/issues/4358')
39743973
self.emcc_args += ['-Wno-sync-fetch-and-nand-semantics-changed']
3975-
self.btest_exit('pthread/test_pthread_gcc_64bit_atomic_fetch_and_op.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
3974+
self.btest_exit('pthread/test_pthread_gcc_64bit_atomic_fetch_and_op.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
39763975

39773976
# Test the old GCC atomic __sync_op_and_fetch builtin operations.
39783977
@also_with_wasm2js
39793978
@requires_threads
39803979
def test_pthread_gcc_atomic_op_and_fetch(self):
39813980
self.emcc_args += ['-Wno-sync-fetch-and-nand-semantics-changed']
3982-
self.btest_exit('pthread/test_pthread_gcc_atomic_op_and_fetch.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
3981+
self.btest_exit('pthread/test_pthread_gcc_atomic_op_and_fetch.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
39833982

39843983
# 64 bit version of the above test.
39853984
@also_with_wasm2js
@@ -3988,28 +3987,28 @@ def test_pthread_gcc_64bit_atomic_op_and_fetch(self):
39883987
if not self.is_wasm():
39893988
self.skipTest('https://github.com/WebAssembly/binaryen/issues/4358')
39903989
self.emcc_args += ['-Wno-sync-fetch-and-nand-semantics-changed', '--profiling-funcs']
3991-
self.btest_exit('pthread/test_pthread_gcc_64bit_atomic_op_and_fetch.cpp', args=['-sINITIAL_MEMORY=64MB', '-pthread', '-O2', '-sPTHREAD_POOL_SIZE=8'])
3990+
self.btest_exit('pthread/test_pthread_gcc_64bit_atomic_op_and_fetch.cpp', args=['-pthread', '-O2', '-sPTHREAD_POOL_SIZE=8'])
39923991

39933992
# Tests the rest of the remaining GCC atomics after the two above tests.
39943993
@also_with_wasm2js
39953994
@requires_threads
39963995
def test_pthread_gcc_atomics(self):
3997-
self.btest_exit('pthread/test_pthread_gcc_atomics.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
3996+
self.btest_exit('pthread/test_pthread_gcc_atomics.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
39983997

39993998
# Test the __sync_lock_test_and_set and __sync_lock_release primitives.
40003999
@also_with_wasm2js
40014000
@requires_threads
40024001
def test_pthread_gcc_spinlock(self):
40034002
for arg in [[], ['-DUSE_EMSCRIPTEN_INTRINSICS']]:
4004-
self.btest_exit('pthread/test_pthread_gcc_spinlock.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'] + arg)
4003+
self.btest_exit('pthread/test_pthread_gcc_spinlock.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'] + arg)
40054004

40064005
# Test that basic thread creation works.
40074006
@requires_threads
40084007
def test_pthread_create(self):
40094008
def test(args):
40104009
print(args)
40114010
self.btest_exit('pthread/test_pthread_create.cpp',
4012-
args=['-sINITIAL_MEMORY=64MB', '-pthread', '-sPTHREAD_POOL_SIZE=8'] + args,
4011+
args=['-pthread', '-sPTHREAD_POOL_SIZE=8'] + args,
40134012
extra_tries=0) # this should be 100% deterministic
40144013
print() # new line
40154014
test([])
@@ -4082,7 +4081,7 @@ def test_pthread_cleanup(self):
40824081
'spinlock': (['-DSPINLOCK_TEST'],),
40834082
})
40844083
def test_pthread_mutex(self, args):
4085-
self.btest_exit('pthread/test_pthread_mutex.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'] + args)
4084+
self.btest_exit('pthread/test_pthread_mutex.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'] + args)
40864085

40874086
@requires_threads
40884087
def test_pthread_attr_getstack(self):
@@ -4091,27 +4090,27 @@ def test_pthread_attr_getstack(self):
40914090
# Test that memory allocation is thread-safe.
40924091
@requires_threads
40934092
def test_pthread_malloc(self):
4094-
self.btest_exit('pthread/test_pthread_malloc.c', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
4093+
self.btest_exit('pthread/test_pthread_malloc.c', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
40954094

40964095
# Stress test pthreads allocating memory that will call to sbrk(), and main thread has to free up the data.
40974096
@requires_threads
40984097
def test_pthread_malloc_free(self):
4099-
self.btest_exit('pthread/test_pthread_malloc_free.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8', '-sINITIAL_MEMORY=256MB'])
4098+
self.btest_exit('pthread/test_pthread_malloc_free.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
41004099

41014100
# Test that the pthread_barrier API works ok.
41024101
@requires_threads
41034102
def test_pthread_barrier(self):
4104-
self.btest_exit('pthread/test_pthread_barrier.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
4103+
self.btest_exit('pthread/test_pthread_barrier.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
41054104

41064105
# Test the pthread_once() function.
41074106
@requires_threads
41084107
def test_pthread_once(self):
4109-
self.btest_exit('pthread/test_pthread_once.c', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
4108+
self.btest_exit('pthread/test_pthread_once.c', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
41104109

41114110
# Test against a certain thread exit time handling bug by spawning tons of threads.
41124111
@requires_threads
41134112
def test_pthread_spawns(self):
4114-
self.btest_exit('pthread/test_pthread_spawns.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8', '--closure=1', '-sENVIRONMENT=web,worker'])
4113+
self.btest_exit('pthread/test_pthread_spawns.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8', '--closure=1', '-sENVIRONMENT=web,worker'])
41154114

41164115
# It is common for code to flip volatile global vars for thread control. This is a bit lax, but nevertheless, test whether that
41174116
# kind of scheme will work with Emscripten as well.
@@ -4121,17 +4120,17 @@ def test_pthread_spawns(self):
41214120
'atomic': ([],),
41224121
})
41234122
def test_pthread_volatile(self, args):
4124-
self.btest_exit('pthread/test_pthread_volatile.c', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'] + args)
4123+
self.btest_exit('pthread/test_pthread_volatile.c', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'] + args)
41254124

41264125
# Test thread-specific data (TLS).
41274126
@requires_threads
41284127
def test_pthread_thread_local_storage(self):
4129-
self.btest_exit('pthread/test_pthread_thread_local_storage.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8', '-sASSERTIONS'])
4128+
self.btest_exit('pthread/test_pthread_thread_local_storage.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8', '-sASSERTIONS'])
41304129

41314130
# Test the pthread condition variable creation and waiting.
41324131
@requires_threads
41334132
def test_pthread_condition_variable(self):
4134-
self.btest_exit('pthread/test_pthread_condition_variable.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
4133+
self.btest_exit('pthread/test_pthread_condition_variable.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8'])
41354134

41364135
# Test that pthreads are able to do printf.
41374136
@parameterized({
@@ -4140,12 +4139,12 @@ def test_pthread_condition_variable(self):
41404139
})
41414140
@requires_threads
41424141
def test_pthread_printf(self, debug):
4143-
self.btest_exit('pthread/test_pthread_printf.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE', '-sLIBRARY_DEBUG=%d' % debug])
4142+
self.btest_exit('pthread/test_pthread_printf.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE', '-sLIBRARY_DEBUG=%d' % debug])
41444143

41454144
# Test that pthreads are able to do cout. Failed due to https://bugzilla.mozilla.org/show_bug.cgi?id=1154858.
41464145
@requires_threads
41474146
def test_pthread_iostream(self):
4148-
self.btest_exit('pthread/test_pthread_iostream.cpp', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread', '-sPTHREAD_POOL_SIZE'])
4147+
self.btest_exit('pthread/test_pthread_iostream.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE'])
41494148

41504149
@requires_threads
41514150
def test_pthread_unistd_io_bigint(self):
@@ -4155,7 +4154,7 @@ def test_pthread_unistd_io_bigint(self):
41554154
@also_with_wasm2js
41564155
@requires_threads
41574156
def test_pthread_setspecific_mainthread(self):
4158-
self.btest_exit('pthread/test_pthread_setspecific_mainthread.c', args=['-sINITIAL_MEMORY=64MB', '-O3', '-pthread'])
4157+
self.btest_exit('pthread/test_pthread_setspecific_mainthread.c', args=['-O3', '-pthread'])
41594158

41604159
# Test that pthreads have access to filesystem.
41614160
@requires_threads
@@ -4319,7 +4318,7 @@ def test_pthread_utf8_funcs(self):
43194318
@also_with_wasm2js
43204319
@requires_threads
43214320
def test_pthread_wake_all(self):
4322-
self.btest_exit('pthread/test_futex_wake_all.cpp', args=['-O3', '-pthread', '-sINITIAL_MEMORY=64MB'])
4321+
self.btest_exit('pthread/test_futex_wake_all.cpp', args=['-O3', '-pthread'])
43234322

43244323
# Test that stack base and max correctly bound the stack on pthreads.
43254324
@requires_threads
@@ -4351,7 +4350,7 @@ def test_pthread_safe_stack(self):
43514350
@requires_threads
43524351
@no_firefox('https://github.com/emscripten-core/emscripten/issues/15978')
43534352
def test_pthread_lsan(self, name, args):
4354-
self.btest(Path('pthread', name + '.cpp'), expected='1', args=['-fsanitize=leak', '-sINITIAL_MEMORY=256MB', '-pthread', '-sPROXY_TO_PTHREAD', '--pre-js', test_file('pthread', name + '.js')] + args)
4353+
self.btest(Path('pthread', name + '.cpp'), expected='1', args=['-fsanitize=leak', '-pthread', '-sPROXY_TO_PTHREAD', '--pre-js', test_file('pthread', name + '.js')] + args)
43554354

43564355
@no_wasm64('TODO: ASAN in memory64')
43574356
@parameterized({
@@ -4361,12 +4360,12 @@ def test_pthread_lsan(self, name, args):
43614360
})
43624361
@requires_threads
43634362
def test_pthread_asan(self, name, args):
4364-
self.btest(Path('pthread', name + '.cpp'), expected='1', args=['-fsanitize=address', '-sINITIAL_MEMORY=256MB', '-pthread', '-sPROXY_TO_PTHREAD', '--pre-js', test_file('pthread', name + '.js')] + args)
4363+
self.btest(Path('pthread', name + '.cpp'), expected='1', args=['-fsanitize=address', '-pthread', '-sPROXY_TO_PTHREAD', '--pre-js', test_file('pthread', name + '.js')] + args)
43654364

43664365
@no_wasm64('TODO: ASAN in memory64')
43674366
@requires_threads
43684367
def test_pthread_asan_use_after_free(self):
4369-
self.btest('pthread/test_pthread_asan_use_after_free.cpp', expected='1', args=['-fsanitize=address', '-sINITIAL_MEMORY=256MB', '-pthread', '-sPROXY_TO_PTHREAD', '--pre-js', test_file('pthread/test_pthread_asan_use_after_free.js')])
4368+
self.btest('pthread/test_pthread_asan_use_after_free.cpp', expected='1', args=['-fsanitize=address', '-pthread', '-sPROXY_TO_PTHREAD', '--pre-js', test_file('pthread/test_pthread_asan_use_after_free.js')])
43704369

43714370
@no_wasm64('TODO: ASAN in memory64')
43724371
@no_firefox('https://github.com/emscripten-core/emscripten/issues/20006')
@@ -4377,7 +4376,7 @@ def test_pthread_asan_use_after_free_2(self):
43774376
# of proxy-to-pthread, and also the allocation happens on the pthread
43784377
# (which tests that it can use the offset converter to get the stack
43794378
# trace there)
4380-
self.btest('pthread/test_pthread_asan_use_after_free_2.cpp', expected='1', args=['-fsanitize=address', '-sINITIAL_MEMORY=256MB', '-pthread', '-sPTHREAD_POOL_SIZE=1', '--pre-js', test_file('pthread/test_pthread_asan_use_after_free_2.js')])
4379+
self.btest('pthread/test_pthread_asan_use_after_free_2.cpp', expected='1', args=['-fsanitize=address', '-pthread', '-sPTHREAD_POOL_SIZE=1', '--pre-js', test_file('pthread/test_pthread_asan_use_after_free_2.js')])
43814380

43824381
@requires_threads
43834382
def test_pthread_exit_process(self):
@@ -4516,7 +4515,7 @@ def test_async_compile(self, opts, returncode):
45164515
# Test that implementing Module.instantiateWasm() callback works.
45174516
@parameterized({
45184517
'': ([],),
4519-
'asan': (['-fsanitize=address', '-sINITIAL_MEMORY=128MB'],)
4518+
'asan': (['-fsanitize=address'],)
45204519
})
45214520
def test_manual_wasm_instantiate(self, args):
45224521
if self.is_wasm64() and args:
@@ -4861,8 +4860,7 @@ def test_fetch_stream_file(self):
48614860
with open('largefile.txt', 'w') as f:
48624861
for _ in range(1024):
48634862
f.write(s)
4864-
self.btest_exit('fetch/test_fetch_stream_file.cpp',
4865-
args=['-sFETCH_DEBUG', '-sFETCH', '-sINITIAL_MEMORY=536870912'])
4863+
self.btest_exit('fetch/test_fetch_stream_file.cpp', args=['-sFETCH_DEBUG', '-sFETCH'])
48664864

48674865
def test_fetch_headers_received(self):
48684866
create_file('myfile.dat', 'hello world\n')
@@ -5111,7 +5109,7 @@ def test_single_file_worker_js(self):
51115109
@requires_threads
51125110
def test_pthreads_started_in_worker(self):
51135111
self.set_setting('EXIT_RUNTIME')
5114-
self.compile_btest('pthread/test_pthread_atomics.cpp', ['-o', 'test.js', '-sINITIAL_MEMORY=64MB', '-pthread', '-sPTHREAD_POOL_SIZE=8'], reporting=Reporting.JS_ONLY)
5112+
self.compile_btest('pthread/test_pthread_atomics.cpp', ['-o', 'test.js', '-pthread', '-sPTHREAD_POOL_SIZE=8'], reporting=Reporting.JS_ONLY)
51155113
create_file('test.html', '''
51165114
<script>
51175115
new Worker('test.js');
@@ -5606,7 +5604,7 @@ def test_dlmalloc_3gb(self):
56065604
# will require bumping this
56075605
'main_thread': (['-sPTHREAD_POOL_SIZE=5'],),
56085606
# using proxy_to_pthread also works, of course
5609-
'proxy_to_pthread': (['-sPROXY_TO_PTHREAD', '-sINITIAL_MEMORY=32MB', '-DPROXYING'],),
5607+
'proxy_to_pthread': (['-sPROXY_TO_PTHREAD', '-DPROXYING'],),
56105608
# using BigInt support affects the ABI, and should not break things. (this
56115609
# could be tested on either thread; do the main thread for simplicity)
56125610
'bigint': (['-sPTHREAD_POOL_SIZE=5', '-sWASM_BIGINT'],),
@@ -5621,7 +5619,7 @@ def test_wasmfs_fetch_backend(self, args):
56215619
create_file('subdir/backendfile', 'file 1')
56225620
create_file('subdir/backendfile2', 'file 2')
56235621
self.btest_exit('wasmfs/wasmfs_fetch.c',
5624-
args=['-sWASMFS', '-pthread', '-sPROXY_TO_PTHREAD', '-sINITIAL_MEMORY=32MB',
5622+
args=['-sWASMFS', '-pthread', '-sPROXY_TO_PTHREAD',
56255623
'--js-library', test_file('wasmfs/wasmfs_fetch.js')] + args)
56265624

56275625
@no_firefox('no OPFS support yet')

0 commit comments

Comments
 (0)