diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-12-09 21:09:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 21:09:33 +0100 |
commit | 733558adef7787f1a66c301bc36c4740218d16aa (patch) | |
tree | c8256cccf67289876560df746489fa4bb08bb0a8 /src/test | |
parent | 4e1db59274c4b31ba5369270a489420245616eb4 (diff) | |
parent | a6c7811f0d3888e2fa545cd80d7815049b5cb084 (diff) | |
download | systemd-733558adef7787f1a66c301bc36c4740218d16aa.tar.gz |
Merge pull request #17884 from poettering/test-dlopen
tests: add test that dlopen()s our weak shared library deps once
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/meson.build | 4 | ||||
-rw-r--r-- | src/test/test-dlopen-so.c | 40 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/test/meson.build b/src/test/meson.build index 9e781f88dc..3afe5d58cb 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -71,6 +71,10 @@ tests += [ libshared], []], + [['src/test/test-dlopen-so.c'], + [libshared], + []], + [['src/test/test-job-type.c'], [libcore, libshared], diff --git a/src/test/test-dlopen-so.c b/src/test/test-dlopen-so.c new file mode 100644 index 0000000000..6436dc600f --- /dev/null +++ b/src/test/test-dlopen-so.c @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#include <dlfcn.h> +#include <stdlib.h> + +#include "cryptsetup-util.h" +#include "idn-util.h" +#include "macro.h" +#include "main-func.h" +#include "pwquality-util.h" +#include "qrcode-util.h" +#include "tests.h" + +static int run(int argc, char **argv) { + test_setup_logging(LOG_DEBUG); + + /* Try to load each of our weak library dependencies once. This is supposed to help finding cases + * where .so versions change and distributions update, but systemd doesn't have the new so names + * around yet. */ + +#if HAVE_LIBIDN2 || HAVE_LIBIDN + assert_se(dlopen_idn() >= 0); +#endif + +#if HAVE_LIBCRYPTSETUP + assert_se(dlopen_cryptsetup() >= 0); +#endif + +#if HAVE_PWQUALITY + assert_se(dlopen_pwquality() >= 0); +#endif + +#if HAVE_QRENCODE + assert_se(dlopen_qrencode() >= 0); +#endif + + return 0; +} + +DEFINE_MAIN_FUNCTION(run); |