From af5654d35c5f4184dab7e5b9de94343264727d39 Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Sat, 21 Mar 2020 10:59:42 -0400 Subject: 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. --- src/test/test-cgroup.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); -- cgit v1.2.1