|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
From 0068962099fe81e644fdf2218408ce2baac0e234 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
Date: Fri, 6 Oct 2017 17:24:50 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
Subject: [PATCH] tests: skip tests when cg_pid_get_path fails
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
src/test/test-helper.c | 8 +++++++-
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
diff --git a/src/test/test-helper.c b/src/test/test-helper.c
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
index 5b707c3276..2f61f779a5 100644
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
--- a/src/test/test-helper.c
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
+++ b/src/test/test-helper.c
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
@@ -25,8 +25,14 @@
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
void enter_cgroup_subroot(void) {
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
_cleanup_free_ char *cgroup_root = NULL, *cgroup_subroot = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
CGroupMask supported;
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
+ int r;
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
+ r = cg_pid_get_path(NULL, 0, &cgroup_root);
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
+ if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
+ log_error_errno(r, "cg_pid_get_path(NULL, 0, ...) failed, bailing out: %m");
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
+ exit(EXIT_TEST_SKIP);
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
|
|
Zbigniew Jędrzejewski-Szmek |
8a7522 |
- assert_se(cg_pid_get_path(NULL, 0, &cgroup_root) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
assert_se(asprintf(&cgroup_subroot, "%s/%" PRIx64, cgroup_root, random_u64()) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
assert_se(cg_mask_supported(&supported) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
a46c78 |
|