mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-04-23 07:30:39 +02:00
test: Move fd limit check into test_flood
Other tests have different requirements for fds (and already check for them), so move this check into the specific test (mirroring what those other tests already do) instead of blocking the whole test program, incorrectly using autoconf test return codes instead of TAP protocol, as discussed in #176. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
f851484bf5
commit
72642d7ff6
1 changed files with 17 additions and 10 deletions
|
|
@ -674,10 +674,27 @@ test_flood (Fixture *f,
|
|||
unsigned int i, j;
|
||||
DBusMessage *outgoing[SOME_MESSAGES];
|
||||
dbus_uint32_t serial;
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
struct rlimit lim;
|
||||
#endif
|
||||
|
||||
if (f->skip)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
if (getrlimit (RLIMIT_NOFILE, &lim) == 0)
|
||||
{
|
||||
if (lim.rlim_cur != RLIM_INFINITY &&
|
||||
/* only run if we have a fairly generous margin of error
|
||||
* for stdout, stderr, duplicates, the D-Bus connection, etc. */
|
||||
lim.rlim_cur < 2 * MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES)
|
||||
{
|
||||
g_test_skip ("not enough RLIMIT_NOFILE to run this test");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
test_connect (f, TRUE);
|
||||
|
||||
for (j = 0; j < SOME_MESSAGES; j++)
|
||||
|
|
@ -919,16 +936,6 @@ main (int argc,
|
|||
g_error ("Failed to set RLIMIT_NOFILE limit to %ld: %s",
|
||||
(long) lim.rlim_cur, g_strerror (errno));
|
||||
}
|
||||
|
||||
if (lim.rlim_cur != RLIM_INFINITY &&
|
||||
/* only run if we have a fairly generous margin of error
|
||||
* for stdout, stderr, duplicates, the D-Bus connection, etc. */
|
||||
lim.rlim_cur < 2 * MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES)
|
||||
{
|
||||
g_message ("not enough RLIMIT_NOFILE to run this test");
|
||||
/* Autotools exit code for "all skipped" */
|
||||
return 77;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue