comparison src/testdir/test_memory_usage.vim @ 17089:8e9e9124c7a2 v8.1.1544

patch 8.1.1544: some balloon tests don't run when they can commit https://github.com/vim/vim/commit/b46fecd3454399f8ebdc5055302e4bfc5a10f98b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 15 17:58:09 2019 +0200 patch 8.1.1544: some balloon tests don't run when they can Problem: Some balloon tests don't run when they can. Solution: Split GUI balloon tests off into a separate file. (Ozaki Kiichi, closes #4538) Change the feature check into a command for consistency.
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Jun 2019 18:00:08 +0200
parents 6641a15f999d
children 6990c1160ea5
comparison
equal deleted inserted replaced
17088:49eb35886d80 17089:8e9e9124c7a2
1 " Tests for memory usage. 1 " Tests for memory usage.
2 2
3 if !has('terminal') 3 source check.vim
4 throw 'Skipped, terminal feature missing' 4 CheckFeature terminal
5 endif 5
6 if has('gui_running') 6 if has('gui_running')
7 throw 'Skipped, does not work in GUI' 7 throw 'Skipped: does not work in GUI'
8 endif 8 endif
9 if execute('version') =~# '-fsanitize=[a-z,]*\<address\>' 9 if execute('version') =~# '-fsanitize=[a-z,]*\<address\>'
10 " Skip tests on Travis CI ASAN build because it's difficult to estimate 10 " Skip tests on Travis CI ASAN build because it's difficult to estimate
11 " memory usage. 11 " memory usage.
12 throw 'Skipped, does not work with ASAN' 12 throw 'Skipped: does not work with ASAN'
13 endif 13 endif
14 14
15 source shared.vim 15 source shared.vim
16 16
17 func s:pick_nr(str) abort 17 func s:pick_nr(str) abort
18 return substitute(a:str, '[^0-9]', '', 'g') * 1 18 return substitute(a:str, '[^0-9]', '', 'g') * 1
19 endfunc 19 endfunc
20 20
21 if has('win32') 21 if has('win32')
22 if !executable('wmic') 22 if !executable('wmic')
23 throw 'Skipped, wmic program missing' 23 throw 'Skipped: wmic program missing'
24 endif 24 endif
25 func s:memory_usage(pid) abort 25 func s:memory_usage(pid) abort
26 let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid) 26 let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid)
27 return s:pick_nr(system(cmd)) / 1024 27 return s:pick_nr(system(cmd)) / 1024
28 endfunc 28 endfunc
29 elseif has('unix') 29 elseif has('unix')
30 if !executable('ps') 30 if !executable('ps')
31 throw 'Skipped, ps program missing' 31 throw 'Skipped: ps program missing'
32 endif 32 endif
33 func s:memory_usage(pid) abort 33 func s:memory_usage(pid) abort
34 return s:pick_nr(system('ps -o rss= -p ' . a:pid)) 34 return s:pick_nr(system('ps -o rss= -p ' . a:pid))
35 endfunc 35 endfunc
36 else 36 else
37 throw 'Skipped, not win32 or unix' 37 throw 'Skipped: not win32 or unix'
38 endif 38 endif
39 39
40 " Wait for memory usage to level off. 40 " Wait for memory usage to level off.
41 func s:monitor_memory_usage(pid) abort 41 func s:monitor_memory_usage(pid) abort
42 let proc = {} 42 let proc = {}