summaryrefslogtreecommitdiff
path: root/testsuite/dlopen-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/dlopen-test.c')
-rw-r--r--testsuite/dlopen-test.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
new file mode 100644
index 00000000..7a638457
--- /dev/null
+++ b/testsuite/dlopen-test.c
@@ -0,0 +1,35 @@
+#include "testutils.h"
+#include "version.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+int
+main (int argc, char **argv)
+{
+#if HAVE_LIBDL
+ void *handle = dlopen ("../libnettle.so", RTLD_NOW);
+ int (*get_version)(void);
+ if (!handle)
+ {
+ fprintf (stderr, "dlopen failed: %s\n", dlerror());
+ FAIL ();
+ }
+
+ get_version = (int(*)(void)) dlsym (handle, "nettle_version_minor");
+ if (!get_version)
+ {
+ fprintf (stderr, "dlsym failed: %s\n", dlerror());
+ FAIL ();
+ }
+ if (get_version() != NETTLE_VERSION_MINOR)
+ {
+ fprintf (stderr, "unexpected nettle version\n");
+ FAIL ();
+ }
+ return EXIT_SUCCESS;
+#else
+ SKIP();
+#endif
+}