From 3d291be8dc7b2c7bb2b99148877302b8cf5f2d3e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 16 Oct 2014 12:23:18 +0200 Subject: [PATCH] Cherry-pick upstream patch to fix tests in limited schroot environments --- debian/changelog | 1 + debian/patches/series | 1 + ...tests-fix-some-tests-to-pass-in-koji.patch | 83 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 debian/patches/tests-fix-some-tests-to-pass-in-koji.patch diff --git a/debian/changelog b/debian/changelog index 97edba953..a8629d53b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ systemd (215-6) UNRELEASED; urgency=medium * Cherry-pick upstream patch to fix udev crash in link_config_get(). + * Cherry-pick upstream patch to fix tests in limited schroot environments. -- Martin Pitt Sun, 12 Oct 2014 17:29:00 +0200 diff --git a/debian/patches/series b/debian/patches/series index 8dab2a871..59b422d19 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -106,6 +106,7 @@ sd-journal-properly-convert-object-size-on-big-endia.patch always-check-for-__BYTE_ORDER-__BIG_ENDIAN-when-chec.patch timesyncd-when-we-don-t-know-anything-about-the-netw.patch udev-link-config-fix-crash-due-to-missing-hwaddr.patch +tests-fix-some-tests-to-pass-in-koji.patch ## Debian specific patches: Add-back-support-for-Debian-specific-config-files.patch diff --git a/debian/patches/tests-fix-some-tests-to-pass-in-koji.patch b/debian/patches/tests-fix-some-tests-to-pass-in-koji.patch new file mode 100644 index 000000000..f0d66b33b --- /dev/null +++ b/debian/patches/tests-fix-some-tests-to-pass-in-koji.patch @@ -0,0 +1,83 @@ +From: =?utf-8?q?Zbigniew_J=C4=99drzejewski-Szmek?= +Date: Sun, 12 Oct 2014 16:05:49 -0400 +Subject: tests: fix some tests to pass in koji + +FAIL: test-engine +================= +Cannot find cgroup mount point: No such file or directory +Assertion 'r >= 0' failed at ../src/test/test-engine.c:46, function main(). Aborting. + +FAIL: test-sched-prio +===================== +Cannot find cgroup mount point: No such file or directory +Assertion 'r >= 0' failed at ../src/test/test-sched-prio.c:42, function main(). Aborting. + +FAIL: test-bus-cleanup +====================== +Assertion 'sd_bus_open_system(&bus) >= 0' failed at ../src/libsystemd/sd-bus/test-bus-cleanup.c:40, function test_bus_open(). Aborting. +after new: refcount 1 +--- + src/libsystemd/sd-bus/test-bus-cleanup.c | 22 +++++++++++++++++++--- + src/test/test-sched-prio.c | 2 +- + 2 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/src/libsystemd/sd-bus/test-bus-cleanup.c b/src/libsystemd/sd-bus/test-bus-cleanup.c +index e36a69f..f586880 100644 +--- a/src/libsystemd/sd-bus/test-bus-cleanup.c ++++ b/src/libsystemd/sd-bus/test-bus-cleanup.c +@@ -34,11 +34,18 @@ static void test_bus_new(void) { + printf("after new: refcount %u\n", REFCNT_GET(bus->n_ref)); + } + +-static void test_bus_open(void) { ++static int test_bus_open(void) { + _cleanup_bus_unref_ sd_bus *bus = NULL; ++ int r; + +- assert_se(sd_bus_open_system(&bus) >= 0); ++ r = sd_bus_open_system(&bus); ++ if (r == -ECONNREFUSED || r == -ENOENT) ++ return r; ++ ++ assert_se(r >= 0); + printf("after open: refcount %u\n", REFCNT_GET(bus->n_ref)); ++ ++ return 0; + } + + static void test_bus_new_method_call(void) { +@@ -70,11 +77,20 @@ static void test_bus_new_signal(void) { + } + + int main(int argc, char **argv) { ++ int r; ++ + log_parse_environment(); + log_open(); + + test_bus_new(); +- test_bus_open(); ++ r = test_bus_open(); ++ if (r < 0) { ++ log_info("Failed to connect to bus, skipping tests."); ++ return EXIT_TEST_SKIP; ++ } ++ + test_bus_new_method_call(); + test_bus_new_signal(); ++ ++ return EXIT_SUCCESS; + } +diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c +index e984ee4..6c90561 100644 +--- a/src/test/test-sched-prio.c ++++ b/src/test/test-sched-prio.c +@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { + /* prepare the test */ + assert_se(set_unit_path(dir) >= 0); + r = manager_new(SYSTEMD_USER, &m); +- if (r == -EPERM || r == -EACCES || r == -EADDRINUSE || r == -EHOSTDOWN) { ++ if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) { + printf("Skipping test: manager_new: %s", strerror(-r)); + return EXIT_TEST_SKIP; + } -- 2.39.5