Build: qualify wasm test suite with portable libc++ fallbacks (refs #38)
This commit is contained in:
1 parent
1ba60d5d6a
commit
f0820b778f
7 files changed
+163
-12
No files matched your search
+26
-10
@@ -147,7 +147,7 @@ cmake -S . -B build-mingw -G Ninja \
|
||||
A regular MinGW-w64 installation with winpthreads does not need those extra
|
||||
flags.
|
||||
|
||||
### Browser / Wasm subset (library qualified, test suite unqualified)
|
||||
### Browser / Wasm subset (qualified)
|
||||
|
||||
| Item | Value |
|
||||
|------|-------|
|
||||
@@ -157,7 +157,7 @@ flags.
|
||||
| CMake / generator | CMake 4.5 via `emcmake`, Ninja, Node 24.22.3 as the test emulator |
|
||||
| Language | C++26 without reflection (`VOID_HAS_CXX26_REFLECTION=no`) |
|
||||
| Modules | `Algorithms Binary Containers Core Data Functional LogState Math Memory Testing TestingMock Text Time Unicode` |
|
||||
| Observed | configure, compile, `cmake --install`, consume (`find_package(Void)`) and run the consumer under Node (`node_exit=0`) |
|
||||
| Observed | library: configure, compile, install, consume and run under Node; tests: **901 tests, 895 passed, 6 skipped, 0 failed** under Node |
|
||||
|
||||
The allowlist is fail-closed: native networking (`Net`, `RPC`), processes and
|
||||
filesystem (`System`, `SystemAsync`), IPC, SQLite, plugins and anything that
|
||||
@@ -190,15 +190,31 @@ scanner calling Emscripten's `emscan-deps`, which is not shipped by every
|
||||
Emscripten package. `CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH` is needed
|
||||
because the Emscripten toolchain restricts package lookup to its sysroot.
|
||||
|
||||
The **test suite** does not build yet on wasm (7 translation units after the
|
||||
reflection gating below). The remaining blockers are libc++ gaps, not
|
||||
reflection:
|
||||
The **test suite** is qualified with pthreads, exception handling and a
|
||||
larger stack:
|
||||
|
||||
- `Core/Publication` uses `std::atomic<std::shared_ptr<...>>`, whose
|
||||
specialization is not implemented by this libc++ (`__cpp_lib_atomic_shared_ptr`
|
||||
absent). A portable fallback is needed.
|
||||
- Several `TestingMock` tests need `std::move_only_function`, also absent
|
||||
from this libc++.
|
||||
```bash
|
||||
emcmake cmake -S . -B build-wasm-tests -G Ninja -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_CXX_FLAGS="-fexceptions -pthread" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-fexceptions -pthread -sSTACK_SIZE=16777216 \
|
||||
-sINITIAL_MEMORY=134217728 -sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1073741824" \
|
||||
-DVOID_ENABLE_TESTING=ON \
|
||||
-DVOID_ENABLED_MODULES="Algorithms;Binary;Containers;Core;Data;Functional;LogState;Math;Memory;Testing;TestingMock;Text;Time;Unicode"
|
||||
cmake --build build-wasm-tests
|
||||
node build-wasm-tests/tests/VoidTests.js --no-color
|
||||
```
|
||||
|
||||
Static linking (`BUILD_SHARED_LIBS=OFF`) is required for exception handling
|
||||
across the test binary; `-fexceptions` enables catching, `-pthread` enables
|
||||
the threading tests, and the stack/memory flags accommodate the deepest
|
||||
recursive tests.
|
||||
|
||||
Portable fallbacks added for libc++ without the C++23/26 pieces:
|
||||
`Core/Publication` uses a mutex-protected `shared_ptr` when
|
||||
`__cpp_lib_atomic_shared_ptr` is absent, and `TestingMock` uses an internal
|
||||
move-only function wrapper when `__cpp_lib_move_only_function` is absent.
|
||||
|
||||
Reflection-dependent test files are gated with `// @requires-reflection`
|
||||
(Core/Meta, Core/FlagsReflect, Data/CsvReflect, Data/Reflect*,
|
||||
|
||||
Reference in new issue
Block a user