]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-dlopen-so.c
gcrypt: dlopenify for libsystemd
[thirdparty/systemd.git] / src / test / test-dlopen-so.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include <dlfcn.h>
4 #include <stdlib.h>
5
6 #include "bpf-dlopen.h"
7 #include "compress.h"
8 #include "cryptsetup-util.h"
9 #include "elf-util.h"
10 #include "gcrypt-util.h"
11 #include "idn-util.h"
12 #include "libarchive-util.h"
13 #include "libfido2-util.h"
14 #include "macro.h"
15 #include "main-func.h"
16 #include "password-quality-util-passwdqc.h"
17 #include "password-quality-util-pwquality.h"
18 #include "pcre2-util.h"
19 #include "pkcs11-util.h"
20 #include "qrcode-util.h"
21 #include "tests.h"
22 #include "tpm2-util.h"
23
24 static int run(int argc, char **argv) {
25 test_setup_logging(LOG_DEBUG);
26
27 /* Try to load each of our weak library dependencies once. This is supposed to help finding cases
28 * where .so versions change and distributions update, but systemd doesn't have the new so names
29 * around yet. */
30
31 #if HAVE_LIBIDN2 || HAVE_LIBIDN
32 assert_se(dlopen_idn() >= 0);
33 #endif
34
35 #if HAVE_LIBCRYPTSETUP
36 assert_se(dlopen_cryptsetup() >= 0);
37 #endif
38
39 #if HAVE_PASSWDQC
40 assert_se(dlopen_passwdqc() >= 0);
41 #endif
42
43 #if HAVE_PWQUALITY
44 assert_se(dlopen_pwquality() >= 0);
45 #endif
46
47 #if HAVE_QRENCODE
48 assert_se(dlopen_qrencode() >= 0);
49 #endif
50
51 #if HAVE_TPM2
52 assert_se(dlopen_tpm2() >= 0);
53 #endif
54
55 #if HAVE_LIBFIDO2
56 assert_se(dlopen_libfido2() >= 0);
57 #endif
58
59 #if HAVE_LIBBPF
60 assert_se(dlopen_bpf() >= 0);
61 #endif
62
63 #if HAVE_ELFUTILS
64 assert_se(dlopen_dw() >= 0);
65 assert_se(dlopen_elf() >= 0);
66 #endif
67
68 #if HAVE_PCRE2
69 assert_se(dlopen_pcre2() >= 0);
70 #endif
71
72 #if HAVE_P11KIT
73 assert_se(dlopen_p11kit() >= 0);
74 #endif
75
76 #if HAVE_LIBARCHIVE
77 assert_se(dlopen_libarchive() >= 0);
78 #endif
79
80 #if HAVE_LZ4
81 assert_se(dlopen_lz4() >= 0);
82 #endif
83
84 #if HAVE_ZSTD
85 assert_se(dlopen_zstd() >= 0);
86 #endif
87
88 #if HAVE_XZ
89 assert_se(dlopen_lzma() >= 0);
90 #endif
91
92 #if HAVE_GCRYPT
93 assert_se(initialize_libgcrypt(/* secmem= */ false) >= 0);
94 #endif
95
96 return 0;
97 }
98
99 DEFINE_MAIN_FUNCTION(run);