Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib Convert the libpthread tests to atf.
details: https://anonhg.NetBSD.org/src/rev/ddfb4af354dc
branches: trunk
changeset: 756408:ddfb4af354dc
user: jmmv <jmmv%NetBSD.org@localhost>
date: Fri Jul 16 15:42:53 2010 +0000
description:
Convert the libpthread tests to atf.
Initial work from the GSoC 2008 project by Lukasz Strzygowski.
I think that this, together with the previous conversion of librt, obsoletes
the tests in the semaphore/ directory. Will investigate later.
diffstat:
tests/lib/Makefile | 5 +-
tests/lib/libpthread/Makefile | 42 ++
tests/lib/libpthread/d_mach | 92 ++++++
tests/lib/libpthread/h_atexit.c | 183 ++++++++++++
tests/lib/libpthread/h_cancel.c | 58 ++++
tests/lib/libpthread/h_common.h | 12 +
tests/lib/libpthread/h_exit.c | 47 +++
tests/lib/libpthread/h_resolv.c | 208 ++++++++++++++
tests/lib/libpthread/t_atexit.sh | 50 +++
tests/lib/libpthread/t_barrier.c | 110 +++++++
tests/lib/libpthread/t_cancel.sh | 44 +++
tests/lib/libpthread/t_cond.c | 510 ++++++++++++++++++++++++++++++++++++
tests/lib/libpthread/t_exit.sh | 41 ++
tests/lib/libpthread/t_fork.c | 107 +++++++
tests/lib/libpthread/t_fpu.c | 148 ++++++++++
tests/lib/libpthread/t_kill.c | 147 ++++++++++
tests/lib/libpthread/t_mutex.c | 281 +++++++++++++++++++
tests/lib/libpthread/t_name.c | 103 +++++++
tests/lib/libpthread/t_once.c | 196 +++++++++++++
tests/lib/libpthread/t_preempt.c | 127 ++++++++
tests/lib/libpthread/t_resolv.sh | 42 ++
tests/lib/libpthread/t_rwlock.c | 125 ++++++++
tests/lib/libpthread/t_sem.c | 274 +++++++++++++++++++
tests/lib/libpthread/t_sigalarm.c | 107 +++++++
tests/lib/libpthread/t_siglongjmp.c | 109 +++++++
tests/lib/libpthread/t_sigmask.c | 263 ++++++++++++++++++
tests/lib/libpthread/t_sigsuspend.c | 90 ++++++
tests/lib/libpthread/t_sleep.c | 104 +++++++
tests/lib/libpthread/t_status.c | 124 ++++++++
29 files changed, 3747 insertions(+), 2 deletions(-)
diffs (truncated from 3871 to 300 lines):
diff -r 3546a8e1044c -r ddfb4af354dc tests/lib/Makefile
--- a/tests/lib/Makefile Fri Jul 16 15:30:10 2010 +0000
+++ b/tests/lib/Makefile Fri Jul 16 15:42:53 2010 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.5 2010/07/16 13:56:31 jmmv Exp $
+# $NetBSD: Makefile,v 1.6 2010/07/16 15:42:53 jmmv Exp $
.include <bsd.own.mk>
-TESTS_SUBDIRS= libc libevent libposix libprop librt libutil semaphore
+TESTS_SUBDIRS= libc libevent libposix libprop librt libpthread libutil \
+ semaphore
.if (${MKSKEY} != "no")
TESTS_SUBDIRS+= libskey
diff -r 3546a8e1044c -r ddfb4af354dc tests/lib/libpthread/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread/Makefile Fri Jul 16 15:42:53 2010 +0000
@@ -0,0 +1,42 @@
+# $NetBSD: Makefile,v 1.1 2010/07/16 15:42:53 jmmv Exp $
+
+NOMAN= # defined
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libpthread
+LDADD+= -lpthread
+
+TESTS_SH+= t_atexit
+TESTS_C+= t_barrier
+TESTS_SH+= t_cancel
+TESTS_C+= t_cond
+TESTS_SH+= t_exit
+TESTS_C+= t_fork
+TESTS_C+= t_fpu
+TESTS_C+= t_kill
+TESTS_C+= t_mutex
+TESTS_C+= t_name
+TESTS_C+= t_once
+TESTS_C+= t_preempt
+TESTS_SH+= t_resolv
+TESTS_C+= t_rwlock
+TESTS_C+= t_sem
+TESTS_C+= t_sigmask
+TESTS_C+= t_sigsuspend
+TESTS_C+= t_siglongjmp
+TESTS_C+= t_sleep
+TESTS_C+= t_status
+
+LDADD.t_sem+= -lrt
+
+BINDIR= ${TESTSDIR}
+PROGS= h_atexit
+PROGS+= h_cancel
+PROGS+= h_exit
+PROGS+= h_resolv
+
+FILESDIR= ${TESTSDIR}
+FILES= d_mach
+
+.include <bsd.test.mk>
diff -r 3546a8e1044c -r ddfb4af354dc tests/lib/libpthread/d_mach
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread/d_mach Fri Jul 16 15:42:53 2010 +0000
@@ -0,0 +1,92 @@
+above.warped.net
+anoncvs.cirr.com
+anoncvs.isc.netbsd.org
+anoncvs.leo.org
+anoncvs.netbsd.lt
+anoncvs.netbsd.ro
+anoncvs.netbsd.se
+antioche.antioche.eu.org
+boulder.tele.dk
+centaurus.4web.cz
+chur.math.ntnu.no
+cnftp.bjpu.edu.cn
+console.netbsd.org
+cvs.fi.netbsd.org
+cvs.mikrolahti.fi
+cvs.netbsd.org
+cvsup-netbsd.leo.org
+cvsup.netbsd.se
+cvsup.pasta.cs.uit.no
+ftp.bitcon.no
+ftp.chg.ru
+ftp.duth.gr
+ftp.estpak.ee
+ftp.fsn.hu
+ftp.funet.fi
+ftp.grondar.za
+ftp.leo.org
+ftp.netbsd.lt
+ftp.netbsd.org
+ftp.nluug.nl
+ftp.plig.org
+ftp.uni-erlangen.de
+ftp.xgate.co.kr
+gd.tuwien.ac.at
+gort.ludd.luth.se
+grappa.unix-ag.uni-kl.de
+info.wins.uva.nl
+irc.warped.net
+knug.youn.co.kr
+lala.iri.co.jp
+mail.jp.netbsd.org
+mail.kr.netbsd.org
+mail.netbsd.org
+melanoma.cs.rmit.edu.au
+mirror.aarnet.edu.au
+mirror.netbsd.com.br
+mirror03.inet.tele.dk
+moon.vub.ac.be
+nbwww.sergei.cc
+net.bsd.cz
+netbsd.3miasto.net
+netbsd.4ka.mipt.ru
+netbsd.apk.od.ua
+netbsd.csie.nctu.edu.tw
+netbsd.enderunix.org
+netbsd.ftp.fu-berlin.de
+netbsd.netlead.com.au
+netbsd.nsysu.edu.tw
+netbsd.pair.com
+netbsd.stevens-tech.edu
+netbsd.triada.bg
+netbsd.unix.net.nz
+netbsd.unixtech.be
+netbsd.vejas.lt
+netbsd.wagener-consulting.lu
+netbsd.zarco.org
+netbsdiso.interoute.net.uk
+netbsdwww.bitcon.no
+netbsdwww.cordef.com.pl
+netbsdwww.cs.rmit.edu.au
+netbsdwww.interoute.net.uk
+news.gw.com
+ns.netbsd.org
+pigu.iri.co.jp
+pluto.cdpa.nsysu.edu.tw
+projects.slowass.net
+server6.pasta.cs.uit.no
+skeleton.phys.spbu.ru
+snoopy.allbsd.org
+spike.allbsd.org
+sundry.netbsd.org
+tanya.sergei.cc
+web-a.fi.gw.com
+web-a.us.gw.com
+web.netbsd.mirror.arhea.net
+www.en.netbsd.de
+www.netbsd.cl
+www.netbsd.nl
+www.netbsd.org
+www.netbsd.ro
+zathras.netbsd.org
+zeppo.rediris.es
diff -r 3546a8e1044c -r ddfb4af354dc tests/lib/libpthread/h_atexit.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread/h_atexit.c Fri Jul 16 15:42:53 2010 +0000
@@ -0,0 +1,183 @@
+/* $NetBSD: h_atexit.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
+
+/*
+ * Copyright (c) 2008 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.
+ */
+
+/*
+ * Program to test atexit(3) and __cxa_atexit()/__cxa_finalize().
+ *
+ * Written by Jason R. Thorpe, February 2003.
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_atexit.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+extern int __cxa_atexit(void (*func)(void *), void *, void *);
+extern void __cxa_finalize(void *);
+
+static int dso_handle_1;
+static int dso_handle_2;
+static int dso_handle_3;
+
+static int arg_1;
+static int arg_2;
+static int arg_3;
+
+static int exiting_state;
+
+#define ASSERT(expr) \
+do { \
+ if ((expr) == 0) { \
+ write(STDERR_FILENO, __func__, strlen(__func__)); \
+ write(STDERR_FILENO, ": ", 2); \
+ write(STDERR_FILENO, __STRING(expr), \
+ strlen(__STRING(expr))); \
+ write(STDERR_FILENO, "\n", 1); \
+ my_abort(); \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define SUCCESS() \
+do { \
+ write(STDOUT_FILENO, __func__, strlen(__func__)); \
+ write(STDOUT_FILENO, "\n", 1); \
+} while (/*CONSTCOND*/0)
+
+static void
+my_abort(void)
+{
+
+ kill(getpid(), SIGABRT);
+ /* NOTREACHED */
+}
+
+static void
+cxa_handler_5(void *arg)
+{
+ static int cxa_handler_5_called;
+
+ ASSERT(arg == (void *)&arg_1);
+ ASSERT(cxa_handler_5_called == 0);
+ ASSERT(exiting_state == 5);
+
+ exiting_state--;
+ cxa_handler_5_called = 1;
+ SUCCESS();
+}
+
+static void
+cxa_handler_4(void *arg)
+{
+ static int cxa_handler_4_called;
+
+ ASSERT(arg == (void *)&arg_1);
+ ASSERT(cxa_handler_4_called == 0);
+ ASSERT(exiting_state == 4);
+
+ exiting_state--;
+ cxa_handler_4_called = 1;
+ SUCCESS();
+}
+
+static void
+cxa_handler_3(void *arg)
+{
+ static int cxa_handler_3_called;
+
+ ASSERT(arg == (void *)&arg_2);
+ ASSERT(cxa_handler_3_called == 0);
+ ASSERT(exiting_state == 3);
+
+ exiting_state--;
+ cxa_handler_3_called = 1;
+ SUCCESS();
+}
+
+static void
+cxa_handler_2(void *arg)
+{
+ static int cxa_handler_2_called;
+
+ ASSERT(arg == (void *)&arg_3);
+ ASSERT(cxa_handler_2_called == 0);
+ ASSERT(exiting_state == 2);
+
+ exiting_state--;
+ cxa_handler_2_called = 1;
+ SUCCESS();
Home |
Main Index |
Thread Index |
Old Index