mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 14:50:05 +00:00
* posix/bug-regex15.c: New file.
* posix/Makefile (tests): Add it. * test-skeleton.c (TEST_DATA_LIMIT): New macro, default to 64MB. (main): Set RLIMIT_DATA limit to TEST_DATA_LIMIT (or lower if need be).
This commit is contained in:
parent
afc58fa87c
commit
63b11dd19b
@ -1,3 +1,11 @@
|
||||
2002-12-13 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* posix/bug-regex15.c: New file.
|
||||
* posix/Makefile (tests): Add it.
|
||||
|
||||
* test-skeleton.c (TEST_DATA_LIMIT): New macro, default to 64MB.
|
||||
(main): Set RLIMIT_DATA limit to TEST_DATA_LIMIT (or lower if need be).
|
||||
|
||||
2002-12-13 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* elf/dl-misc.c (_dl_debug_vdprintf): Don't depend on 5-digit PIDs.
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
/* The test function is normally called `do_test' and it is called
|
||||
with argc and argv as the arguments. We nevertheless provide the
|
||||
@ -35,6 +36,9 @@
|
||||
# define TEST_FUNCTION do_test (argc, argv)
|
||||
#endif
|
||||
|
||||
#ifndef TEST_DATA_LIMIT
|
||||
# define TEST_DATA_LIMIT (64 << 20) /* Data limit (bytes) to run with. */
|
||||
#endif
|
||||
|
||||
#define OPT_DIRECT 1000
|
||||
#define OPT_TESTDIR 1001
|
||||
@ -250,6 +254,23 @@ main (int argc, char *argv[])
|
||||
setrlimit (RLIMIT_CORE, &core_limit);
|
||||
#endif
|
||||
|
||||
#ifdef RLIMIT_DATA
|
||||
/* Try to avoid eating all memory if a test leaks. */
|
||||
struct rlimit data_limit;
|
||||
if (getrlimit (RLIMIT_DATA, &data_limit) == 0)
|
||||
{
|
||||
if (TEST_DATA_LIMIT == RLIM_INFINITY)
|
||||
data_limit.rlim_cur = data_limit.rlim_max;
|
||||
else if (data_limit.rlim_cur > (rlim_t) TEST_DATA_LIMIT)
|
||||
data_limit.rlim_cur = MIN ((rlim_t) TEST_DATA_LIMIT,
|
||||
data_limit.rlim_max);
|
||||
if (setrlimit (RLIMIT_DATA, &data_limit) < 0)
|
||||
perror ("setrlimit: RLIMIT_DATA");
|
||||
}
|
||||
else
|
||||
perror ("getrlimit: RLIMIT_DATA");
|
||||
#endif
|
||||
|
||||
/* We put the test process in its own pgrp so that if it bogusly
|
||||
generates any job control signals, they won't hit the whole build. */
|
||||
setpgid (0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user