aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/memory_usage_spec.lua
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-09-06 00:32:43 +0900
committererw7 <erw7.github@gmail.com>2020-05-07 16:48:08 +0900
commita32bac0c04215a867b941957c2dac89a719261cf (patch)
treecb6e733cb592e9c27bc685f610ba3f86d4a3c471 /test/functional/legacy/memory_usage_spec.lua
parent6b3399338f831c69f8b9da63d8277860d3a302d6 (diff)
downloadrneovim-a32bac0c04215a867b941957c2dac89a719261cf.tar.gz
rneovim-a32bac0c04215a867b941957c2dac89a719261cf.tar.bz2
rneovim-a32bac0c04215a867b941957c2dac89a719261cf.zip
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
Diffstat (limited to 'test/functional/legacy/memory_usage_spec.lua')
-rw-r--r--test/functional/legacy/memory_usage_spec.lua10
1 files 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))