summaryrefslogtreecommitdiff
path: root/src/test/test-cgroup.c
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@canonical.com>2020-03-21 10:59:42 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-04-25 10:00:43 +0200
commitaf5654d35c5f4184dab7e5b9de94343264727d39 (patch)
treefefcf64433089945cd0617ae690789c72b4b9e52 /src/test/test-cgroup.c
parent0bc5f001dbf25ea264a9b61aafd3d7362f53b7be (diff)
downloadsystemd-af5654d35c5f4184dab7e5b9de94343264727d39.tar.gz
test-cgroup: skip if /sys/fs/cgroup unknown fs
It's not always mounted, e.g. during the build-time tests, it's running inside a chroot (that's how Debian/Ubuntu build packages, in chroots) so this test always fails because /sys/fs/cgroup isn't mounted.
Diffstat (limited to 'src/test/test-cgroup.c')
-rw-r--r--src/test/test-cgroup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/test/test-cgroup.c b/src/test/test-cgroup.c
index 853c6c4ab4..4fbb186f52 100644
--- a/src/test/test-cgroup.c
+++ b/src/test/test-cgroup.c
@@ -44,6 +44,13 @@ static void test_cg_split_spec(void) {
static void test_cg_create(void) {
log_info("/* %s */", __func__);
+ int r;
+
+ r = cg_unified_cached(false);
+ if (r < 0) {
+ log_info_errno(r, "Skipping %s: %m", __func__);
+ return;
+ }
_cleanup_free_ char *here = NULL;
assert_se(cg_pid_get_path_shifted(0, NULL, &here) >= 0);
@@ -53,7 +60,6 @@ static void test_cg_create(void) {
*test_c = prefix_roota(here, "/test-b/test-c"),
*test_d = prefix_roota(here, "/test-b/test-d");
char *path;
- int r;
log_info("Paths for test:\n%s\n%s", test_a, test_b);