]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-cgroup-util: bail out when running under mock (#8365)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 7 Mar 2018 21:41:25 +0000 (22:41 +0100)
committerEvgeny Vereshchagin <evvers@ya.ru>
Wed, 7 Mar 2018 21:41:25 +0000 (00:41 +0300)
The builds were failing in Fedora koji, where something strange is mounted
on /sys/fs/cgroup.

Also closes https://github.com/systemd/systemd/issues/8383.

src/test/test-cgroup-util.c

index c4163fc3a973b6d41de43bf0b73882db4878fc41..9ef7c97c741a50dbb8cc42db38fad5bddccb5c37 100644 (file)
@@ -408,9 +408,15 @@ static void test_cg_tests(void) {
 static void test_cg_get_keyed_attribute(void) {
         _cleanup_free_ char *val = NULL;
         char *vals3[3] = {}, *vals3a[3] = {};
-        int i;
+        int i, r;
 
-        assert_se(cg_get_keyed_attribute("cpu", "/init.scope", "no_such_file", STRV_MAKE("no_such_attr"), &val) == -ENOENT);
+        r = cg_get_keyed_attribute("cpu", "/init.scope", "no_such_file", STRV_MAKE("no_such_attr"), &val);
+        if (r == -ENOMEDIUM) {
+                log_info_errno(r, "Skipping most of %s, /sys/fs/cgroup not accessible: %m", __func__);
+                return;
+        }
+
+        assert_se(r == -ENOENT);
         assert_se(val == NULL);
 
         if (access("/sys/fs/cgroup/init.scope/cpu.stat", R_OK) < 0) {