NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes



The following reply was made to PR bin/51832; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
Date: Wed, 11 Jan 2017 22:05:30 -0800

 --Apple-Mail=_D113D9B1-C3DF-41C0-B6F4-E1D7D91117D9
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 Patch attached.
 -Ngie
 
 --Apple-Mail=_D113D9B1-C3DF-41C0-B6F4-E1D7D91117D9
 Content-Disposition: attachment;
 	filename=lib-libc-regex-various-fixes.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="lib-libc-regex-various-fixes.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: regex/debug.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/regex/debug.c,v
 retrieving revision 1.2
 diff -u -r1.2 debug.c
 --- regex/debug.c	10 Oct 2011 04:32:41 -0000	1.2
 +++ regex/debug.c	12 Jan 2017 05:53:17 -0000
 @@ -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: regex/t_exhaust.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/regex/t_exhaust.c,v
 retrieving revision 1.7
 diff -u -r1.7 t_exhaust.c
 --- regex/t_exhaust.c	16 Nov 2011 18:37:31 -0000	1.7
 +++ regex/t_exhaust.c	12 Jan 2017 05:53:17 -0000
 @@ -39,12 +39,13 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 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 @@
  	    " 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: regex/t_regex_att.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/regex/t_regex_att.c,v
 retrieving revision 1.1
 diff -u -r1.1 t_regex_att.c
 --- regex/t_regex_att.c	24 Aug 2012 20:24:40 -0000	1.1
 +++ regex/t_regex_att.c	12 Jan 2017 05:53:17 -0000
 @@ -374,7 +374,7 @@
  		    " 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);
  }
  
 
 --Apple-Mail=_D113D9B1-C3DF-41C0-B6F4-E1D7D91117D9--
 


Home | Main Index | Thread Index | Old Index