Module Name: src
Committed By: christos
Date: Sat Jan 14 00:50:56 UTC 2017
Modified Files:
src/tests/lib/libc/regex: debug.c t_exhaust.c t_regex_att.c
Log Message:
PR/51832: Ngie Cooper:
- limit memory to 64M
- error msg fixes
- includes fixes
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/regex/debug.c
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/regex/t_exhaust.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/regex/t_regex_att.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/regex/debug.c
diff -u src/tests/lib/libc/regex/debug.c:1.2 src/tests/lib/libc/regex/debug.c:1.3
--- src/tests/lib/libc/regex/debug.c:1.2 Mon Oct 10 00:32:41 2011
+++ src/tests/lib/libc/regex/debug.c Fri Jan 13 19:50:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.2 2011/10/10 04:32:41 christos Exp $ */
+/* $NetBSD: debug.c,v 1.3 2017/01/14 00:50:56 christos Exp $ */
/*-
* Copyright (c) 1993 The NetBSD Foundation, Inc.
@@ -26,14 +26,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/types.h>
#include <ctype.h>
#include <limits.h>
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include <sys/types.h>
+#include <wchar.h>
+#include <wctype.h>
/* Don't sort these! */
#include "utils.h"
Index: src/tests/lib/libc/regex/t_exhaust.c
diff -u src/tests/lib/libc/regex/t_exhaust.c:1.7 src/tests/lib/libc/regex/t_exhaust.c:1.8
--- src/tests/lib/libc/regex/t_exhaust.c:1.7 Wed Nov 16 13:37:31 2011
+++ src/tests/lib/libc/regex/t_exhaust.c Fri Jan 13 19:50:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $ */
+/* $NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,14 +37,15 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $");
+__RCSID("$NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $");
-#include <stdio.h>
+#include <sys/resource.h>
+#include <atf-c.h>
+#include <err.h>
#include <regex.h>
-#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <err.h>
-#include <atf-c.h>
+#include <string.h>
#ifndef REGEX_MAXSIZE
#define REGEX_MAXSIZE 9999
@@ -176,14 +177,17 @@ 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");
- atf_tc_set_md_var(tc, "require.memory", "120M");
+ atf_tc_set_md_var(tc, "require.memory", "64M");
}
ATF_TC_BODY(regcomp_too_big, tc)
{
regex_t re;
+ struct rlimit limit;
int e;
+ limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024;
+ ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
for (size_t i = 0; i < __arraycount(tests); i++) {
char *d = (*tests[i].pattern)(REGEX_MAXSIZE);
e = regcomp(&re, d, tests[i].type);
Index: src/tests/lib/libc/regex/t_regex_att.c
diff -u src/tests/lib/libc/regex/t_regex_att.c:1.1 src/tests/lib/libc/regex/t_regex_att.c:1.2
--- src/tests/lib/libc/regex/t_regex_att.c:1.1 Fri Aug 24 16:24:40 2012
+++ src/tests/lib/libc/regex/t_regex_att.c Fri Jan 13 19:50:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $ */
+/* $NetBSD: t_regex_att.c,v 1.2 2017/01/14 00:50:56 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $");
+__RCSID("$NetBSD: t_regex_att.c,v 1.2 2017/01/14 00:50:56 christos Exp $");
#include <sys/param.h>
@@ -374,7 +374,7 @@ checkmatches(const char *matches, size_t
" cur=%d, max=%zu", res, l, len - off);
off += l;
}
- ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno);
+ ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno);
free(res);
}