Package: systemd
Version: 204-7
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch trusty

Hello,

systemd has some unit tests (with "make check"). Unfortunately not all
of them work in the rather restricted environment of our buildds, but
most of them do. It would be nice to at least run those, to pick up
regressions on particular architectures. Of course, over time, I
also hope that we can fix those tests upstream to work better during
package build.

The main ingredient is a patch to allow specifying a different path
for /etc/machine-id, as that does not yet usually exist (particularly,
not in buildd chroots). Upstream rejected the patch back then
(https://bugs.freedesktop.org/show_bug.cgi?id=62344), but it's rather
simple, so doesn't hurt too bad for a distro patch.

Are you interested in that for Debian? If so, I'll attach the three
git formatted patches for that (against current packaging git).

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
From d594684c0f4ab6bc79d52b727c916e3e72d2d3be Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinp...@gnome.org>
Date: Fri, 15 Mar 2013 08:27:43 +0100
Subject: [PATCH 1/3] Add env variable for machine ID path

During package build, in minimal chroots, or other systems which do not already
have an /etc/machine-id we get six test failures. Introduce a
$SYSTEMD_MACHINE_ID_PATH environment variable which can specify a location
other than /etc/machine-id, so that the unit tests are independent from the
environment.

https://bugs.freedesktop.org/show_bug.cgi?id=62344
---
 debian/changelog                | 8 ++++++++
 src/libsystemd-id128/sd-id128.c | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 0490e3d..bd12491 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,16 @@
 systemd (204-8) UNRELEASED; urgency=low
 
+  [ Michael Stapelberg ]
   * move manpages from systemd to libsystemd-*-dev as appropriate
     (Closes: #738723)
 
+  [ Martin Pitt ]
+  * Add env variable for machine ID path. During package build, in minimal
+    chroots, or other systems which do not already have an /etc/machine-id we
+    get six test failures. Introduce a $SYSTEMD_MACHINE_ID_PATH environment
+    variable which can specify a location other than /etc/machine-id, so that
+    the unit tests are independent from the environment.
+
  -- Michael Stapelberg <stapelb...@debian.org>  Thu, 13 Feb 2014 22:52:45 +0100
 
 systemd (204-7) unstable; urgency=low
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 64ddd09..47351c8 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -115,6 +115,7 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
         ssize_t k;
         unsigned j;
         sd_id128_t t;
+        const char *machine_id_path;
 
         if (!ret)
                 return -EINVAL;
@@ -124,7 +125,10 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
                 return 0;
         }
 
-        fd = open("/etc/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
+        machine_id_path = getenv("SYSTEMD_MACHINE_ID_PATH");
+        if (machine_id_path == NULL)
+                machine_id_path = "/etc/machine-id";
+        fd = open(machine_id_path, O_RDONLY|O_CLOEXEC|O_NOCTTY);
         if (fd < 0)
                 return -errno;
 
-- 
1.9.rc1

From eace7af7b5a98ac26945e024f01145898f059c39 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.p...@ubuntu.com>
Date: Sat, 15 Feb 2014 00:26:27 +0100
Subject: [PATCH 2/3] debian/rules: Run unit tests during package build.

Don't run them under fakeroot as that hangs some tests, and supply a local
machine id file.
---
 debian/changelog |  2 ++
 debian/rules     | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index bd12491..1722ce3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ systemd (204-8) UNRELEASED; urgency=low
     get six test failures. Introduce a $SYSTEMD_MACHINE_ID_PATH environment
     variable which can specify a location other than /etc/machine-id, so that
     the unit tests are independent from the environment.
+  * debian/rules: Run unit tests during package build. Don't run them under
+    fakeroot as that hangs some tests, and supply a local machine id file.
 
  -- Michael Stapelberg <stapelb...@debian.org>  Thu, 13 Feb 2014 22:52:45 +0100
 
diff --git a/debian/rules b/debian/rules
index 677e3e2..06c9f48 100755
--- a/debian/rules
+++ b/debian/rules
@@ -218,3 +218,14 @@ ifeq (,$(findstring stage1,$(DEB_BUILD_PROFILES)))
 else
 	dh $@ --with autoreconf,python2 $(BOOTSTRAP_DH_FLAGS)
 endif
+
+override_dh_auto_test:
+ifeq (, $(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+	# some tests hang under fakeroot, so disable fakeroot
+	echo "01234567890123456789012345678901" > build-deb/machine-id
+	env -u LD_PRELOAD SYSTEMD_MACHINE_ID_PATH=$(CURDIR)/build-deb/machine-id \
+		make -C build-deb check || ( \
+		cd build-deb; \
+		for f in test-*.log; do echo "==== $$f ===="; cat $$f; done; \
+		exit 1; )
+endif
-- 
1.9.rc1

From bfaa13d1fb1c10819919fe1e1cc63c2adc32ab8f Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.p...@ubuntu.com>
Date: Sat, 15 Feb 2014 01:11:00 +0100
Subject: [PATCH 3/3] Disable tests that fail on the buildds.

---
 Makefile.am      | 7 +------
 debian/changelog | 1 +
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 610ed7c..90da178 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1095,16 +1095,12 @@ tests += \
 	test-strv \
 	test-path-util \
 	test-strxcpyx \
-	test-unit-name \
 	test-unit-file \
-	test-util \
 	test-date \
 	test-sleep \
 	test-replace-var \
-	test-sched-prio \
 	test-calendarspec \
 	test-strip-tab-ansi \
-	test-cgroup-util \
 	test-prioq \
 	test-fileio \
 	test-time \
@@ -2855,10 +2851,9 @@ tests += \
 	test-journal-send \
 	test-journal-syslog \
 	test-journal-match \
-	test-journal-stream \
 	test-journal-verify \
 	test-mmap-cache \
-	test-catalog
+	$(NULL)
 
 pkginclude_HEADERS += \
 	src/systemd/sd-journal.h \
diff --git a/debian/changelog b/debian/changelog
index 1722ce3..0ad0da4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ systemd (204-8) UNRELEASED; urgency=low
     the unit tests are independent from the environment.
   * debian/rules: Run unit tests during package build. Don't run them under
     fakeroot as that hangs some tests, and supply a local machine id file.
+  * Disable tests that fail on the buildds.
 
  -- Michael Stapelberg <stapelb...@debian.org>  Thu, 13 Feb 2014 22:52:45 +0100
 
-- 
1.9.rc1

Attachment: signature.asc
Description: Digital signature

Reply via email to