vim-patch:8.1.1058: memory usage test may still fail on some systems

Problem:    Memory usage test may still fail on some systems.
Solution:   Use 98% of the lower limit. (Christian Brabandt)
3a731ee0c2
This commit is contained in:
erw7 2019-09-06 00:32:43 +09:00
parent 6b3399338f
commit a32bac0c04

View File

@ -101,11 +101,13 @@ describe('memory usage', function()
]])
local after = monitor_memory_usage(pid)
-- Estimate the limit of max usage as 2x initial usage.
check_result({before=before, after=after}, pcall(ok, before.last < after.max))
check_result({before=before, after=after}, pcall(ok, before.last * 2 > after.max))
-- The lower limit can fluctuate a bit, use 98%.
check_result({before=before, after=after},
pcall(ok, before.last * 98 / 100 < after.max))
check_result({before=before, after=after},
pcall(ok, before.last * 2 > after.max))
-- 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.
local lower = after.last * 97 / 100
local upper = after.last * 103 / 100
check_result({before=before, after=after}, pcall(ok, lower < after.max))