mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #21116 from poettering/test-cleaner
make tests a bit cleaner in regards to oomd handling
This commit is contained in:
@@ -3043,12 +3043,15 @@ int unit_check_oom(Unit *u) {
|
||||
return 0;
|
||||
|
||||
r = cg_get_keyed_attribute("memory", u->cgroup_path, "memory.events", STRV_MAKE("oom_kill"), &oom_kill);
|
||||
if (r < 0)
|
||||
if (IN_SET(r, -ENOENT, -ENXIO)) /* Handle gracefully if cgroup or oom_kill attribute don't exist */
|
||||
c = 0;
|
||||
else if (r < 0)
|
||||
return log_unit_debug_errno(u, r, "Failed to read oom_kill field of memory.events cgroup attribute: %m");
|
||||
|
||||
r = safe_atou64(oom_kill, &c);
|
||||
if (r < 0)
|
||||
return log_unit_debug_errno(u, r, "Failed to parse oom_kill field: %m");
|
||||
else {
|
||||
r = safe_atou64(oom_kill, &c);
|
||||
if (r < 0)
|
||||
return log_unit_debug_errno(u, r, "Failed to parse oom_kill field: %m");
|
||||
}
|
||||
|
||||
increased = c > u->oom_kill_last;
|
||||
u->oom_kill_last = c;
|
||||
|
||||
@@ -562,6 +562,9 @@ static int manager_varlink_init_user(Manager *m) {
|
||||
if (m->managed_oom_varlink)
|
||||
return 1;
|
||||
|
||||
if (MANAGER_IS_TEST_RUN(m))
|
||||
return 0;
|
||||
|
||||
r = varlink_connect_address(&link, VARLINK_ADDR_PATH_MANAGED_OOM_USER);
|
||||
if (r == -ENOENT || ERRNO_IS_DISCONNECT(r)) {
|
||||
log_debug("systemd-oomd varlink unix socket not found, skipping user manager varlink setup");
|
||||
|
||||
Reference in New Issue
Block a user