vim-patch:8.1.1435: memory usage test is a bit too flaky

Problem:    Memory usage test is a bit too flaky.
Solution:   Adjust the tolerances a bit. (Christian Brabandt)
5d508dd39e
This commit is contained in:
erw7 2019-09-06 00:37:03 +09:00
parent a32bac0c04
commit 7ac46b5d37

View File

@ -101,15 +101,16 @@ describe('memory usage', function()
]]) ]])
local after = monitor_memory_usage(pid) local after = monitor_memory_usage(pid)
-- Estimate the limit of max usage as 2x initial usage. -- Estimate the limit of max usage as 2x initial usage.
-- The lower limit can fluctuate a bit, use 98%. -- The lower limit can fluctuate a bit, use 97%.
check_result({before=before, after=after}, check_result({before=before, after=after},
pcall(ok, before.last * 98 / 100 < after.max)) pcall(ok, before.last * 97 / 100 < after.max))
check_result({before=before, after=after}, check_result({before=before, after=after},
pcall(ok, before.last * 2 > after.max)) pcall(ok, before.last * 2 > after.max))
-- In this case, garbage collecting is not needed. -- In this case, garbage collecting is not needed.
-- The value might fluctuate a bit, allow for 3% tolerance. -- The value might fluctuate a bit, allow for 3% tolerance below and 5% above.
-- Based on various test runs.
local lower = after.last * 97 / 100 local lower = after.last * 97 / 100
local upper = after.last * 103 / 100 local upper = after.last * 105 / 100
check_result({before=before, after=after}, pcall(ok, lower < after.max)) check_result({before=before, after=after}, pcall(ok, lower < after.max))
check_result({before=before, after=after}, pcall(ok, after.max < upper)) check_result({before=before, after=after}, pcall(ok, after.max < upper))
end) end)