aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/plugins.sh
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-03-11 00:50:57 -0700
committerJade Lovelace <lix@jade.fyi>2024-03-15 12:31:16 -0700
commit0d85875c3a4284dabad79069758a9056898c42dc (patch)
tree482ab97522a63b1cadb34cffe8e9195725283d1e /tests/functional/plugins.sh
parent7d361f1a828ee800e2e5353169c31134cbd08f0d (diff)
Allow dlopen of plugins to fail
It happens with some frequency that plugins that might be unimportant to the evaluation at hand mismatch with the nix version, leading to spurious load failures. Let's make these non fatal. Change-Id: Iba10e951d171725ccf1a121bcd9be1e1d6ad69eb
Diffstat (limited to 'tests/functional/plugins.sh')
-rw-r--r--tests/functional/plugins.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/functional/plugins.sh b/tests/functional/plugins.sh
index baf71a362..491b933b7 100644
--- a/tests/functional/plugins.sh
+++ b/tests/functional/plugins.sh
@@ -4,6 +4,20 @@ if [[ $BUILD_SHARED_LIBS != 1 ]]; then
skipTest "Plugins are not supported"
fi
-res=$(nix --option setting-set true --option plugin-files $PWD/plugins/libplugintest* eval --expr builtins.anotherNull)
+res=$(nix --option setting-set true --option plugin-files $PWD/plugins/libplugintest.* eval --expr builtins.anotherNull)
[ "$res"x = "nullx" ]
+
+# Plugin load failing due to missing symbols
+res=$(nix --option plugin-files $PWD/plugins/libplugintestfail.* 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