Source-Changes-HG archive

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

[src/trunk]: src Add a test case for PR lib/41931 reported by he@. It was ver...



details:   https://anonhg.NetBSD.org/src/rev/7be8891a1e78
branches:  trunk
changeset: 763992:7be8891a1e78
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sun Apr 10 06:11:47 2011 +0000

description:
Add a test case for PR lib/41931 reported by he@. It was verified that these
fail on NetBSD 5.99.48 amd64 but pass on amd64 Linux (glibc 2.7).

diffstat:

 distrib/sets/lists/tests/mi |   4 +-
 tests/lib/libm/Makefile     |   6 +-
 tests/lib/libm/t_log.c      |  78 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 4 deletions(-)

diffs (126 lines):

diff -r d9505c708299 -r 7be8891a1e78 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Apr 10 00:05:51 2011 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Apr 10 06:11:47 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.301 2011/04/09 17:45:25 pgoyette Exp $
+# $NetBSD: mi,v 1.302 2011/04/10 06:11:47 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -465,6 +465,7 @@
 ./usr/libdata/debug/usr/tests/lib/libm                                 tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libm/t_ceil.debug                    tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_floor.debug                   tests-lib-debug         debug,atf
+./usr/libdata/debug/usr/tests/lib/libm/t_log.debug                     tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_libm.debug                    tests-obsolete          obsolete
 ./usr/libdata/debug/usr/tests/lib/libm/t_round.debug                   tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_tanh.debug                    tests-lib-debug         debug,atf
@@ -1956,6 +1957,7 @@
 ./usr/tests/lib/libm/Atffile                   tests-lib-tests         atf
 ./usr/tests/lib/libm/t_ceil                    tests-lib-tests         atf
 ./usr/tests/lib/libm/t_floor                   tests-lib-tests         atf
+./usr/tests/lib/libm/t_log                     tests-lib-tests         atf
 ./usr/tests/lib/libm/t_libm                    tests-obsolete          obsolete
 ./usr/tests/lib/libm/t_round                   tests-lib-tests         atf
 ./usr/tests/lib/libm/t_tanh                    tests-lib-tests         atf
diff -r d9505c708299 -r 7be8891a1e78 tests/lib/libm/Makefile
--- a/tests/lib/libm/Makefile   Sun Apr 10 00:05:51 2011 +0000
+++ b/tests/lib/libm/Makefile   Sun Apr 10 06:11:47 2011 +0000
@@ -1,12 +1,12 @@
-# $NetBSD: Makefile,v 1.4 2011/04/08 06:49:21 jruoho Exp $
+# $NetBSD: Makefile,v 1.5 2011/04/10 06:11:47 jruoho Exp $
 
 .include <bsd.own.mk>
 
 TESTSDIR=      ${TESTSBASE}/lib/libm
 
-TESTS_C+=      t_ceil t_floor t_round t_tanh
+TESTS_C+=      t_ceil t_floor t_log t_round t_tanh
 
-LDADD+=-lm
+LDADD+=                -lm
 COPTS+=                -Wfloat-equal
 
 .include <bsd.test.mk>
diff -r d9505c708299 -r 7be8891a1e78 tests/lib/libm/t_log.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libm/t_log.c    Sun Apr 10 06:11:47 2011 +0000
@@ -0,0 +1,78 @@
+/* $NetBSD: t_log.c,v 1.1 2011/04/10 06:11:47 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * 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 <sys/cdefs.h>
+__RCSID("$NetBSD: t_log.c,v 1.1 2011/04/10 06:11:47 jruoho Exp $");
+
+#include <math.h>
+
+#include <atf-c.h>
+
+ATF_TC(log_nan);
+ATF_TC_HEAD(log_nan, tc)
+{
+       atf_tc_set_md_var(tc, "descr", "Test NaN from log(3)");
+}
+
+ATF_TC_BODY(log_nan, tc)
+{
+#ifndef __vax__
+
+       double d;
+       float f;
+
+       /*
+        * If the argument is negative,
+        * the result should be NaN and
+        * a domain error should follow
+        */
+       atf_tc_expect_fail("PR lib/41931");
+
+       d = log(-1);
+       ATF_REQUIRE(isnan(d) != 0);
+
+       d = log(-INFINITY);
+       ATF_REQUIRE(isnan(d) != 0);
+
+       f = logf(-1);
+       ATF_REQUIRE(isnan(f) != 0);
+
+       f = logf(-INFINITY);
+       ATF_REQUIRE(isnan(f) != 0);
+#endif
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+       ATF_TP_ADD_TC(tp, log_nan);
+
+       return atf_no_error();
+}



Home | Main Index | Thread Index | Old Index