From: Yu Watanabe Date: Wed, 26 Mar 2025 18:56:46 +0000 (+0900) Subject: test-watch-pid: move required test conditions to intro() X-Git-Tag: v258-rc1~1001^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=017f9bc1d77d5026c3c009c7246d6c743197a41e;p=thirdparty%2Fsystemd.git test-watch-pid: move required test conditions to intro() Follow-up for 7bcd76513a61f8f16f2cc9b291895779c7c367fe. --- diff --git a/src/test/test-watch-pid.c b/src/test/test-watch-pid.c index 17dce056785..2769377c7f4 100644 --- a/src/test/test-watch-pid.c +++ b/src/test/test-watch-pid.c @@ -7,17 +7,10 @@ #include "service.h" #include "tests.h" -TEST_RET(watch_pid) { +TEST(watch_pid) { _cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL; _cleanup_(manager_freep) Manager *m = NULL; Unit *a, *b, *c, *u; - int r; - - if (getuid() != 0) - return log_tests_skipped("not root"); - r = enter_cgroup_subroot(NULL); - if (r < 0) - return log_tests_skipped("cgroupfs not available"); _cleanup_free_ char *unit_dir = NULL; ASSERT_OK(get_testdata_dir("units/", &unit_dir)); @@ -95,12 +88,18 @@ TEST_RET(watch_pid) { unit_unwatch_pid(c, pid); ASSERT_NULL(manager_get_unit_by_pid(m, pid)); - - return EXIT_SUCCESS; } static int intro(void) { - log_show_color(true); + int r; + + if (getuid() != 0) + return log_tests_skipped("not root"); + + r = enter_cgroup_subroot(NULL); + if (r < 0) + return log_tests_skipped_errno(r, "cgroupfs not available"); + return EXIT_SUCCESS; }