Module Name:    src
Committed By:   kamil
Date:           Wed Nov 16 21:36:23 UTC 2016

Modified Files:
        src/distrib/sets/lists/debug: mi
        src/distrib/sets/lists/tests: mi
        src/etc/mtree: NetBSD.dist.tests
        src/tests/lib: Makefile
Added Files:
        src/tests/lib/libpthread_dbg: Makefile t_dummy.c

Log Message:
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>


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.700 -r1.701 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.133 -r1.134 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libpthread_dbg/Makefile \
    src/tests/lib/libpthread_dbg/t_dummy.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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.177 src/distrib/sets/lists/debug/mi:1.178
--- src/distrib/sets/lists/debug/mi:1.177	Tue Nov 15 12:59:33 2016
+++ src/distrib/sets/lists/debug/mi	Wed Nov 16 21:36:22 2016
@@ -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

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.700 src/distrib/sets/lists/tests/mi:1.701
--- src/distrib/sets/lists/tests/mi:1.700	Tue Nov 15 12:59:33 2016
+++ src/distrib/sets/lists/tests/mi	Wed Nov 16 21:36:23 2016
@@ -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

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.133 src/etc/mtree/NetBSD.dist.tests:1.134
--- src/etc/mtree/NetBSD.dist.tests:1.133	Tue Nov 15 12:59:33 2016
+++ src/etc/mtree/NetBSD.dist.tests	Wed Nov 16 21:36:23 2016
@@ -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

Index: src/tests/lib/Makefile
diff -u src/tests/lib/Makefile:1.26 src/tests/lib/Makefile:1.27
--- src/tests/lib/Makefile:1.26	Mon Nov 14 16:10:31 2016
+++ src/tests/lib/Makefile	Wed Nov 16 21:36:23 2016
@@ -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

Added files:

Index: src/tests/lib/libpthread_dbg/Makefile
diff -u /dev/null src/tests/lib/libpthread_dbg/Makefile:1.1
--- /dev/null	Wed Nov 16 21:36:23 2016
+++ src/tests/lib/libpthread_dbg/Makefile	Wed Nov 16 21:36:23 2016
@@ -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>
Index: src/tests/lib/libpthread_dbg/t_dummy.c
diff -u /dev/null src/tests/lib/libpthread_dbg/t_dummy.c:1.1
--- /dev/null	Wed Nov 16 21:36:23 2016
+++ src/tests/lib/libpthread_dbg/t_dummy.c	Wed Nov 16 21:36:23 2016
@@ -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();
+}

Reply via email to