Skip to content

Commit 5f044a5

Browse files
authored
Remove test_emcc_4. NFC (#26440)
This is a rather sprawling and unfocused test that has a huge loop inside. This single test take over 30 seconds to run. It seems to test for a lot of different things, including stuff from the old compile-to-JS days. I'm pretty sure all this stuff is covered in a more logical fashion elsewhere. It also has a very useless name.
1 parent 882bc6a commit 5f044a5

File tree

3 files changed

+0
-130
lines changed

3 files changed

+0
-130
lines changed

test/hello_world_loop.c

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/hello_world_loop_malloc.c

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/test_other.py

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -583,90 +583,6 @@ def test_emcc_3(self, compiler, suffix):
583583
os.chdir(last)
584584
delete_file(path)
585585

586-
@is_slow_test
587-
@with_both_compilers
588-
def test_emcc_4(self, compiler):
589-
# Optimization: emcc src.cpp -o something.js [-Ox]. -O0 is the same as not specifying any optimization setting
590-
# link_param are used after compiling first
591-
for params, opt_level, link_params, closure, has_malloc in [
592-
(['-o', 'something.js'], 0, None, 0, 1),
593-
(['-o', 'something.js', '-O0', '-g'], 0, None, 0, 0),
594-
(['-o', 'something.js', '-O1'], 1, None, 0, 0),
595-
(['-o', 'something.js', '-O1', '-g'], 1, None, 0, 0), # no closure since debug
596-
(['-o', 'something.js', '-O2'], 2, None, 0, 1),
597-
(['-o', 'something.js', '-O2', '-g'], 2, None, 0, 0),
598-
(['-o', 'something.js', '-Os'], 2, None, 0, 1),
599-
(['-o', 'something.js', '-O3'], 3, None, 0, 1),
600-
# and, test compiling first
601-
(['-c', '-o', 'something.o'], 0, [], 0, 0),
602-
(['-c', '-o', 'something.o', '-O0'], 0, [], 0, 0),
603-
(['-c', '-o', 'something.o', '-O1'], 1, ['-O1'], 0, 0),
604-
(['-c', '-o', 'something.o', '-O2'], 2, ['-O2'], 0, 0),
605-
(['-c', '-o', 'something.o', '-O3'], 3, ['-O3'], 0, 0),
606-
(['-O1', '-c', '-o', 'something.o'], 1, [], 0, 0),
607-
# non-wasm
608-
(['-sWASM=0', '-o', 'something.js'], 0, None, 0, 1),
609-
(['-sWASM=0', '-o', 'something.js', '-O0', '-g'], 0, None, 0, 0),
610-
(['-sWASM=0', '-o', 'something.js', '-O1'], 1, None, 0, 0),
611-
(['-sWASM=0', '-o', 'something.js', '-O1', '-g'], 1, None, 0, 0), # no closure since debug
612-
(['-sWASM=0', '-o', 'something.js', '-O2'], 2, None, 0, 1),
613-
(['-sWASM=0', '-o', 'something.js', '-O2', '-g'], 2, None, 0, 0),
614-
(['-sWASM=0', '-o', 'something.js', '-Os'], 2, None, 0, 1),
615-
(['-sWASM=0', '-o', 'something.js', '-O3'], 3, None, 0, 1),
616-
# and, test compiling to bitcode first
617-
(['-flto', '-c', '-o', 'something.o'], 0, [], 0, 0),
618-
(['-flto', '-c', '-o', 'something.o', '-O0'], 0, [], 0, 0),
619-
(['-flto', '-c', '-o', 'something.o', '-O1'], 1, ['-O1'], 0, 0),
620-
(['-flto', '-c', '-o', 'something.o', '-O2'], 2, ['-O2'], 0, 0),
621-
(['-flto', '-c', '-o', 'something.o', '-O3'], 3, ['-O3'], 0, 0),
622-
(['-flto', '-O1', '-c', '-o', 'something.o'], 1, [], 0, 0),
623-
]:
624-
print(params, opt_level, link_params, closure, has_malloc)
625-
self.clear()
626-
keep_debug = '-g' in params
627-
if has_malloc:
628-
filename = test_file('hello_world_loop_malloc.c')
629-
else:
630-
filename = test_file('hello_world_loop.c')
631-
args = [compiler, filename] + params
632-
print('..', args)
633-
output = self.run_process(args, stdout=PIPE, stderr=PIPE)
634-
assert len(output.stdout) == 0, output.stdout
635-
if link_params is not None:
636-
self.assertExists('something.o', output.stderr)
637-
obj_args = [compiler, 'something.o', '-o', 'something.js'] + link_params
638-
print('....', obj_args)
639-
output = self.run_process(obj_args, stdout=PIPE, stderr=PIPE)
640-
self.assertExists('something.js', output.stderr)
641-
self.assertContained('Hello, world!', self.run_js('something.js'))
642-
643-
# Verify optimization level etc. in the generated code
644-
# XXX these are quite sensitive, and will need updating when code generation changes
645-
generated = read_file('something.js')
646-
main = self.get_func(generated, '_main') if 'function _main' in generated else generated
647-
assert 'new Uint16Array' in generated and 'new Uint32Array' in generated, 'typed arrays 2 should be used by default'
648-
assert 'SAFE_HEAP_LOAD' not in generated, 'safe heap should not be used by default'
649-
assert 'SAFE_HEAP_STORE' not in generated, 'safe heap should not be used by default'
650-
assert ': while(' not in main, 'when relooping we also js-optimize, so there should be no labelled whiles'
651-
if closure:
652-
if opt_level == 0:
653-
assert '._main =' in generated, 'closure compiler should have been run'
654-
elif opt_level >= 1:
655-
assert '._main=' in generated, 'closure compiler should have been run (and output should be minified)'
656-
else:
657-
# closure has not been run, we can do some additional checks. TODO: figure out how to do these even with closure
658-
assert '._main = ' not in generated, 'closure compiler should not have been run'
659-
if keep_debug:
660-
self.assertContainedIf("assert(typeof Module['STACK_SIZE'] == 'undefined'", generated, opt_level == 0)
661-
if 'WASM=0' in params:
662-
looks_unminified = ' = {}' in generated and ' = []' in generated
663-
looks_minified = '={}' in generated and '=[]' and ';var' in generated
664-
assert not (looks_minified and looks_unminified)
665-
if opt_level == 0 or '-g' in params:
666-
assert looks_unminified
667-
elif opt_level >= 2:
668-
assert looks_minified
669-
670586
def test_multiple_sources(self):
671587
# Compiling two sources at a time should work.
672588
cmd = [EMCC, '-c', test_file('twopart_main.cpp'), test_file('twopart_side.c')]

0 commit comments

Comments
 (0)