From 5f8801236b0c57109e8ae8ba658b71fe44d74dea Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 08:35:16 +0000 Subject: Only build/run hsearch_basic and hsearch_r_basic on NetBSD hdestroy1 is not present on FreeBSD Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c index 099b3e7..3c869c4 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c @@ -75,6 +75,7 @@ __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)) +#if defined(__NetBSD__) ATF_TC(hsearch_basic); ATF_TC_HEAD(hsearch_basic, tc) { @@ -123,6 +124,7 @@ ATF_TC_BODY(hsearch_basic, tc) hdestroy1(free, NULL); } +#endif ATF_TC(hsearch_duplicate); ATF_TC_HEAD(hsearch_duplicate, tc) @@ -229,6 +231,7 @@ ATF_TC_BODY(hsearch_two, tc) hdestroy(); } +#if defined(__NetBSD__) ATF_TC(hsearch_r_basic); ATF_TC_HEAD(hsearch_r_basic, tc) { @@ -276,6 +279,7 @@ ATF_TC_BODY(hsearch_r_basic, tc) hdestroy1_r(&t, free, NULL); } +#endif ATF_TC(hsearch_r_duplicate); ATF_TC_HEAD(hsearch_r_duplicate, tc) @@ -385,12 +389,16 @@ ATF_TC_BODY(hsearch_r_two, tc) ATF_TP_ADD_TCS(tp) { +#if defined(__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(__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); -- cgit v1.1 From fd80e03aa02bfa9b05a962c7f6dcb30c38a1cee0 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 08:57:55 +0000 Subject: Expect SIGSEGV in lib/libc/stdlib/t_getenv:setenv_basic See bin/189805 for more details In collaboration with: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c b/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c index 35d6874..3b0b885 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c @@ -40,6 +40,9 @@ __RCSID("$NetBSD: t_getenv.c,v 1.2 2011/07/15 13:54:31 jruoho Exp $"); #include #include #include +#if defined(__FreeBSD__) +#include +#endif extern char **environ; @@ -152,6 +155,15 @@ ATF_TC_BODY(setenv_basic, tc) ATF_CHECK_ERRNO(EINVAL, setenv(NULL, "val", 1) == -1); ATF_CHECK_ERRNO(EINVAL, setenv("", "val", 1) == -1); ATF_CHECK_ERRNO(EINVAL, setenv("v=r", "val", 1) == -1); +#if defined(__FreeBSD__) + /* + Both FreeBSD and OS/X does not validate the second + argument to setenv(3) + */ + atf_tc_expect_signal(SIGSEGV, "FreeBSD does not validate the second " + "argument to setenv(3); see bin/189805"); +#endif + ATF_CHECK_ERRNO(EINVAL, setenv("var", NULL, 1) == -1); ATF_CHECK(setenv("var", "=val", 1) == 0); -- cgit v1.1 From 5c778ecb2063f1ab20f356631ec7cd06f922a747 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 18:57:39 +0000 Subject: Disable tests that don't pass on FreeBSD due to missing support in humanize_number(3). Bringing in additional revisions from NetBSD's humanize_number(3) will fix the tests Account for the fact that util.h on NetBSD is libutil.h on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c index 1af579e..eec2d10 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c @@ -34,7 +34,11 @@ #include #include #include +#if defined(__FreeBSD__) +#include +#else #include +#endif const struct hnopts { size_t ho_len; @@ -78,6 +82,7 @@ const struct hnopts { /* * Truncated output. Rev. 1.7 produces "1.0 K". */ +#if !defined(__FreeBSD__) { 6, 1000, "A", HN_AUTOSCALE, HN_DECIMAL, -1, "" }, /* @@ -90,6 +95,7 @@ const struct hnopts { /* Similar case it prints 1000 where it shouldn't */ { 5, 1023488, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL, 4, "1.0M" }, +#endif { 5, 1023999, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL, 4, "1.0M" }, }; -- cgit v1.1 From 7a443b9edd4e06abc67f81d6c6037191525045d4 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 18:59:18 +0000 Subject: Add missing #include for gettimeofday Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_time.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_time.c b/contrib/netbsd-tests/lib/libc/gen/t_time.c index bfbdc73..21e625f 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_time.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_time.c @@ -31,6 +31,9 @@ #include __RCSID("$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $"); +#if defined(__FreeBSD__) +#include +#endif #include #include #include -- cgit v1.1 From 4cb4e287c6e3b9f3ec21e2fd4733d8b136475d82 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 19:02:02 +0000 Subject: FreeBSD returns ENOTTY instead of EBADF in ttyname_r; mark it as an expected failure PR: 191936 In collaboration with: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_ttyname.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c b/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c index 0c10c24..80f5c17 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c @@ -107,6 +107,9 @@ ATF_TC_BODY(ttyname_r_err, tc) ATF_REQUIRE(rv == ERANGE); } +#if defined(__FreeBSD__) + atf_tc_expect_fail("FreeBSD returns ENOTTY instead of EBADF; see bin/191936"); +#endif rv = ttyname_r(-1, buf, ttymax); ATF_REQUIRE(rv == EBADF); -- cgit v1.1 From 0af4e9789883c048c1bb1d7220f5acf4833f6a86 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 19:18:52 +0000 Subject: FreeBSD doesn't support strings greater than MAXHOSTNAMELEN-1 in {get,set}{domain,host}name. Adjust the tests to not exceed that value when testing out the code Add a positive and negative test for MAXHOSTNAMELEN-1 and MAXHOSTNAMELEN, respectively PR: 181127 In collaboration with: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c | 16 ++++++++++++++++ contrib/netbsd-tests/lib/libc/gen/t_sethostname.c | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c b/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c index 89818f0..a93083a 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c @@ -63,8 +63,20 @@ ATF_TC_BODY(setdomainname_basic, tc) (void)memset(name, 0, sizeof(name)); +#if defined(__FreeBSD__) + /* + * Sanity checks to ensure that the wrong invariant isn't being + * tested for per PR # 181127 + */ + ATF_REQUIRE_EQ(sizeof(domains[i]), MAXHOSTNAMELEN); + ATF_REQUIRE_EQ(sizeof(name), MAXHOSTNAMELEN); + + ATF_REQUIRE(setdomainname(domains[i],sizeof(domains[i]) - 1) == 0); + ATF_REQUIRE(getdomainname(name, sizeof(name) - 1) == 0); +#else ATF_REQUIRE(setdomainname(domains[i],sizeof(domains[i])) == 0); ATF_REQUIRE(getdomainname(name, sizeof(name)) == 0); +#endif ATF_REQUIRE(strcmp(domains[i], name) == 0); } @@ -89,6 +101,10 @@ ATF_TC_BODY(setdomainname_limit, tc) (void)memset(name, 0, sizeof(name)); +#if defined(__FreeBSD__) + ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN - 1 ) == 0); + ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN) == -1); +#endif ATF_REQUIRE(setdomainname(name, sizeof(name)) == -1); } diff --git a/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c b/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c index a753ac7..9c5abac 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c @@ -63,8 +63,20 @@ ATF_TC_BODY(sethostname_basic, tc) (void)memset(name, 0, sizeof(name)); +#if defined(__FreeBSD__) + /* + * Sanity checks to ensure that the wrong invariant isn't being + * tested for per PR # 181127 + */ + ATF_REQUIRE_EQ(sizeof(hosts[i]), MAXHOSTNAMELEN); + ATF_REQUIRE_EQ(sizeof(name), MAXHOSTNAMELEN); + + ATF_REQUIRE(sethostname(hosts[i], sizeof(hosts[i]) - 1) == 0); + ATF_REQUIRE(gethostname(name, sizeof(name) - 1) == 0); +#else ATF_REQUIRE(sethostname(hosts[i], sizeof(hosts[i])) == 0); ATF_REQUIRE(gethostname(name, sizeof(name)) == 0); +#endif ATF_REQUIRE(strcmp(hosts[i], name) == 0); } @@ -94,6 +106,10 @@ ATF_TC_BODY(sethostname_limit, tc) ATF_TC_CLEANUP(sethostname_limit, tc) { +#if defined(__FreeBSD__) + ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN - 1 ) == 0); + ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN) == -1); +#endif (void)sethostname(host, sizeof(host)); } -- cgit v1.1 From d20db9d537a86bd3d2904192e5fa0a74b9decc7a Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 19:28:57 +0000 Subject: Disable the invalid pointer test on FreeBSD FreeBSD segfaults on invalid pointers passed to getcwd because it throbs the address passed in in libc, whereas NetBSD just passes the information off to the syscall, which allows the kernel to return EFAULT on bad pointers. In collaboration with: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_getcwd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c b/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c index 76c287a..bb3baf0 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c @@ -56,10 +56,12 @@ ATF_TC_BODY(getcwd_err, tc) ATF_REQUIRE(getcwd(buf, 0) == NULL); ATF_REQUIRE(errno == EINVAL); +#if defined(__NetBSD__) errno = 0; ATF_REQUIRE(getcwd((void *)-1, sizeof(buf)) == NULL); ATF_REQUIRE(errno == EFAULT); +#endif } ATF_TC(getcwd_fts); -- cgit v1.1 From 5ce4af18cfbb66514344003b6c81710f21c3e3b6 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 19:32:53 +0000 Subject: Handle getting/setting niceness/priority correctly on FreeBSD vs NetBSD This might be fallout from PR: 189821 Submitted by: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_nice.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_nice.c b/contrib/netbsd-tests/lib/libc/gen/t_nice.c index f4a62e9..67a0bf5 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_nice.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_nice.c @@ -93,7 +93,11 @@ ATF_TC_HEAD(nice_priority, tc) ATF_TC_BODY(nice_priority, tc) { +#if defined(__FreeBSD__) + int i, pri, pri2, nic; +#else int i, pri, nic; +#endif pid_t pid; int sta; @@ -106,8 +110,10 @@ ATF_TC_BODY(nice_priority, tc) pri = getpriority(PRIO_PROCESS, 0); ATF_REQUIRE(errno == 0); +#if defined(__NetBSD__) if (nic != pri) atf_tc_fail("nice(3) and getpriority(2) conflict"); +#endif /* * Also verify that the nice(3) values @@ -119,10 +125,18 @@ ATF_TC_BODY(nice_priority, tc) if (pid == 0) { errno = 0; +#if defined(__FreeBSD__) pri = getpriority(PRIO_PROCESS, 0); +#else + pri2 = getpriority(PRIO_PROCESS, 0); +#endif ATF_REQUIRE(errno == 0); +#if defined(__FreeBSD__) + if (pri != pri2) +#else if (nic != pri) +#endif _exit(EXIT_FAILURE); _exit(EXIT_SUCCESS); @@ -161,7 +175,11 @@ ATF_TC_HEAD(nice_thread, tc) ATF_TC_BODY(nice_thread, tc) { pthread_t tid[5]; +#if defined(__FreeBSD__) + int pri, rv, val; +#else int rv, val; +#endif size_t i; /* @@ -173,7 +191,12 @@ ATF_TC_BODY(nice_thread, tc) val = nice(i); ATF_REQUIRE(val != -1); +#if defined(__FreeBSD__) + pri = getpriority(PRIO_PROCESS, 0); + rv = pthread_create(&tid[i], NULL, threadfunc, &pri); +#else rv = pthread_create(&tid[i], NULL, threadfunc, &val); +#endif ATF_REQUIRE(rv == 0); rv = pthread_join(tid[i], NULL); -- cgit v1.1 From a9e5625f70e9f41a8bbface0fe26b4d84927695b Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 19:34:19 +0000 Subject: SIGPWR does not exist on FreeBSD Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_raise.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_raise.c b/contrib/netbsd-tests/lib/libc/gen/t_raise.c index adc032f..120981f 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_raise.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_raise.c @@ -43,7 +43,11 @@ static int count; static void handler_err(int); static void handler_ret(int); static void handler_stress(int); +#if defined(__FreeBSD__) +static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2 }; +#else static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2, SIGPWR }; +#endif static void handler_stress(int signo) -- cgit v1.1 From 653a540178a700c6fcf8cfc0fa0683eb8ba5043d Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 21:19:17 +0000 Subject: Skip over t_spawn_open_nonexistent_diag because it requires NetBSD specific additions to posix_spawn Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c index 1cf6433..e998249 100644 --- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c +++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c @@ -31,6 +31,9 @@ */ +#if defined(__FreeBSD__) +#include +#endif #include #include #include @@ -248,6 +251,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent, tc) posix_spawn_file_actions_destroy(&fa); } +#if defined(__NetBSD__) ATF_TC(t_spawn_open_nonexistent_diag); ATF_TC_HEAD(t_spawn_open_nonexistent_diag, tc) @@ -283,6 +287,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent_diag, tc) posix_spawn_file_actions_destroy(&fa); posix_spawnattr_destroy(&attr); } +#endif ATF_TC(t_spawn_fileactions); @@ -376,7 +381,9 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, t_spawn_fileactions); ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent); +#if defined(__NetBSD__) ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent_diag); +#endif ATF_TP_ADD_TC(tp, t_spawn_reopen); ATF_TP_ADD_TC(tp, t_spawn_openmode); ATF_TP_ADD_TC(tp, t_spawn_empty_fileactions); -- cgit v1.1 From e2ee0b35f844a7c0f9b4ee0ea49371df496ae584 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Oct 2014 21:22:25 +0000 Subject: Port the testcase to FreeBSD - Make #include path to h_macros.h a non-relative path - __gl_stat_t is synonymous with struct stat on FreeBSD - FreeBSD doesn't have _DIRENT_RECLEN - Skip over glob_star on FreeBSD (testcase doesn't pass) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_glob.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_glob.c b/contrib/netbsd-tests/lib/libc/gen/t_glob.c index ff62b63..1611bfa 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_glob.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_glob.c @@ -46,7 +46,13 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $"); #include #include +#if defined(__FreeBSD__) +#include "h_macros.h" +#define __gl_stat_t struct stat +#define _S_IFDIR S_IFDIR +#else #include "../../../h_macros.h" +#endif #ifdef DEBUG @@ -132,7 +138,11 @@ gl_readdir(void *v) dir.d_ino = dd->pos; dir.d_type = f->dir ? DT_DIR : DT_REG; DPRINTF(("readdir %s %d\n", dir.d_name, dir.d_type)); +#if defined(__FreeBSD__) + dir.d_reclen = -1; /* Does not have _DIRENT_RECLEN */ +#else dir.d_reclen = _DIRENT_RECLEN(&dir, dir.d_namlen); +#endif return &dir; } return NULL; @@ -213,6 +223,7 @@ run(const char *p, int flags, const char **res, size_t len) } +#if !defined(__FreeBSD__) ATF_TC(glob_star); ATF_TC_HEAD(glob_star, tc) { @@ -224,6 +235,7 @@ ATF_TC_BODY(glob_star, tc) { run("a/**", GLOB_STAR, glob_star, __arraycount(glob_star)); } +#endif ATF_TC(glob_star_not); ATF_TC_HEAD(glob_star_not, tc) @@ -260,7 +272,9 @@ ATF_TC_BODY(glob_nocheck, tc) ATF_TP_ADD_TCS(tp) { +#if !defined(__FreeBSD__) ATF_TP_ADD_TC(tp, glob_star); +#endif ATF_TP_ADD_TC(tp, glob_star_not); /* * Remove this test for now - the GLOB_NOCHECK return value has been -- cgit v1.1 From 9cc3d490e4454bdd80542923889dc987d978a6b2 Mon Sep 17 00:00:00 2001 From: ngie Date: Sun, 12 Oct 2014 10:04:59 +0000 Subject: Only #include on NetBSD Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/tls/dso/h_tls_dlopen.c | 2 ++ contrib/netbsd-tests/lib/libc/tls/t_tls_dlopen.c | 2 ++ contrib/netbsd-tests/lib/libc/tls/t_tls_dynamic.c | 2 ++ contrib/netbsd-tests/lib/libc/tls/t_tls_static.c | 2 ++ contrib/netbsd-tests/lib/libc/tls/t_tls_static_helper.c | 2 ++ contrib/netbsd-tests/lib/libc/tls_dso/h_tls_dynamic.c | 2 ++ 6 files changed, 12 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/tls/dso/h_tls_dlopen.c b/contrib/netbsd-tests/lib/libc/tls/dso/h_tls_dlopen.c index c455d33..373528b 100644 --- a/contrib/netbsd-tests/lib/libc/tls/dso/h_tls_dlopen.c +++ b/contrib/netbsd-tests/lib/libc/tls/dso/h_tls_dlopen.c @@ -36,7 +36,9 @@ __RCSID("$NetBSD: h_tls_dlopen.c,v 1.5 2013/10/21 19:14:16 joerg Exp $"); #include #include +#if defined(__NetBSD__) #include +#endif #ifdef __HAVE_NO___THREAD #define __thread diff --git a/contrib/netbsd-tests/lib/libc/tls/t_tls_dlopen.c b/contrib/netbsd-tests/lib/libc/tls/t_tls_dlopen.c index 591823e..1ebbe7d 100644 --- a/contrib/netbsd-tests/lib/libc/tls/t_tls_dlopen.c +++ b/contrib/netbsd-tests/lib/libc/tls/t_tls_dlopen.c @@ -39,7 +39,9 @@ __RCSID("$NetBSD: t_tls_dlopen.c,v 1.3 2012/01/17 20:34:57 joerg Exp $"); #include #include +#if defined(__NetBSD__) #include +#endif #ifdef __HAVE_NO___THREAD #define __thread diff --git a/contrib/netbsd-tests/lib/libc/tls/t_tls_dynamic.c b/contrib/netbsd-tests/lib/libc/tls/t_tls_dynamic.c index 9d242ae..b5d1728 100644 --- a/contrib/netbsd-tests/lib/libc/tls/t_tls_dynamic.c +++ b/contrib/netbsd-tests/lib/libc/tls/t_tls_dynamic.c @@ -38,7 +38,9 @@ __RCSID("$NetBSD: t_tls_dynamic.c,v 1.3 2012/01/17 20:34:57 joerg Exp $"); #include #include +#if defined(__NetBSD__) #include +#endif #ifdef __HAVE_NO___THREAD #define __thread diff --git a/contrib/netbsd-tests/lib/libc/tls/t_tls_static.c b/contrib/netbsd-tests/lib/libc/tls/t_tls_static.c index 7751a16..028f398 100644 --- a/contrib/netbsd-tests/lib/libc/tls/t_tls_static.c +++ b/contrib/netbsd-tests/lib/libc/tls/t_tls_static.c @@ -37,7 +37,9 @@ __RCSID("$NetBSD: t_tls_static.c,v 1.2 2012/01/17 20:34:57 joerg Exp $"); #include #include +#if defined(__NetBSD__) #include +#endif #ifdef __HAVE_NO___THREAD #define __thread diff --git a/contrib/netbsd-tests/lib/libc/tls/t_tls_static_helper.c b/contrib/netbsd-tests/lib/libc/tls/t_tls_static_helper.c index da3b6f0..a85ce9b 100644 --- a/contrib/netbsd-tests/lib/libc/tls/t_tls_static_helper.c +++ b/contrib/netbsd-tests/lib/libc/tls/t_tls_static_helper.c @@ -34,7 +34,9 @@ #include __RCSID("$NetBSD: t_tls_static_helper.c,v 1.2 2012/01/17 20:34:57 joerg Exp $"); +#if defined(__NetBSD__) #include +#endif #ifdef __HAVE_NO___THREAD #define __thread diff --git a/contrib/netbsd-tests/lib/libc/tls_dso/h_tls_dynamic.c b/contrib/netbsd-tests/lib/libc/tls_dso/h_tls_dynamic.c index a12e07a..8a82689 100644 --- a/contrib/netbsd-tests/lib/libc/tls_dso/h_tls_dynamic.c +++ b/contrib/netbsd-tests/lib/libc/tls_dso/h_tls_dynamic.c @@ -35,7 +35,9 @@ __RCSID("$NetBSD: h_tls_dynamic.c,v 1.5 2013/10/21 19:11:17 joerg Exp $"); #include +#if defined(__NetBSD__) #include +#endif #ifdef __HAVE_NO___THREAD #define __thread -- cgit v1.1 From c60e1a8fc3c6e0e955c37437181901f57f1a3727 Mon Sep 17 00:00:00 2001 From: ngie Date: Sun, 12 Oct 2014 10:07:26 +0000 Subject: #include libutil.h for fparseln on FreeBSD Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') 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 17258f5..f5ded27 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c @@ -36,6 +36,9 @@ #include #include #include +#if defined(__FreeBSD__) +#include +#endif #define SKIPWS(p) while (isspace((int)(*p))) p++ #define WS "\t\n " -- cgit v1.1 From 7a7f1f864ed680bdb4c5dff5643a1e7d77a6984f Mon Sep 17 00:00:00 2001 From: ngie Date: Sun, 12 Oct 2014 21:53:13 +0000 Subject: Implement 64MB memory limit for test to ensure that it fails reliably in 600 seconds; it would previously fail inconsistently when run in some virtual machine configurations This patch might need to be reverted or revisited later (see the attached PR for more details) PR: 169302 Submitted by: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/regex/t_exhaust.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c b/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c index 468492c..bc34441 100644 --- a/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c +++ b/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c @@ -45,6 +45,9 @@ __RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $"); #include #include #include +#if defined(__FreeBSD__) +#include +#endif #ifndef REGEX_MAXSIZE #define REGEX_MAXSIZE 9999 @@ -176,14 +179,25 @@ ATF_TC_HEAD(regcomp_too_big, tc) " crash, but return a proper error code"); // libtre needs it. atf_tc_set_md_var(tc, "timeout", "600"); +#if defined(__FreeBSD__) + atf_tc_set_md_var(tc, "require.memory", "64M"); +#else atf_tc_set_md_var(tc, "require.memory", "120M"); +#endif } ATF_TC_BODY(regcomp_too_big, tc) { regex_t re; +#if defined(__FreeBSD__) + struct rlimit limit; +#endif int e; +#if defined(__FreeBSD__) + limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024; + ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1); +#endif for (size_t i = 0; i < __arraycount(tests); i++) { char *d = (*tests[i].pattern)(REGEX_MAXSIZE); e = regcomp(&re, d, tests[i].type); -- cgit v1.1 From 58bd819849119cdcc80dcf3601c7fce2ddc14cff Mon Sep 17 00:00:00 2001 From: ngie Date: Sun, 12 Oct 2014 21:54:55 +0000 Subject: Fix compilation errors with missing wide-type headers and fix compilation warnings with -Wformat In collaboration with: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/regex/debug.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/regex/debug.c b/contrib/netbsd-tests/lib/libc/regex/debug.c index c1528b9..55655eb 100644 --- a/contrib/netbsd-tests/lib/libc/regex/debug.c +++ b/contrib/netbsd-tests/lib/libc/regex/debug.c @@ -34,6 +34,10 @@ #include #include +#if defined(__FreeBSD__) +#include +#include +#endif /* Don't sort these! */ #include "utils.h" @@ -50,6 +54,7 @@ static char *regchar(int); void regprint(regex_t *r, FILE *d) { +#if defined(__NetBSD__) struct re_guts *g = r->re_g; int c; int last; @@ -111,6 +116,7 @@ regprint(regex_t *r, FILE *d) } fprintf(d, "\n"); } +#endif } /* @@ -171,6 +177,7 @@ s_print(struct re_guts *g, FILE *d) break; case OANYOF: fprintf(d, "[(%ld)", (long)opnd); +#if defined(__NetBSD__) cs = &g->sets[opnd]; last = -1; for (size_t i = 0; i < g->csetsize+1; i++) /* +1 flushes */ @@ -187,6 +194,7 @@ s_print(struct re_guts *g, FILE *d) last = -1; } } +#endif fprintf(d, "]"); break; case OBACK_: @@ -242,7 +250,11 @@ s_print(struct re_guts *g, FILE *d) fprintf(d, ">"); break; default: +#if defined(__FreeBSD__) + fprintf(d, "!%ld(%ld)!", OP(*s), opnd); +#else fprintf(d, "!%d(%d)!", OP(*s), opnd); +#endif break; } if (!done) -- cgit v1.1 From b463c81586c75c1544987853784de32b3ae51687 Mon Sep 17 00:00:00 2001 From: ngie Date: Sun, 12 Oct 2014 21:59:23 +0000 Subject: - Add libutil #include for fparseln - Change ATF_REQUIRE_EQ_MSG to ATF_CHECK_EQ_MSG to gather all failing results possible (currently 12 with leftassoc) - Mark leftassoc "atf_tc_expect_fail" on FreeBSD (PR coming soon after further analysis is done on the code) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/regex/t_regex_att.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c b/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c index beaeb04..fb8f285 100644 --- a/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c +++ b/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c @@ -48,6 +48,9 @@ __RCSID("$NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $"); #include #include #include +#if defined(__FreeBSD__) +#include +#endif static const char sep[] = "\r\n\t"; static const char delim[3] = "\\\\\0"; @@ -374,7 +377,11 @@ checkmatches(const char *matches, size_t nm, const regmatch_t *pm, " cur=%d, max=%zu", res, l, len - off); off += l; } +#if defined(__FreeBSD__) + ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno); +#else ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno); +#endif free(res); } @@ -573,6 +580,9 @@ ATF_TC_BODY(leftassoc, tc) * any explation. Mark as broken here, but I don't know why. */ atf_tc_expect_fail("Reason for breakage unknown"); #endif +#if defined(__FreeBSD__) + atf_tc_expect_fail("The expected and matched groups are mismatched on FreeBSD"); +#endif att_test(tc, "leftassoc"); } -- cgit v1.1 From 1cc1341f99e4db303ca09d810d015e413a249d2b Mon Sep 17 00:00:00 2001 From: ngie Date: Sun, 12 Oct 2014 23:46:24 +0000 Subject: Expect nice_err to fail on FreeBSD with unprivileged users PR: 189821 Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/gen/t_nice.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/gen/t_nice.c b/contrib/netbsd-tests/lib/libc/gen/t_nice.c index 67a0bf5..a0e912b 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_nice.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_nice.c @@ -72,6 +72,11 @@ ATF_TC_BODY(nice_err, tc) { int i; +#if defined(__FreeBSD__) + atf_tc_expect_fail("nice(incr) with incr < 0 fails with unprivileged " + "users and sets errno == EPERM; see PR # 189821 for more details"); +#endif + /* * The call should fail with EPERM if the * supplied parameter is negative and the -- cgit v1.1 From a53fdcf816a269f780e6ef16e2aed22208331072 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 00:33:59 +0000 Subject: Add #include for printf Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/locale/t_wcstod.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c b/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c index 85b1ee1..ef85777 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c @@ -66,6 +66,10 @@ __RCSID("$NetBSD: t_wcstod.c,v 1.3 2011/10/01 17:56:11 christos Exp $"); #include +#if defined(__FreeBSD__) +#include +#endif + #define ALT_HUGE_VAL -1 #define ALT_MINUS_HUGE_VAL -2 #define ALT_NAN -3 -- cgit v1.1 From f890b5bffa3a65125f7b30bd9a79a81fab72c5f8 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 01:14:01 +0000 Subject: Do initial port of contrib/netbsd-tests/lib/libc/locale t_io: - Expect failures potentially related to implementation-specific knowledge of the zh_TW.Big5 locale [*] t_mbrtowc: - Handle unknown locales more gracefully (do not test if the locale doesn't exist) - Expect failure with mbrtowc_internal dealing with Japanese locales (potentially related to implementation detail knowledge of the ja_* locales) [*]. t_mbstowcs, t_mbtowc, t_wctomb: - Handle unknown locales more gracefully (do not test if the locale doesn't exist) t_wcstod: - Treat FreeBSD like NetBSD and Linux in the XXX: FIXME section [*] More investigation is required to determine the root cause of the failures Submitted by: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/locale/t_io.c | 13 +++++++++++++ contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c | 10 ++++++++++ contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c | 7 +++++++ contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c | 14 ++++++++++++++ contrib/netbsd-tests/lib/libc/locale/t_wcstod.c | 2 +- contrib/netbsd-tests/lib/libc/locale/t_wctomb.c | 7 +++++++ 6 files changed, 52 insertions(+), 1 deletion(-) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/locale/t_io.c b/contrib/netbsd-tests/lib/libc/locale/t_io.c index 782bed8..7f7293a 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_io.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_io.c @@ -56,6 +56,11 @@ ATF_TC_BODY(bad_big5_wprintf, tc) /* XXX implementation detail knowledge (wchar_t encoding) */ wchar_t ibuf[] = { 0xcf10, 0 }; setlocale(LC_CTYPE, "zh_TW.Big5"); + +#if defined(__FreeBSD__) + atf_tc_expect_fail("does not fail as expected (may be implementation " + "specific issue with the test)"); +#endif ATF_REQUIRE_ERRNO(EILSEQ, wprintf(L"%ls\n", ibuf) < 0); ATF_REQUIRE(ferror(stdout)); } @@ -72,6 +77,11 @@ ATF_TC_BODY(bad_big5_swprintf, tc) wchar_t ibuf[] = { 0xcf10, 0 }; wchar_t obuf[20]; setlocale(LC_CTYPE, "zh_TW.Big5"); + +#if defined(__FreeBSD__) + atf_tc_expect_fail("does not fail as expected (may be implementation " + "specific issue with the test)"); +#endif ATF_REQUIRE_ERRNO(EILSEQ, swprintf(obuf, sizeof(obuf), L"%ls\n", ibuf) < 0); } @@ -161,6 +171,9 @@ ATF_TC_BODY(bad_big5_getwc, tc) ATF_REQUIRE(fp != NULL); setlocale(LC_CTYPE, "zh_TW.Big5"); +#if defined(__FreeBSD__) + atf_tc_expect_fail("does not return WEOF as expected"); +#endif ATF_REQUIRE_EQ(getwc(fp), WEOF); fclose(fp); } diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c b/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c index b4ad841..7cab973 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c @@ -132,7 +132,14 @@ h_ctype2(const struct test *t, bool use_mbstate) size_t n; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL); +#else + if (setlocale(LC_CTYPE, t->locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", t->locale); + return; + } +#endif (void)strvis(buf, t->data, VIS_WHITE | VIS_OCTAL); (void)printf("Checking string: \"%s\"\n", buf); @@ -238,6 +245,9 @@ ATF_TC_BODY(mbrtowc_internal, tc) { struct test *t; +#if defined(__FreeBSD__) + atf_tc_expect_fail("ja_* locale fails"); +#endif for (t = &tests[0]; t->data != NULL; ++t) h_ctype2(t, false); } diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c b/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c index ec06729..7395d19 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c @@ -150,7 +150,14 @@ ATF_TC_BODY(mbstowcs_basic, tc) int i; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL); +#else + if (setlocale(LC_CTYPE, t->locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", t->locale); + continue; + } +#endif (void)strvis(visbuf, t->data, VIS_WHITE | VIS_OCTAL); (void)printf("Checking string: \"%s\"\n", visbuf); diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c index 62f62b1..bb69060 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c @@ -76,7 +76,14 @@ h_mbtowc(const char *locale, const char *illegal, const char *legal) char *str; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, locale) != NULL); +#else + if (setlocale(LC_CTYPE, locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", locale); + return; + } +#endif ATF_REQUIRE((str = setlocale(LC_ALL, NULL)) != NULL); (void)printf("Using locale: %s\n", str); @@ -130,9 +137,16 @@ ATF_TC_BODY(mbtowc, tc) h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B"); h_mbtowc("ja_JP.SJIS", "\202", "\202\240"); h_mbtowc("ja_JP.eucJP", "\244", "\244\242"); +#if !defined(__FreeBSD__) + /* Moved last as it fails */ h_mbtowc("zh_CN.GB18030", "\241", "\241\241"); +#endif h_mbtowc("zh_TW.Big5", "\241", "\241@"); h_mbtowc("zh_TW.eucTW", "\241", "\241\241"); +#if defined(__FreeBSD__) + atf_tc_expect_fail("zh_CN.GB18030"); + h_mbtowc("zh_CN.GB18030", "\241", "\241\241"); +#endif } ATF_TP_ADD_TCS(tp) diff --git a/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c b/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c index ef85777..fe7b468 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c @@ -238,7 +238,7 @@ static struct test { { L" -0X.", 12, 0, 0 }, #endif /* XXX: FIXME */ -#if defined(__NetBSD__) || defined(__linux__) +#if defined(__NetBSD__) || defined(__linux__) || defined(__FreeBSD__) { L"0X.0", 4, 0, 0 }, { L"+0X.0", 5, 0, 0 }, { L"-0X.0", 5, 0, 0 }, diff --git a/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c b/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c index f553c8c..06016bf 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c @@ -109,7 +109,14 @@ h_wctomb(const struct test *t, char tc) size_t sz, ret, i; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL); +#else + if (setlocale(LC_CTYPE, t->locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", t->locale); + return; + } +#endif (void)strvis(buf, t->data, VIS_WHITE | VIS_OCTAL); (void)printf("Checking sequence: \"%s\"\n", buf); -- cgit v1.1 From 362e0ab994b3958dacb21b1efbff0ffc4d02074d Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 02:23:24 +0000 Subject: memmem with NUL length "needle" (aka small) strings on FreeBSD/OSX returns NULL instead of the "haystack" value (aka big) Submitted by: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/string/t_memmem.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/string/t_memmem.c b/contrib/netbsd-tests/lib/libc/string/t_memmem.c index 1e87af8..8734bc3 100644 --- a/contrib/netbsd-tests/lib/libc/string/t_memmem.c +++ b/contrib/netbsd-tests/lib/libc/string/t_memmem.c @@ -75,8 +75,13 @@ ATF_TC_HEAD(memmem_basic, tc) ATF_TC_BODY(memmem_basic, tc) { +#if defined(__darwin__) || defined(__FreeBSD__) + expect(memmem(b2, lb2, p0, lp0) == NULL); + expect(memmem(b0, lb0, p0, lp0) == NULL); +#else expect(memmem(b2, lb2, p0, lp0) == b2); expect(memmem(b0, lb0, p0, lp0) == b0); +#endif expect(memmem(b0, lb0, p1, lp1) == NULL); expect(memmem(b1, lb1, p1, lp1) == NULL); -- cgit v1.1 From 62e17d5b26e52ce8b87a1ada46b99bf64ba8db19 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 02:27:59 +0000 Subject: Use 1 as a random seed, as recommended in srandom(3). Adjust the random values accordingly Submitted by: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/string/t_memcpy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/string/t_memcpy.c b/contrib/netbsd-tests/lib/libc/string/t_memcpy.c index 6485a88..c9e52a3 100644 --- a/contrib/netbsd-tests/lib/libc/string/t_memcpy.c +++ b/contrib/netbsd-tests/lib/libc/string/t_memcpy.c @@ -51,7 +51,11 @@ unsigned char *start[BLOCKTYPES] = { }; char result[100]; +#if defined(__NetBSD__) const char goodResult[] = "7b405d24bc03195474c70ddae9e1f8fb"; +#else +const char goodResult[] = "217b4fbe456916bf62a2f85df752e4ab"; +#endif static void runTest(unsigned char *b1, unsigned char *b2) @@ -89,7 +93,15 @@ ATF_TC_BODY(memcpy_basic, tc) start[2] = auto1; start[3] = auto2; +#if defined(__NetBSD__) srandom(0L); +#else + /* + * random() shall produce by default a sequence of numbers that can be + * duplicated by calling srandom() with 1 as the seed. + */ + srandom(1); +#endif MD5Init(mc); for (i = 0; i < BLOCKTYPES; ++i) for (j = 0; j < BLOCKTYPES; ++j) -- cgit v1.1 From fbee57a2afc0f921e0cbf4c9dda8861722f0ac06 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 02:29:58 +0000 Subject: Add #include to get sys_nerr definition Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/string/t_strerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/string/t_strerror.c b/contrib/netbsd-tests/lib/libc/string/t_strerror.c index c0e9c06..cb008d7 100644 --- a/contrib/netbsd-tests/lib/libc/string/t_strerror.c +++ b/contrib/netbsd-tests/lib/libc/string/t_strerror.c @@ -37,6 +37,10 @@ __RCSID("$NetBSD: t_strerror.c,v 1.3 2011/05/10 06:55:27 jruoho Exp $"); #include #include +#if defined(__FreeBSD__) +#include +#endif + ATF_TC(strerror_basic); ATF_TC_HEAD(strerror_basic, tc) { -- cgit v1.1 From 18628d06309cff733d706f08f4013615cc6bcc17 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 02:32:37 +0000 Subject: __isnanl is automatically picked according to data type in . There isn't a need for the explicit __isnanl test Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c index d7ebe1b..d11e6f0 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c @@ -221,7 +221,9 @@ ATF_TC_BODY(strtold_nan, tc) volatile long double ld = strtold(nan_string, &end); ATF_REQUIRE(isnan(ld) != 0); +#if !defined(__FreeBSD__) ATF_REQUIRE(__isnanl(ld) != 0); +#endif ATF_REQUIRE(strcmp(end, "y") == 0); # else atf_tc_skip("Requires long double support"); -- cgit v1.1 From 56e7f9c5eb57f41bff12067ab49a3a56a274f6cd Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 02:44:35 +0000 Subject: Only test the return value in mktime_negyear Testing for the errno is an optional requirement according to POSIX, and FreeBSD doesn't document that errno would be set on failure with mktime Submitted by: pho Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/lib/libc/time/t_mktime.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/time/t_mktime.c b/contrib/netbsd-tests/lib/libc/time/t_mktime.c index 8092361..caef906 100644 --- a/contrib/netbsd-tests/lib/libc/time/t_mktime.c +++ b/contrib/netbsd-tests/lib/libc/time/t_mktime.c @@ -72,7 +72,12 @@ ATF_TC_BODY(mktime_negyear, tc) errno = 0; t = mktime(&tms); +#if defined(__FreeBSD__) + /* Open Group says "and may set errno to indicate the error" */ + ATF_REQUIRE(t == (time_t)-1); +#else ATF_REQUIRE_ERRNO(0, t != (time_t)-1); +#endif } ATF_TC(timegm_epoch); -- cgit v1.1 From 1d5071689271b21013e6aeffbbcaf7130a2c2694 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 13 Oct 2014 03:55:47 +0000 Subject: Change ATF_REQUIRE_MSG calls to ATF_CHECK_MSG to get as many errors as possible t_strptime:common.. - Expect the testcase body as a whole to fail. Multiple PRs will be filed to track the issues (there are 18 check failures) t_strptime:day.. - %EA and %OA seem to be case insensitive on FreeBSD --- contrib/netbsd-tests/lib/libc/time/t_strptime.c | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc') diff --git a/contrib/netbsd-tests/lib/libc/time/t_strptime.c b/contrib/netbsd-tests/lib/libc/time/t_strptime.c index c0f9cdf..7808891 100644 --- a/contrib/netbsd-tests/lib/libc/time/t_strptime.c +++ b/contrib/netbsd-tests/lib/libc/time/t_strptime.c @@ -49,6 +49,17 @@ h_pass(const char *buf, const char *fmt, int len, exp = buf + len; ret = strptime(buf, fmt, &tm); +#if defined(__FreeBSD__) + ATF_CHECK_MSG(ret == exp, + "strptime(\"%s\", \"%s\", tm): incorrect return code: " + "expected: %p, got: %p", buf, fmt, exp, ret); + +#define H_REQUIRE_FIELD(field) \ + ATF_CHECK_MSG(tm.field == field, \ + "strptime(\"%s\", \"%s\", tm): incorrect %s: " \ + "expected: %d, but got: %d", buf, fmt, \ + ___STRING(field), field, tm.field) +#else ATF_REQUIRE_MSG(ret == exp, "strptime(\"%s\", \"%s\", tm): incorrect return code: " "expected: %p, got: %p", buf, fmt, exp, ret); @@ -58,6 +69,7 @@ h_pass(const char *buf, const char *fmt, int len, "strptime(\"%s\", \"%s\", tm): incorrect %s: " \ "expected: %d, but got: %d", buf, fmt, \ ___STRING(field), field, tm.field) +#endif H_REQUIRE_FIELD(tm_sec); H_REQUIRE_FIELD(tm_min); @@ -76,8 +88,13 @@ h_fail(const char *buf, const char *fmt) { struct tm tm = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, NULL }; +#if defined(__FreeBSD__) + ATF_CHECK_MSG(strptime(buf, fmt, &tm) == NULL, "strptime(\"%s\", " + "\"%s\", &tm) should fail, but it didn't", buf, fmt); +#else ATF_REQUIRE_MSG(strptime(buf, fmt, &tm) == NULL, "strptime(\"%s\", " "\"%s\", &tm) should fail, but it didn't", buf, fmt); +#endif } ATF_TC(common); @@ -91,6 +108,10 @@ ATF_TC_HEAD(common, tc) ATF_TC_BODY(common, tc) { +#if defined(__FreeBSD__) + atf_tc_expect_fail("There are various issues with strptime on FreeBSD"); +#endif + h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %T %Y", 24, 46, 27, 23, 20, 0, 98, 2, -1); h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %H:%M:%S %Y", @@ -168,9 +189,17 @@ ATF_TC_BODY(day, tc) h_pass("mon", "%a", 3, -1, -1, -1, -1, -1, -1, 1, -1); h_pass("tueSDay", "%A", 7, -1, -1, -1, -1, -1, -1, 2, -1); h_pass("sunday", "%A", 6, -1, -1, -1, -1, -1, -1, 0, -1); +#if defined(__NetBSD__) h_fail("sunday", "%EA"); +#else + h_pass("Sunday", "%EA", 6, -1, -1, -1, -1, -1, -1, 0, -1); +#endif h_pass("SaturDay", "%A", 8, -1, -1, -1, -1, -1, -1, 6, -1); +#if defined(__NetBSD__) h_fail("SaturDay", "%OA"); +#else + h_pass("SaturDay", "%OA", 8, -1, -1, -1, -1, -1, -1, 6, -1); +#endif } ATF_TC(month); -- cgit v1.1