From a32bac0c04215a867b941957c2dac89a719261cf Mon Sep 17 00:00:00 2001 From: erw7 Date: Fri, 6 Sep 2019 00:32:43 +0900 Subject: [PATCH] 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) https://github.com/vim/vim/commit/3a731ee0c2dd34792c1b21fc4c699a84129f1b86 --- test/functional/legacy/memory_usage_spec.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua index b52742eaac..d665c6c35c 100644 --- a/test/functional/legacy/memory_usage_spec.lua +++ b/test/functional/legacy/memory_usage_spec.lua @@ -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))