From d6f23c0fe1025be1aa6327df9d375854517be327 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 12 Dec 2022 12:05:11 -0800 Subject: [PATCH] Don't error on STANDALONE_WASM + USE_PTHREADS Using these two options together will most likely result in some non-standard JS imports (e.g. `_pthread_create_js`), but the point of `STANDALONE_WASM` is not to completely eliminate those, only to avoid them where possible. Fixes: #18354 --- src/library_pthread.js | 3 --- test/test_core.py | 6 +++++- test/test_other.py | 14 +++++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/library_pthread.js b/src/library_pthread.js index 854ae09f99958..c14bf035f9492 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -25,9 +25,6 @@ #if EVAL_CTORS #error "EVAL_CTORS is not compatible with pthreads yet (passive segments)" #endif -#if STANDALONE_WASM -#error "STANDALONE_WASM does not support shared memories yet" -#endif var LibraryPThread = { $PThread__postset: 'PThread.init();', diff --git a/test/test_core.py b/test/test_core.py index 313e26ebb2e84..5f39e300c56bf 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -9110,9 +9110,13 @@ def test_fpic_static(self): self.emcc_args.append('-fPIC') self.do_core_test('test_hello_world.c') + # Marked as impure since we don't have a wasi-threads is still + # a WIP. + @also_with_standalone_wasm(impure=True) @node_pthreads def test_pthread_create(self): - self.set_setting('EXIT_RUNTIME') + if not self.get_setting('STANDALONE_WASM'): + self.set_setting('EXIT_RUNTIME') # test that the node environment can be specified by itself, and that still # works with pthreads (even though we did not specify 'node,worker') self.set_setting('ENVIRONMENT', 'node') diff --git a/test/test_other.py b/test/test_other.py index f88e1a28db6f0..144e2b9c02f55 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -890,12 +890,20 @@ def test_pkg_config_packages(self): out = self.run_process([emmake, 'pkg-config', '--modversion', package], stdout=PIPE).stdout self.assertContained(version, out) - def test_cmake_check_type_size(self): - self.run_process([EMCMAKE, 'cmake', test_file('cmake/check_type_size')]) + @parameterized({ + '': [[]], + 'pthreads': [['-DCMAKE_CXX_FLAGS=-pthread', '-DCMAKE_C_FLAGS=-pthread']], + }) + def test_cmake_check_type_size(self, flags): + cmd = [EMCMAKE, 'cmake', test_file('cmake/check_type_size')] + if flags: + cmd += flags + + self.run_process(cmd) # Verify that this test works without needing to run node. We do this by breaking node # execution. - self.run_process([EMCMAKE, 'cmake', '-DCMAKE_CROSSCOMPILING_EMULATOR=/missing_binary', test_file('cmake/check_type_size')]) + self.run_process(cmd + ['-DCMAKE_CROSSCOMPILING_EMULATOR=/missing_binary']) def test_system_include_paths(self): # Verify that all default include paths are within `emscripten/system`