Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Move the tests/libc/ieeefp to tests/libc/gen to match the st...



details:   https://anonhg.NetBSD.org/src/rev/49a6bc9a1915
branches:  trunk
changeset: 769690:49a6bc9a1915
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon Sep 19 05:25:50 2011 +0000

description:
Move the tests/libc/ieeefp to tests/libc/gen to match the structure of libc.
Also rename the test files to gain functional scope.

diffstat:

 distrib/sets/lists/tests/mi         |   24 +-
 etc/mtree/NetBSD.dist.tests         |    4 +-
 tests/lib/libc/gen/Makefile         |   12 +-
 tests/lib/libc/gen/t_fpclassify.c   |  206 ++++++++++++++++++++++
 tests/lib/libc/gen/t_fpsetmask.c    |  330 ++++++++++++++++++++++++++++++++++++
 tests/lib/libc/gen/t_fpsetround.c   |   77 ++++++++
 tests/lib/libc/gen/t_isnan.c        |   62 ++++++
 tests/lib/libc/ieeefp/Makefile      |   14 -
 tests/lib/libc/ieeefp/Makefile.inc  |    6 -
 tests/lib/libc/ieeefp/t_except.c    |  330 ------------------------------------
 tests/lib/libc/ieeefp/t_nan_inf.c   |   66 -------
 tests/lib/libc/ieeefp/t_round.c     |   78 --------
 tests/lib/libc/ieeefp/t_subnormal.c |  212 -----------------------
 13 files changed, 699 insertions(+), 722 deletions(-)

diffs (truncated from 1530 to 300 lines):

diff -r 0673d756e344 -r 49a6bc9a1915 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Mon Sep 19 01:45:15 2011 +0000
+++ b/distrib/sets/lists/tests/mi       Mon Sep 19 05:25:50 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.389 2011/09/18 05:19:18 jruoho Exp $
+# $NetBSD: mi,v 1.390 2011/09/19 05:25:50 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -387,11 +387,11 @@
 ./usr/libdata/debug/usr/tests/lib/libc/hash                            tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/hash/h_hash.debug               tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/hash/t_sha2.debug               tests-lib-debug         debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/ieeefp                          tests-lib-debug
-./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_except.debug           tests-lib-debug         debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_nan_inf.debug          tests-lib-debug         debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_round.debug            tests-lib-debug         debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_subnormal.debug                tests-lib-debug         debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp                          tests-obsolete          obsolete
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_except.debug           tests-obsolete          obsolete
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_nan_inf.debug          tests-obsolete          obsolete
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_round.debug            tests-obsolete          obsolete
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_subnormal.debug                tests-obsolete          obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/locale                          tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/locale/t_ctype1.debug           tests-obsolete          obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/locale/t_ctype2.debug           tests-obsolete          obsolete
@@ -1935,12 +1935,12 @@
 ./usr/tests/lib/libc/hash/h_hash               tests-lib-tests         atf
 ./usr/tests/lib/libc/hash/t_hash               tests-lib-tests         atf
 ./usr/tests/lib/libc/hash/t_sha2               tests-lib-tests         atf
-./usr/tests/lib/libc/ieeefp                    tests-lib-tests
-./usr/tests/lib/libc/ieeefp/Atffile            tests-lib-tests         atf
-./usr/tests/lib/libc/ieeefp/t_except           tests-lib-tests         atf
-./usr/tests/lib/libc/ieeefp/t_nan_inf          tests-lib-tests         atf
-./usr/tests/lib/libc/ieeefp/t_round            tests-lib-tests         atf
-./usr/tests/lib/libc/ieeefp/t_subnormal                tests-lib-tests         atf
+./usr/tests/lib/libc/ieeefp                    tests-obsolete
+./usr/tests/lib/libc/ieeefp/Atffile            tests-obsolete          obsolete
+./usr/tests/lib/libc/ieeefp/t_except           tests-obsolete          obsolete
+./usr/tests/lib/libc/ieeefp/t_nan_inf          tests-obsolete          obsolete
+./usr/tests/lib/libc/ieeefp/t_round            tests-obsolete          obsolete
+./usr/tests/lib/libc/ieeefp/t_subnormal                tests-obsolete          obsolete
 ./usr/tests/lib/libc/locale                    tests-lib-tests
 ./usr/tests/lib/libc/locale/Atffile            tests-lib-tests         atf
 ./usr/tests/lib/libc/locale/t_ctype1           tests-obsolete          obsolete
diff -r 0673d756e344 -r 49a6bc9a1915 etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests       Mon Sep 19 01:45:15 2011 +0000
+++ b/etc/mtree/NetBSD.dist.tests       Mon Sep 19 05:25:50 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: NetBSD.dist.tests,v 1.52 2011/08/27 19:02:29 dyoung Exp $
+#      $NetBSD: NetBSD.dist.tests,v 1.53 2011/09/19 05:25:50 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -51,7 +51,6 @@
 ./usr/libdata/debug/usr/tests/lib/libc/db
 ./usr/libdata/debug/usr/tests/lib/libc/gen
 ./usr/libdata/debug/usr/tests/lib/libc/hash
-./usr/libdata/debug/usr/tests/lib/libc/ieeefp
 ./usr/libdata/debug/usr/tests/lib/libc/locale
 ./usr/libdata/debug/usr/tests/lib/libc/inet
 ./usr/libdata/debug/usr/tests/lib/libc/net
@@ -173,7 +172,6 @@
 ./usr/tests/lib/libc/gen
 ./usr/tests/lib/libc/hash
 ./usr/tests/lib/libc/hash/data
-./usr/tests/lib/libc/ieeefp
 ./usr/tests/lib/libc/locale
 ./usr/tests/lib/libc/inet
 ./usr/tests/lib/libc/net
diff -r 0673d756e344 -r 49a6bc9a1915 tests/lib/libc/gen/Makefile
--- a/tests/lib/libc/gen/Makefile       Mon Sep 19 01:45:15 2011 +0000
+++ b/tests/lib/libc/gen/Makefile       Mon Sep 19 05:25:50 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.28 2011/07/07 15:53:27 jruoho Exp $
+# $NetBSD: Makefile,v 1.29 2011/09/19 05:25:50 jruoho Exp $
 
 .include <bsd.own.mk>
 
@@ -10,10 +10,14 @@
 TESTS_C+=      t_closefrom
 TESTS_C+=      t_dir
 TESTS_C+=      t_fmtcheck
+TESTS_C+=      t_fpclassify
+TESTS_C+=      t_fpsetmask
+TESTS_C+=      t_fpsetround
 TESTS_C+=      t_getcwd
 TESTS_C+=      t_getgrent
 TESTS_C+=      t_glob
 TESTS_C+=      t_humanize_number
+TESTS_C+=      t_isnan
 TESTS_C+=      t_ldexp
 TESTS_C+=      t_nice
 TESTS_C+=      t_pause
@@ -26,8 +30,14 @@
 TESTS_C+=      t_ttyname
 TESTS_C+=      t_vis
 
+LDADD.t_fpclassify+=   -lm
 LDADD.t_ldexp+=                -lm
+
 LDADD.t_nice+=         -lpthread
 LDADD.t_syslog+=       -lpthread
 
+.if ${MACHINE_ARCH} == "alpha"
+COPTS+=                        -mieee
+.endif
+
 .include <bsd.test.mk>
diff -r 0673d756e344 -r 49a6bc9a1915 tests/lib/libc/gen/t_fpclassify.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/gen/t_fpclassify.c Mon Sep 19 05:25:50 2011 +0000
@@ -0,0 +1,206 @@
+/* $NetBSD: t_fpclassify.c,v 1.1 2011/09/19 05:25:50 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 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 <float.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined(__vax__)
+
+ATF_TC(no_test);
+ATF_TC_HEAD(no_test, tc)
+{
+       atf_tc_set_md_var(tc, "descr", "Dummy test");
+}
+
+ATF_TC_BODY(no_test,tc)
+{
+       atf_tc_skip("Test not available on this architecture");
+}
+
+#else /* defined(__vax__) */
+
+ATF_TC(fpclassify_float);
+ATF_TC_HEAD(fpclassify_float, tc)
+{
+
+       atf_tc_set_md_var(tc, "descr", "Test float operations");
+}
+
+ATF_TC_BODY(fpclassify_float, tc)
+{
+       float d0, d1, d2, f, ip;
+       int e, i;
+
+       d0 = FLT_MIN;
+       ATF_REQUIRE_EQ(fpclassify(d0), FP_NORMAL);
+       f = frexpf(d0, &e);
+       ATF_REQUIRE_EQ(e, FLT_MIN_EXP);
+       ATF_REQUIRE_EQ(f, 0.5);
+       d1 = d0;
+
+       /* shift a "1" bit through the mantissa (skip the implicit bit) */
+       for (i = 1; i < FLT_MANT_DIG; i++) {
+               d1 /= 2;
+               ATF_REQUIRE_EQ(fpclassify(d1), FP_SUBNORMAL);
+               ATF_REQUIRE(d1 > 0 && d1 < d0);
+
+               d2 = ldexpf(d0, -i);
+               ATF_REQUIRE_EQ(d2, d1);
+
+               d2 = modff(d1, &ip);
+               ATF_REQUIRE_EQ(d2, d1);
+               ATF_REQUIRE_EQ(ip, 0);
+
+               f = frexpf(d1, &e);
+               ATF_REQUIRE_EQ(e, FLT_MIN_EXP - i);
+               ATF_REQUIRE_EQ(f, 0.5);
+       }
+
+       d1 /= 2;
+       ATF_REQUIRE_EQ(fpclassify(d1), FP_ZERO);
+       f = frexpf(d1, &e);
+       ATF_REQUIRE_EQ(e, 0);
+       ATF_REQUIRE_EQ(f, 0);
+}
+
+ATF_TC(fpclassify_double);
+ATF_TC_HEAD(fpclassify_double, tc)
+{
+
+       atf_tc_set_md_var(tc, "descr", "Test double operations");
+}
+
+ATF_TC_BODY(fpclassify_double, tc)
+{
+       double d0, d1, d2, f, ip;
+       int e, i;
+
+       d0 = DBL_MIN;
+       ATF_REQUIRE_EQ(fpclassify(d0), FP_NORMAL);
+       f = frexp(d0, &e);
+       ATF_REQUIRE_EQ(e, DBL_MIN_EXP);
+       ATF_REQUIRE_EQ(f, 0.5);
+       d1 = d0;
+
+       /* shift a "1" bit through the mantissa (skip the implicit bit) */
+       for (i = 1; i < DBL_MANT_DIG; i++) {
+               d1 /= 2;
+               ATF_REQUIRE_EQ(fpclassify(d1), FP_SUBNORMAL);
+               ATF_REQUIRE(d1 > 0 && d1 < d0);
+
+               d2 = ldexp(d0, -i);
+               ATF_REQUIRE_EQ(d2, d1);
+
+               d2 = modf(d1, &ip);
+               ATF_REQUIRE_EQ(d2, d1);
+               ATF_REQUIRE_EQ(ip, 0);
+
+               f = frexp(d1, &e);
+               ATF_REQUIRE_EQ(e, DBL_MIN_EXP - i);
+               ATF_REQUIRE_EQ(f, 0.5);
+       }
+
+       d1 /= 2;
+       ATF_REQUIRE_EQ(fpclassify(d1), FP_ZERO);
+       f = frexp(d1, &e);
+       ATF_REQUIRE_EQ(e, 0);
+       ATF_REQUIRE_EQ(f, 0);
+}
+
+/*
+ * XXX NetBSD doesn't have long-double flavors of frexp, ldexp, and modf,
+ * XXX so this test is disabled.
+ */
+
+#ifdef TEST_LONG_DOUBLE
+
+ATF_TC(fpclassify_long_double);
+ATF_TC_HEAD(fpclassify_long_double, tc)
+{
+
+       atf_tc_set_md_var(tc, "descr", "Test long double operations");
+}
+
+ATF_TC_BODY(fpclassify_long_double, tc)
+{
+       long double d0, d1, d2, f, ip;
+       int e, i;
+
+       d0 = LDBL_MIN;
+       ATF_REQUIRE_EQ(fpclassify(d0), FP_NORMAL);
+       f = frexpl(d0, &e);
+       ATF_REQUIRE_EQ(e, LDBL_MIN_EXP);
+       ATF_REQUIRE_EQ(f, 0.5);
+       d1 = d0;
+
+       /* shift a "1" bit through the mantissa (skip the implicit bit) */
+       for (i = 1; i < LDBL_MANT_DIG; i++) {
+               d1 /= 2;
+               ATF_REQUIRE_EQ(fpclassify(d1), FP_SUBNORMAL);
+               ATF_REQUIRE(d1 > 0 && d1 < d0);
+
+               d2 = ldexpl(d0, -i);
+               ATF_REQUIRE_EQ(d2, d1);
+
+               d2 = modfl(d1, &ip);
+               ATF_REQUIRE_EQ(d2, d1);
+               ATF_REQUIRE_EQ(ip, 0);
+
+               f = frexpl(d1, &e);
+               ATF_REQUIRE_EQ(e, LDBL_MIN_EXP - i);
+               ATF_REQUIRE_EQ(f, 0.5);
+       }
+
+       d1 /= 2;
+       ATF_REQUIRE_EQ(fpclassify(d1), FP_ZERO);
+       f = frexpl(d1, &e);
+       ATF_REQUIRE_EQ(e, 0);
+       ATF_REQUIRE_EQ(f, 0);



Home | Main Index | Thread Index | Old Index