diff options
Diffstat (limited to 'lib/libc/tests')
29 files changed, 1237 insertions, 0 deletions
diff --git a/lib/libc/tests/Makefile b/lib/libc/tests/Makefile new file mode 100644 index 0000000..3036ce9 --- /dev/null +++ b/lib/libc/tests/Makefile @@ -0,0 +1,32 @@ +# $FreeBSD$ + +.include <src.opts.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..5f4e1ca --- /dev/null +++ b/lib/libc/tests/c063/Makefile @@ -0,0 +1,27 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/lib/libc/c063 + +#TODO: t_o_search + +NETBSD_ATF_TESTS_C= faccessat +NETBSD_ATF_TESTS_C+= fchmodat +NETBSD_ATF_TESTS_C+= fchownat +NETBSD_ATF_TESTS_C+= fexecve +NETBSD_ATF_TESTS_C+= fstatat +NETBSD_ATF_TESTS_C+= linkat +NETBSD_ATF_TESTS_C+= mkdirat +NETBSD_ATF_TESTS_C+= mkfifoat +NETBSD_ATF_TESTS_C+= mknodat +NETBSD_ATF_TESTS_C+= openat +NETBSD_ATF_TESTS_C+= readlinkat +NETBSD_ATF_TESTS_C+= renameat +NETBSD_ATF_TESTS_C+= symlinkat +NETBSD_ATF_TESTS_C+= unlinkat +NETBSD_ATF_TESTS_C+= utimensat + +CFLAGS+= -D_INCOMPLETE_XOPEN_C063 + +.include "../Makefile.netbsd-tests" + +.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/lib/libc/tests/gen/arc4random_test.c b/lib/libc/tests/gen/arc4random_test.c new file mode 100644 index 0000000..ec82c32 --- /dev/null +++ b/lib/libc/tests/gen/arc4random_test.c @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2011 David Schultz + * 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. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#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 + * that this test fails spuriously is 2**(-BUFSIZE * 8). + */ +#define BUFSIZE 8 + +/* + * Test whether arc4random_buf() returns the same sequence of bytes in both + * parent and child processes. (Hint: It shouldn't.) + */ +ATF_TC_WITHOUT_HEAD(test_arc4random); +ATF_TC_BODY(test_arc4random, tc) +{ + struct shared_page { + char parentbuf[BUFSIZE]; + char childbuf[BUFSIZE]; + } *page; + pid_t pid; + char c; + + printf("1..1\n"); + + page = mmap(NULL, sizeof(struct shared_page), PROT_READ | PROT_WRITE, + MAP_ANON | MAP_SHARED, -1, 0); + if (page == MAP_FAILED) { + printf("fail 1 - mmap\n"); + exit(1); + } + + arc4random_buf(&c, 1); + + pid = fork(); + ATF_REQUIRE(0 <= pid); + if (pid == 0) { + /* child */ + arc4random_buf(page->childbuf, BUFSIZE); + exit(0); + } else { + /* parent */ + int status; + arc4random_buf(page->parentbuf, BUFSIZE); + wait(&status); + } + 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); + + 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..52fd569 --- /dev/null +++ b/lib/libc/tests/hash/Makefile @@ -0,0 +1,37 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +TESTSDIR= ${TESTSBASE}/lib/libc/hash + +NETBSD_ATF_TESTS_C= + +.if ${MK_OPENSSL} != "no" +NETBSD_ATF_TESTS_C+= sha2_test +.endif + +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..7bc8660 --- /dev/null +++ b/lib/libc/tests/ssp/Makefile @@ -0,0 +1,49 @@ +# $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 +# This testcase doesn't run properly when not compiled with -fsantize=bounds +# with clang, which is currently contingent on a compiler_rt update +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 30500 +PROGS+= h_raw +.endif +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..23d5c1e --- /dev/null +++ b/lib/libc/tests/stdio/Makefile @@ -0,0 +1,19 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/lib/libc/stdio + +ATF_TESTS_C= fmemopen2_test + +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/stdio/fmemopen2_test.c b/lib/libc/tests/stdio/fmemopen2_test.c new file mode 100644 index 0000000..d137780 --- /dev/null +++ b/lib/libc/tests/stdio/fmemopen2_test.c @@ -0,0 +1,300 @@ +/*- +Copyright (C) 2013 Pietro Cerutti <gahr@FreeBSD.org> + +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 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 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. +*/ + +/* + * Test basic FILE * functions (fread, fwrite, fseek, fclose) against + * a FILE * retrieved using fmemopen() + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <strings.h> +#include <atf-c.h> + +ATF_TC_WITHOUT_HEAD(test_preexisting); +ATF_TC_BODY(test_preexisting, tc) +{ + /* + * Use a pre-existing buffer. + */ + + char buf[512]; + char buf2[512]; + char str[] = "Test writing some stuff"; + char str2[] = "AAAAAAAAA"; + char str3[] = "AAAA writing some stuff"; + FILE *fp; + size_t nofw, nofr; + int rc; + + /* Open a FILE * using fmemopen. */ + fp = fmemopen(buf, sizeof(buf), "w"); + ATF_REQUIRE(fp != NULL); + + /* Write to the buffer. */ + nofw = fwrite(str, 1, sizeof(str), fp); + ATF_REQUIRE(nofw == sizeof(str)); + + /* Close the FILE *. */ + rc = fclose(fp); + ATF_REQUIRE(rc == 0); + + /* Re-open the FILE * to read back the data. */ + fp = fmemopen(buf, sizeof(buf), "r"); + ATF_REQUIRE(fp != NULL); + + /* Read from the buffer. */ + bzero(buf2, sizeof(buf2)); + nofr = fread(buf2, 1, sizeof(buf2), fp); + ATF_REQUIRE(nofr == sizeof(buf2)); + + /* + * Since a write on a FILE * retrieved by fmemopen + * will add a '\0' (if there's space), we can check + * the strings for equality. + */ + ATF_REQUIRE(strcmp(str, buf2) == 0); + + /* Close the FILE *. */ + rc = fclose(fp); + ATF_REQUIRE(rc == 0); + + /* Now open a FILE * on the first 4 bytes of the string. */ + fp = fmemopen(str, 4, "w"); + ATF_REQUIRE(fp != NULL); + + /* + * Try to write more bytes than we shoud, we'll get a short count (4). + */ + nofw = fwrite(str2, 1, sizeof(str2), fp); + ATF_REQUIRE(nofw == 4); + + /* Close the FILE *. */ + rc = fclose(fp); + + /* Check that the string was not modified after the first 4 bytes. */ + ATF_REQUIRE(strcmp(str, str3) == 0); +} + +ATF_TC_WITHOUT_HEAD(test_autoalloc); +ATF_TC_BODY(test_autoalloc, tc) +{ + /* + * Let fmemopen allocate the buffer. + */ + + char str[] = "A quick test"; + FILE *fp; + long pos; + size_t nofw, nofr, i; + int rc; + + /* Open a FILE * using fmemopen. */ + fp = fmemopen(NULL, 512, "w+"); + ATF_REQUIRE(fp != NULL); + + /* fill the buffer */ + for (i = 0; i < 512; i++) { + nofw = fwrite("a", 1, 1, fp); + ATF_REQUIRE(nofw == 1); + } + + /* Get the current position into the stream. */ + pos = ftell(fp); + ATF_REQUIRE(pos == 512); + + /* + * Try to write past the end, we should get a short object count (0) + */ + nofw = fwrite("a", 1, 1, fp); + ATF_REQUIRE(nofw == 0); + + /* Close the FILE *. */ + rc = fclose(fp); + ATF_REQUIRE(rc == 0); + + /* Open a FILE * using a wrong mode */ + fp = fmemopen(NULL, 512, "r"); + ATF_REQUIRE(fp == NULL); + + fp = fmemopen(NULL, 512, "w"); + ATF_REQUIRE(fp == NULL); +} + +ATF_TC_WITHOUT_HEAD(test_data_length); +ATF_TC_BODY(test_data_length, tc) +{ + /* + * Here we test that a read operation doesn't go past the end of the + * data actually written, and that a SEEK_END seeks from the end of the + * data, not of the whole buffer. + */ + FILE *fp; + char buf[512] = {'\0'}; + char str[] = "Test data length. "; + char str2[] = "Do we have two sentences?"; + char str3[sizeof(str) + sizeof(str2) -1]; + long pos; + size_t nofw, nofr; + int rc; + + /* Open a FILE * for updating our buffer. */ + fp = fmemopen(buf, sizeof(buf), "w+"); + ATF_REQUIRE(fp != NULL); + + /* Write our string into the buffer. */ + nofw = fwrite(str, 1, sizeof(str), fp); + ATF_REQUIRE(nofw == sizeof(str)); + + /* + * Now seek to the end and check that ftell + * gives us sizeof(str). + */ + rc = fseek(fp, 0, SEEK_END); + ATF_REQUIRE(rc == 0); + pos = ftell(fp); + ATF_REQUIRE(pos == sizeof(str)); + + /* Close the FILE *. */ + rc = fclose(fp); + ATF_REQUIRE(rc == 0); + + /* Reopen the buffer for appending. */ + fp = fmemopen(buf, sizeof(buf), "a+"); + ATF_REQUIRE(fp != NULL); + + /* We should now be writing after the first string. */ + nofw = fwrite(str2, 1, sizeof(str2), fp); + ATF_REQUIRE(nofw == sizeof(str2)); + + /* Rewind the FILE *. */ + rc = fseek(fp, 0, SEEK_SET); + ATF_REQUIRE(rc == 0); + + /* Make sure we're at the beginning. */ + pos = ftell(fp); + ATF_REQUIRE(pos == 0); + + /* Read the whole buffer. */ + nofr = fread(str3, 1, sizeof(buf), fp); + ATF_REQUIRE(nofr == sizeof(str3)); + + /* Make sure the two strings are there. */ + ATF_REQUIRE(strncmp(str3, str, sizeof(str) - 1) == 0); + ATF_REQUIRE(strncmp(str3 + sizeof(str) - 1, str2, sizeof(str2)) == 0); + + /* Close the FILE *. */ + rc = fclose(fp); + ATF_REQUIRE(rc == 0); +} + +ATF_TC_WITHOUT_HEAD(test_binary); +ATF_TC_BODY(test_binary, tc) +{ + /* + * Make sure that NULL bytes are never appended when opening a buffer + * in binary mode. + */ + + FILE *fp; + char buf[20]; + char str[] = "Test"; + size_t nofw; + int rc, i; + + /* Pre-fill the buffer. */ + memset(buf, 'A', sizeof(buf)); + + /* Open a FILE * in binary mode. */ + fp = fmemopen(buf, sizeof(buf), "w+b"); + ATF_REQUIRE(fp != NULL); + + /* Write some data into it. */ + nofw = fwrite(str, 1, strlen(str), fp); + ATF_REQUIRE(nofw == strlen(str)); + + /* Make sure that the buffer doesn't contain any NULL bytes. */ + for (i = 0; i < sizeof(buf); i++) + ATF_REQUIRE(buf[i] != '\0'); + + /* Close the FILE *. */ + rc = fclose(fp); + ATF_REQUIRE(rc == 0); +} + +ATF_TC_WITHOUT_HEAD(test_append_binary_pos); +ATF_TC_BODY(test_append_binary_pos, tc) +{ + /* + * For compatibility with other implementations (glibc), we set the + * position to 0 when opening an automatically allocated binary stream + * for appending. + */ + + FILE *fp; + + fp = fmemopen(NULL, 16, "ab+"); + ATF_REQUIRE(ftell(fp) == 0L); + fclose(fp); + + /* + * Make sure that a pre-allocated buffer behaves correctly. + */ + char buf[] = "Hello"; + fp = fmemopen(buf, sizeof(buf), "ab+"); + ATF_REQUIRE(ftell(fp) == strlen(buf)); + fclose(fp); +} + +ATF_TC_WITHOUT_HEAD(test_size_0); +ATF_TC_BODY(test_size_0, tc) +{ + /* + * POSIX mandates that we return EINVAL if size is 0. + */ + + FILE *fp; + + fp = fmemopen(NULL, 0, "r+"); + ATF_REQUIRE(fp == NULL); + ATF_REQUIRE(errno == EINVAL); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, test_autoalloc); + ATF_TP_ADD_TC(tp, test_preexisting); + ATF_TP_ADD_TC(tp, test_data_length); + ATF_TP_ADD_TC(tp, test_binary); + ATF_TP_ADD_TC(tp, test_append_binary_pos); + ATF_TP_ADD_TC(tp, test_size_0); + + return (atf_no_error()); +} 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> |