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/string') 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/string') 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/string') 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