Debian Codegraph @

src/test/test-dlopen-so.c

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "acl-util.h"
4 #include "apparmor-util.h"
5 #include "blkid-util.h"
6 #include "bpf-util.h"
7 #include "compress.h"
8 #include "crypto-util.h"
9 #include "cryptsetup-util.h"
10 #include "curl-util.h"
11 #include "elf-util.h"
12 #include "fdisk-util.h"
13 #include "gcrypt-util.h"
14 #include "gnutls-util.h"
15 #include "idn-util.h"
16 #include "libarchive-util.h"
17 #include "libaudit-util.h"
18 #include "libcrypt-util.h"
19 #include "libfido2-util.h"
20 #include "libmount-util.h"
21 #include "locale-util.h"
22 #include "main-func.h"
23 #include "microhttpd-util.h"
24 #include "module-util.h"
25 #include "pam-util.h"
26 #include "password-quality-util-passwdqc.h"
27 #include "password-quality-util-pwquality.h"
28 #include "pcre2-util.h"
29 #include "pkcs11-util.h"
30 #include "qrcode-util.h"
31 #include "seccomp-util.h"
32 #include "selinux-util.h"
33 #include "ssl-util.h"
34 #include "tests.h"
35 #include "tpm2-util.h"
36
37 #define ASSERT_DLOPEN(func, cond) \
38 do { \
39 if (cond) \
40 ASSERT_OK(func(LOG_DEBUG)); \
41 else \
42 ASSERT_ERROR(func(LOG_DEBUG), EOPNOTSUPP); \
43 } while (false)
44
45 static int run(int argc, char **argv) {
46 test_setup_logging(LOG_DEBUG);
47
48 /* Try to load each of our weak library dependencies once. This is supposed to help finding cases
49 * where .so versions change and distributions update, but systemd doesn't have the new so names
50 * around yet. */
51
52 ASSERT_DLOPEN(dlopen_bzip2, HAVE_BZIP2);
53 ASSERT_DLOPEN(dlopen_bpf, HAVE_LIBBPF);
54 ASSERT_DLOPEN(dlopen_cryptsetup, HAVE_LIBCRYPTSETUP);
55 ASSERT_DLOPEN(dlopen_curl, HAVE_LIBCURL);
56 ASSERT_DLOPEN(dlopen_dw, HAVE_ELFUTILS);
57 ASSERT_DLOPEN(dlopen_elf, HAVE_ELFUTILS);
58 ASSERT_DLOPEN(dlopen_fdisk, HAVE_LIBFDISK);
59 ASSERT_DLOPEN(dlopen_gcrypt, HAVE_GCRYPT);
60 ASSERT_DLOPEN(dlopen_gnutls, HAVE_GNUTLS);
61 ASSERT_DLOPEN(dlopen_idn, HAVE_LIBIDN2);
62 ASSERT_DLOPEN(dlopen_libacl, HAVE_ACL);
63 ASSERT_DLOPEN(dlopen_libapparmor, HAVE_APPARMOR);
64 ASSERT_DLOPEN(dlopen_libarchive, HAVE_LIBARCHIVE);
65 ASSERT_DLOPEN(dlopen_libaudit, HAVE_AUDIT);
66 ASSERT_DLOPEN(dlopen_libblkid, HAVE_BLKID);
67 ASSERT_DLOPEN(dlopen_libcrypt, HAVE_LIBCRYPT);
68 ASSERT_DLOPEN(dlopen_libfido2, HAVE_LIBFIDO2);
69 ASSERT_OK(dlopen_libintl(LOG_DEBUG)); /* Required to be available at build time. */
70 ASSERT_DLOPEN(dlopen_libkmod, HAVE_KMOD);
71 ASSERT_DLOPEN(dlopen_libmount, HAVE_LIBMOUNT);
72 ASSERT_DLOPEN(dlopen_libpam, HAVE_PAM);
73 ASSERT_DLOPEN(dlopen_libseccomp, HAVE_SECCOMP);
74 ASSERT_DLOPEN(dlopen_libselinux, HAVE_SELINUX);
75 ASSERT_DLOPEN(dlopen_libcrypto, HAVE_OPENSSL);
76 ASSERT_DLOPEN(dlopen_libssl, HAVE_OPENSSL);
77 ASSERT_DLOPEN(dlopen_xz, HAVE_XZ);
78 ASSERT_DLOPEN(dlopen_lz4, HAVE_LZ4);
79 ASSERT_DLOPEN(dlopen_microhttpd, HAVE_MICROHTTPD);
80 ASSERT_DLOPEN(dlopen_p11kit, HAVE_P11KIT);
81 ASSERT_DLOPEN(dlopen_passwdqc, HAVE_PASSWDQC);
82 ASSERT_DLOPEN(dlopen_pcre2, HAVE_PCRE2);
83 ASSERT_DLOPEN(dlopen_pwquality, HAVE_PWQUALITY);
84 ASSERT_DLOPEN(dlopen_qrencode, HAVE_QRENCODE);
85 ASSERT_DLOPEN(dlopen_tpm2, HAVE_TPM2);
86 ASSERT_DLOPEN(dlopen_zlib, HAVE_ZLIB);
87 ASSERT_DLOPEN(dlopen_zstd, HAVE_ZSTD);
88
89 return 0;
90 }
91
92 DEFINE_MAIN_FUNCTION(run);