diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-09-13 13:34:12 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-09-14 09:29:57 +0200 |
commit | 317bb217d3f21312e58d9efdc6d3739f7895a08c (patch) | |
tree | 3915b40c31898e4b3b3e80406b9e53aa64446ac9 /src/test/test-cgroup-mask.c | |
parent | c1cd674357f921136b1e74ece641288670de33c7 (diff) | |
download | systemd-317bb217d3f21312e58d9efdc6d3739f7895a08c.tar.gz |
tests: add helper to unify skipping a test and exiting
Diffstat (limited to 'src/test/test-cgroup-mask.c')
-rw-r--r-- | src/test/test-cgroup-mask.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c index 8dc1639720..0dd673e3e5 100644 --- a/src/test/test-cgroup-mask.c +++ b/src/test/test-cgroup-mask.c @@ -17,19 +17,18 @@ static int test_cgroup_mask(void) { int r; r = enter_cgroup_subroot(); - if (r == -ENOMEDIUM) { - puts("Skipping test: cgroupfs not available"); - return EXIT_TEST_SKIP; - } + if (r == -ENOMEDIUM) + return log_tests_skipped("cgroupfs not available"); /* Prepare the manager. */ assert_se(set_unit_path(get_testdata_dir()) >= 0); assert_se(runtime_dir = setup_fake_runtime_dir()); r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m); if (IN_SET(r, -EPERM, -EACCES)) { - puts("manager_new: Permission denied. Skipping test."); - return EXIT_TEST_SKIP; + log_error_errno(r, "manager_new: %m"); + return log_tests_skipped("cannot create manager"); } + assert_se(r >= 0); /* Turn off all kinds of default accouning, so that we can @@ -117,13 +116,13 @@ static void test_cg_mask_to_string(void) { } int main(int argc, char* argv[]) { - int rc = 0; + int rc = EXIT_SUCCESS; log_parse_environment(); log_open(); - TEST_REQ_RUNNING_SYSTEMD(rc = test_cgroup_mask()); test_cg_mask_to_string(); + TEST_REQ_RUNNING_SYSTEMD(rc = test_cgroup_mask()); return rc; } |