Skip to content

Commit 161f350

Browse files
authored
Test emmalloc in CI (WebAssembly#683)
Currently we don't even test that it builds, so this adds it both to run the normal tests but additionally with Python as well. I found that if `-fno-strict-aliasing` was left out it would crash Python, so this is hopefully a pretty comprehensive test.
1 parent e0af707 commit 161f350

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ jobs:
142142
THREAD_MODEL: posix
143143
DEBUG: true
144144

145+
- name: Test emmalloc
146+
os: ubuntu-24.04
147+
clang_version: 19
148+
test: true
149+
env:
150+
TARGET_TRIPLE: wasm32-wasip1
151+
MALLOC_IMPL: emmalloc
152+
145153
steps:
146154
- uses: actions/[email protected]
147155
with:
@@ -169,7 +177,8 @@ jobs:
169177
cmake -S test -B testbuild -G Ninja \
170178
-DTARGET_TRIPLE=${{ env.TARGET_TRIPLE }} \
171179
-DENGINE=${{ env.ENGINE }} \
172-
-DCMAKE_LINK_DEPENDS_USE_LINKER=OFF
180+
-DCMAKE_LINK_DEPENDS_USE_LINKER=OFF \
181+
-DMALLOC_IMPL=${{ env.MALLOC_IMPL }}
173182
174183
- name: Build tests
175184
if: matrix.test
@@ -256,6 +265,9 @@ jobs:
256265
- env:
257266
TARGET_TRIPLE: wasm32-wasip2
258267
WASI_SNAPSHOT: p2
268+
- env:
269+
TARGET_TRIPLE: wasm32-wasip1
270+
MALLOC_IMPL: emmalloc
259271
steps:
260272
- uses: actions/[email protected]
261273
with:

test/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ include(CTest)
1515
enable_testing()
1616

1717
set(TARGET_TRIPLE "wasm32-wasi" CACHE STRING "WASI target to test")
18+
set(MALLOC_IMPL "" CACHE STRING "Malloc implementation in use")
1819
option(PYTHON_TESTS "Build Python with this wasi-libc and run its tests" OFF)
1920

2021
# ========= Sysroot sanity check ================================
@@ -234,6 +235,9 @@ add_libc_test(functional/memstream.c)
234235
add_libc_test(functional/qsort.c)
235236
add_libc_test(functional/random.c)
236237
add_libc_test(functional/search_hsearch.c)
238+
if (MALLOC_IMPL STREQUAL "emmalloc")
239+
set_tests_properties(libc_test_functional_search_hsearch.wasm PROPERTIES WILL_FAIL TRUE)
240+
endif()
237241
add_libc_test(functional/search_insque.c)
238242
add_libc_test(functional/search_lsearch.c)
239243
add_libc_test(functional/search_tsearch.c)

0 commit comments

Comments
 (0)