Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/regress/lib/libc These tests have been atf-ified
details: https://anonhg.NetBSD.org/src/rev/6c757c505fba
branches: trunk
changeset: 760211:6c757c505fba
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Fri Dec 31 04:10:41 2010 +0000
description:
These tests have been atf-ified
diffstat:
regress/lib/libc/Makefile | 8 +-
regress/lib/libc/convfp/Makefile | 11 --
regress/lib/libc/convfp/convfp.c | 137 -------------------------------------
regress/lib/libc/gdtoa/Makefile | 12 ---
regress/lib/libc/gdtoa/gdtoa.c | 49 -------------
regress/lib/libc/randomid/Makefile | 10 --
regress/lib/libc/randomid/idtest.c | 62 ----------------
7 files changed, 4 insertions(+), 285 deletions(-)
diffs (truncated from 321 to 300 lines):
diff -r e13b4c97daa8 -r 6c757c505fba regress/lib/libc/Makefile
--- a/regress/lib/libc/Makefile Fri Dec 31 04:08:32 2010 +0000
+++ b/regress/lib/libc/Makefile Fri Dec 31 04:10:41 2010 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.66 2010/12/28 17:35:25 pgoyette Exp $
+# $NetBSD: Makefile,v 1.67 2010/12/31 04:10:41 pgoyette Exp $
-SUBDIR+= atexit citrus clone context convfp db \
- divrem gdtoa getaddrinfo hsearch inet int_fmtio locale md5sha \
- nsdispatch pty randomid regex rpc servent stdlib strptime sys time
+SUBDIR+= atexit citrus clone context db \
+ divrem getaddrinfo hsearch inet int_fmtio locale md5sha \
+ nsdispatch pty regex rpc servent stdlib strptime sys time
.include <bsd.own.mk>
.include <bsd.sys.mk>
diff -r e13b4c97daa8 -r 6c757c505fba regress/lib/libc/convfp/Makefile
--- a/regress/lib/libc/convfp/Makefile Fri Dec 31 04:08:32 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-# $NetBSD: Makefile,v 1.2 2007/11/07 00:08:50 martin Exp $
-
-NOMAN= # defined
-
-PROG= convfp
-CFLAGS+= -O0
-
-regress: ${PROG}
- @./${PROG}
-
-.include <bsd.prog.mk>
diff -r e13b4c97daa8 -r 6c757c505fba regress/lib/libc/convfp/convfp.c
--- a/regress/lib/libc/convfp/convfp.c Fri Dec 31 04:08:32 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/* $NetBSD: convfp.c,v 1.7 2008/04/28 20:23:04 martin Exp $ */
-
-/*-
- * Copyright (c) 2003 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 <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/*
- * This value is representable as an unsigned int, but not as an int.
- * According to ISO C it must survive the convsion back from a double
- * to an unsigned int (everything > -1 and < UINT_MAX+1 has to)
- */
-#define UINT_TESTVALUE (INT_MAX+42U)
-
-/* The same for unsigned long */
-#define ULONG_TESTVALUE (LONG_MAX+42UL)
-
-static void test1();
-static void test2();
-static void test3();
-
-int
-main()
-{
- test1();
- test2();
- test3();
- printf("PASSED\n");
- return 0;
-}
-
-static void
-test1()
-{
- unsigned int ui;
- unsigned long ul;
- long double dt;
- double d;
-
- /* unsigned int test */
- d = UINT_TESTVALUE;
- ui = (unsigned int)d;
-
- if (ui != UINT_TESTVALUE) {
- printf("FAILED: unsigned int %u (0x%x) != %u (0x%x)\n",
- ui, ui, UINT_TESTVALUE, UINT_TESTVALUE);
- exit(1);
- }
-
- /* unsigned long vs. {long} double test */
- if (sizeof(d) > sizeof(ul)) {
- d = ULONG_TESTVALUE;
- ul = (unsigned long)d;
- printf("testing double vs. long\n");
- } else if (sizeof(dt) > sizeof(ul)) {
- dt = ULONG_TESTVALUE;
- ul = (unsigned long)dt;
- printf("testing long double vs. long\n");
- } else {
- printf("no suitable {long} double type found, skipping "
- "\"unsigned long\" test\n");
- printf("sizeof(long) = %d, sizeof(double) = %d, "
- "sizeof(long double) = %d\n",
- sizeof(ul), sizeof(d), sizeof(dt));
- return;
- }
-
- if (ul != ULONG_TESTVALUE) {
- printf("FAILED: unsigned long %lu (0x%lx) != %lu (0x%lx)\n",
- ul, ul, ULONG_TESTVALUE, ULONG_TESTVALUE);
- exit(1);
- }
-}
-
-static void
-test2()
-{
- double nv;
- unsigned long uv;
-
- printf("testing double to unsigned long cast\n");
- nv = 5.6;
- uv = (unsigned long)nv;
-
- if (uv == 5)
- return;
-
- printf("FAILED: %.3f casted to unsigned long is %lu\n", nv, uv);
- exit(1);
-}
-
-static void
-test3()
-{
- double dv = 1.9;
- long double ldv = dv;
- unsigned long l1 = dv;
- unsigned long l2 = ldv;
-
- printf("Testing double/long double casts to unsigned long\n");
- if (l1 != 1) {
- printf("FAILED: double 1.9 casted to unsigned long should"
- " be 1, but is %lu\n", l1);
- exit(1);
- }
-
- if (l2 != 1) {
- printf("FAILED: long double 1.9 casted to unsigned long should"
- " be 1, but is %lu\n", l2);
- exit(1);
- }
-}
diff -r e13b4c97daa8 -r 6c757c505fba regress/lib/libc/gdtoa/Makefile
--- a/regress/lib/libc/gdtoa/Makefile Fri Dec 31 04:08:32 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2009/05/07 20:40:25 christos Exp $
-
-NOMAN= # defined
-
-.include <bsd.own.mk>
-
-PROG= gdtoa
-
-regress: ${PROG}
- ./${PROG}
-
-.include <bsd.prog.mk>
diff -r e13b4c97daa8 -r 6c757c505fba regress/lib/libc/gdtoa/gdtoa.c
--- a/regress/lib/libc/gdtoa/gdtoa.c Fri Dec 31 04:08:32 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2009 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * 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 by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 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: gdtoa.c,v 1.1 2009/05/07 20:40:25 christos Exp $");
-#include <stdio.h>
-
-/* reported by Maksymilian Arciemowicz */
-
-int
-main(int argc, char *argv[])
-{
- char *buf;
- (void)asprintf(&buf, "%1.262159f", 1.1);
- return 0;
-}
-
diff -r e13b4c97daa8 -r 6c757c505fba regress/lib/libc/randomid/Makefile
--- a/regress/lib/libc/randomid/Makefile Fri Dec 31 04:08:32 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2003/11/14 23:10:48 simonb Exp $
-
-NOMAN= # defined
-
-PROG= idtest
-
-regress: ${PROG}
- ./${PROG}
-
-.include <bsd.prog.mk>
diff -r e13b4c97daa8 -r 6c757c505fba regress/lib/libc/randomid/idtest.c
--- a/regress/lib/libc/randomid/idtest.c Fri Dec 31 04:08:32 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/* $NetBSD: idtest.c,v 1.5 2006/05/10 19:07:22 mrg Exp $ */
-
-/* If defined, abort at first short period and only test REGRESS times. */
-#define REGRESS 10000000 /* should be enough... */
-
-#include <sys/types.h>
-
-#include <assert.h>
-#include <randomid.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define PERIOD 30000
-
-uint64_t last[65536];
-
-uint64_t n = 0;
-
-main()
-{
- static randomid_t ctx = NULL;
- uint64_t lowest;
- uint16_t id;
- int i;
-
- memset(last, 0, sizeof(last));
- ctx = randomid_new(16, (long)3600);
-
- lowest = UINT64_MAX;
- while (n < UINT64_MAX) {
- id = randomid(ctx);
- if (last[id] > 0) {
- if (n - last[id] <= lowest) {
- if (lowest != UINT64_MAX) {
- printf("id %5d "
- "last call for id at %9lld, "
- "current call %9lld (diff %5lld)\n",
- id, last[id], n, n - last[id]);
-#ifdef REGRESS
Home |
Main Index |
Thread Index |
Old Index