Skip to content

Commit

Permalink
Improvements to emscripten test shell scripts (#21)
Browse files Browse the repository at this point in the history
This fixes the C++ unwinding tests and makes other minor improvements
to the Emscripten test shell scripts.
  • Loading branch information
hoodmane committed Jan 27, 2023
1 parent e7582c7 commit 3a4ca23
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
9 changes: 8 additions & 1 deletion testsuite/emscripten-test-stuff/build-tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/sh
emcc_exists="$(command -v emcc)"
if [ ! "${emcc_exists}" ]; then
echo "Emscripten not on path"
exit 1
fi

set -e

cd "$1"
export CFLAGS="-fPIC -I../../target/include $EXTRA_CFLAGS"
export CFLAGS="-fPIC -O2 -I../../target/include $EXTRA_CFLAGS"
export CXXFLAGS="-fPIC -I../../target/include -sNO_DISABLE_EXCEPTION_CATCHING -g3 $EXTRA_CFLAGS"
export LDFLAGS=" \
-sEXPORT_ALL \
Expand Down
26 changes: 18 additions & 8 deletions testsuite/emscripten-test-stuff/node-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# JS BigInt to Wasm i64 integration, disabled by default
WASM_BIGINT=false

emcc_exists="$(command -v emcc)"
if [ ! "${emcc_exists}" ]; then
echo "Emscripten not on path"
exit 1
fi


# Parse arguments
while [ $# -gt 0 ]; do
case $1 in
Expand All @@ -13,25 +20,28 @@ while [ $# -gt 0 ]; do
done

# Common compiler flags
export CFLAGS="-O3 -fPIC"
export CFLAGS="-fPIC"
if [ "$WASM_BIGINT" = "true" ]; then
# We need to detect WASM_BIGINT support at compile time
export CFLAGS+=" -DWASM_BIGINT"
fi
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-sEXPORTED_FUNCTIONS=_main,_malloc,_free -sALLOW_TABLE_GROWTH -sASSERTIONS"
export CXXFLAGS="$CFLAGS -sNO_DISABLE_EXCEPTION_CATCHING"
export LDFLAGS="-sEXPORTED_FUNCTIONS=_main,_malloc,_free -sALLOW_TABLE_GROWTH -sASSERTIONS -sNO_DISABLE_EXCEPTION_CATCHING"
if [ "$WASM_BIGINT" = "true" ]; then
export LDFLAGS+=" -sWASM_BIGINT"
else
export LDFLAGS+=" -sEXPORTED_RUNTIME_METHODS='getTempRet0,setTempRet0'"
fi

# Specific variables for cross-compilation
export CHOST="wasm32-unknown-linux" # wasm32-unknown-emscripten

autoreconf -fiv
emconfigure ./configure --host=$CHOST --enable-static --disable-shared \
--disable-builddir --disable-multi-os-directory --disable-raw-api --disable-docs || (cat config.log && exit 1)
emconfigure ./configure --prefix="`pwd`/target" --host=$CHOST --enable-static --disable-shared \
--disable-builddir --disable-multi-os-directory --disable-raw-api --disable-docs \
|| (cat config.log && exit 1)
make
#EMMAKEN_JUST_CONFIGURE=1 emmake make check \
# RUNTESTFLAGS="libffi.closures/closure.exp LDFLAGS_FOR_TARGET='$LDFLAGS'" || (cat testsuite/libffi.log && exit 1)


EMMAKEN_JUST_CONFIGURE=1 emmake make check \
RUNTESTFLAGS="LDFLAGS_FOR_TARGET='$LDFLAGS' -v -v" || (cat testsuite/libffi.log && exit 1)
RUNTESTFLAGS="LDFLAGS_FOR_TARGET='$LDFLAGS'" || (cat testsuite/libffi.log && exit 1)

0 comments on commit 3a4ca23

Please sign in to comment.