From: Emil Velikov Date: Sat, 24 May 2025 11:57:11 +0000 (+0100) Subject: testsuite: fprintf() + abort() when dlsym() returns NULL X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f71e76fdaed68321246e84b19684effdd83ff75;p=thirdparty%2Fkmod.git testsuite: fprintf() + abort() when dlsym() returns NULL Currently each of our three dlsym() instances behaves differently. From seg-faulting, to abort() to assert(). Just use abort throughout, since assert() is no-op when NDEBUG is defined. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/355 Signed-off-by: Lucas De Marchi --- diff --git a/testsuite/path.c b/testsuite/path.c index 947a3915..06060b85 100644 --- a/testsuite/path.c +++ b/testsuite/path.c @@ -84,7 +84,11 @@ static void *get_libc_func(const char *f) void *fp; fp = dlsym(RTLD_NEXT, f); - assert(fp); + if (fp == NULL) { + fprintf(stderr, "FIXME FIXME FIXME: could not load %s symbol: %s\n", f, + dlerror()); + abort(); + } return fp; } diff --git a/testsuite/uname.c b/testsuite/uname.c index 0333f7a9..ffd274dc 100644 --- a/testsuite/uname.c +++ b/testsuite/uname.c @@ -20,8 +20,15 @@ TS_EXPORT int uname(struct utsname *u) int err; size_t sz; - if (nextlib_uname == NULL) + if (nextlib_uname == NULL) { nextlib_uname = dlsym(RTLD_NEXT, "uname"); + if (nextlib_uname == NULL) { + fprintf(stderr, + "FIXME FIXME FIXME: could not load uname symbol: %s\n", + dlerror()); + abort(); + } + } err = nextlib_uname(u); if (err < 0)