diff options
author | Anita Zhang <the.anitazha@gmail.com> | 2021-01-24 07:10:42 +0100 |
---|---|---|
committer | Anita Zhang <the.anitazha@gmail.com> | 2021-01-24 10:59:03 +0100 |
commit | 408a3bbd76326793ea5d1cf4e0a9444a4c252d86 (patch) | |
tree | cf0878be9c40811a312514ca610eadbd1c8b87ac /src/oom/test-oomd-util.c | |
parent | oom: make memory pressure duration configurable through oomd.conf (diff) | |
download | systemd-408a3bbd76326793ea5d1cf4e0a9444a4c252d86.tar.xz systemd-408a3bbd76326793ea5d1cf4e0a9444a4c252d86.zip |
oom: make swap a soft requirement
Diffstat (limited to 'src/oom/test-oomd-util.c')
-rw-r--r-- | src/oom/test-oomd-util.c | 11 |
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) { |