Mercurial > vim
comparison src/testdir/test_memory_usage.vim @ 17049:f38fcbf343ce v8.1.1524
patch 8.1.1524: tests are silently skipped
commit https://github.com/vim/vim/commit/b0f94c1ff34d27d33aa9f96204985ea29c2eb0a1
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 13 22:19:53 2019 +0200
patch 8.1.1524: tests are silently skipped
Problem: Tests are silently skipped.
Solution: Throw an exception for skipped tests in more places.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Jun 2019 22:30:07 +0200 |
parents | 0baa4c7e057f |
children | 6641a15f999d |
comparison
equal
deleted
inserted
replaced
17048:dcbd3676e9d6 | 17049:f38fcbf343ce |
---|---|
1 " Tests for memory usage. | 1 " Tests for memory usage. |
2 | 2 |
3 if !has('terminal') || has('gui_running') || $ASAN_OPTIONS !=# '' | 3 if !has('terminal') |
4 throw 'Skipped, terminal feature missing' | |
5 endif | |
6 if has('gui_running') | |
7 throw 'Skipped, does not work in GUI' | |
8 endif | |
9 if $ASAN_OPTIONS !=# '' | |
4 " 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 |
5 " memory usage. | 11 " memory usage. |
6 finish | 12 throw 'Skipped, does not work with ASAN' |
7 endif | 13 endif |
8 | 14 |
9 source shared.vim | 15 source shared.vim |
10 | 16 |
11 func s:pick_nr(str) abort | 17 func s:pick_nr(str) abort |
12 return substitute(a:str, '[^0-9]', '', 'g') * 1 | 18 return substitute(a:str, '[^0-9]', '', 'g') * 1 |
13 endfunc | 19 endfunc |
14 | 20 |
15 if has('win32') | 21 if has('win32') |
16 if !executable('wmic') | 22 if !executable('wmic') |
17 finish | 23 throw 'Skipped, wmic program missing' |
18 endif | 24 endif |
19 func s:memory_usage(pid) abort | 25 func s:memory_usage(pid) abort |
20 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) |
21 return s:pick_nr(system(cmd)) / 1024 | 27 return s:pick_nr(system(cmd)) / 1024 |
22 endfunc | 28 endfunc |
23 elseif has('unix') | 29 elseif has('unix') |
24 if !executable('ps') | 30 if !executable('ps') |
25 finish | 31 throw 'Skipped, ps program missing' |
26 endif | 32 endif |
27 func s:memory_usage(pid) abort | 33 func s:memory_usage(pid) abort |
28 return s:pick_nr(system('ps -o rss= -p ' . a:pid)) | 34 return s:pick_nr(system('ps -o rss= -p ' . a:pid)) |
29 endfunc | 35 endfunc |
30 else | 36 else |
31 finish | 37 throw 'Skipped, not win32 or unix' |
32 endif | 38 endif |
33 | 39 |
34 " Wait for memory usage to level off. | 40 " Wait for memory usage to level off. |
35 func s:monitor_memory_usage(pid) abort | 41 func s:monitor_memory_usage(pid) abort |
36 let proc = {} | 42 let proc = {} |