From f781fea6f015a1f23707040ac9e161c031ec7b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adil=20Alperen=20=C3=87iftci?= Date: Thu, 29 Oct 2026 13:02:09 +0300 Subject: [PATCH] tests: run shared-map hosts with sandbox ABI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compile the in-process bridges with sandbox checker support and export each detected runtime library path before execution. This lets versioned Debian and Ubuntu runtimes reach the grant-map assertions instead of failing during setup. Signed-off-by: Adil Alperen Çiftci --- ...29T102000Z-fixed-shared-map-host-test-build.md | 4 ++++ tests/sandbox/detect_host_langs.sh | 15 +++++++++++++++ tests/sandbox/test_shared_map_all.sh | 10 +++++----- 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 new_changelogs/20261029T102000Z-fixed-shared-map-host-test-build.md diff --git a/new_changelogs/20261029T102000Z-fixed-shared-map-host-test-build.md b/new_changelogs/20261029T102000Z-fixed-shared-map-host-test-build.md new file mode 100644 index 000000000..e927408a7 --- /dev/null +++ b/new_changelogs/20261029T102000Z-fixed-shared-map-host-test-build.md @@ -0,0 +1,4 @@ +- **Shared-map host tests now exercise provisioned language runtimes.** The + Lua, JavaScript, Python, Perl, and Ruby bridges now compile with the + sandbox ABI enabled and receive their detected runtime library paths, + instead of failing before their grant-map checks run. diff --git a/tests/sandbox/detect_host_langs.sh b/tests/sandbox/detect_host_langs.sh index a9c805edc..78a049409 100644 --- a/tests/sandbox/detect_host_langs.sh +++ b/tests/sandbox/detect_host_langs.sh @@ -8,6 +8,9 @@ for v in lua5.4 lua5.3 lua5.2; do if pkg-config --exists $v 2>/dev/null; then LUA_CFLAGS=$(pkg-config --cflags $v) LUA_LIBS=$(pkg-config --libs $v) + LUA_LIBNAME=$(pkg-config --libs-only-l $v | sed -n 's/.*-l\([^ ]*\).*/lib\1.so/p') + AETHER_LUA_SONAME=$(ldconfig -p 2>/dev/null | awk -v lib="$LUA_LIBNAME" '$1 == lib { print $NF; exit }') + export AETHER_LUA_SONAME LUA_CMD=$(echo $v | tr -d '.') # lua54, lua53, etc — some systems use this # Try common command names for cmd in $v lua; do @@ -26,6 +29,8 @@ for v in python3 python3.12 python3.11 python3.10; do PY_CFLAGS=$($cfg --includes 2>/dev/null) PY_LIBS="-l$(echo $v | tr -d .)" # -lpython311 etc doesn't work, try embed PY_LIBS=$($cfg --ldflags --embed 2>/dev/null || $cfg --ldflags 2>/dev/null) + AETHER_PYTHON_SONAME=$($v -c 'import os, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR") or "", sysconfig.get_config_var("INSTSONAME") or ""))' 2>/dev/null) + export AETHER_PYTHON_SONAME PY_AVAILABLE=1 break fi @@ -36,6 +41,8 @@ if [ $PY_AVAILABLE -eq 0 ]; then if pkg-config --exists $v 2>/dev/null; then PY_CFLAGS=$(pkg-config --cflags $v) PY_LIBS=$(pkg-config --libs $v) + AETHER_PYTHON_SONAME=$(python3 -c 'import os, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR") or "", sysconfig.get_config_var("INSTSONAME") or ""))' 2>/dev/null) + export AETHER_PYTHON_SONAME PY_AVAILABLE=1 break fi @@ -53,6 +60,8 @@ if perl -MExtUtils::Embed -e ccopts >/dev/null 2>&1; then PERL_SO=$(find /usr/lib -name "$PERL_LIBDIR" 2>/dev/null | head -1) if [ -n "$PERL_SO" ]; then PERL_LIBS="$PERL_SO -ldl -lm -lpthread -lcrypt" + AETHER_PERL_SONAME="$PERL_SO" + export AETHER_PERL_SONAME fi fi # Fallback: try -lperl @@ -68,6 +77,10 @@ for v in ruby-3.3 ruby-3.2 ruby-3.1 ruby-3.0 ruby; do if pkg-config --exists $v 2>/dev/null; then RUBY_CFLAGS=$(pkg-config --cflags $v) RUBY_LIBS=$(pkg-config --libs $v) + if command -v ruby >/dev/null 2>&1; then + AETHER_RUBY_SONAME=$(ruby -rrbconfig -e 'print File.join(RbConfig::CONFIG["libdir"], RbConfig::CONFIG["LIBRUBY_SO"])' 2>/dev/null) + export AETHER_RUBY_SONAME + fi RUBY_AVAILABLE=1 break fi @@ -78,6 +91,8 @@ JS_AVAILABLE=0 if [ -f /usr/include/duktape.h ]; then JS_CFLAGS="" JS_LIBS="-lduktape" + AETHER_DUKTAPE_SONAME=$(ldconfig -p 2>/dev/null | awk '/libduktape\.so/ { print $NF; exit }') + export AETHER_DUKTAPE_SONAME JS_AVAILABLE=1 fi diff --git a/tests/sandbox/test_shared_map_all.sh b/tests/sandbox/test_shared_map_all.sh index 5b4a59faa..43e02db05 100755 --- a/tests/sandbox/test_shared_map_all.sh +++ b/tests/sandbox/test_shared_map_all.sh @@ -39,7 +39,7 @@ LUA_OUT=$(gcc -o $AE_TMP/test_map_lua \ "$ROOT/contrib/host/lua/aether_host_lua.c" \ "$ROOT/runtime/aether_sandbox.c" \ "$ROOT/runtime/aether_shared_map.c" \ - $LUA_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_LUA \ + $LUA_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_LUA -DAETHER_HAS_SANDBOX \ -L"$ROOT/build" -laether $LUA_LIBS -ldl -lm -lrt \ -Wno-discarded-qualifiers \ -xc - 2>/dev/null << 'CEOF' @@ -88,7 +88,7 @@ JS_OUT=$(gcc -o $AE_TMP/test_map_js \ "$ROOT/contrib/host/duktape/aether_host_duktape.c" \ "$ROOT/runtime/aether_sandbox.c" \ "$ROOT/runtime/aether_shared_map.c" \ - $JS_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_DUKTAPE \ + $JS_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_DUKTAPE -DAETHER_HAS_SANDBOX \ -L"$ROOT/build" -laether $JS_LIBS -ldl -lm -lrt \ -Wno-discarded-qualifiers \ -xc - 2>/dev/null << 'CEOF' @@ -135,7 +135,7 @@ PY_OUT=$(gcc -o $AE_TMP/test_map_py \ "$ROOT/contrib/host/python/aether_host_python.c" \ "$ROOT/runtime/aether_sandbox.c" \ "$ROOT/runtime/aether_shared_map.c" \ - $PY_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_PYTHON \ + $PY_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_PYTHON -DAETHER_HAS_SANDBOX \ -L"$ROOT/build" -laether $PY_LIBS -ldl -lm -lrt \ -Wno-discarded-qualifiers \ -xc - 2>/dev/null << 'CEOF' @@ -186,7 +186,7 @@ PERL_OUT=$(gcc -o $AE_TMP/test_map_perl \ "$ROOT/contrib/host/perl/aether_host_perl.c" \ "$ROOT/runtime/aether_sandbox.c" \ "$ROOT/runtime/aether_shared_map.c" \ - $PERL_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_PERL \ + $PERL_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_PERL -DAETHER_HAS_SANDBOX \ -L"$ROOT/build" -laether $PERL_LIBS -lrt \ -Wno-discarded-qualifiers \ -xc - 2>/dev/null << 'CEOF' @@ -233,7 +233,7 @@ RUBY_OUT=$(gcc -o $AE_TMP/test_map_ruby \ "$ROOT/contrib/host/ruby/aether_host_ruby.c" \ "$ROOT/runtime/aether_sandbox.c" \ "$ROOT/runtime/aether_shared_map.c" \ - $RUBY_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_RUBY \ + $RUBY_CFLAGS -I"$ROOT/runtime" -DAETHER_HAS_RUBY -DAETHER_HAS_SANDBOX \ -L"$ROOT/build" -laether $RUBY_LIBS -ldl -lm -lrt \ -Wno-discarded-qualifiers \ -xc - 2>/dev/null << 'CEOF'