diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-07 22:41:25 +0100 |
---|---|---|
committer | Evgeny Vereshchagin <evvers@ya.ru> | 2018-03-08 00:41:25 +0300 |
commit | 18ce247c4cd0238de3425923ddab2309990c263a (patch) | |
tree | f92b97942c61c21647ecc2af57e7c48e45c0cc55 /src/test/test-cgroup-util.c | |
parent | a9e8ecf0374c675831208559ba37749a8f9719ef (diff) | |
download | systemd-18ce247c4cd0238de3425923ddab2309990c263a.tar.gz |
test-cgroup-util: bail out when running under mock (#8365)
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.
Diffstat (limited to 'src/test/test-cgroup-util.c')
-rw-r--r-- | src/test/test-cgroup-util.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c index c4163fc3a9..9ef7c97c74 100644 --- a/src/test/test-cgroup-util.c +++ b/src/test/test-cgroup-util.c @@ -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) { |