diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-02-22 18:25:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 18:25:45 +0100 |
commit | cab4ed0f4a5cb1f2e2d236082370e0a7982b9fbf (patch) | |
tree | 0eb0be64ccb7e6b8db2624427b935f1bfd79af77 /src/oom | |
parent | b491d74064f9d5e17a71b38b014434237169a077 (diff) | |
parent | a6d6a51d83fae32212e1780e71b16517a4df9a57 (diff) | |
download | systemd-cab4ed0f4a5cb1f2e2d236082370e0a7982b9fbf.tar.gz |
Merge pull request #22592 from yuwata/test-oomd-util-fixlets
test: test-oomd-util fixlets
Diffstat (limited to 'src/oom')
-rw-r--r-- | src/oom/test-oomd-util.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/oom/test-oomd-util.c b/src/oom/test-oomd-util.c index 265e77c0a2..f0283677f7 100644 --- a/src/oom/test-oomd-util.c +++ b/src/oom/test-oomd-util.c @@ -283,7 +283,7 @@ static void test_oomd_system_context_acquire(void) { static void test_oomd_pressure_above(void) { _cleanup_hashmap_free_ Hashmap *h1 = NULL, *h2 = NULL; _cleanup_set_free_ Set *t1 = NULL, *t2 = NULL, *t3 = NULL; - OomdCGroupContext ctx[2], *c; + OomdCGroupContext ctx[2] = {}, *c; loadavg_t threshold; assert_se(store_loadavg_fixed_point(80, 0, &threshold) == 0); @@ -300,12 +300,11 @@ static void test_oomd_pressure_above(void) { assert_se(store_loadavg_fixed_point(1, 11, &(ctx[1].memory_pressure.avg300)) == 0); ctx[1].mem_pressure_limit = threshold; - /* High memory pressure */ assert_se(h1 = hashmap_new(&string_hash_ops)); assert_se(hashmap_put(h1, "/herp.slice", &ctx[0]) >= 0); assert_se(oomd_pressure_above(h1, 0 /* duration */, &t1) == 1); - assert_se(set_contains(t1, &ctx[0]) == true); + assert_se(set_contains(t1, &ctx[0])); assert_se(c = hashmap_get(h1, "/herp.slice")); assert_se(c->mem_pressure_limit_hit_start > 0); @@ -313,14 +312,14 @@ static void test_oomd_pressure_above(void) { assert_se(h2 = hashmap_new(&string_hash_ops)); assert_se(hashmap_put(h2, "/derp.slice", &ctx[1]) >= 0); assert_se(oomd_pressure_above(h2, 0 /* duration */, &t2) == 0); - assert_se(t2 == NULL); + assert_se(!t2); assert_se(c = hashmap_get(h2, "/derp.slice")); assert_se(c->mem_pressure_limit_hit_start == 0); /* High memory pressure w/ multiple cgroups */ assert_se(hashmap_put(h1, "/derp.slice", &ctx[1]) >= 0); assert_se(oomd_pressure_above(h1, 0 /* duration */, &t3) == 1); - assert_se(set_contains(t3, &ctx[0]) == true); + assert_se(set_contains(t3, &ctx[0])); assert_se(set_size(t3) == 1); assert_se(c = hashmap_get(h1, "/herp.slice")); assert_se(c->mem_pressure_limit_hit_start > 0); |