Source-Changes-HG archive

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

[src/trunk]: src Add new test-suite t_dummy for libpthread_dbg



details:   https://anonhg.NetBSD.org/src/rev/0a2fa830f016
branches:  trunk
changeset: 348939:0a2fa830f016
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Nov 16 21:36:22 2016 +0000

description:
Add new test-suite t_dummy for libpthread_dbg

At the moment this test does nothing except reports failure from td_open()
for overloaded (implemented) dummy1_proc_lookup() (.proc_lookup from
td_proc_callbacks_t) of the following form:

static int
dummy1_proc_lookup(void *arg, const char *sym, caddr_t *addr)
{
        return TD_ERR_ERR;
}

This file and directory with tests is placeholder for new ones, without
further need to alter mtree and distribution sets.

The libpthread_dbg interface and library is used by gdb(1) to handle
threads in applications.

Sponsored by <The NetBSD Foundation>

diffstat:

 distrib/sets/lists/debug/mi        |    3 +-
 distrib/sets/lists/tests/mi        |    7 ++-
 etc/mtree/NetBSD.dist.tests        |    4 +-
 tests/lib/Makefile                 |    7 +-
 tests/lib/libpthread_dbg/Makefile  |   13 ++++
 tests/lib/libpthread_dbg/t_dummy.c |  105 +++++++++++++++++++++++++++++++++++++
 6 files changed, 133 insertions(+), 6 deletions(-)

diffs (214 lines):

diff -r ed5208c1eea7 -r 0a2fa830f016 distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi       Wed Nov 16 19:39:38 2016 +0000
+++ b/distrib/sets/lists/debug/mi       Wed Nov 16 21:36:22 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.177 2016/11/15 12:59:33 skrll Exp $
+# $NetBSD: mi,v 1.178 2016/11/16 21:36:22 kamil Exp $
 ./etc/mtree/set.debug                           comp-sys-root
 ./usr/lib                                      comp-sys-usr            compatdir
 ./usr/lib/i18n/libBIG5_g.a                     comp-c-debuglib         debuglib,compatfile
@@ -2173,6 +2173,7 @@
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_status.debug            tests-obsolete          obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_swapcontext.debug       tests-lib-tests         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_timedmutex.debug                tests-lib-tests         debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libpthread_dbg/t_dummy.debug         tests-lib-tests         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/librt/t_sched.debug                  tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/librt/t_sem.debug                    tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/librefuse/t_refuse_opt.debug         tests-lib-debug         debug,atf,compattestfile
diff -r ed5208c1eea7 -r 0a2fa830f016 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed Nov 16 19:39:38 2016 +0000
+++ b/distrib/sets/lists/tests/mi       Wed Nov 16 21:36:22 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.700 2016/11/15 12:59:33 skrll Exp $
+# $NetBSD: mi,v 1.701 2016/11/16 21:36:23 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -128,6 +128,7 @@
 ./usr/libdata/debug/usr/tests/lib/libprop                              tests-lib-debug         compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libpthread                           tests-lib-debug         compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libpthread/dlopen                    tests-lib-debug         compattestfile,atf
+./usr/libdata/debug/usr/tests/lib/libpthread_dbg                       tests-lib-debug         compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/librt                                        tests-lib-debug         compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/librefuse                            tests-lib-debug         compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/librumpclient                                tests-lib-debug         compattestfile,atf
@@ -3015,6 +3016,10 @@
 ./usr/tests/lib/libpthread/t_status            tests-obsolete          obsolete
 ./usr/tests/lib/libpthread/t_swapcontext       tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libpthread/t_timedmutex                tests-lib-tests         compattestfile,atf
+./usr/tests/lib/libpthread_dbg                 tests-lib-tests         compattestfile,atf
+./usr/tests/lib/libpthread_dbg/Atffile         tests-lib-tests         compattestfile,atf
+./usr/tests/lib/libpthread_dbg/Kyuafile                tests-lib-tests         compattestfile,atf,kyua
+./usr/tests/lib/libpthread_dbg/t_dummy         tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/librt                          tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/librt/Atffile                  tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/librt/Kyuafile                 tests-lib-tests         compattestfile,atf,kyua
diff -r ed5208c1eea7 -r 0a2fa830f016 etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests       Wed Nov 16 19:39:38 2016 +0000
+++ b/etc/mtree/NetBSD.dist.tests       Wed Nov 16 21:36:22 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: NetBSD.dist.tests,v 1.133 2016/11/15 12:59:33 skrll Exp $
+#      $NetBSD: NetBSD.dist.tests,v 1.134 2016/11/16 21:36:23 kamil Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -116,6 +116,7 @@
 ./usr/libdata/debug/usr/tests/lib/libprop
 ./usr/libdata/debug/usr/tests/lib/libpthread
 ./usr/libdata/debug/usr/tests/lib/libpthread/dlopen
+./usr/libdata/debug/usr/tests/lib/libpthread_dbg
 ./usr/libdata/debug/usr/tests/lib/librefuse
 ./usr/libdata/debug/usr/tests/lib/librt
 ./usr/libdata/debug/usr/tests/lib/librumpclient
@@ -301,6 +302,7 @@
 ./usr/tests/lib/libprop
 ./usr/tests/lib/libpthread
 ./usr/tests/lib/libpthread/dlopen
+./usr/tests/lib/libpthread_dbg
 ./usr/tests/lib/librefuse
 ./usr/tests/lib/librt
 ./usr/tests/lib/librumpclient
diff -r ed5208c1eea7 -r 0a2fa830f016 tests/lib/Makefile
--- a/tests/lib/Makefile        Wed Nov 16 19:39:38 2016 +0000
+++ b/tests/lib/Makefile        Wed Nov 16 21:36:22 2016 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.26 2016/11/14 16:10:31 pho Exp $
+# $NetBSD: Makefile,v 1.27 2016/11/16 21:36:23 kamil Exp $
 
 .include <bsd.own.mk>
 
 TESTS_SUBDIRS= csu libbluetooth libc libcrypt libcurses libevent libexecinfo \
-               libm libobjc libposix libppath libprop libpthread librefuse \
-               librt libtre libusbhid libutil semaphore
+               libm libobjc libposix libppath libprop libpthread \
+               libpthread_dbg librefuse librt libtre libusbhid libutil \
+               semaphore
 
 .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)
 TESTS_SUBDIRS+= librumpclient librumphijack
diff -r ed5208c1eea7 -r 0a2fa830f016 tests/lib/libpthread_dbg/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread_dbg/Makefile Wed Nov 16 21:36:22 2016 +0000
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1 2016/11/16 21:36:23 kamil Exp $
+
+NOMAN=         # defined
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/lib/libpthread_dbg
+LDADD+=                -lpthread
+LDADD+=                -lpthread_dbg
+
+TESTS_C+=      t_dummy
+
+.include <bsd.test.mk>
diff -r ed5208c1eea7 -r 0a2fa830f016 tests/lib/libpthread_dbg/t_dummy.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread_dbg/t_dummy.c        Wed Nov 16 21:36:22 2016 +0000
@@ -0,0 +1,105 @@
+/*     $NetBSD: t_dummy.c,v 1.1 2016/11/16 21:36:23 kamil Exp $        */
+
+/*-
+ * Copyright (c) 2016 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/cdefs.h>
+__RCSID("$NetBSD: t_dummy.c,v 1.1 2016/11/16 21:36:23 kamil Exp $");
+
+#include <pthread.h>
+#include <pthread_dbg.h>
+
+#include <atf-c.h>
+
+static int
+dummy1_proc_read(void *arg, caddr_t addr, void *buf, size_t size)
+{
+       return TD_ERR_ERR;
+}
+
+static int
+dummy1_proc_write(void *arg, caddr_t addr, void *buf, size_t size)
+{
+       return TD_ERR_ERR;
+}
+
+static int
+dummy1_proc_lookup(void *arg, const char *sym, caddr_t *addr)
+{
+       return TD_ERR_ERR;
+}
+
+static int
+dummy1_proc_regsize(void *arg, int regset, size_t *size)
+{
+       return TD_ERR_ERR;
+}
+ 
+static int
+dummy1_proc_getregs(void *arg, int regset, int lwp, void *buf)   
+{
+       return TD_ERR_ERR;
+}
+
+static int
+dummy1_proc_setregs(void *arg, int regset, int lwp, void *buf)
+{
+       return TD_ERR_ERR;
+}
+
+
+ATF_TC(dummy1);
+ATF_TC_HEAD(dummy1, tc)
+{
+
+       atf_tc_set_md_var(tc, "descr",
+           "Asserts that dummy lookup functions stops td_open()");
+}
+
+ATF_TC_BODY(dummy1, tc)
+{
+
+       struct td_proc_callbacks_t dummy1_callbacks;
+       td_proc_t *main_ta;
+
+       dummy1_callbacks.proc_read      = dummy1_proc_read;
+       dummy1_callbacks.proc_write     = dummy1_proc_write;
+       dummy1_callbacks.proc_lookup    = dummy1_proc_lookup;
+       dummy1_callbacks.proc_regsize   = dummy1_proc_regsize;
+       dummy1_callbacks.proc_getregs   = dummy1_proc_getregs;
+       dummy1_callbacks.proc_setregs   = dummy1_proc_setregs;
+
+       ATF_REQUIRE(td_open(&dummy1_callbacks, NULL, &main_ta) == TD_ERR_ERR);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+       ATF_TP_ADD_TC(tp, dummy1);
+
+       return atf_no_error();
+}



Home | Main Index | Thread Index | Old Index