From ad0e2455f7f70505565064271552f3a896400edf Mon Sep 17 00:00:00 2001 From: sundb Date: Fri, 19 Feb 2021 19:01:25 +0800 Subject: [PATCH] Fix timing error oom-score-adj test (#8513) fixes timing issue, fork didn't always get to set the oom score before the test verified it. --- tests/unit/oom-score-adj.tcl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/unit/oom-score-adj.tcl b/tests/unit/oom-score-adj.tcl index efa61b759..892b1a7ad 100644 --- a/tests/unit/oom-score-adj.tcl +++ b/tests/unit/oom-score-adj.tcl @@ -39,7 +39,12 @@ if {$system_name eq {linux}} { r bgsave set child_pid [get_child_pid 0] - assert_equal [get_oom_score_adj $child_pid] [expr $base + 30] + # Wait until background child process to setOOMScoreAdj success. + wait_for_condition 100 10 { + [get_oom_score_adj $child_pid] == [expr $base + 30] + } else { + fail "Set oom-score-adj of background child process is not ok" + } } # Failed oom-score-adj tests can only run unprivileged