4 #include "cgroup-util.h"
6 #define check_c_t_u(path, code, result) \
10 assert_se(cgroup_to_unit(a, &unit) == code); \
11 assert(code < 0 || streq(unit, result)); \
15 static void test_cgroup_to_unit(void) {
16 check_c_t_u("/system/getty@.service/tty2", 0, "getty@tty2.service");
17 check_c_t_u("/system/getty@.service/", -EINVAL, "getty@tty2.service");
18 check_c_t_u("/system/getty@.service", -EINVAL, "getty@tty2.service");
19 check_c_t_u("/system/getty.service", 0, "getty.service");
20 check_c_t_u("/system/getty", -EINVAL, "getty.service");
24 test_cgroup_to_unit();