Module Name: src
Committed By: skrll
Date: Tue Dec 14 05:57:32 UTC 2010
Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/libexec/ld.elf_so: Makefile
Added Files:
src/tests/libexec/ld.elf_so: t_dlerror-cleared.c t_dlerror-false.c
Removed Files:
src/regress/usr.bin/rtld/dlerror-cleared: Makefile dlerror-cleared.c
src/regress/usr.bin/rtld/dlerror-false: Makefile dlerror-false.c
src/regress/usr.bin/rtld/dlopen: Makefile dlopen.c dlopen.exp
Log Message:
Convert a couple of old regress tests to ATF.
Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).
To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.1 -r0 src/regress/usr.bin/rtld/dlerror-cleared/Makefile
cvs rdiff -u -r1.3 -r0 \
src/regress/usr.bin/rtld/dlerror-cleared/dlerror-cleared.c
cvs rdiff -u -r1.1 -r0 src/regress/usr.bin/rtld/dlerror-false/Makefile
cvs rdiff -u -r1.2 -r0 src/regress/usr.bin/rtld/dlerror-false/dlerror-false.c
cvs rdiff -u -r1.8 -r0 src/regress/usr.bin/rtld/dlopen/Makefile
cvs rdiff -u -r1.4 -r0 src/regress/usr.bin/rtld/dlopen/dlopen.c
cvs rdiff -u -r1.1 -r0 src/regress/usr.bin/rtld/dlopen/dlopen.exp
cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/libexec/ld.elf_so/t_dlerror-cleared.c \
src/tests/libexec/ld.elf_so/t_dlerror-false.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.172 src/distrib/sets/lists/tests/mi:1.173
--- src/distrib/sets/lists/tests/mi:1.172 Mon Dec 13 13:39:42 2010
+++ src/distrib/sets/lists/tests/mi Tue Dec 14 05:57:31 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.172 2010/12/13 13:39:42 pooka Exp $
+# $NetBSD: mi,v 1.173 2010/12/14 05:57:31 skrll Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -380,6 +380,10 @@
./usr/libdata/debug/usr/tests/lib/libutil/t_sockaddr_snprintf.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/libexec tests-lib-debug
./usr/libdata/debug/usr/tests/libexec/ld.elf_so tests-libexec-debug
+./usr/libdata/debug/usr/tests/libexec/ld.elf_so/h_df_1_noopen1.debug tests-libexec-debug debug,atf
+./usr/libdata/debug/usr/tests/libexec/ld.elf_so/h_df_1_noopen2.debug tests-libexec-debug debug,atf
+./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlerror-cleared.debug tests-libexec-debug debug,atf
+./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlerror-false.debug tests-libexec-debug debug,atf
./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlinfo.debug tests-libexec-debug debug,atf
./usr/libdata/debug/usr/tests/modules tests-sys-debug
./usr/libdata/debug/usr/tests/modules/t_builtin.debug tests-sys-debug debug,atf
@@ -1609,6 +1613,11 @@
./usr/tests/libexec/Atffile tests-lib-tests atf
./usr/tests/libexec/ld.elf_so tests-libexec-tests
./usr/tests/libexec/ld.elf_so/Atffile tests-libexec-tests atf
+./usr/tests/libexec/ld.elf_so/h_df_1_noopen1 tests-libexec-tests atf
+./usr/tests/libexec/ld.elf_so/h_df_1_noopen2 tests-libexec-tests atf
+./usr/tests/libexec/ld.elf_so/t_df_1_noopen tests-libexec-tests atf
+./usr/tests/libexec/ld.elf_so/t_dlerror-cleared tests-libexec-tests atf
+./usr/tests/libexec/ld.elf_so/t_dlerror-false tests-libexec-tests atf
./usr/tests/libexec/ld.elf_so/t_dlinfo tests-libexec-tests atf
./usr/tests/modules tests-sys-tests
./usr/tests/net tests-net-tests
Index: src/tests/libexec/ld.elf_so/Makefile
diff -u src/tests/libexec/ld.elf_so/Makefile:1.1 src/tests/libexec/ld.elf_so/Makefile:1.2
--- src/tests/libexec/ld.elf_so/Makefile:1.1 Thu Sep 24 21:33:45 2009
+++ src/tests/libexec/ld.elf_so/Makefile Tue Dec 14 05:57:32 2010
@@ -5,6 +5,8 @@
TESTSDIR= ${TESTSBASE}/libexec/ld.elf_so
-TESTS_C+= t_dlinfo
+TESTS_C+= t_dlerror-cleared t_dlerror-false t_dlinfo
+
+LDADD.t_dlerror-false= -Wl,-rpath,/var/nonexistent/lib
.include <bsd.test.mk>
Added files:
Index: src/tests/libexec/ld.elf_so/t_dlerror-cleared.c
diff -u /dev/null src/tests/libexec/ld.elf_so/t_dlerror-cleared.c:1.1
--- /dev/null Tue Dec 14 05:57:32 2010
+++ src/tests/libexec/ld.elf_so/t_dlerror-cleared.c Tue Dec 14 05:57:32 2010
@@ -0,0 +1,67 @@
+/* $NetBSD: t_dlerror-cleared.c,v 1.1 2010/12/14 05:57:32 skrll Exp $ */
+
+/*
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+
+#include <atf-c.h>
+#include <dlfcn.h>
+#include <link_elf.h>
+
+#include "../../h_macros.h"
+
+ATF_TC(rtld_dlerror_cleared);
+ATF_TC_HEAD(rtld_dlerror_cleared, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "error set by dlopen persists past a successful dlopen call");
+}
+
+ATF_TC_BODY(rtld_dlerror_cleared, tc)
+{
+ void *handle;
+ char *error;
+
+ /*
+ * Test that an error set by dlopen() persists past a successful
+ * dlopen() call.
+ */
+ handle = dlopen("libnonexistent.so", RTLD_LAZY);
+ ATF_CHECK(handle == NULL);
+ handle = dlopen("libm.so", RTLD_NOW);
+ ATF_CHECK(handle);
+ error = dlerror();
+ ATF_CHECK(error);
+
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, rtld_dlerror_cleared);
+ return 0;
+}
Index: src/tests/libexec/ld.elf_so/t_dlerror-false.c
diff -u /dev/null src/tests/libexec/ld.elf_so/t_dlerror-false.c:1.1
--- /dev/null Tue Dec 14 05:57:32 2010
+++ src/tests/libexec/ld.elf_so/t_dlerror-false.c Tue Dec 14 05:57:32 2010
@@ -0,0 +1,79 @@
+/* $NetBSD: t_dlerror-false.c,v 1.1 2010/12/14 05:57:32 skrll Exp $ */
+
+/*
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+
+#include <atf-c.h>
+#include <dlfcn.h>
+#include <link_elf.h>
+
+#include "../../h_macros.h"
+
+ATF_TC(rtld_dlerror_false);
+ATF_TC_HEAD(rtld_dlerror_false, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "error set by dlopen persists past a successful dlopen call");
+}
+
+ATF_TC_BODY(rtld_dlerror_false, tc)
+{
+ void *handle, *sym;
+ char *error;
+
+ /*
+ *
+ * Test for dlerror() being set by a successful library open.
+ * Requires that the rpath be set to something that does not
+ * include libm.so.
+ */
+
+ handle = dlopen("libm.so", RTLD_LAZY);
+ error = dlerror();
+ ATF_CHECK(error == NULL);
+ ATF_CHECK(handle != NULL);
+
+ sym = dlsym(handle, "sin");
+ error = dlerror();
+ ATF_CHECK(sym != NULL);
+ ATF_CHECK(error == NULL);
+
+ dlclose(handle);
+ error = dlerror();
+
+ ATF_CHECK(error == NULL);
+
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, rtld_dlerror_false);
+
+ return atf_no_error();
+}