summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-12 15:37:17 +0000
committerSimon McVittie <smcv@debian.org>2015-02-12 19:19:06 +0000
commitb2386f6cb809fca4fb2ded4734c3d8e35459b401 (patch)
tree32130850835f738eb833e46d23f92a880e86f8fd
parent61b27251ff565081ab6f9566a53b5d6e565442cb (diff)
downloaddbus-b2386f6cb809fca4fb2ded4734c3d8e35459b401.tar.gz
Add patch from upstream to reduce the number of fds the fdpass test demands
This fixes autopkgtest in a more limited environment.
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/Reduce-the-number-of-fds-the-fdpass-test-uses.patch61
-rw-r--r--debian/patches/series1
3 files changed, 64 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 025d2cf0..ff95aca3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ dbus (1.9.10-2) UNRELEASED; urgency=medium
unapplies patches after the build if they were unapplied before)
* Configure gbp-pq to export patches without patch numbers, and
re-export our long-standing Debian patch in that format
+ * Add patch from upstream to reduce the number of fds the fdpass test
+ demands, fixing autopkgtest in a more limited environment
-- Simon McVittie <smcv@debian.org> Mon, 09 Feb 2015 17:53:51 +0000
diff --git a/debian/patches/Reduce-the-number-of-fds-the-fdpass-test-uses.patch b/debian/patches/Reduce-the-number-of-fds-the-fdpass-test-uses.patch
new file mode 100644
index 00000000..0a2176d6
--- /dev/null
+++ b/debian/patches/Reduce-the-number-of-fds-the-fdpass-test-uses.patch
@@ -0,0 +1,61 @@
+From: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: Wed, 11 Feb 2015 11:47:15 +0000
+Subject: Reduce the number of fds the fdpass test uses
+
+It was relying on a higher-than-default fd limit; cut it down to
+more than 256 but rather less than 1024, since the default Linux
+limit is 1024 fds per user.
+
+Also automatically skip this test if our rlimit is too small.
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88998
+Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
+Applied-upstream: 1.9.12, commit:e38733122084655738d109228b4df271262fac42
+---
+ test/fdpass.c | 25 +++++++++++++++++++++++--
+ 1 file changed, 23 insertions(+), 2 deletions(-)
+
+diff --git a/test/fdpass.c b/test/fdpass.c
+index fa958da..96f9427 100644
+--- a/test/fdpass.c
++++ b/test/fdpass.c
+@@ -57,9 +57,11 @@ _DBUS_STATIC_ASSERT (MAX_MESSAGE_UNIX_FDS <= 253);
+ /* Arbitrary; included here to avoid relying on the default. */
+ #define MAX_INCOMING_UNIX_FDS (MAX_MESSAGE_UNIX_FDS * 4)
+
+-/* Arbitrary, except that MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES must be
++/* Arbitrary, except that MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES should be
+ * less than the process's file descriptor limit. */
+-#define SOME_MESSAGES 50
++#define SOME_MESSAGES 20
++/* To cover some situations on Linux we want this to be true. */
++_DBUS_STATIC_ASSERT (MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES > 256);
+
+ /* Linux won't allow more than 253 fds per sendmsg(). */
+ #define TOO_MANY_FDS 255
+@@ -809,6 +811,25 @@ main (int argc,
+ {
+ test_init (&argc, &argv);
+
++#ifdef HAVE_GETRLIMIT
++ {
++ struct rlimit lim;
++
++ if (getrlimit (RLIMIT_NOFILE, &lim) < 0)
++ g_error ("Failed to get RLIMIT_NOFILE limit: %s", 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
++
+ g_test_add ("/relay", Fixture, NULL, setup,
+ test_relay, teardown);
+ g_test_add ("/limit", Fixture, NULL, setup,
diff --git a/debian/patches/series b/debian/patches/series
index 4308ad94..77406a3a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
+Reduce-the-number-of-fds-the-fdpass-test-uses.patch
Don-t-abort-on-fatal-warnings-by-default.patch