summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/mtree/BSD.tests.dist50
-rw-r--r--lib/libc/Makefile2
-rw-r--r--lib/libc/Makefile.amd646
-rw-r--r--lib/libc/Makefile.i3866
-rw-r--r--lib/libc/tests/Makefile32
-rw-r--r--lib/libc/tests/Makefile.netbsd-tests7
-rw-r--r--lib/libc/tests/c063/Makefile24
-rw-r--r--lib/libc/tests/db/Makefile17
-rw-r--r--lib/libc/tests/gen/Makefile61
-rw-r--r--lib/libc/tests/gen/arc4random_test.c (renamed from tools/regression/lib/libc/gen/test-arc4random.c)27
-rw-r--r--lib/libc/tests/gen/execve/Makefile15
-rw-r--r--lib/libc/tests/gen/fpclassify2_test.c72
-rw-r--r--lib/libc/tests/gen/posix_spawn/Makefile34
-rw-r--r--lib/libc/tests/hash/Makefile31
-rw-r--r--lib/libc/tests/inet/Makefile11
-rw-r--r--lib/libc/tests/locale/Makefile22
-rw-r--r--lib/libc/tests/net/Makefile39
-rw-r--r--lib/libc/tests/net/getaddrinfo/Makefile31
-rw-r--r--lib/libc/tests/regex/Makefile59
-rw-r--r--lib/libc/tests/rpc/Makefile27
-rw-r--r--lib/libc/tests/setjmp/Makefile13
-rw-r--r--lib/libc/tests/ssp/Makefile45
-rw-r--r--lib/libc/tests/stdio/Makefile17
-rw-r--r--lib/libc/tests/stdlib/Makefile44
-rw-r--r--lib/libc/tests/string/Makefile33
-rw-r--r--lib/libc/tests/sys/Makefile85
-rw-r--r--lib/libc/tests/termios/Makefile11
-rw-r--r--lib/libc/tests/time/Makefile12
-rw-r--r--lib/libc/tests/tls/Makefile35
-rw-r--r--lib/libc/tests/tls/dso/Makefile18
-rw-r--r--lib/libc/tests/tls_dso/Makefile20
-rw-r--r--lib/libc/tests/ttyio/Makefile15
-rw-r--r--tools/regression/lib/libc/gen/Makefile4
-rw-r--r--tools/regression/lib/libc/gen/test-fpclassify.c76
34 files changed, 911 insertions, 90 deletions
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
index e188a2c..0c6df59 100644
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -87,6 +87,56 @@
test-programs
..
..
+ libc
+ c063
+ ..
+ db
+ ..
+ gen
+ execve
+ ..
+ posix_spawn
+ ..
+ ..
+ hash
+ data
+ ..
+ ..
+ inet
+ ..
+ locale
+ ..
+ net
+ getaddrinfo
+ data
+ ..
+ ..
+ ..
+ regex
+ data
+ ..
+ ..
+ ssp
+ ..
+ stdio
+ ..
+ stdlib
+ ..
+ string
+ ..
+ sys
+ ..
+ time
+ ..
+ tls
+ dso
+ ..
+ ..
+ termios
+ ..
+ ttyio
+ ..
+ ..
libcrypt
..
libmp
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 6575f6b..361d7f4 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -160,6 +160,8 @@ libkern.${LIBC_ARCH}:: ${KMSRCS}
CFLAGS+=-DSYSCALL_COMPAT
.endif
+.include <bsd.arch.inc.mk>
+
.include <bsd.lib.mk>
# Disable warnings in contributed sources.
diff --git a/lib/libc/Makefile.amd64 b/lib/libc/Makefile.amd64
new file mode 100644
index 0000000..dd0f5b0
--- /dev/null
+++ b/lib/libc/Makefile.amd64
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
diff --git a/lib/libc/Makefile.i386 b/lib/libc/Makefile.i386
new file mode 100644
index 0000000..dd0f5b0
--- /dev/null
+++ b/lib/libc/Makefile.i386
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
diff --git a/lib/libc/tests/Makefile b/lib/libc/tests/Makefile
new file mode 100644
index 0000000..ad523aa
--- /dev/null
+++ b/lib/libc/tests/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc
+
+SUBDIR= tls_dso
+
+TESTS_SUBDIRS= c063
+TESTS_SUBDIRS+= db
+TESTS_SUBDIRS+= gen
+TESTS_SUBDIRS+= hash
+TESTS_SUBDIRS+= inet
+TESTS_SUBDIRS+= net
+TESTS_SUBDIRS+= regex
+TESTS_SUBDIRS+= stdio
+TESTS_SUBDIRS+= stdlib
+TESTS_SUBDIRS+= string
+TESTS_SUBDIRS+= sys
+TESTS_SUBDIRS+= termios
+TESTS_SUBDIRS+= tls
+TESTS_SUBDIRS+= ttyio
+
+.if ${MK_LOCALES} != "no"
+TESTS_SUBDIRS+= locale
+.endif
+
+.if ${MK_SSP} != "no"
+TESTS_SUBDIRS+= ssp
+.endif
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/Makefile.netbsd-tests b/lib/libc/tests/Makefile.netbsd-tests
new file mode 100644
index 0000000..f364b1c
--- /dev/null
+++ b/lib/libc/tests/Makefile.netbsd-tests
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+OBJTOP?= ${.OBJDIR:H:H:H:H}
+SRCTOP?= ${.CURDIR:H:H:H:H}
+TESTSRC?= ${SRCTOP}/contrib/netbsd-tests/lib/libc/${.CURDIR:T}
+
+.include <netbsd-tests.test.mk>
diff --git a/lib/libc/tests/c063/Makefile b/lib/libc/tests/c063/Makefile
new file mode 100644
index 0000000..b743165
--- /dev/null
+++ b/lib/libc/tests/c063/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/lib/libc/c063
+
+#TODO: t_o_search, t_utimensat
+
+NETBSD_ATF_TESTS_C= t_faccessat
+NETBSD_ATF_TESTS_C+= t_fchmodat
+NETBSD_ATF_TESTS_C+= t_fchownat
+NETBSD_ATF_TESTS_C+= t_fexecve
+NETBSD_ATF_TESTS_C+= t_fstatat
+NETBSD_ATF_TESTS_C+= t_linkat
+NETBSD_ATF_TESTS_C+= t_mkdirat
+NETBSD_ATF_TESTS_C+= t_mkfifoat
+NETBSD_ATF_TESTS_C+= t_mknodat
+NETBSD_ATF_TESTS_C+= t_openat
+NETBSD_ATF_TESTS_C+= t_readlinkat
+NETBSD_ATF_TESTS_C+= t_renameat
+NETBSD_ATF_TESTS_C+= t_symlinkat
+NETBSD_ATF_TESTS_C+= t_unlinkat
+
+CFLAGS+= -D_INCOMPLETE_XOPEN_C063
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/db/Makefile b/lib/libc/tests/db/Makefile
new file mode 100644
index 0000000..323a9f0
--- /dev/null
+++ b/lib/libc/tests/db/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/lib/libc/db
+
+BINDIR= ${TESTSDIR}
+
+PROGS= h_db
+
+FILESDIR= ${TESTSDIR}
+
+FILES= README
+
+NETBSD_ATF_TESTS_SH+= db_test
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile
new file mode 100644
index 0000000..f9a0bd4
--- /dev/null
+++ b/lib/libc/tests/gen/Makefile
@@ -0,0 +1,61 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/gen
+
+ATF_TESTS_C= arc4random_test
+ATF_TESTS_C+= fpclassify2_test
+
+# TODO: t_closefrom, t_cpuset, t_fmtcheck, t_randomid, t_sleep
+# TODO: t_siginfo (fixes require further inspection)
+# TODO: t_sethostname_test (consistently screws up the hostname)
+
+NETBSD_ATF_TESTS_C= alarm_test
+NETBSD_ATF_TESTS_C+= assert_test
+NETBSD_ATF_TESTS_C+= basedirname_test
+NETBSD_ATF_TESTS_C+= dir_test
+NETBSD_ATF_TESTS_C+= floatunditf_test
+NETBSD_ATF_TESTS_C+= fnmatch_test
+NETBSD_ATF_TESTS_C+= fpclassify_test
+NETBSD_ATF_TESTS_C+= fpsetmask_test
+NETBSD_ATF_TESTS_C+= fpsetround_test
+NETBSD_ATF_TESTS_C+= ftok_test
+NETBSD_ATF_TESTS_C+= getcwd_test
+NETBSD_ATF_TESTS_C+= getgrent_test
+NETBSD_ATF_TESTS_C+= glob_test
+NETBSD_ATF_TESTS_C+= humanize_number_test
+NETBSD_ATF_TESTS_C+= isnan_test
+NETBSD_ATF_TESTS_C+= nice_test
+NETBSD_ATF_TESTS_C+= pause_test
+NETBSD_ATF_TESTS_C+= raise_test
+NETBSD_ATF_TESTS_C+= realpath_test
+NETBSD_ATF_TESTS_C+= setdomainname_test
+NETBSD_ATF_TESTS_C+= sethostname_test
+NETBSD_ATF_TESTS_C+= sleep_test
+NETBSD_ATF_TESTS_C+= syslog_test
+NETBSD_ATF_TESTS_C+= time_test
+NETBSD_ATF_TESTS_C+= ttyname_test
+NETBSD_ATF_TESTS_C+= vis_test
+
+.include "../Makefile.netbsd-tests"
+
+LDADD.humanize_number_test+= -lutil
+DPADD.humanize_number_test+= ${LIBUTIL}
+
+LDADD.fpclassify_test+= -lm
+DPADD.fpclassify_test+= ${LIBM}
+LDADD.fpsetround_test+= -lm
+DPADD.fpsetround_test+= ${LIBM}
+LDADD.siginfo_test+= -lm
+DPADD.siginfo_test+= ${LIBM}
+
+LDADD.nice_test+= -lpthread
+DPADD.nice_test+= ${LIBPTHREAD}
+LDADD.syslog_test+= -lpthread
+DPADD.syslog_test+= ${LIBPTHREAD}
+
+TESTS_SUBDIRS= execve
+TESTS_SUBDIRS+= posix_spawn
+
+.include <bsd.test.mk>
diff --git a/tools/regression/lib/libc/gen/test-arc4random.c b/lib/libc/tests/gen/arc4random_test.c
index eb3d88c..ec82c32 100644
--- a/tools/regression/lib/libc/gen/test-arc4random.c
+++ b/lib/libc/tests/gen/arc4random_test.c
@@ -27,13 +27,14 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/mman.h>
#include <sys/types.h>
+#include <sys/mman.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <atf-c.h>
/*
* BUFSIZE is the number of bytes of rc4 output to compare. The probability
@@ -45,7 +46,9 @@ __FBSDID("$FreeBSD$");
* Test whether arc4random_buf() returns the same sequence of bytes in both
* parent and child processes. (Hint: It shouldn't.)
*/
-int main(int argc, char *argv[]) {
+ATF_TC_WITHOUT_HEAD(test_arc4random);
+ATF_TC_BODY(test_arc4random, tc)
+{
struct shared_page {
char parentbuf[BUFSIZE];
char childbuf[BUFSIZE];
@@ -65,10 +68,7 @@ int main(int argc, char *argv[]) {
arc4random_buf(&c, 1);
pid = fork();
- if (pid < 0) {
- printf("fail 1 - fork\n");
- exit(1);
- }
+ ATF_REQUIRE(0 <= pid);
if (pid == 0) {
/* child */
arc4random_buf(page->childbuf, BUFSIZE);
@@ -79,11 +79,14 @@ int main(int argc, char *argv[]) {
arc4random_buf(page->parentbuf, BUFSIZE);
wait(&status);
}
- if (memcmp(page->parentbuf, page->childbuf, BUFSIZE) == 0) {
- printf("fail 1 - sequences are the same\n");
- exit(1);
- }
+ ATF_CHECK_MSG(memcmp(page->parentbuf, page->childbuf, BUFSIZE) != 0,
+ "sequences are the same");
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, test_arc4random);
- printf("ok 1 - sequences are different\n");
- exit(0);
+ return (atf_no_error());
}
diff --git a/lib/libc/tests/gen/execve/Makefile b/lib/libc/tests/gen/execve/Makefile
new file mode 100644
index 0000000..2106a15
--- /dev/null
+++ b/lib/libc/tests/gen/execve/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+OBJTOP= ${.OBJDIR:H:H:H:H:H}
+SRCTOP= ${.CURDIR:H:H:H:H:H}
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/gen/${.CURDIR:T}
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/gen/execve
+
+NETBSD_ATF_TESTS_C= execve_test
+
+.include "../../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/gen/fpclassify2_test.c b/lib/libc/tests/gen/fpclassify2_test.c
new file mode 100644
index 0000000..a6bb1df
--- /dev/null
+++ b/lib/libc/tests/gen/fpclassify2_test.c
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <atf-c.h>
+
+ATF_TC_WITHOUT_HEAD(test_fpclassify);
+ATF_TC_BODY(test_fpclassify, tc)
+{
+
+ ATF_CHECK(fpclassify((float)0) == FP_ZERO);
+ ATF_CHECK(fpclassify((float)-0.0) == FP_ZERO);
+ ATF_CHECK(fpclassify((float)1) == FP_NORMAL);
+ ATF_CHECK(fpclassify((float)1000) == FP_NORMAL);
+ ATF_CHECK(fpclassify(HUGE_VALF) == FP_INFINITE);
+ ATF_CHECK(fpclassify((float)HUGE_VAL) == FP_INFINITE);
+ ATF_CHECK(fpclassify((float)HUGE_VALL) == FP_INFINITE);
+ ATF_CHECK(fpclassify(NAN) == FP_NAN);
+
+ ATF_CHECK(fpclassify((double)0) == FP_ZERO);
+ ATF_CHECK(fpclassify((double)-0) == FP_ZERO);
+ ATF_CHECK(fpclassify((double)1) == FP_NORMAL);
+ ATF_CHECK(fpclassify((double)1000) == FP_NORMAL);
+ ATF_CHECK(fpclassify(HUGE_VAL) == FP_INFINITE);
+ ATF_CHECK(fpclassify((double)HUGE_VALF) == FP_INFINITE);
+ ATF_CHECK(fpclassify((double)HUGE_VALL) == FP_INFINITE);
+ ATF_CHECK(fpclassify((double)NAN) == FP_NAN);
+
+ ATF_CHECK(fpclassify((long double)0) == FP_ZERO);
+ ATF_CHECK(fpclassify((long double)-0.0) == FP_ZERO);
+ ATF_CHECK(fpclassify((long double)1) == FP_NORMAL);
+ ATF_CHECK(fpclassify((long double)1000) == FP_NORMAL);
+ ATF_CHECK(fpclassify(HUGE_VALL) == FP_INFINITE);
+ ATF_CHECK(fpclassify((long double)HUGE_VALF) == FP_INFINITE);
+ ATF_CHECK(fpclassify((long double)HUGE_VAL) == FP_INFINITE);
+ ATF_CHECK(fpclassify((long double)NAN) == FP_NAN);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, test_fpclassify);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/gen/posix_spawn/Makefile b/lib/libc/tests/gen/posix_spawn/Makefile
new file mode 100644
index 0000000..a1c9b9e
--- /dev/null
+++ b/lib/libc/tests/gen/posix_spawn/Makefile
@@ -0,0 +1,34 @@
+# $FreeBSD$
+
+OBJTOP= ${.OBJDIR:H:H:H:H:H}
+SRCTOP= ${.CURDIR:H:H:H:H:H}
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/gen/${.CURDIR:T}
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/gen/posix_spawn
+
+BINDIR= ${TESTSDIR}
+
+# TODO: t_spawnattr (fix from pho@ needs additional review)
+NETBSD_ATF_TESTS_C= fileactions_test
+NETBSD_ATF_TESTS_C+= spawn_test
+
+PROGS= h_fileactions
+PROGS+= h_spawn
+PROGS+= h_spawnattr
+
+SCRIPTS= h_nonexec
+SCRIPTS+= h_zero
+
+.include "../../Makefile.netbsd-tests"
+
+h_zero:
+ dd if=/dev/zero of=h_zero bs=1k count=2
+ chmod a+x h_zero
+
+CLEANFILES+= h_zero
+
+WARNS?=3
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile
new file mode 100644
index 0000000..df9d6d9
--- /dev/null
+++ b/lib/libc/tests/hash/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/lib/libc/hash
+
+NETBSD_ATF_TESTS_C= sha2_test
+
+NETBSD_ATF_TESTS_SH= hash_test
+
+BINDIR= ${TESTSDIR}
+
+PROGS+= h_hash
+
+FILESDIR= ${TESTSDIR}/data
+
+FILES+= data/md5test-in
+FILES+= data/md5test-out
+FILES+= data/sha1test-in
+FILES+= data/sha1test-out
+FILES+= data/sha1test2-out
+
+DPADD+= ${LIBMD}
+LDADD+= -lmd
+DPADD.sha2_test+= ${LIBCRYPTO}
+LDADD.sha2_test+= -lcrypto
+
+CFLAGS.sha2_test+= -I${.CURDIR}/../../../../crypto/openssh/openbsd-compat
+CFLAGS.sha2_test+= -I${.CURDIR}/../../../../crypto/openssh
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/inet/Makefile b/lib/libc/tests/inet/Makefile
new file mode 100644
index 0000000..a15b96a
--- /dev/null
+++ b/lib/libc/tests/inet/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/inet
+
+NETBSD_ATF_TESTS_C= inet_network_test
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/locale/Makefile b/lib/libc/tests/locale/Makefile
new file mode 100644
index 0000000..e4dc553
--- /dev/null
+++ b/lib/libc/tests/locale/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/locale
+
+NETBSD_ATF_TESTS_C= io_test
+NETBSD_ATF_TESTS_C+= mbrtowc_test
+NETBSD_ATF_TESTS_C+= mbstowcs_test
+NETBSD_ATF_TESTS_C+= mbsnrtowcs_test
+NETBSD_ATF_TESTS_C+= mbtowc_test
+NETBSD_ATF_TESTS_C+= wcscspn_test
+NETBSD_ATF_TESTS_C+= wcspbrk_test
+NETBSD_ATF_TESTS_C+= wcsspn_test
+NETBSD_ATF_TESTS_C+= wcstod_test
+NETBSD_ATF_TESTS_C+= wctomb_test
+
+CFLAGS.t_wctomb.c+= -Wno-stack-protector
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/net/Makefile b/lib/libc/tests/net/Makefile
new file mode 100644
index 0000000..eb199f0
--- /dev/null
+++ b/lib/libc/tests/net/Makefile
@@ -0,0 +1,39 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/net
+
+BINDIR= ${TESTSDIR}
+
+NETBSD_ATF_TESTS_C= getprotoent_test
+NETBSD_ATF_TESTS_C+= ether_aton_test
+
+SRCS.t_ether_aton= aton_ether_subr.c t_ether_aton.c
+
+aton_ether_subr.c: gen_ether_subr ${.CURDIR:H:H:H:H}/sys/net/if_ethersubr.c
+ ${HOST_SH} ${.ALLSRC} ${.TARGET}
+
+# TODO: hostent_test
+NETBSD_ATF_TESTS_SH= nsdispatch_test
+NETBSD_ATF_TESTS_SH+= protoent_test
+NETBSD_ATF_TESTS_SH+= servent_test
+
+PROGS= h_nsd_recurse
+PROGS+= h_protoent
+PROGS+= h_servent
+PROGS+= h_dns_server
+
+DPADD.h_nsd_recurse+= ${LIBPTHREAD}
+LDADD.h_nsd_recurse+= -lpthread
+
+CLEANFILES+= aton_ether_subr.c
+
+.include "../Makefile.netbsd-tests"
+
+# TODO: the testcases needs to be ported to FreeBSD
+#TESTS_SUBDIRS= getaddrinfo
+FILES= hosts
+FILES+= resolv.conf
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/net/getaddrinfo/Makefile b/lib/libc/tests/net/getaddrinfo/Makefile
new file mode 100644
index 0000000..a6b9eb1
--- /dev/null
+++ b/lib/libc/tests/net/getaddrinfo/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+OBJTOP= ${.OBJDIR:H:H:H:H:H}
+SRCTOP= ${.CURDIR:H:H:H:H:H}
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/net/${.CURDIR:T}
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/net/getaddrinfo
+
+BINDIR= ${TESTSDIR}
+
+.error "This testcase needs to be ported to FreeBSD (the output from getaddrinfo_test differs from NetBSD)"
+
+NETBSD_ATF_TESTS_SH= getaddrinfo_test
+
+PROGS= h_gai
+
+FILESDIR= ${TESTSDIR}/data
+
+FILES= basics_v4.exp basics_v4v6.exp
+FILES+= no_host_v4.exp no_host_v4v6.exp
+FILES+= no_serv_v4.exp no_serv_v4v6.exp
+FILES+= sock_raw_v4.exp sock_raw_v4v6.exp
+FILES+= spec_fam_v4.exp spec_fam_v4v6.exp
+FILES+= scoped.exp
+FILES+= unsup_fam.exp
+
+.include "../../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/regex/Makefile b/lib/libc/tests/regex/Makefile
new file mode 100644
index 0000000..37b3277
--- /dev/null
+++ b/lib/libc/tests/regex/Makefile
@@ -0,0 +1,59 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+BINDIR= ${TESTSDIR}
+
+TESTSDIR= ${TESTSBASE}/lib/libc/regex
+
+IMPLEMENTATION?= -DREGEX_SPENCER
+
+CFLAGS.h_regex+=-I${TESTSRC} -I${.CURDIR:H:H}/regex
+PROGS+= h_regex
+SRCS.h_regex= main.c split.c debug.c
+
+NETBSD_ATF_TESTS_SH= regex_test
+
+FILESDIR= ${TESTSDIR}/data
+FILES+= README
+FILES+= data/anchor.in
+FILES+= data/backref.in
+FILES+= data/basic.in
+FILES+= data/bracket.in
+FILES+= data/c_comments.in
+FILES+= data/complex.in
+FILES+= data/error.in
+FILES+= data/meta.in
+FILES+= data/nospec.in
+FILES+= data/paren.in
+FILES+= data/regress.in
+FILES+= data/repet_bounded.in
+FILES+= data/repet_multi.in
+FILES+= data/repet_ordinary.in
+FILES+= data/startend.in
+FILES+= data/subexp.in
+FILES+= data/subtle.in
+FILES+= data/word_bound.in
+FILES+= data/zero.in
+#FILES+= data/att/README
+FILES+= data/att/basic.dat
+FILES+= data/att/categorization.dat
+FILES+= data/att/forcedassoc.dat
+FILES+= data/att/leftassoc.dat
+FILES+= data/att/nullsubexpr.dat
+FILES+= data/att/repetition.dat
+FILES+= data/att/rightassoc.dat
+
+NETBSD_ATF_TESTS_C= exhaust_test
+NETBSD_ATF_TESTS_C+= regex_att_test
+
+.for t in ${NETBSD_ATF_TESTS_C}
+CFLAGS.$t+= -I${TESTSRC} ${IMPLEMENTATION}
+.endfor
+
+.include "../Makefile.netbsd-tests"
+
+DPADD.regex_att_test+= ${LIBUTIL}
+LDADD.regex_att_test+= -lutil
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/rpc/Makefile b/lib/libc/tests/rpc/Makefile
new file mode 100644
index 0000000..0380294
--- /dev/null
+++ b/lib/libc/tests/rpc/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/lib/libc/rpc
+SRCS.xdr_test= ${RPCSRC:.x=_xdr.c} t_xdr.c ${RPCSRC:.x=.h}
+
+NETBSD_ATF_TESTS_C= rpc_test
+NETBSD_ATF_TESTS_C+= xdr_test
+
+RPCSRC= h_testbits.x
+RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C
+
+h_testbits.h: ${RPCSRC}
+ ${RPCGEN} -h -o ${.TARGET} ${.ALLSRC}
+
+h_testbits_xdr.c: ${RPCSRC} h_testbits.h
+ ${RPCGEN} ${.ALLSRC:M*.x}
+
+CLEANFILES+= ${RPCSRC:.x=.h} ${RPCSRC:.x=.c} h_testbits_xdr.c
+CFLAGS+= -I${.OBJDIR}
+DPSRCS+= h_testbits.h
+
+LDADD+= -lrpcsvc -lutil
+DPADD+= ${LIBRPCSVC} ${LIBUTIL}
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/setjmp/Makefile b/lib/libc/tests/setjmp/Makefile
new file mode 100644
index 0000000..e4c7ae5
--- /dev/null
+++ b/lib/libc/tests/setjmp/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/lib/libc/setjmp
+
+NETBSD_ATF_TESTS_C= t_setjmp
+NETBSD_ATF_TESTS_C+= t_threadjmp
+
+DPADD.t_threadjmp+= ${LIBPTHREAD}
+LDADD.t_threadjmp+= -lpthread
+
+WARNS?= 4
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile
new file mode 100644
index 0000000..cf767ce
--- /dev/null
+++ b/lib/libc/tests/ssp/Makefile
@@ -0,0 +1,45 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/ssp
+
+NO_WERROR=
+WARNS?= 2
+
+CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector
+.if ${COMPILER_TYPE} == "clang"
+CFLAGS.h_raw+= -fsanitize=bounds
+.elif ${COMPILER_TYPE} == "gcc"
+CFLAGS.h_raw+= --param ssp-buffer-size=1
+DPADD+= ${LIBSSP}
+LDADD+= -lssp
+.endif
+
+NETBSD_ATF_TESTS_SH= ssp_test
+
+BINDIR= ${TESTSDIR}
+
+PROGS= h_fgets
+PROGS+= h_gets
+PROGS+= h_getcwd
+PROGS+= h_memcpy
+PROGS+= h_memmove
+PROGS+= h_memset
+PROGS+= h_raw
+PROGS+= h_read
+PROGS+= h_readlink
+PROGS+= h_snprintf
+PROGS+= h_sprintf
+PROGS+= h_stpcpy
+PROGS+= h_stpncpy
+PROGS+= h_strcat
+PROGS+= h_strcpy
+PROGS+= h_strncat
+PROGS+= h_strncpy
+PROGS+= h_vsnprintf
+PROGS+= h_vsprintf
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/stdio/Makefile b/lib/libc/tests/stdio/Makefile
new file mode 100644
index 0000000..3512dd9
--- /dev/null
+++ b/lib/libc/tests/stdio/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/lib/libc/stdio
+
+NETBSD_ATF_TESTS_C= clearerr_test
+NETBSD_ATF_TESTS_C+= fflush_test
+NETBSD_ATF_TESTS_C+= fmemopen_test
+NETBSD_ATF_TESTS_C+= fopen_test
+NETBSD_ATF_TESTS_C+= fputc_test
+NETBSD_ATF_TESTS_C+= mktemp_test
+NETBSD_ATF_TESTS_C+= popen_test
+NETBSD_ATF_TESTS_C+= printf_test
+NETBSD_ATF_TESTS_C+= scanf_test
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
new file mode 100644
index 0000000..9171601
--- /dev/null
+++ b/lib/libc/tests/stdlib/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/stdlib
+
+# TODO: t_getenv_thread, t_mi_vector_hash
+NETBSD_ATF_TESTS_C= abs_test
+NETBSD_ATF_TESTS_C+= atoi_test
+NETBSD_ATF_TESTS_C+= div_test
+NETBSD_ATF_TESTS_C+= getenv_test
+NETBSD_ATF_TESTS_C+= exit_test
+NETBSD_ATF_TESTS_C+= hsearch_test
+NETBSD_ATF_TESTS_C+= posix_memalign_test
+NETBSD_ATF_TESTS_C+= random_test
+NETBSD_ATF_TESTS_C+= strtod_test
+NETBSD_ATF_TESTS_C+= strtol_test
+NETBSD_ATF_TESTS_C+= system_test
+
+# TODO: need to come up with a correct explanation of what the patch pho does
+# with h_atexit
+#ATF_TESTS_SH= atexit_test
+NETBSD_ATF_TESTS_SH= getopt_test
+
+.include "../Makefile.netbsd-tests"
+
+BINDIR= ${TESTSDIR}
+
+# TODO: see comment above
+#PROGS+= h_atexit
+PROGS+= h_getopt h_getopt_long
+
+.for t in h_getopt h_getopt_long
+CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests
+LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR}
+
+DPADD.$t+= ${LIBNETBSD} ${LIBUTIL}
+LDADD.$t+= -lnetbsd -lutil
+.endfor
+
+DPADD.strtod_test+= ${LIBM}
+LDADD.strtod_test+= -lm
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile
new file mode 100644
index 0000000..3c30ab6
--- /dev/null
+++ b/lib/libc/tests/string/Makefile
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/string
+
+# TODO: popcount, stresep
+
+NETBSD_ATF_TESTS_C+= memchr
+NETBSD_ATF_TESTS_C+= memcpy
+NETBSD_ATF_TESTS_C+= memmem
+NETBSD_ATF_TESTS_C+= memset
+NETBSD_ATF_TESTS_C+= strcat
+NETBSD_ATF_TESTS_C+= strchr
+NETBSD_ATF_TESTS_C+= strcmp
+NETBSD_ATF_TESTS_C+= strcpy
+NETBSD_ATF_TESTS_C+= strcspn
+NETBSD_ATF_TESTS_C+= strerror
+NETBSD_ATF_TESTS_C+= strlen
+NETBSD_ATF_TESTS_C+= strpbrk
+NETBSD_ATF_TESTS_C+= strrchr
+NETBSD_ATF_TESTS_C+= strspn
+NETBSD_ATF_TESTS_C+= swab
+
+.include "../Makefile.netbsd-tests"
+
+LDADD.memchr+= -lmd
+DPADD.memchr+= ${LIBMD}
+
+LDADD.memcpy+= -lmd
+DPADD.memcpy+= ${LIBMD}
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile
new file mode 100644
index 0000000..89431bc
--- /dev/null
+++ b/lib/libc/tests/sys/Makefile
@@ -0,0 +1,85 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/sys
+
+# TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg,
+# swapcontext
+NETBSD_ATF_TESTS_C+= access_test
+NETBSD_ATF_TESTS_C+= chroot_test
+NETBSD_ATF_TESTS_C+= clock_gettime_test
+NETBSD_ATF_TESTS_C+= connect_test
+NETBSD_ATF_TESTS_C+= dup_test
+NETBSD_ATF_TESTS_C+= fsync_test
+NETBSD_ATF_TESTS_C+= getcontext_test
+NETBSD_ATF_TESTS_C+= getgroups_test
+NETBSD_ATF_TESTS_C+= getitimer_test
+NETBSD_ATF_TESTS_C+= getlogin_test
+NETBSD_ATF_TESTS_C+= getpid_test
+NETBSD_ATF_TESTS_C+= getrusage_test
+NETBSD_ATF_TESTS_C+= getsid_test
+NETBSD_ATF_TESTS_C+= gettimeofday_test
+NETBSD_ATF_TESTS_C+= issetugid_test
+NETBSD_ATF_TESTS_C+= kevent_test
+NETBSD_ATF_TESTS_C+= kill_test
+NETBSD_ATF_TESTS_C+= link_test
+NETBSD_ATF_TESTS_C+= listen_test
+NETBSD_ATF_TESTS_C+= mincore_test
+NETBSD_ATF_TESTS_C+= mkdir_test
+NETBSD_ATF_TESTS_C+= mkfifo_test
+NETBSD_ATF_TESTS_C+= mknod_test
+NETBSD_ATF_TESTS_C+= mlock_test
+NETBSD_ATF_TESTS_C+= mmap_test
+NETBSD_ATF_TESTS_C+= mprotect_test
+NETBSD_ATF_TESTS_C+= msgctl_test
+NETBSD_ATF_TESTS_C+= msgget_test
+NETBSD_ATF_TESTS_C+= msgrcv_test
+NETBSD_ATF_TESTS_C+= msgsnd_test
+NETBSD_ATF_TESTS_C+= msync_test
+NETBSD_ATF_TESTS_C+= nanosleep_test
+NETBSD_ATF_TESTS_C+= pipe_test
+NETBSD_ATF_TESTS_C+= pipe2_test
+NETBSD_ATF_TESTS_C+= poll_test
+NETBSD_ATF_TESTS_C+= revoke_test
+NETBSD_ATF_TESTS_C+= select_test
+NETBSD_ATF_TESTS_C+= setrlimit_test
+NETBSD_ATF_TESTS_C+= setuid_test
+NETBSD_ATF_TESTS_C+= sigaction_test
+NETBSD_ATF_TESTS_C+= sigqueue_test
+NETBSD_ATF_TESTS_C+= sigtimedwait_test
+NETBSD_ATF_TESTS_C+= socketpair_test
+NETBSD_ATF_TESTS_C+= stat_test
+NETBSD_ATF_TESTS_C+= timer_create_test
+NETBSD_ATF_TESTS_C+= truncate_test
+NETBSD_ATF_TESTS_C+= ucontext_test
+NETBSD_ATF_TESTS_C+= umask_test
+NETBSD_ATF_TESTS_C+= unlink_test
+NETBSD_ATF_TESTS_C+= write_test
+
+DPADD.getpid_test+= ${LIBPTHREAD}
+LDADD.getpid_test+= -lpthread
+DPADD.timer_create_test+= ${LIBRT}
+LDADD.timer_create_test+= -lrt
+
+.include "../Makefile.netbsd-tests"
+
+.if ${COMPILER_TYPE} == "gcc"
+WARNS?= 3
+.else
+WARNS?= 4
+.endif
+
+FILESGROUPS= FILES truncate_test_FILES
+
+truncate_test_FILES= truncate_test.root_owned
+truncate_test_FILESDIR= ${TESTSDIR}
+truncate_test_FILESMODE= 0600
+truncate_test_FILESOWNER= root
+truncate_test_FILESGRP= wheel
+
+CLEANFILES= truncate_test.root_owned
+truncate_test.root_owned:
+ dd if=/dev/null bs=1 count=1 of=${.TARGET}
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/termios/Makefile b/lib/libc/tests/termios/Makefile
new file mode 100644
index 0000000..9a3fd66
--- /dev/null
+++ b/lib/libc/tests/termios/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/termios
+
+NETBSD_ATF_TESTS_C= tcsetpgrp_test
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/time/Makefile b/lib/libc/tests/time/Makefile
new file mode 100644
index 0000000..c2a55df
--- /dev/null
+++ b/lib/libc/tests/time/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/time
+
+NETBSD_ATF_TESTS_C= mktime_test
+NETBSD_ATF_TESTS_C+= strptime_test
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/tls/Makefile b/lib/libc/tests/tls/Makefile
new file mode 100644
index 0000000..e224895
--- /dev/null
+++ b/lib/libc/tests/tls/Makefile
@@ -0,0 +1,35 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/tls
+.if !defined(NO_PIC)
+SUBDIR+= dso
+.endif
+
+# TODO: doesn't link properly (for some odd reason it's trying to link in
+# libatf.so)
+#NETBSD_ATF_TESTS_C= tls_static_test
+.if !defined(NO_PIC)
+NETBSD_ATF_TESTS_C+= tls_dlopen_test
+NETBSD_ATF_TESTS_C+= tls_dynamic_test
+.endif
+
+.include "../Makefile.netbsd-tests"
+
+DSODIR= ${.OBJDIR}/../tls_dso
+
+DPADD.tls_static_test+= ${LIBPTHREAD}
+LDADD.tls_static_test+= -lpthread
+LDFLAGS.tls_static_test+= -static
+SRCS.tls_static_test= t_tls_static.c t_tls_static_helper.c
+
+DPADD.tls_dynamic_test+= ${LIBPTHREAD} ${DSODIR}/libh_tls_dynamic.so
+LDADD.tls_dynamic_test+= -lpthread -lh_tls_dynamic
+LDFLAGS.tls_dynamic_test+= -Wl,-rpath,${TESTSDIR} -L${DSODIR}
+
+DPADD.tls_dlopen_test+= ${LIBPTHREAD}
+LDADD.tls_dlopen_test+= -lpthread
+LDFLAGS.tls_dlopen_test+= -Wl,-rpath,${TESTSDIR} -Wl,-export-dynamic
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/tls/dso/Makefile b/lib/libc/tests/tls/dso/Makefile
new file mode 100644
index 0000000..466f950
--- /dev/null
+++ b/lib/libc/tests/tls/dso/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+OBJTOP= ${.OBJDIR:H:H:H:H:H}
+SRCTOP= ${.CURDIR:H:H:H:H:H}
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/tls/${.CURDIR:T}
+
+LIB= h_tls_dlopen
+SHLIB_NAME= h_tls_dlopen.so
+SRCS= h_tls_dlopen.c
+
+MAN=
+
+LIBDIR= ${TESTSBASE}/lib/libc/tls
+SHLIB_MAJOR= 1
+
+.include "../../Makefile.netbsd-tests"
+
+.include <bsd.lib.mk>
diff --git a/lib/libc/tests/tls_dso/Makefile b/lib/libc/tests/tls_dso/Makefile
new file mode 100644
index 0000000..5449799
--- /dev/null
+++ b/lib/libc/tests/tls_dso/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+LIB= h_tls_dynamic
+SRCS= h_tls_dynamic.c
+
+LIBDIR= ${TESTSBASE}/lib/libc/tls
+SHLIBDIR= ${TESTSBASE}/lib/libc/tls
+SHLIB_MAJOR= 1
+
+WITHOUT_STATIC=
+WITHOUT_PROFILE=
+WITHOUT_PIC=
+
+MAN=
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.lib.mk>
diff --git a/lib/libc/tests/ttyio/Makefile b/lib/libc/tests/ttyio/Makefile
new file mode 100644
index 0000000..a1f320d
--- /dev/null
+++ b/lib/libc/tests/ttyio/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/ttyio
+
+# TODO: ptm_test
+NETBSD_ATF_TESTS_C= ttyio_test
+
+DPADD.ttyio_test+= ${LIBUTIL}
+LDADD.ttyio_test+= -lutil
+
+.include "../Makefile.netbsd-tests"
+
+.include <bsd.test.mk>
diff --git a/tools/regression/lib/libc/gen/Makefile b/tools/regression/lib/libc/gen/Makefile
index 4cba5de..f3a40e3 100644
--- a/tools/regression/lib/libc/gen/Makefile
+++ b/tools/regression/lib/libc/gen/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
-TESTS= test-arc4random test-fmtcheck test-fmtmsg test-fnmatch \
- test-fpclassify test-ftw test-popen test-posix_spawn test-wordexp
+TESTS= test-fmtcheck test-fmtmsg test-fnmatch \
+ test-ftw test-popen test-posix_spawn test-wordexp
.PHONY: tests
tests: ${TESTS}
diff --git a/tools/regression/lib/libc/gen/test-fpclassify.c b/tools/regression/lib/libc/gen/test-fpclassify.c
deleted file mode 100644
index 799c134..0000000
--- a/tools/regression/lib/libc/gen/test-fpclassify.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main(void)
-{
-
- assert(fpclassify((float)0) == FP_ZERO);
- assert(fpclassify((float)-0.0) == FP_ZERO);
- assert(fpclassify((float)1) == FP_NORMAL);
- assert(fpclassify((float)1000) == FP_NORMAL);
-#ifndef __alpha__
- assert(fpclassify(0x1.2p-150f) == FP_SUBNORMAL);
-#endif
- assert(fpclassify(HUGE_VALF) == FP_INFINITE);
- assert(fpclassify((float)HUGE_VAL) == FP_INFINITE);
- assert(fpclassify((float)HUGE_VALL) == FP_INFINITE);
- assert(fpclassify(NAN) == FP_NAN);
-
- assert(fpclassify((double)0) == FP_ZERO);
- assert(fpclassify((double)-0) == FP_ZERO);
- assert(fpclassify((double)1) == FP_NORMAL);
- assert(fpclassify((double)1000) == FP_NORMAL);
-#ifndef __alpha__
- assert(fpclassify(0x1.2p-1075) == FP_SUBNORMAL);
-#endif
- assert(fpclassify(HUGE_VAL) == FP_INFINITE);
- assert(fpclassify((double)HUGE_VALF) == FP_INFINITE);
- assert(fpclassify((double)HUGE_VALL) == FP_INFINITE);
- assert(fpclassify((double)NAN) == FP_NAN);
-
- assert(fpclassify((long double)0) == FP_ZERO);
- assert(fpclassify((long double)-0.0) == FP_ZERO);
- assert(fpclassify((long double)1) == FP_NORMAL);
- assert(fpclassify((long double)1000) == FP_NORMAL);
-#ifndef __alpha__
- assert(fpclassify(0x1.2p-16383L) == FP_SUBNORMAL);
-#endif
- assert(fpclassify(HUGE_VALL) == FP_INFINITE);
- assert(fpclassify((long double)HUGE_VALF) == FP_INFINITE);
- assert(fpclassify((long double)HUGE_VAL) == FP_INFINITE);
- assert(fpclassify((long double)NAN) == FP_NAN);
-
- printf("PASS fpclassify()\n");
- exit(0);
-}
OpenPOWER on IntegriCloud