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