summaryrefslogtreecommitdiff
path: root/src/oom/test-oomd-util.c
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2021-01-23 22:10:42 -0800
committerAnita Zhang <the.anitazha@gmail.com>2021-01-24 01:59:03 -0800
commit408a3bbd76326793ea5d1cf4e0a9444a4c252d86 (patch)
treecf0878be9c40811a312514ca610eadbd1c8b87ac /src/oom/test-oomd-util.c
parentc20aa7b17166b9f331da33ad9288f9ede75c72db (diff)
downloadsystemd-408a3bbd76326793ea5d1cf4e0a9444a4c252d86.tar.gz
oom: make swap a soft requirement
Diffstat (limited to 'src/oom/test-oomd-util.c')
-rw-r--r--src/oom/test-oomd-util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/oom/test-oomd-util.c b/src/oom/test-oomd-util.c
index 8143408902..54fe2a03d1 100644
--- a/src/oom/test-oomd-util.c
+++ b/src/oom/test-oomd-util.c
@@ -159,6 +159,11 @@ static void test_oomd_system_context_acquire(void) {
assert_se(ctx.swap_total == 0);
assert_se(ctx.swap_used == 0);
+ assert_se(write_string_file(path, "Filename Type Size Used Priority", WRITE_STRING_FILE_CREATE) == 0);
+ assert_se(oomd_system_context_acquire(path, &ctx) == 0);
+ assert_se(ctx.swap_total == 0);
+ assert_se(ctx.swap_used == 0);
+
assert_se(write_string_file(path, "Filename Type Size Used Priority\n"
"/swapvol/swapfile file 18971644 0 -3\n"
"/dev/vda2 partition 1999868 993780 -2", WRITE_STRING_FILE_CREATE) == 0);
@@ -268,6 +273,12 @@ static void test_oomd_swap_free_below(void) {
.swap_used = 3310136 * 1024U,
};
assert_se(oomd_swap_free_below(&ctx, 20) == false);
+
+ ctx = (OomdSystemContext) {
+ .swap_total = 0,
+ .swap_used = 0,
+ };
+ assert_se(oomd_swap_free_below(&ctx, 20) == false);
}
static void test_oomd_sort_cgroups(void) {