lix-releng-staging/tests/functional/plugins.sh
Pierre Bourdon e9ca5c92d2
tests: don't build test plugin shared libs on static builds
This changes the way plugins.sh is excluded to remove the need for
BUILD_SHARED_LIBS along the way.

Change-Id: I19fe55b4a37c49a11fffa61c8a3be7e8d1a51b4d
2024-05-12 23:04:21 +02:00

27 lines
1 KiB
Bash

source common.sh
# FIXME(Qyriad): this is working around Meson putting `libplugintest.so.p` in the same place
# as `libplugintest.so`, so `libplugintest.*` grabs both.
libext=so
if [[ "$(uname -s)" == Darwin ]]; then
libext=dylib
fi
res=$(nix --option setting-set true --option plugin-files "$PWD/plugins/libplugintest.$libext" eval --expr builtins.anotherNull)
[ "$res"x = "nullx" ]
# Plugin load failing due to missing symbols
res=$(nix --option plugin-files "$PWD/plugins/libplugintestfail.$libext" eval --expr '1234 + 5' 2>&1)
# We expect this to succeed evaluating
echo "$res" | grep 1239 >/dev/null
# On Linux, we expect this to print some failure of dlopen.
# Only on Linux do we expect for sure that -z now is set on the .so file, so it
# will definitely fail to load instead of lazy loading (and thus not hitting
# the missing symbol).
# FIXME(jade): does there exist an equivalent of -z now on macOS that eluded us
# in search?
if [[ "$(uname -s)" == Linux ]]; then
echo "$res" | grep "could not dynamically open plugin file" >/dev/null
fi