Module Name: src
Committed By: pgoyette
Date: Mon Dec 20 23:47:23 UTC 2010
Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/lib: Makefile
Added Files:
src/tests/lib/libm: Makefile t_libm.c
Log Message:
Move the only regress/lib/libm test to the new atf format
To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.5 -r1.6 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/Makefile \
src/tests/lib/libm/t_libm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.183 src/distrib/sets/lists/tests/mi:1.184
--- src/distrib/sets/lists/tests/mi:1.183 Mon Dec 20 16:23:01 2010
+++ src/distrib/sets/lists/tests/mi Mon Dec 20 23:47:23 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.183 2010/12/20 16:23:01 njoly Exp $
+# $NetBSD: mi,v 1.184 2010/12/20 23:47:23 pgoyette Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -339,6 +339,7 @@
./usr/libdata/debug/usr/tests/lib/semaphore/pthread/t_sem_pth.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libevent tests-lib-debug
./usr/libdata/debug/usr/tests/lib/libevent/h_event.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libm tests-lib-debug
./usr/libdata/debug/usr/tests/lib/libobjc tests-lib-debug
./usr/libdata/debug/usr/tests/lib/libobjc/t_threads.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libposix tests-lib-debug
@@ -1561,6 +1562,9 @@
./usr/tests/lib/libevent/Atffile tests-lib-tests atf
./usr/tests/lib/libevent/h_event tests-lib-tests atf
./usr/tests/lib/libevent/t_event tests-lib-tests atf
+./usr/tests/lib/libm tests-lib-tests atf
+./usr/tests/lib/libm/Atffile tests-lib-tests atf
+./usr/tests/lib/libm/t_libm tests-lib-tests atf
./usr/tests/lib/libobjc tests-lib-tests atf
./usr/tests/lib/libobjc/Atffile tests-lib-tests atf
./usr/tests/lib/libobjc/t_threads tests-lib-tests atf
Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.5 src/etc/mtree/NetBSD.dist.tests:1.6
--- src/etc/mtree/NetBSD.dist.tests:1.5 Wed Dec 15 20:42:23 2010
+++ src/etc/mtree/NetBSD.dist.tests Mon Dec 20 23:47:23 2010
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.dist.tests,v 1.5 2010/12/15 20:42:23 pooka Exp $
+# $NetBSD: NetBSD.dist.tests,v 1.6 2010/12/20 23:47:23 pgoyette Exp $
./usr/libdata/debug/usr/tests
./usr/libdata/debug/usr/tests/atf
@@ -53,6 +53,7 @@
./usr/libdata/debug/usr/tests/lib/libevent
./usr/libdata/debug/usr/tests/lib/semaphore
./usr/libdata/debug/usr/tests/lib/semaphore/pthread
+./usr/libdata/debug/usr/tests/lib/libm
./usr/libdata/debug/usr/tests/lib/libobjc
./usr/libdata/debug/usr/tests/lib/libposix
./usr/libdata/debug/usr/tests/lib/libposix/bsd
@@ -144,6 +145,7 @@
./usr/tests/lib/semaphore
./usr/tests/lib/semaphore/pthread
./usr/tests/lib/libevent
+./usr/tests/lib/libm
./usr/tests/lib/libobjc
./usr/tests/lib/libposix
./usr/tests/lib/libposix/bsd
Index: src/tests/lib/Makefile
diff -u src/tests/lib/Makefile:1.9 src/tests/lib/Makefile:1.10
--- src/tests/lib/Makefile:1.9 Wed Aug 25 16:46:36 2010
+++ src/tests/lib/Makefile Mon Dec 20 23:47:23 2010
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.9 2010/08/25 16:46:36 jmmv Exp $
+# $NetBSD: Makefile,v 1.10 2010/12/20 23:47:23 pgoyette Exp $
.include <bsd.own.mk>
-TESTS_SUBDIRS= csu libc libevent libobjc libposix libprop librt libpthread \
- libutil semaphore
+TESTS_SUBDIRS= csu libc libm libevent libobjc libposix libprop librt \
+ libpthread libutil semaphore
.if ${MKCRYPTO} != "no"
TESTS_SUBDIRS+= libdes
Added files:
Index: src/tests/lib/libm/Makefile
diff -u /dev/null src/tests/lib/libm/Makefile:1.1
--- /dev/null Mon Dec 20 23:47:24 2010
+++ src/tests/lib/libm/Makefile Mon Dec 20 23:47:23 2010
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.1 2010/12/20 23:47:23 pgoyette Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libm
+
+TESTS_C+= t_libm
+
+LDADD+=-lm
+
+.include <bsd.test.mk>
Index: src/tests/lib/libm/t_libm.c
diff -u /dev/null src/tests/lib/libm/t_libm.c:1.1
--- /dev/null Mon Dec 20 23:47:24 2010
+++ src/tests/lib/libm/t_libm.c Mon Dec 20 23:47:23 2010
@@ -0,0 +1,44 @@
+/* $NetBSD: t_libm.c,v 1.1 2010/12/20 23:47:23 pgoyette Exp $ */
+
+#include <atf-c.h>
+#include <math.h>
+
+/*
+ * This tests for a bug in the initial implementation where precision
+ * was lost in an internal substraction, leading to rounding
+ * into the wrong direction.
+ */
+
+ATF_TC(round);
+
+/* 0.5 - EPSILON */
+#define VAL 0x0.7ffffffffffffcp0
+#define VALF 0x0.7fffff8p0
+
+ATF_TC_HEAD(round, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check for rounding in wrong direction");
+}
+
+ATF_TC_BODY(round, tc)
+{
+ double a = VAL, b, c;
+ float af = VALF, bf, cf;
+
+ b = round(a);
+ bf = roundf(af);
+ c = round(-a);
+ cf = roundf(-af);
+ ATF_REQUIRE(b == 0);
+ ATF_REQUIRE(bf == 0);
+ ATF_REQUIRE(c == 0);
+ ATF_REQUIRE(cf == 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, round);
+
+ return atf_no_error();
+}