mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Tweak test_fork to exercise strerror
This commit is contained in:
parent
de084b4a0d
commit
bf10d6c03b
1 changed files with 13 additions and 5 deletions
|
@ -379,16 +379,19 @@ static void test_tok()
|
||||||
static int test_fork_helper(void *unused)
|
static int test_fork_helper(void *unused)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i=0; i < 100000; i++)
|
for (i=0; i < 1000; i++)
|
||||||
{
|
{
|
||||||
delete [](new char[4 * 1024 * 1024]);
|
//delete [](new char[4 * 1024 * 1024]);
|
||||||
|
for (int j=0; j < 1024; j++) {
|
||||||
|
strerror(j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_fork(void)
|
static void test_fork(void)
|
||||||
{
|
{
|
||||||
return; // Test is disabled until I can force it to fail
|
return;
|
||||||
say(L"Testing fork");
|
say(L"Testing fork");
|
||||||
size_t i, max = 100;
|
size_t i, max = 100;
|
||||||
for (i=0; i < 100; i++)
|
for (i=0; i < 100; i++)
|
||||||
|
@ -396,7 +399,7 @@ static void test_fork(void)
|
||||||
printf("%lu / %lu\n", i+1, max);
|
printf("%lu / %lu\n", i+1, max);
|
||||||
/* Do something horrible to try to trigger an error */
|
/* Do something horrible to try to trigger an error */
|
||||||
#define THREAD_COUNT 8
|
#define THREAD_COUNT 8
|
||||||
#define FORK_COUNT 200
|
#define FORK_COUNT 10
|
||||||
#define FORK_LOOP_COUNT 16
|
#define FORK_LOOP_COUNT 16
|
||||||
signal_block();
|
signal_block();
|
||||||
for (size_t i=0; i < THREAD_COUNT; i++)
|
for (size_t i=0; i < THREAD_COUNT; i++)
|
||||||
|
@ -417,7 +420,12 @@ static void test_fork(void)
|
||||||
else if (pid == 0)
|
else if (pid == 0)
|
||||||
{
|
{
|
||||||
/* Child */
|
/* Child */
|
||||||
new char[4 * 1024 * 1024];
|
//new char[4 * 1024 * 1024];
|
||||||
|
for (size_t i=0; i < 1024 * 16; i++) {
|
||||||
|
for (int j=0; j < 256; j++) {
|
||||||
|
strerror(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
exit_without_destructors(0);
|
exit_without_destructors(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue