diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-05-31 14:48:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 14:48:42 +0200 |
commit | 2533fdd0fbe71e4a3fa7a2cca9830cd864fb9136 (patch) | |
tree | f1bf86b550929b78ceeffcd8a426cadb94f2c0ae /src/test | |
parent | Merge pull request #26969 from DaanDeMeyer/xopenat-label (diff) | |
parent | Fix failing test (diff) | |
download | systemd-2533fdd0fbe71e4a3fa7a2cca9830cd864fb9136.tar.xz systemd-2533fdd0fbe71e4a3fa7a2cca9830cd864fb9136.zip |
Merge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units
Don't GC unit if it is in cgroup_empty_queue
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-execute.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c index ae6227c492..a07c837e3f 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -206,6 +206,17 @@ static bool is_inaccessible_available(void) { return true; } +static void start_parent_slices(Unit *unit) { + Unit *slice; + + slice = UNIT_GET_SLICE(unit); + if (slice) { + start_parent_slices(slice); + int r = unit_start(slice, NULL); + assert_se(r >= 0 || r == -EALREADY); + } +} + static void _test(const char *file, unsigned line, const char *func, Manager *m, const char *unit_name, int status_expected, int code_expected) { Unit *unit; @@ -213,6 +224,9 @@ static void _test(const char *file, unsigned line, const char *func, assert_se(unit_name); assert_se(manager_load_startable_unit_or_warn(m, unit_name, NULL, &unit) >= 0); + /* We need to start the slices as well otherwise the slice cgroups might be pruned + * in on_cgroup_empty_event. */ + start_parent_slices(unit); assert_se(unit_start(unit, NULL) >= 0); check_main_result(file, line, func, m, unit, status_expected, code_expected); } |