Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add new test file lib/libpthread_dbg/t_threads
details: https://anonhg.NetBSD.org/src/rev/f609184d96ff
branches: trunk
changeset: 348980:f609184d96ff
user: kamil <kamil%NetBSD.org@localhost>
date: Fri Nov 18 22:50:19 2016 +0000
description:
Add new test file lib/libpthread_dbg/t_threads
This test contains threads1 test that:
Asserts that td_thr_iter() call without extra logic works
This tests fails and is linked with gnats:
PR lib/51635: td_thr_iter in <pthread_dbg.h> seems broken
Sponsored by <The NetBSD Foundation>
diffstat:
distrib/sets/lists/debug/mi | 3 +-
distrib/sets/lists/tests/mi | 3 +-
tests/lib/libpthread_dbg/Makefile | 3 +-
tests/lib/libpthread_dbg/h_common.h | 128 +++++++++++++++++++++++++++++++++++
tests/lib/libpthread_dbg/t_dummy.c | 83 +---------------------
tests/lib/libpthread_dbg/t_threads.c | 110 ++++++++++++++++++++++++++++++
6 files changed, 247 insertions(+), 83 deletions(-)
diffs (truncated from 399 to 300 lines):
diff -r 8a347e7a5f90 -r f609184d96ff distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi Fri Nov 18 22:41:18 2016 +0000
+++ b/distrib/sets/lists/debug/mi Fri Nov 18 22:50:19 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.178 2016/11/16 21:36:22 kamil Exp $
+# $NetBSD: mi,v 1.179 2016/11/18 22:50:19 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
@@ -2174,6 +2174,7 @@
./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/libpthread_dbg/t_threads.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 8a347e7a5f90 -r f609184d96ff distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Fri Nov 18 22:41:18 2016 +0000
+++ b/distrib/sets/lists/tests/mi Fri Nov 18 22:50:19 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.701 2016/11/16 21:36:23 kamil Exp $
+# $NetBSD: mi,v 1.702 2016/11/18 22:50:19 kamil Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -3020,6 +3020,7 @@
./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/libpthread_dbg/t_threads 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 8a347e7a5f90 -r f609184d96ff tests/lib/libpthread_dbg/Makefile
--- a/tests/lib/libpthread_dbg/Makefile Fri Nov 18 22:41:18 2016 +0000
+++ b/tests/lib/libpthread_dbg/Makefile Fri Nov 18 22:50:19 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2016/11/16 21:36:23 kamil Exp $
+# $NetBSD: Makefile,v 1.2 2016/11/18 22:50:19 kamil Exp $
NOMAN= # defined
@@ -9,5 +9,6 @@
LDADD+= -lpthread_dbg
TESTS_C+= t_dummy
+TESTS_C+= t_threads
.include <bsd.test.mk>
diff -r 8a347e7a5f90 -r f609184d96ff tests/lib/libpthread_dbg/h_common.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread_dbg/h_common.h Fri Nov 18 22:50:19 2016 +0000
@@ -0,0 +1,128 @@
+/* $NetBSD: h_common.h,v 1.1 2016/11/18 22:50:19 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.
+ */
+
+
+#ifndef H_COMMON_H
+#define H_COMMON_H
+
+#include <sys/cdefs.h>
+#include <dlfcn.h>
+#include <pthread_dbg.h>
+#include <string.h>
+
+#include <atf-c.h>
+
+#define PTHREAD_REQUIRE(x) \
+ do { \
+ int ret = (x); \
+ ATF_REQUIRE_MSG(ret == 0, "%s: %s", #x, strerror(ret)); \
+ } while (0)
+
+#define PTHREAD_REQUIRE_STATUS(x, v) \
+ do { \
+ int ret = (x); \
+ ATF_REQUIRE_MSG(ret == (v), "%s: %s", #x, strerror(ret)); \
+ } while (0)
+
+static int __used
+dummy_proc_read(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_write(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_lookup(void *arg, const char *sym, caddr_t *addr)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_regsize(void *arg, int regset, size_t *size)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_getregs(void *arg, int regset, int lwp, void *buf)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_setregs(void *arg, int regset, int lwp, void *buf)
+{
+ return TD_ERR_ERR;
+}
+
+/* Minimalistic basic implementation */
+
+static int __used
+basic_proc_read(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ memcpy(addr, buf, size);
+
+ return TD_ERR_OK;
+}
+
+static int __used
+basic_proc_write(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ memcpy(addr, buf, size);
+
+ return TD_ERR_OK;
+}
+
+static int __used
+basic_proc_lookup(void *arg, const char *sym, caddr_t *addr)
+{
+ void *handle;
+ void *symbol;
+
+ ATF_REQUIRE_MSG((handle = dlopen(NULL, RTLD_LOCAL | RTLD_LAZY))
+ != NULL, "dlopen(3) failed: %s", dlerror());
+
+ symbol = dlsym(handle, sym);
+
+ ATF_REQUIRE_MSG(dlclose(handle) == 0, "dlclose(3) failed: %s",
+ dlerror());
+
+ if (!symbol)
+ return TD_ERR_NOSYM;
+
+ *addr = (caddr_t)(uintptr_t)symbol;
+
+ return TD_ERR_OK;
+}
+
+#endif // H_COMMON_H
diff -r 8a347e7a5f90 -r f609184d96ff tests/lib/libpthread_dbg/t_dummy.c
--- a/tests/lib/libpthread_dbg/t_dummy.c Fri Nov 18 22:41:18 2016 +0000
+++ b/tests/lib/libpthread_dbg/t_dummy.c Fri Nov 18 22:50:19 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dummy.c,v 1.4 2016/11/17 17:30:22 kamil Exp $ */
+/* $NetBSD: t_dummy.c,v 1.5 2016/11/18 22:50:19 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -28,91 +28,14 @@
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_dummy.c,v 1.4 2016/11/17 17:30:22 kamil Exp $");
+__RCSID("$NetBSD: t_dummy.c,v 1.5 2016/11/18 22:50:19 kamil Exp $");
-#include <dlfcn.h>
-#include <pthread.h>
+#include "h_common.h"
#include <pthread_dbg.h>
#include <stdio.h>
#include <atf-c.h>
-static int
-dummy_proc_read(void *arg, caddr_t addr, void *buf, size_t size)
-{
- return TD_ERR_ERR;
-}
-
-static int
-dummy_proc_write(void *arg, caddr_t addr, void *buf, size_t size)
-{
- return TD_ERR_ERR;
-}
-
-static int
-dummy_proc_lookup(void *arg, const char *sym, caddr_t *addr)
-{
- return TD_ERR_ERR;
-}
-
-static int
-dummy_proc_regsize(void *arg, int regset, size_t *size)
-{
- return TD_ERR_ERR;
-}
-
-static int
-dummy_proc_getregs(void *arg, int regset, int lwp, void *buf)
-{
- return TD_ERR_ERR;
-}
-
-static int
-dummy_proc_setregs(void *arg, int regset, int lwp, void *buf)
-{
- return TD_ERR_ERR;
-}
-
-/* Minimalistic basic implementation */
-
-static int
-basic_proc_read(void *arg, caddr_t addr, void *buf, size_t size)
-{
- memcpy(addr, buf, size);
-
- return TD_ERR_OK;
-}
-
-static int
-basic_proc_write(void *arg, caddr_t addr, void *buf, size_t size)
-{
- memcpy(addr, buf, size);
-
- return TD_ERR_OK;
-}
-
-static int
-basic_proc_lookup(void *arg, const char *sym, caddr_t *addr)
-{
- void *handle;
- void *symbol;
-
- ATF_REQUIRE_MSG((handle = dlopen(NULL, RTLD_LOCAL | RTLD_LAZY))
- != NULL, "dlopen(3) failed: %s", dlerror());
-
- symbol = dlsym(handle, sym);
-
- ATF_REQUIRE_MSG(dlclose(handle) == 0, "dlclose(3) failed: %s",
- dlerror());
-
- if (!symbol)
- return TD_ERR_NOSYM;
-
- *addr = (caddr_t)(uintptr_t)symbol;
-
- return TD_ERR_OK;
-}
-
ATF_TC(dummy1);
ATF_TC_HEAD(dummy1, tc)
diff -r 8a347e7a5f90 -r f609184d96ff tests/lib/libpthread_dbg/t_threads.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread_dbg/t_threads.c Fri Nov 18 22:50:19 2016 +0000
@@ -0,0 +1,110 @@
+/* $NetBSD: t_threads.c,v 1.1 2016/11/18 22:50:19 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.
Home |
Main Index |
Thread Index |
Old Index