42
42
from common import also_with_modularize, also_with_wasmfs, with_all_fs
43
43
from common import also_with_minimal_runtime, also_without_bigint, also_with_wasm64, also_with_asan, flaky
44
44
from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER, EMCMAKE, EMCONFIGURE
45
- from common import requires_network, parameterize, copytree
45
+ from common import requires_network, parameterize, copytree, all_engines
46
46
from tools import shared, building, utils, response_file, cache
47
47
from tools.utils import read_file, write_file, delete_file, read_binary, MACOS, WINDOWS
48
48
import common
@@ -1696,19 +1696,15 @@ def test_export_all_and_exported_functions(self):
1696
1696
self.emcc('lib.c', ['-sEXPORTED_FUNCTIONS=_libfunc2', '-sEXPORT_ALL', '--pre-js', 'pre.js'], output_filename='a.out.js')
1697
1697
self.assertContained('libfunc\n', self.run_js('a.out.js'))
1698
1698
1699
+ @all_engines
1699
1700
@also_with_wasmfs
1700
1701
@crossplatform
1701
1702
@parameterized({
1702
1703
'': ([],),
1703
1704
'closure': (['-O2', '--closure=1'],),
1704
1705
})
1705
1706
def test_stdin(self, args):
1706
- self.set_setting('ENVIRONMENT', 'node,shell')
1707
- self.emcc(test_file('module/test_stdin.c'), args=args, output_filename='out.js')
1708
-
1709
- for engine in config.JS_ENGINES:
1710
- output = self.run_js('out.js', engine, input='abcdef\nghijkl\n')
1711
- self.assertContained('abcdef\nghijkl\neof', output)
1707
+ self.do_runf('module/test_stdin.c', 'abcdef\nghijkl\neof', input='abcdef\nghijkl\n', cflags=args)
1712
1708
1713
1709
@crossplatform
1714
1710
def test_module_stdin(self):
@@ -4284,6 +4280,7 @@ def test_exported_runtime_methods_from_js_library(self):
4284
4280
self.assertContained("Aborted('ptrToString' was not exported. add it to EXPORTED_RUNTIME_METHODS", err)
4285
4281
4286
4282
@crossplatform
4283
+ @all_engines
4287
4284
def test_fs_stream_proto(self):
4288
4285
create_file('src.c', br'''
4289
4286
#include <stdio.h>
@@ -4316,10 +4313,7 @@ def test_fs_stream_proto(self):
4316
4313
return 0;
4317
4314
}
4318
4315
''', binary=True)
4319
- self.run_process([EMCC, 'src.c', '--embed-file', 'src.c', '-sENVIRONMENT=node,shell'])
4320
- for engine in config.JS_ENGINES:
4321
- out = self.run_js('a.out.js', engine=engine)
4322
- self.assertContained('File size: 682', out)
4316
+ self.do_runf('src.c', 'File size: 682', cflags=['--embed-file', 'src.c'])
4323
4317
4324
4318
@node_pthreads
4325
4319
def test_node_emscripten_num_logical_cores(self):
@@ -6832,6 +6826,7 @@ def test_create_readonly(self):
6832
6826
Failed to open file for writing: /tmp/file; errno=2; Permission denied
6833
6827
''')
6834
6828
6829
+ @all_engines
6835
6830
def test_embed_file_large(self):
6836
6831
# If such long files are encoded on one line,
6837
6832
# they overflow the interpreter's limit
@@ -6852,12 +6847,7 @@ def test_embed_file_large(self):
6852
6847
return 0;
6853
6848
}
6854
6849
''')
6855
- self.run_process([EMCC, 'src.c', '--embed-file', 'large.txt'])
6856
- for engine in config.JS_ENGINES:
6857
- if engine == config.V8_ENGINE:
6858
- continue # ooms
6859
- print(engine)
6860
- self.assertContained('ok\n' + str(large_size) + '\n', self.run_js('a.out.js', engine=engine))
6850
+ self.do_runf('src.c', 'ok\n' + str(large_size) + '\n', cflags=['--embed-file', 'large.txt'])
6861
6851
6862
6852
def test_force_exit(self):
6863
6853
create_file('src.c', r'''
@@ -12535,12 +12525,11 @@ def test_small_js_flags(self):
12535
12525
self.emcc(test_file('browser_test_hello_world.c'), ['-O3', '--closure=1', '-sINCOMING_MODULE_JS_API=[]', '-sENVIRONMENT=web', '--output-eol=linux'])
12536
12526
self.check_output_sizes('a.out.js')
12537
12527
12528
+ @all_engines
12538
12529
def test_INCOMING_MODULE_JS_API(self):
12539
12530
def test(args):
12540
- self.run_process([EMCC, test_file('hello_world.c'), '-O3', '--closure=1', '-sENVIRONMENT=node,shell', '--output-eol=linux'] + args)
12541
- for engine in config.JS_ENGINES:
12542
- self.assertContained('hello, world!', self.run_js('a.out.js', engine=engine))
12543
- return os.path.getsize('a.out.js')
12531
+ self.do_runf('hello_world.c', 'hello, world!', cflags=['-O3', '--closure=1', '-sENVIRONMENT=node,shell', '--output-eol=linux'] + args)
12532
+ return os.path.getsize('hello_world.js')
12544
12533
normal = test([])
12545
12534
changed = test(['-sINCOMING_MODULE_JS_API=[]'])
12546
12535
print('sizes', normal, changed)
@@ -12941,13 +12930,13 @@ def test_linker_input_unused(self):
12941
12930
# In this case the compiler does not produce any output file.
12942
12931
self.assertNotExists('out.o')
12943
12932
12933
+ @all_engines
12944
12934
def test_non_wasm_without_wasm_in_vm(self):
12945
12935
# Test that our non-wasm output does not depend on wasm support in the vm.
12946
12936
self.run_process([EMCC, test_file('hello_world.c'), '-sWASM=0', '-sENVIRONMENT=node,shell'])
12947
12937
js = read_file('a.out.js')
12948
12938
create_file('a.out.js', 'var WebAssembly = null;\n' + js)
12949
- for engine in config.JS_ENGINES:
12950
- self.assertContained('hello, world!', self.run_js('a.out.js', engine=engine))
12939
+ self.assertContained('hello, world!', self.run_js('a.out.js'))
12951
12940
12952
12941
def test_empty_output_extension(self):
12953
12942
# Default to JS output when no extension is present
0 commit comments