summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2005-09-17 01:55:24 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2005-09-17 01:55:24 +0000
commita0bbe5ba7b550a8d834975e4a19f7aa2fe9e50ba (patch)
tree781e1daae046eacf8d30738816b0fdd76984f75b
parent4de6df3decb8b8b64766c4b51bef1b2acaf7ea2d (diff)
more like a real regression test, not just printfs.
-rw-r--r--regress/libexec/ld.so/dlopen/prog1/Makefile3
-rw-r--r--regress/libexec/ld.so/dlopen/prog1/prog1.C26
2 files changed, 20 insertions, 9 deletions
diff --git a/regress/libexec/ld.so/dlopen/prog1/Makefile b/regress/libexec/ld.so/dlopen/prog1/Makefile
index abc72d08365..8d42845e8cb 100644
--- a/regress/libexec/ld.so/dlopen/prog1/Makefile
+++ b/regress/libexec/ld.so/dlopen/prog1/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2005/09/13 20:51:39 drahn Exp $
+# $OpenBSD: Makefile,v 1.2 2005/09/17 01:55:23 drahn Exp $
.include <bsd.obj.mk>
@@ -23,6 +23,7 @@ AB_OBJDIR!= if [ -d $(AB_DIR)/${__objdir} ]; then \
CFLAGS=-I${.CURDIR}/../libab
+CFLAGS+=-g
LDADD=
#LDADD+=-lab
#LDADD+=-laa
diff --git a/regress/libexec/ld.so/dlopen/prog1/prog1.C b/regress/libexec/ld.so/dlopen/prog1/prog1.C
index cad1faf98fb..8ea62669af3 100644
--- a/regress/libexec/ld.so/dlopen/prog1/prog1.C
+++ b/regress/libexec/ld.so/dlopen/prog1/prog1.C
@@ -1,10 +1,11 @@
/*
* Public Domain 2003 Dale Rahn
*
- * $OpenBSD: prog1.C,v 1.1 2005/09/13 20:51:39 drahn Exp $
+ * $OpenBSD: prog1.C,v 1.2 2005/09/17 01:55:23 drahn Exp $
*/
#include <iostream>
#include <dlfcn.h>
+#include <string.h>
typedef void (v_func)(void);
int a;
int
@@ -18,26 +19,35 @@ main()
std::cout << "main\n";
handle1 = dlopen("libaa.so.0.0", DL_LAZY);
if (handle1 == NULL) {
- std::cout << "handle1 failed\n";
+ std::cout << "handle1 open libaa failed\n";
+ return (1);
}
handle2 = dlopen("libab.so.0.0", DL_LAZY);
if (handle2 == NULL) {
- std::cout << "handle1 failed\n";
+ std::cout << "handle2 open libab failed\n";
+ return (1);
}
- std::cout << "loaded \n";
+
libname = (char **)dlsym(handle1, "libname");
- std::cout << "handle1 is " << *libname << "\n";
+ if (strcmp(*libname, "libaa") != 0) {
+ std::cout << "handle1 is " << *libname << "\n";
+ return (1);
+ }
+
libname = (char **)dlsym(handle2, "libname");
- std::cout << "handle2 is " << *libname << "\n";
+ if (strcmp(*libname, "libab") != 0) {
+ std::cout << "handle2 is " << *libname << "\n";
+ return (1);
+ }
+
func = (v_func*)dlsym(handle1, "lib_entry");
(*func)();
+
func = (v_func*)dlsym(handle2, "lib_entry");
(*func)();
- std::cout << "closing \n";
dlclose(handle1);
dlclose(handle2);
- std::cout << "all done \n";
return 0;
}