#2020/01/30 Patch has not yet been accepted upstream From 30403cfef2327e1df92b5e29201ee1ddf54a8dfd Mon Sep 17 00:00:00 2001 From: Eric Timmons Date: Sun, 2 Dec 2018 14:20:24 -0500 Subject: [PATCH 3/4] Fix foreign tests on musl libc Musl libc's implementation of dlclose(3) is (intentionally) a noop (see: https://wiki.musl-libc.org/functional-differences-from-glibc.html). Add a build time test for this and a new feature :os-dlclose-is-noop. Additionally, use this feature to skip some regression tests if it is present. --- tests/foreign.test.sh | 42 +++++++++++-------- tools-for-build/Makefile | 3 ++ tools-for-build/grovel-features.sh | 7 ++++ .../os-dlclose-is-noop-test-helper.c | 1 + tools-for-build/os-dlclose-is-noop-test.c | 19 +++++++++ 5 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 tools-for-build/os-dlclose-is-noop-test-helper.c create mode 100644 tools-for-build/os-dlclose-is-noop-test.c diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index fabba1246..5574b1ef7 100755 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -250,16 +250,20 @@ cat > $TEST_FILESTEM.test.lisp < $TEST_FILESTEM.test.lisp < /dev/null 2>&1 + +featurep os-dlclose-is-noop + +rm -f os-dlclose-is-noop-test-helper.so diff --git a/tools-for-build/os-dlclose-is-noop-test-helper.c b/tools-for-build/os-dlclose-is-noop-test-helper.c new file mode 100644 index 000000000..4be7a8e5b --- /dev/null +++ b/tools-for-build/os-dlclose-is-noop-test-helper.c @@ -0,0 +1 @@ +int sbcl_dl_close_test = 42; diff --git a/tools-for-build/os-dlclose-is-noop-test.c b/tools-for-build/os-dlclose-is-noop-test.c new file mode 100644 index 000000000..3678870d5 --- /dev/null +++ b/tools-for-build/os-dlclose-is-noop-test.c @@ -0,0 +1,19 @@ +/* test to build and run so that we know if we have a noop dlclose + */ + +#include +#include + +int main () +{ + void * handle = dlopen("./os-dlclose-is-noop-test-helper.so", RTLD_NOW | RTLD_GLOBAL); + dlclose(handle); + + handle = dlopen("./os-dlclose-is-noop-test-helper.so", RTLD_NOW | RTLD_NOLOAD); + + if (handle != NULL) { + return 104; + } else { + return 0; + } +} -- 2.24.1