Skip to content

Commit 33589f7

Browse files
Adjust a couple tests
The tests hardcode the initial memory amount. Make them robust against changes in defaults.
1 parent 010088d commit 33589f7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

test/test_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ def test_memorygrowth_geometric_step(self):
20992099
if not self.is_wasm():
21002100
self.skipTest('wasm memory specific test')
21012101

2102-
self.emcc_args += ['-sALLOW_MEMORY_GROWTH', '-sMEMORY_GROWTH_GEOMETRIC_STEP=8.5', '-sMEMORY_GROWTH_GEOMETRIC_CAP=32MB']
2102+
self.emcc_args += ['-sINITIAL_MEMORY=16MB', '-sALLOW_MEMORY_GROWTH', '-sMEMORY_GROWTH_GEOMETRIC_STEP=8.5', '-sMEMORY_GROWTH_GEOMETRIC_CAP=32MB']
21032103
self.do_core_test('test_memorygrowth_geometric_step.c')
21042104

21052105
def test_memorygrowth_3_force_fail_reallocBuffer(self):
@@ -5993,6 +5993,7 @@ def test_unistd_sysconf_phys_pages(self):
59935993
assert self.get_setting('INITIAL_MEMORY') == '2200mb'
59945994
expected = (2200 * 1024 * 1024) // webassembly.WASM_PAGE_SIZE
59955995
else:
5996+
self.set_setting('INITIAL_MEMORY', '16mb')
59965997
expected = 16 * 1024 * 1024 // webassembly.WASM_PAGE_SIZE
59975998
self.do_runf(filename, str(expected) + ', errno: 0')
59985999

test/test_other.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6567,7 +6567,7 @@ def test_failing_alloc(self):
65676567
printf("managed another malloc!\n");
65686568
}
65696569
''' % (pre_fail, post_fail))
6570-
args = [EMXX, 'main.cpp', '-sEXPORTED_FUNCTIONS=_main,_sbrk'] + opts + aborting_args
6570+
args = [EMXX, 'main.cpp', '-sEXPORTED_FUNCTIONS=_main,_sbrk', '-sINITIAL_MEMORY=16MB'] + opts + aborting_args
65716571
args += ['-sTEST_MEMORY_GROWTH_FAILS'] # In this test, force memory growing to fail
65726572
if growth:
65736573
args += ['-sALLOW_MEMORY_GROWTH']
@@ -8592,7 +8592,7 @@ def run(args, expected):
85928592
result = self.run_js('a.out.js').strip()
85938593
self.assertEqual(result, f'{expected}, errno: 0')
85948594

8595-
run([], 256)
8595+
run(['-sINITIAL_MEMORY=16MB'], 256)
85968596
run(['-sINITIAL_MEMORY=32MB'], 512)
85978597
run(['-sINITIAL_MEMORY=32MB', '-sALLOW_MEMORY_GROWTH'], (2 * 1024 * 1024 * 1024) // webassembly.WASM_PAGE_SIZE)
85988598
run(['-sINITIAL_MEMORY=32MB', '-sALLOW_MEMORY_GROWTH', '-sWASM=0'], (2 * 1024 * 1024 * 1024) // webassembly.WASM_PAGE_SIZE)

0 commit comments

Comments
 (0)