diff options
author | ngie <ngie@FreeBSD.org> | 2017-03-07 01:52:56 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-03-07 01:52:56 +0000 |
commit | 10b87d8ba3ff12dbc34b3c1d99e89f4383fc98c3 (patch) | |
tree | 9c82bf5ded885bafb240ccc56f48e06efbf594be /contrib/netbsd-tests/lib/libc/stdlib | |
parent | 6a26a03ab521df8ace37d7a8ab9af6479c2959c6 (diff) | |
download | FreeBSD-src-10b87d8ba3ff12dbc34b3c1d99e89f4383fc98c3.zip FreeBSD-src-10b87d8ba3ff12dbc34b3c1d99e89f4383fc98c3.tar.gz |
MFC r313439,r314450:
r313439:
Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head
The primary end-goal of this drop is ease future merges with NetBSD and
collaborate further with the NetBSD project.
The goal was (largely, not completely as some items are still oustanding
in the NetBSD GNATS system) achieved by doing the following:
- Pushing as many changes required to port contrib/netbsd-tests
back to NetBSD as possible, then pull the upstream applied changes
back in to FreeBSD.
- Diff reduce with upstream where possible by:
-- Improving libnetbsd header, etc compat glue.
-- Using _SED variables to modify test scripts on the fly for items
that could not be upstreamed to NetBSD.
As a bonus for this work, this change also introduces testcases for
uniq(1).
Many thanks to Christos for working with me to get many of the changes
back into the NetBSD project.
In collaboration with: Christos Zoulas <christos@netbsd.org>
r314450:
Add additional __FreeBSD_version guards around the hsearch_r testcases
The reasoning for this is the same as r276046: to ease MFCing the tests
to ^/stable/10 .
This was accidentally missed in r313439
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/stdlib')
4 files changed, 22 insertions, 11 deletions
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c index ec2b9bb..d53d2d9 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c @@ -35,6 +35,10 @@ #include <unistd.h> #include <err.h> #ifdef __FreeBSD__ +/* + * Needed to avoid libutil.h pollution in stdio.h, which causes grief with + * with hexdump(3) in lib/libc/db/h_hash.c + */ #include <libutil.h> #endif diff --git a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c index 2293e2c..c7cd83e 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c @@ -37,6 +37,10 @@ #include <stdlib.h> #include <unistd.h> #ifdef __FreeBSD__ +/* + * Needed to avoid libutil.h pollution in stdio.h, which causes grief with + * with hexdump(3) in lib/libc/db/h_hash.c + */ #include <libutil.h> #endif diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c index a0e77d3..5a13250 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c @@ -75,7 +75,6 @@ __RCSID("$NetBSD: t_hsearch.c,v 1.4 2014/07/20 20:17:21 christos Exp $"); #define REQUIRE_ERRNO(x) ATF_REQUIRE_MSG(x, "%s", strerror(errno)) -#ifdef __NetBSD__ ATF_TC(hsearch_basic); ATF_TC_HEAD(hsearch_basic, tc) { @@ -122,9 +121,12 @@ ATF_TC_BODY(hsearch_basic, tc) ATF_REQUIRE_EQ((intptr_t)ep->data, i); } +#ifdef __NetBSD__ hdestroy1(free, NULL); -} +#else + hdestroy(); #endif +} ATF_TC(hsearch_duplicate); ATF_TC_HEAD(hsearch_duplicate, tc) @@ -232,7 +234,6 @@ ATF_TC_BODY(hsearch_two, tc) } #if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version -#ifdef __NetBSD__ ATF_TC(hsearch_r_basic); ATF_TC_HEAD(hsearch_r_basic, tc) { @@ -278,10 +279,15 @@ ATF_TC_BODY(hsearch_r_basic, tc) ATF_REQUIRE_EQ((intptr_t)ep->data, i); } +#ifdef __NetBSD__ hdestroy1_r(&t, free, NULL); +#else + hdestroy_r(&t); +#endif } #endif +#if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version ATF_TC(hsearch_r_duplicate); ATF_TC_HEAD(hsearch_r_duplicate, tc) { @@ -332,6 +338,9 @@ ATF_TC_BODY(hsearch_r_nonexistent, tc) REQUIRE_ERRNO(hcreate_r(16, &t)); +#ifdef __FreeBSD__ + atf_tc_expect_fail("behavior doesn't match docs; see bug # 216872"); +#endif e.key = __UNCONST("A"); ATF_REQUIRE(hsearch_r(e, FIND, &ep, &t) == 1); ATF_REQUIRE_EQ(ep, NULL); @@ -391,17 +400,13 @@ ATF_TC_BODY(hsearch_r_two, tc) ATF_TP_ADD_TCS(tp) { -#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, hsearch_basic); -#endif ATF_TP_ADD_TC(tp, hsearch_duplicate); ATF_TP_ADD_TC(tp, hsearch_nonexistent); ATF_TP_ADD_TC(tp, hsearch_two); - + #if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version -#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, hsearch_r_basic); -#endif ATF_TP_ADD_TC(tp, hsearch_r_duplicate); ATF_TP_ADD_TC(tp, hsearch_r_nonexistent); ATF_TP_ADD_TC(tp, hsearch_r_two); diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c index 06f2de0..4835e5d 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c @@ -218,9 +218,7 @@ ATF_TC_BODY(strtold_nan, tc) volatile long double ld = strtold(nan_string, &end); ATF_REQUIRE(isnan(ld) != 0); -#ifdef __FreeBSD__ - ATF_REQUIRE(strcmp(end, "y") == 0); -#else +#ifndef __FreeBSD__ ATF_REQUIRE(__isnanl(ld) != 0); #endif ATF_REQUIRE(strcmp(end, "y") == 0); |