annotate src/testdir/test_memory_usage.vim @ 16115:91da8cd462ef v8.1.1062

patch 8.1.1062: quickfix code is repeated commit https://github.com/vim/vim/commit/a16123a666b4656543614cb5bdaa69ea69f35d30 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 28 20:31:07 2019 +0100 patch 8.1.1062: quickfix code is repeated Problem: Quickfix code is repeated. Solution: Define FOR_ALL_QFL_ITEMS(). Move some code to separate functions. (Yegappan Lakshmanan, closes #4166)
author Bram Moolenaar <Bram@vim.org>
date Thu, 28 Mar 2019 20:45:05 +0100
parents b951bea7d11e
children 0baa4c7e057f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16003
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for memory usage.
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 if !has('terminal') || has('gui_running') || $ASAN_OPTIONS !=# ''
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Skip tests on Travis CI ASAN build because it's difficult to estimate
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " memory usage.
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 finish
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 endif
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 source shared.vim
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 func s:pick_nr(str) abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 return substitute(a:str, '[^0-9]', '', 'g') * 1
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 if has('win32')
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 if !executable('wmic')
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 finish
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 endif
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 func s:memory_usage(pid) abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 return s:pick_nr(system(cmd)) / 1024
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 elseif has('unix')
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 if !executable('ps')
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 finish
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 endif
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 func s:memory_usage(pid) abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 return s:pick_nr(system('ps -o rss= -p ' . a:pid))
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 else
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 finish
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 endif
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 " Wait for memory usage to level off.
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 func s:monitor_memory_usage(pid) abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 let proc = {}
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 let proc.pid = a:pid
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 let proc.hist = []
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 let proc.max = 0
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 func proc.op() abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 " Check the last 200ms.
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 let val = s:memory_usage(self.pid)
16052
853d73097325 patch 8.1.1031: memory usage test may still fail
Bram Moolenaar <Bram@vim.org>
parents: 16044
diff changeset
44 if self.max < val
16003
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 let self.max = val
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 endif
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call add(self.hist, val)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 if len(self.hist) < 20
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 return 0
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endif
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 let sample = remove(self.hist, 0)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 return len(uniq([sample] + self.hist)) == 1
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 call WaitFor({-> proc.op()}, 10000)
16052
853d73097325 patch 8.1.1031: memory usage test may still fail
Bram Moolenaar <Bram@vim.org>
parents: 16044
diff changeset
56 return {'last': get(proc.hist, -1), 'max': proc.max}
16003
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 let s:term_vim = {}
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 func s:term_vim.start(...) abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 let self.buf = term_start([GetVimProg()] + a:000)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 let self.job = term_getjob(self.buf)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 call WaitFor({-> job_status(self.job) ==# 'run'})
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 let self.pid = job_info(self.job).process
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 func s:term_vim.stop() abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 call term_sendkeys(self.buf, ":qall!\<CR>")
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 call WaitFor({-> job_status(self.job) ==# 'dead'})
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 exe self.buf . 'bwipe!'
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 func s:vim_new() abort
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 return copy(s:term_vim)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 func Test_memory_func_capture_vargs()
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 " Case: if a local variable captures a:000, funccall object will be free
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 " just after it finishes.
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 let testfile = 'Xtest.vim'
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 call writefile([
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 \ 'func s:f(...)',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 \ ' let x = a:000',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 \ 'endfunc',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 \ 'for _ in range(10000)',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 \ ' call s:f(0)',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 \ 'endfor',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 \ ], testfile)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 let vim = s:vim_new()
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 call vim.start('--clean', '-c', 'set noswapfile', testfile)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 let before = s:monitor_memory_usage(vim.pid).last
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 call term_sendkeys(vim.buf, ":so %\<CR>")
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 call WaitFor({-> term_getcursor(vim.buf)[0] == 1})
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 let after = s:monitor_memory_usage(vim.pid)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 " Estimate the limit of max usage as 2x initial usage.
16107
b951bea7d11e patch 8.1.1058: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16064
diff changeset
100 " The lower limit can fluctuate a bit, use 98%.
b951bea7d11e patch 8.1.1058: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16064
diff changeset
101 call assert_inrange(before * 98 / 100, 2 * before, after.max)
b951bea7d11e patch 8.1.1058: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16064
diff changeset
102
b951bea7d11e patch 8.1.1058: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16064
diff changeset
103 " In this case, garbage collecting is not needed.
b951bea7d11e patch 8.1.1058: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16064
diff changeset
104 " The value might fluctuate a bit, allow for 3% tolerance.
16052
853d73097325 patch 8.1.1031: memory usage test may still fail
Bram Moolenaar <Bram@vim.org>
parents: 16044
diff changeset
105 let lower = after.last * 97 / 100
853d73097325 patch 8.1.1031: memory usage test may still fail
Bram Moolenaar <Bram@vim.org>
parents: 16044
diff changeset
106 let upper = after.last * 103 / 100
853d73097325 patch 8.1.1031: memory usage test may still fail
Bram Moolenaar <Bram@vim.org>
parents: 16044
diff changeset
107 call assert_inrange(lower, upper, after.max)
16003
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 call vim.stop()
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 call delete(testfile)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 endfunc
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 func Test_memory_func_capture_lvars()
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 " Case: if a local variable captures l: dict, funccall object will not be
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 " free until garbage collector runs, but after that memory usage doesn't
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 " increase so much even when rerun Xtest.vim since system memory caches.
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 let testfile = 'Xtest.vim'
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 call writefile([
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 \ 'func s:f()',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 \ ' let x = l:',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 \ 'endfunc',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 \ 'for _ in range(10000)',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 \ ' call s:f()',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 \ 'endfor',
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 \ ], testfile)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 let vim = s:vim_new()
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 call vim.start('--clean', '-c', 'set noswapfile', testfile)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 let before = s:monitor_memory_usage(vim.pid).last
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 call term_sendkeys(vim.buf, ":so %\<CR>")
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 call WaitFor({-> term_getcursor(vim.buf)[0] == 1})
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 let after = s:monitor_memory_usage(vim.pid)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 " Rerun Xtest.vim.
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 for _ in range(3)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 call term_sendkeys(vim.buf, ":so %\<CR>")
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 call WaitFor({-> term_getcursor(vim.buf)[0] == 1})
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 let last = s:monitor_memory_usage(vim.pid).last
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 endfor
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141
16052
853d73097325 patch 8.1.1031: memory usage test may still fail
Bram Moolenaar <Bram@vim.org>
parents: 16044
diff changeset
142 " The usage may be a bit less than the last value, use 80%.
16064
e4ba2925b54d patch 8.1.1037: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16056
diff changeset
143 " Allow for 20% tolerance at the upper limit. That's very permissive, but
e4ba2925b54d patch 8.1.1037: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16056
diff changeset
144 " otherwise the test fails sometimes.
16044
f4a206d7a04d patch 8.1.1027: memory usage test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 16003
diff changeset
145 let lower = before * 8 / 10
16064
e4ba2925b54d patch 8.1.1037: memory usage test may still fail on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16056
diff changeset
146 let upper = (after.max + (after.last - before)) * 12 / 10
16052
853d73097325 patch 8.1.1031: memory usage test may still fail
Bram Moolenaar <Bram@vim.org>
parents: 16044
diff changeset
147 call assert_inrange(lower, upper, last)
16003
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 call vim.stop()
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 call delete(testfile)
879829e44091 patch 8.1.1007: using closure may consume a lot of memory
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 endfunc