1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

test/oomd: Add test for new oomd_ooms xattr

Check if `user.oomd_ooms` xattr is being set as part of `oomd_cgroup_kill()`
this xattr tracks OOM kills that were initiated by systemd-oomd.
This commit is contained in:
Nishal Kulkarni 2022-03-15 00:10:39 +05:30
parent 38c41427c7
commit c0ebfef358

View File

@ -77,12 +77,16 @@ static void test_oomd_cgroup_kill(void) {
abort();
}
assert_se(cg_get_xattr_malloc(SYSTEMD_CGROUP_CONTROLLER, cgroup, "user.oomd_ooms", &v) >= 0);
assert_se(streq(v, i == 0 ? "1" : "2"));
v = mfree(v);
/* Wait a bit since processes may take some time to be cleaned up. */
sleep(2);
assert_se(cg_is_empty(SYSTEMD_CGROUP_CONTROLLER, cgroup) == true);
assert_se(cg_get_xattr_malloc(SYSTEMD_CGROUP_CONTROLLER, cgroup, "user.oomd_kill", &v) >= 0);
assert_se(memcmp(v, i == 0 ? "2" : "4", 2) == 0);
assert_se(streq(v, i == 0 ? "2" : "4"));
}
}