Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run more of out tests with -sNO_DEFAULT_TO_CXX #21096

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,11 @@ def setUp(self):
self.js_engines = config.JS_ENGINES.copy()
self.settings_mods = {}
self.emcc_args = ['-Wclosure', '-Werror', '-Wno-limited-postlink-optimizations']
# TODO(https://github.com/emscripten-core/emscripten/issues/11121)
# For historical reasons emcc compiles and links as C++ by default.
# However we want to run our tests in a more strict manner. We can
# remove this if the issue above is ever fixed.
self.set_setting('NO_DEFAULT_TO_CXX')
self.ldflags = []
# Increate stack trace limit to maximise usefulness of test failure reports
self.node_args = ['--stack-trace-limit=50']
Expand Down Expand Up @@ -1042,12 +1047,6 @@ def build(self, filename, libraries=None, includes=None, force_c=False, js_outfi
filename = test_file(filename)
suffix = '.js' if js_outfile else '.wasm'
compiler = [compiler_for(filename, force_c)]
if compiler[0] == EMCC:
# TODO(https://github.com/emscripten-core/emscripten/issues/11121)
# For historical reasons emcc compiles and links as C++ by default.
# However we want to run our tests in a more strict manner. We can
# remove this if the issue above is ever fixed.
compiler.append('-sNO_DEFAULT_TO_CXX')

if force_c:
assert shared.suffix(filename) != '.c', 'force_c is not needed for source files ending in .c'
Expand Down
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8390
8359
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23034
22949
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7219
7187
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19658
19573
6 changes: 3 additions & 3 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ def test_sdl_ogl(self):
def test_sdl_ogl_regal(self):
shutil.copyfile(test_file('screenshot.png'), 'screenshot.png')
self.btest('test_sdl_ogl.c', reference='screenshot-gray-purple.png', reference_slack=1,
args=['-O2', '--minify=0', '--preload-file', 'screenshot.png', '-sUSE_REGAL', '-DUSE_REGAL', '--use-preload-plugins', '-lSDL', '-lGL'])
args=['-O2', '--minify=0', '--preload-file', 'screenshot.png', '-sUSE_REGAL', '-DUSE_REGAL', '--use-preload-plugins', '-lSDL', '-lGL', '-lc++', '-lc++abi'])

@requires_graphics_hardware
def test_sdl_ogl_defaultmatrixmode(self):
Expand Down Expand Up @@ -2114,13 +2114,13 @@ def test_cubegeom(self, args):
@no_wasm64('wasm64 + LEGACY_GL_EMULATION')
@requires_graphics_hardware
def test_cubegeom_regal(self):
self.btest('third_party/cubegeom/cubegeom.c', reference='third_party/cubegeom/cubegeom.png', args=['-O2', '-g', '-DUSE_REGAL', '-sUSE_REGAL', '-lGL', '-lSDL'], also_proxied=True)
self.btest('third_party/cubegeom/cubegeom.c', reference='third_party/cubegeom/cubegeom.png', args=['-O2', '-g', '-DUSE_REGAL', '-sUSE_REGAL', '-lGL', '-lSDL', '-lc++', '-lc++abi'], also_proxied=True)

@no_wasm64('wasm64 + LEGACY_GL_EMULATION')
@requires_threads
@requires_graphics_hardware
def test_cubegeom_regal_mt(self):
self.btest('third_party/cubegeom/cubegeom.c', reference='third_party/cubegeom/cubegeom.png', args=['-O2', '-g', '-pthread', '-DUSE_REGAL', '-pthread', '-sUSE_REGAL', '-lGL', '-lSDL'], also_proxied=False)
self.btest('third_party/cubegeom/cubegeom.c', reference='third_party/cubegeom/cubegeom.png', args=['-O2', '-g', '-pthread', '-DUSE_REGAL', '-pthread', '-sUSE_REGAL', '-lGL', '-lSDL', '-lc++', '-lc++abi'], also_proxied=False)

@no_wasm64('wasm64 + LEGACY_GL_EMULATION')
@requires_graphics_hardware
Expand Down
8 changes: 4 additions & 4 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3102,7 +3102,7 @@ def test_embind_tsgen_ignore(self):
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))

def test_embind_tsgen_test_embind(self):
self.run_process([EMCC, test_file('embind/embind_test.cpp'),
self.run_process([EMXX, test_file('embind/embind_test.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen_test_embind.d.ts',
# This test explicitly creates std::string from unsigned char pointers
# which is deprecated in upstream LLVM.
Expand All @@ -3118,7 +3118,7 @@ def test_embind_tsgen_val(self):
self.assertExists('embind_tsgen_val.d.ts')

def test_embind_tsgen_bigint(self):
args = [EMCC, test_file('other/embind_tsgen_bigint.cpp'), '-lembind', '--embind-emit-tsd', 'embind_tsgen_bigint.d.ts']
args = [EMXX, test_file('other/embind_tsgen_bigint.cpp'), '-lembind', '--embind-emit-tsd', 'embind_tsgen_bigint.d.ts']
# Check that TypeScript generation fails when code contains bigints but their support is not enabled
stderr = self.expect_fail(args)
self.assertContained("Missing primitive type to TS type for 'int64_t", stderr)
Expand All @@ -3128,14 +3128,14 @@ def test_embind_tsgen_bigint(self):

def test_embind_tsgen_memory64(self):
# Check that when memory64 is enabled longs & unsigned longs are mapped to bigint in the generated TS bindings
self.run_process([EMCC, test_file('other/embind_tsgen_memory64.cpp'),
self.run_process([EMXX, test_file('other/embind_tsgen_memory64.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen_memory64.d.ts', '-sMEMORY64', '-Wno-experimental'] +
self.get_emcc_args())
self.assertFileContents(test_file('other/embind_tsgen_memory64.d.ts'), read_file('embind_tsgen_memory64.d.ts'))

def test_embind_tsgen_exceptions(self):
# Check that when Wasm exceptions and assertions are enabled bindings still generate.
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
self.run_process([EMXX, test_file('other/embind_tsgen.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts', '-fwasm-exceptions', '-sASSERTIONS'])
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))

Expand Down
Loading