Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Convert a couple of old regress tests to ATF.



details:   https://anonhg.NetBSD.org/src/rev/b9aff0efeafc
branches:  trunk
changeset: 759638:b9aff0efeafc
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Dec 14 05:57:31 2010 +0000

description:
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).

diffstat:

 distrib/sets/lists/tests/mi                            |  11 ++-
 regress/usr.bin/rtld/dlerror-cleared/Makefile          |  10 --
 regress/usr.bin/rtld/dlerror-cleared/dlerror-cleared.c |  22 -----
 regress/usr.bin/rtld/dlerror-false/Makefile            |  12 --
 regress/usr.bin/rtld/dlerror-false/dlerror-false.c     |  38 --------
 regress/usr.bin/rtld/dlopen/Makefile                   |  19 ----
 regress/usr.bin/rtld/dlopen/dlopen.c                   |  44 ----------
 regress/usr.bin/rtld/dlopen/dlopen.exp                 |   6 -
 tests/libexec/ld.elf_so/Makefile                       |   4 +-
 tests/libexec/ld.elf_so/t_dlerror-cleared.c            |  67 +++++++++++++++
 tests/libexec/ld.elf_so/t_dlerror-false.c              |  79 ++++++++++++++++++
 11 files changed, 159 insertions(+), 153 deletions(-)

diffs (truncated from 380 to 300 lines):

diff -r ca9a96e5e8eb -r b9aff0efeafc distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Dec 14 04:04:20 2010 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Dec 14 05:57:31 2010 +0000
@@ -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
diff -r ca9a96e5e8eb -r b9aff0efeafc regress/usr.bin/rtld/dlerror-cleared/Makefile
--- a/regress/usr.bin/rtld/dlerror-cleared/Makefile     Tue Dec 14 04:04:20 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2002/11/14 21:10:46 nathanw Exp $
-
-NOMAN= # defined
-
-PROG=  dlerror-cleared
-
-regress:
-       ./${PROG}
-
-.include <bsd.prog.mk>
\ No newline at end of file
diff -r ca9a96e5e8eb -r b9aff0efeafc regress/usr.bin/rtld/dlerror-cleared/dlerror-cleared.c
--- a/regress/usr.bin/rtld/dlerror-cleared/dlerror-cleared.c    Tue Dec 14 04:04:20 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#include <stdio.h>
-#include <dlfcn.h>
-#include <err.h>
-
-int main(void)
-{
-       void *handle;
-       char *error;
-
-       /*
-        * Test that an error set by dlopen() persists past a successful
-        * dlopen() call.
-        */
-       handle = dlopen("libnonexistent.so", RTLD_LAZY);
-       handle = dlopen("libm.so", RTLD_NOW);
-       error = dlerror();
-       if (error == NULL)
-               errx(1, "Failed: dlerror() was cleared by successful dlopen()\n");
-       printf("OK: %s\n", error);
-       
-       return 0;
-}
diff -r ca9a96e5e8eb -r b9aff0efeafc regress/usr.bin/rtld/dlerror-false/Makefile
--- a/regress/usr.bin/rtld/dlerror-false/Makefile       Tue Dec 14 04:04:20 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2002/11/14 21:10:47 nathanw Exp $
-
-NOMAN= # defined
-
-PROG=  dlerror-false
-
-LDADD= -Wl,-rpath,/var/nonexistent/lib
-
-regress:
-       ./${PROG}
-
-.include <bsd.prog.mk>
\ No newline at end of file
diff -r ca9a96e5e8eb -r b9aff0efeafc regress/usr.bin/rtld/dlerror-false/dlerror-false.c
--- a/regress/usr.bin/rtld/dlerror-false/dlerror-false.c        Tue Dec 14 04:04:20 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#include <stdio.h>
-#include <dlfcn.h>
-#include <err.h>
-
-int main(void)
-{
-       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();
-       if (error != NULL)
-               errx(1, "Error opening libm.so: %s", error);
-       if (handle == NULL)
-               errx(1, "Library handle is NULL but dlerror not set.");
-
-       sym = dlsym(handle, "sin");
-       error = dlerror();
-       if (error != NULL)
-               errx(1, "Error looking up sin(): %s", error);
-       if (sym == NULL)
-               errx(1, "Looked-up symbol is NULL but dlerror not set.");
-
-       dlclose(handle);
-       error = dlerror();
-       if (error != NULL)
-               errx(1, "Error calling dlclose(): %s", error);
-
-       printf("OK\n");
-
-       return 0;
-}
diff -r ca9a96e5e8eb -r b9aff0efeafc regress/usr.bin/rtld/dlopen/Makefile
--- a/regress/usr.bin/rtld/dlopen/Makefile      Tue Dec 14 04:04:20 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-# $NetBSD: Makefile,v 1.8 2003/06/26 18:43:35 drochner Exp $
-
-NOMAN=         # defined
-
-PROG=          dlopen
-CLEANFILES+=   dlopen.out
-
-# we don't access program symbols from the shared object yet
-#LDADD+=       -export-dynamic
-
-regress:
-       if [ -f ${TESTLIBDIR}/libtest.so ]; then \
-               ./${PROG} ${TESTLIBDIR}/libtest.so >dlopen.out; \
-               tail +4 ${.CURDIR}/dlopen.exp | diff - dlopen.out; \
-       fi
-
-.include <bsd.prog.mk>
-
-TESTLIBDIR!=   cd ${.CURDIR}/../testlib && ${PRINTOBJDIR}
diff -r ca9a96e5e8eb -r b9aff0efeafc regress/usr.bin/rtld/dlopen/dlopen.c
--- a/regress/usr.bin/rtld/dlopen/dlopen.c      Tue Dec 14 04:04:20 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*     $NetBSD: dlopen.c,v 1.4 2008/04/28 20:23:07 martin Exp $        */
-
-/*-
- * Copyright (c) 2000 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 <stdio.h>
-#include <dlfcn.h>
-
-int
-main(int argc, char **argv)
-{
-       void *p;
-
-       p = dlopen(argv[1], RTLD_LAZY);
-       if (p)
-               printf("OK\n");
-       else
-               printf("%s\n", dlerror());
-
-       return (0);
-}
diff -r ca9a96e5e8eb -r b9aff0efeafc regress/usr.bin/rtld/dlopen/dlopen.exp
--- a/regress/usr.bin/rtld/dlopen/dlopen.exp    Tue Dec 14 04:04:20 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-# $NetBSD: dlopen.exp,v 1.1 2000/12/08 19:22:51 drochner Exp $
-# real output must start in line 4
-
-constructor
-OK
-destructor
diff -r ca9a96e5e8eb -r b9aff0efeafc tests/libexec/ld.elf_so/Makefile
--- a/tests/libexec/ld.elf_so/Makefile  Tue Dec 14 04:04:20 2010 +0000
+++ b/tests/libexec/ld.elf_so/Makefile  Tue Dec 14 05:57:31 2010 +0000
@@ -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>
diff -r ca9a96e5e8eb -r b9aff0efeafc tests/libexec/ld.elf_so/t_dlerror-cleared.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libexec/ld.elf_so/t_dlerror-cleared.c       Tue Dec 14 05:57:31 2010 +0000
@@ -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;
+}
diff -r ca9a96e5e8eb -r b9aff0efeafc tests/libexec/ld.elf_so/t_dlerror-false.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libexec/ld.elf_so/t_dlerror-false.c Tue Dec 14 05:57:31 2010 +0000



Home | Main Index | Thread Index | Old Index