Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc Continuing the (re)organization of the lib/li...
details: https://anonhg.NetBSD.org/src/rev/66905bfedae5
branches: trunk
changeset: 760785:66905bfedae5
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Thu Jan 13 02:40:43 2011 +0000
description:
Continuing the (re)organization of the lib/libc atf regression tests
diffstat:
tests/lib/libc/Makefile | 6 +-
tests/lib/libc/gen/Makefile | 3 +-
tests/lib/libc/gen/t_randomid.c | 93 ++++++++++++++
tests/lib/libc/sys/Makefile | 5 +-
tests/lib/libc/sys/t_cerror.c | 115 +++++++++++++++++
tests/lib/libc/sys/t_clone.c | 262 ++++++++++++++++++++++++++++++++++++++++
tests/lib/libc/sys/t_context.c | 102 +++++++++++++++
tests/lib/libc/t_cerror.c | 115 -----------------
tests/lib/libc/t_clone.c | 262 ----------------------------------------
tests/lib/libc/t_context.c | 102 ---------------
tests/lib/libc/t_randomid.c | 93 --------------
11 files changed, 579 insertions(+), 579 deletions(-)
diffs (truncated from 1236 to 300 lines):
diff -r ef02d96c0504 -r 66905bfedae5 tests/lib/libc/Makefile
--- a/tests/lib/libc/Makefile Thu Jan 13 02:24:51 2011 +0000
+++ b/tests/lib/libc/Makefile Thu Jan 13 02:40:43 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.33 2011/01/13 01:56:44 pgoyette Exp $
+# $NetBSD: Makefile,v 1.34 2011/01/13 02:40:43 pgoyette Exp $
.include <bsd.own.mk>
.include <bsd.sys.mk>
@@ -12,14 +12,10 @@
TESTSDIR= ${TESTSBASE}/lib/libc
-TESTS_C+= t_cerror
-TESTS_C+= t_clone
-TESTS_C+= t_context
TESTS_C+= t_convfp
TESTS_C+= t_gdtoa
TESTS_C+= t_hsearch
TESTS_C+= t_inet
TESTS_C+= t_ptm
-TESTS_C+= t_randomid
.include <bsd.test.mk>
diff -r ef02d96c0504 -r 66905bfedae5 tests/lib/libc/gen/Makefile
--- a/tests/lib/libc/gen/Makefile Thu Jan 13 02:24:51 2011 +0000
+++ b/tests/lib/libc/gen/Makefile Thu Jan 13 02:40:43 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2011/01/02 18:28:36 pgoyette Exp $
+# $NetBSD: Makefile,v 1.13 2011/01/13 02:40:43 pgoyette Exp $
.include <bsd.own.mk>
@@ -10,6 +10,7 @@
TESTS_C+= t_glob_star
TESTS_C+= t_humanize_number
TESTS_C+= t_ldexp
+TESTS_C+= t_randomid
TESTS_C+= t_rbstress
TESTS_C+= t_siginfo
TESTS_C+= t_syslog_pthread
diff -r ef02d96c0504 -r 66905bfedae5 tests/lib/libc/gen/t_randomid.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/gen/t_randomid.c Thu Jan 13 02:40:43 2011 +0000
@@ -0,0 +1,93 @@
+/* $NetBSD: t_randomid.c,v 1.1 2011/01/13 02:40:43 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2010 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 <atf-c.h>
+
+#include <sys/types.h>
+
+#include <assert.h>
+#include <inttypes.h>
+#include <randomid.h>
+#include <stdio.h>
+#include <string.h>
+
+#define PERIOD 30000
+
+uint64_t last[65536];
+
+ATF_TC(randomid);
+
+ATF_TC_HEAD(randomid, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "Check randomid(3)");
+}
+
+ATF_TC_BODY(randomid, tc)
+{
+ static randomid_t ctx = NULL;
+ uint64_t lowest, n, diff;
+ uint16_t id;
+
+ memset(last, 0, sizeof(last));
+ ctx = randomid_new(16, (long)3600);
+
+ lowest = UINT64_MAX;
+
+ for (n = 0; n < 1000000; n++) {
+ id = randomid(ctx);
+
+ if (last[id] > 0) {
+ diff = n - last[id];
+
+ if (diff <= lowest) {
+ if (lowest != UINT64_MAX)
+ printf("id %5d: last call at %9lld, "
+ "current call %9lld (diff %5lld)"
+ ", lowest %lld\n",
+ id, last[id], n, diff, lowest);
+
+ ATF_REQUIRE_MSG(diff >= PERIOD,
+ "diff (%"PRIu64") less than minimum "
+ "period (%d)", diff, PERIOD);
+
+ lowest = diff;
+ }
+ }
+
+ last[id] = n;
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, randomid);
+
+ return atf_no_error();
+}
diff -r ef02d96c0504 -r 66905bfedae5 tests/lib/libc/sys/Makefile
--- a/tests/lib/libc/sys/Makefile Thu Jan 13 02:24:51 2011 +0000
+++ b/tests/lib/libc/sys/Makefile Thu Jan 13 02:40:43 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2011/01/10 04:57:56 christos Exp $
+# $NetBSD: Makefile,v 1.2 2011/01/13 02:40:44 pgoyette Exp $
MKMAN= no
@@ -6,6 +6,9 @@
TESTSDIR= ${TESTSBASE}/lib/libc/sys
+TESTS_C+= t_cerror
+TESTS_C+= t_clone
+TESTS_C+= t_context
TESTS_C= t_sigqueue
.include <bsd.test.mk>
diff -r ef02d96c0504 -r 66905bfedae5 tests/lib/libc/sys/t_cerror.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/sys/t_cerror.c Thu Jan 13 02:40:43 2011 +0000
@@ -0,0 +1,115 @@
+/* $NetBSD: t_cerror.c,v 1.1 2011/01/13 02:40:44 pgoyette 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.
+ */
+
+/*
+ * Copyright (c) 2003 Christopher G. Demetriou
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the
+ * NetBSD Project. See http://www.NetBSD.org/ for
+ * information about NetBSD.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: t_cerror.c,v 1.1 2011/01/13 02:40:44 pgoyette Exp $");
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+ATF_TC(cerror_32);
+ATF_TC_HEAD(cerror_32, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Checks that libc's cerror (error handler) "
+ "correctly handles 32-bit error codes");
+}
+ATF_TC_BODY(cerror_32, tc)
+{
+ /* Make sure file desc 4 is closed. */
+ (void)close(4);
+
+ /* Check error and 32-bit return code.*/
+ errno = 0;
+ ATF_REQUIRE_EQ(close(4), -1);
+ ATF_REQUIRE_EQ(errno, EBADF);
+}
+
+ATF_TC(cerror_64);
+ATF_TC_HEAD(cerror_64, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Checks that libc's cerror (error handler) "
+ "correctly handles 64-bit error codes");
+}
+ATF_TC_BODY(cerror_64, tc)
+{
+ /* Make sure file desc 4 is closed. */
+ (void)close(4);
+
+ /* Check error and 64-bit return code.*/
+ errno = 0;
+ ATF_REQUIRE_EQ(lseek(4, (off_t) 0, SEEK_SET), (off_t) -1);
+ ATF_REQUIRE_EQ(errno, EBADF);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, cerror_32);
+ ATF_TP_ADD_TC(tp, cerror_64);
+
+ return atf_no_error();
+}
diff -r ef02d96c0504 -r 66905bfedae5 tests/lib/libc/sys/t_clone.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/sys/t_clone.c Thu Jan 13 02:40:43 2011 +0000
@@ -0,0 +1,262 @@
+/* $NetBSD: t_clone.c,v 1.1 2011/01/13 02:40:44 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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
Home |
Main Index |
Thread Index |
Old Index