Skip to content

Commit 1b4409e

Browse files
authored
Re-enable disabled parts of test_dlmalloc. NFC (#24330)
The second half of the test was never being run because self.emcc_args is never empty by default. Also, no need to require v8 here, node seems just as fast now and works on my x86_64 machine. I'm not sure how useful these parts of the test are but seems like having them enabled is better than not.
1 parent 0552c30 commit 1b4409e

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

test/test_core.py

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6344,8 +6344,6 @@ def test_dlmalloc_inline(self):
63446344
self.do_run(src, '*1,0*', args=['200', '1'], force_c=True)
63456345
self.do_run('src.js', '*400,0*', args=['400', '400'], force_c=True, no_build=True)
63466346

6347-
# node is slower, and fail on 64-bit
6348-
@requires_v8
63496347
@no_asan('depends on the specifics of memory size, which for asan we are forced to increase')
63506348
@no_lsan('depends on the specifics of memory size, which for lsan we are forced to increase')
63516349
@no_wasmfs('wasmfs does some malloc/free during startup, fragmenting the heap, leading to differences later')
@@ -6355,28 +6353,23 @@ def test_dlmalloc(self):
63556353

63566354
# Linked version
63576355
self.do_runf('dlmalloc_test.c', '*1,0*', args=['200', '1'])
6358-
self.do_run('dlmalloc_test.js', '*400,0*', args=['400', '400'], no_build=True)
6359-
6360-
# TODO: do this in other passes too, passing their opts into emcc
6361-
if self.emcc_args == []:
6362-
# emcc should build in dlmalloc automatically, and do all the sign correction etc. for it
6363-
6364-
delete_file('src.js')
6365-
self.run_process([EMCC, test_file('dlmalloc_test.c'), '-sINITIAL_MEMORY=128MB', '-o', 'src.js'], stdout=PIPE, stderr=self.stderr_redirect)
6366-
6367-
self.do_run(None, '*1,0*', ['200', '1'], no_build=True)
6368-
self.do_run(None, '*400,0*', ['400', '400'], no_build=True)
6369-
6370-
# The same for new and all its variants
6371-
src = read_file(test_file('new.cpp'))
6372-
for new, delete in [
6373-
('malloc(100)', 'free'),
6374-
('new char[100]', 'delete[]'),
6375-
('new Structy', 'delete'),
6376-
('new int', 'delete'),
6377-
('new Structy[10]', 'delete[]'),
6378-
]:
6379-
self.do_run(src.replace('{{{ NEW }}}', new).replace('{{{ DELETE }}}', delete), '*1,0*')
6356+
self.do_run(self.output_name('dlmalloc_test'), '*400,0*', args=['400', '400'], no_build=True)
6357+
6358+
self.run_process([EMCC, test_file('dlmalloc_test.c'), '-sINITIAL_MEMORY=128MB', '-o', 'src.js'] + self.get_emcc_args())
6359+
6360+
self.do_run('src.js', '*1,0*', args=['200', '1'], no_build=True)
6361+
self.do_run('src.js', '*400,0*', args=['400', '400'], no_build=True)
6362+
6363+
# The same for new and all its variants
6364+
src = read_file(test_file('new.cpp'))
6365+
for new, delete in [
6366+
('malloc(100)', 'free'),
6367+
('new char[100]', 'delete[]'),
6368+
('new Structy', 'delete'),
6369+
('new int', 'delete'),
6370+
('new Structy[10]', 'delete[]'),
6371+
]:
6372+
self.do_run(src.replace('{{{ NEW }}}', new).replace('{{{ DELETE }}}', delete), '*1,0*')
63806373

63816374
# Tests that a large allocation should gracefully fail
63826375
@no_asan('the memory size limit here is too small for asan')

0 commit comments

Comments
 (0)