From b2965573f962680d224f979948b7973be06cbd3f Mon Sep 17 00:00:00 2001 From: plunky Date: Mon, 2 Nov 2009 10:15:45 +0000 Subject: [PATCH] add ATF tests for libevent --- distrib/sets/lists/tests/mi | 9 ++++- etc/mtree/NetBSD.dist.base | 4 ++- tests/lib/Makefile | 4 +-- tests/lib/libevent/Atffile | 6 ++++ tests/lib/libevent/Makefile | 26 ++++++++++++++ tests/lib/libevent/t_event.sh | 67 +++++++++++++++++++++++++++++++++++ 6 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 tests/lib/libevent/Atffile create mode 100644 tests/lib/libevent/Makefile create mode 100644 tests/lib/libevent/t_event.sh diff --git a/distrib/sets/lists/tests/mi b/distrib/sets/lists/tests/mi index b09ae284a216..c9743d2a3c5c 100644 --- a/distrib/sets/lists/tests/mi +++ b/distrib/sets/lists/tests/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.53 2009/10/20 22:00:38 jmmv Exp $ +# $NetBSD: mi,v 1.54 2009/11/02 10:15:45 plunky Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -139,6 +139,9 @@ ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_mi_vector_hash.debug tests-lib-debug debug ./usr/libdata/debug/usr/tests/lib/libc/string tests-lib-debug ./usr/libdata/debug/usr/tests/lib/libc/string/t_popcount.debug tests-lib-debug debug +./usr/libdata/debug/usr/tests/lib/libevent tests-lib-debug +./usr/libdata/debug/usr/tests/lib/libevent/h_event.debug tests-lib-debug debug +./usr/libdata/debug/usr/tests/lib/libevent/t_event.debug tests-lib-debug debug ./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/t_dlinfo.debug tests-libexec-debug debug @@ -858,6 +861,10 @@ ./usr/tests/lib/libc/string tests-lib-tests ./usr/tests/lib/libc/string/Atffile tests-lib-tests ./usr/tests/lib/libc/string/t_popcount tests-lib-tests +./usr/tests/lib/libevent tests-lib-tests +./usr/tests/lib/libevent/Atffile tests-lib-tests +./usr/tests/lib/libevent/h_event tests-lib-tests +./usr/tests/lib/libevent/t_event tests-lib-tests ./usr/tests/libexec tests-lib-tests ./usr/tests/libexec/Atffile tests-lib-tests ./usr/tests/libexec/ld.elf_so tests-libexec-tests diff --git a/etc/mtree/NetBSD.dist.base b/etc/mtree/NetBSD.dist.base index b7da86c92a68..001bfb027f6b 100644 --- a/etc/mtree/NetBSD.dist.base +++ b/etc/mtree/NetBSD.dist.base @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.base,v 1.4 2009/10/12 08:54:19 tron Exp $ +# $NetBSD: NetBSD.dist.base,v 1.5 2009/11/02 10:15:45 plunky Exp $ # @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93 # Do not customize this file as it may be overwritten on upgrades. @@ -209,6 +209,7 @@ ./usr/libdata/debug/usr/tests/lib/libc ./usr/libdata/debug/usr/tests/lib/libc/stdlib ./usr/libdata/debug/usr/tests/lib/libc/string +./usr/libdata/debug/usr/tests/lib/libevent ./usr/libdata/debug/usr/tests/libexec ./usr/libdata/debug/usr/tests/libexec/ld.elf_so ./usr/libdata/debug/usr/tests/modules @@ -1096,6 +1097,7 @@ ./usr/tests/lib/libc ./usr/tests/lib/libc/stdlib ./usr/tests/lib/libc/string +./usr/tests/lib/libevent ./usr/tests/libexec ./usr/tests/libexec/ld.elf_so ./usr/tests/modules diff --git a/tests/lib/Makefile b/tests/lib/Makefile index 4b9abae0914e..660d4f6c3853 100644 --- a/tests/lib/Makefile +++ b/tests/lib/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.1 2009/07/20 17:03:38 joerg Exp $ +# $NetBSD: Makefile,v 1.2 2009/11/02 10:15:45 plunky Exp $ .include -SUBDIR= libc +SUBDIR= libc libevent TESTSDIR= ${TESTSBASE}/lib diff --git a/tests/lib/libevent/Atffile b/tests/lib/libevent/Atffile new file mode 100644 index 000000000000..1e99f63dc65f --- /dev/null +++ b/tests/lib/libevent/Atffile @@ -0,0 +1,6 @@ +Content-Type: application/X-atf-atffile; version="1" +X-NetBSD-Id: "$NetBSD: Atffile,v 1.1 2009/11/02 10:15:45 plunky Exp $" + +prop: test-suite = "NetBSD" + +tp: t_event diff --git a/tests/lib/libevent/Makefile b/tests/lib/libevent/Makefile new file mode 100644 index 000000000000..e5beaa049645 --- /dev/null +++ b/tests/lib/libevent/Makefile @@ -0,0 +1,26 @@ +# $NetBSD: Makefile,v 1.1 2009/11/02 10:15:45 plunky Exp $ + +TESTSDIR= ${TESTSBASE}/lib/libevent + +TESTS_SH= t_event + +.include +.include <../../../external/bsd/libevent/Makefile.inc> + +.PATH: ${LIBEVENT_DIR}/dist/test + +BINDIR= ${TESTSDIR} + +PROG= h_event +MAN= # defined +SRCS= regress.c regress.gen.c regress_dns.c regress_http.c \ + regress_rpc.c + +DPADD+= ${LIBEVENT} +LDADD+= -levent + +CPPFLAGS.regress.c+= -Wno-cast-qual -Wno-sign-compare -Wno-shadow +CPPFLAGS.regress_http.c+= -Wno-cast-qual -Wno-sign-compare -Wno-shadow +CPPFLAGS.regress_rpc.c+= -Wno-cast-qual -Wno-shadow + +.include diff --git a/tests/lib/libevent/t_event.sh b/tests/lib/libevent/t_event.sh new file mode 100644 index 000000000000..1b9a859a7edc --- /dev/null +++ b/tests/lib/libevent/t_event.sh @@ -0,0 +1,67 @@ +# $NetBSD: t_event.sh,v 1.1 2009/11/02 10:15:45 plunky 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. +# + +# +# This is not great but rather than reimplementing the libevent +# provided regression tests, we use an ATF wrapper around the test +# program which carries out all the tests and prints an extensive +# report. +# + +atf_test_case kqueue +kqueue_head() { + atf_set "descr" "Test libevent with kqueue backend" +} +kqueue_body() { + EVENT_NOPOLL=1 EVENT_NOSELECT=1 \ + $(atf_get_srcdir)/h_event 2>&1 || atf_fail "check report" +} + +atf_test_case poll +poll_head() { + atf_set "descr" "Test libevent with poll backend" +} +poll_body() { + EVENT_NOKQUEUE=1 EVENT_NOSELECT=1 \ + $(atf_get_srcdir)/h_event 2>&1 || atf_fail "check report" +} + +atf_test_case select +select_head() { + atf_set "descr" "Test libevent with select backend" +} +select_body() { + EVENT_NOKQUEUE=1 EVENT_NOPOLL=1 \ + $(atf_get_srcdir)/h_event 2>&1 || atf_fail "check report" +} + +atf_init_test_cases() +{ + atf_add_test_case kqueue + atf_add_test_case poll + atf_add_test_case select +}