summaryrefslogtreecommitdiff
path: root/src/test/test-dlopen.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-14 20:10:28 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-23 21:47:28 -0400
commit83b6af36d1ea1d1250ad2836c00193021e908cef (patch)
tree560bb4e198fd4d7638f1806c233daf15de55c718 /src/test/test-dlopen.c
parent3762b6722e24c17dccf1ec7d352b403469398ba4 (diff)
downloadsystemd-83b6af36d1ea1d1250ad2836c00193021e908cef.tar.gz
meson: add test-dlopen
test-dlopen is a very simple binary that is only linked with libc and libdl. From it we do dlopen() on the nss and pam modules to check that they are linked to all necessary libs. (meson-compiled nss modules are linked to less libraries, for whatever reason. I suspected that some deps are missing, but it turns out that my suspicions weren't justified, and the modules load just fine. Let's keep the test though, it is very quick, and might detect missing linkage in the future.)
Diffstat (limited to 'src/test/test-dlopen.c')
-rw-r--r--src/test/test-dlopen.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/test-dlopen.c b/src/test/test-dlopen.c
new file mode 100644
index 0000000000..9f5343a7ea
--- /dev/null
+++ b/src/test/test-dlopen.c
@@ -0,0 +1,32 @@
+/***
+ This file is part of systemd.
+
+ Copyright 2016 Zbigniew Jędrzejewski-Szmek
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <dlfcn.h>
+#include <stdlib.h>
+
+#include "macro.h"
+
+int main(int argc, char **argv) {
+ void *handle;
+
+ assert_se((handle = dlopen(argv[1], RTLD_NOW)));
+ assert_se(dlclose(handle) == 0);
+
+ return EXIT_SUCCESS;
+}