Mercurial > vim
comparison src/testdir/test_profile.vim @ 19683:dd028abdde0f v8.2.0398
patch 8.2.0398: profile test fails when two functions take same time
Commit: https://github.com/vim/vim/commit/a21df1db3ca619afdcb47931af042508a6bbc8e5
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 17 20:57:09 2020 +0100
patch 8.2.0398: profile test fails when two functions take same time
Problem: Profile test fails when two functions take same time.
Solution: Add a short sleep in once function. (closes https://github.com/vim/vim/issues/5797)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 Mar 2020 21:00:06 +0100 |
parents | ed222e264905 |
children | c087099e9163 |
comparison
equal
deleted
inserted
replaced
19682:24fcf2b1ba72 | 19683:dd028abdde0f |
---|---|
15 func! Foo2() | 15 func! Foo2() |
16 let l:count = 100 | 16 let l:count = 100 |
17 while l:count > 0 | 17 while l:count > 0 |
18 let l:count = l:count - 1 | 18 let l:count = l:count - 1 |
19 endwhile | 19 endwhile |
20 sleep 1m | |
20 endfunc | 21 endfunc |
21 func! Foo3() | 22 func! Foo3() |
22 endfunc | 23 endfunc |
23 func! Bar() | 24 func! Bar() |
24 endfunc | 25 endfunc |
50 " - Foo2() should come before Foo1() since Foo1() does much more work. | 51 " - Foo2() should come before Foo1() since Foo1() does much more work. |
51 " - Foo3() is not reported because function is deleted. | 52 " - Foo3() is not reported because function is deleted. |
52 " - Unlike Foo3(), Foo2() should not be deleted since there is a check | 53 " - Unlike Foo3(), Foo2() should not be deleted since there is a check |
53 " for v:profiling. | 54 " for v:profiling. |
54 " - Bar() is not reported since it does not match "profile func Foo*". | 55 " - Bar() is not reported since it does not match "profile func Foo*". |
55 call assert_equal(30, len(lines)) | 56 call assert_equal(31, len(lines)) |
56 | 57 |
57 call assert_equal('FUNCTION Foo1()', lines[0]) | 58 call assert_equal('FUNCTION Foo1()', lines[0]) |
58 call assert_match('Defined:.*Xprofile_func.vim:3', lines[1]) | 59 call assert_match('Defined:.*Xprofile_func.vim:3', lines[1]) |
59 call assert_equal('Called 2 times', lines[2]) | 60 call assert_equal('Called 2 times', lines[2]) |
60 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) | 61 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) |
70 call assert_equal('count total (s) self (s)', lines[14]) | 71 call assert_equal('count total (s) self (s)', lines[14]) |
71 call assert_match('^\s*1\s\+.*\slet l:count = 100$', lines[15]) | 72 call assert_match('^\s*1\s\+.*\slet l:count = 100$', lines[15]) |
72 call assert_match('^\s*101\s\+.*\swhile l:count > 0$', lines[16]) | 73 call assert_match('^\s*101\s\+.*\swhile l:count > 0$', lines[16]) |
73 call assert_match('^\s*100\s\+.*\s let l:count = l:count - 1$', lines[17]) | 74 call assert_match('^\s*100\s\+.*\s let l:count = l:count - 1$', lines[17]) |
74 call assert_match('^\s*101\s\+.*\sendwhile$', lines[18]) | 75 call assert_match('^\s*101\s\+.*\sendwhile$', lines[18]) |
75 call assert_equal('', lines[19]) | 76 call assert_match('^\s*1\s\+.\+sleep 1m$', lines[19]) |
76 call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[20]) | 77 call assert_equal('', lines[20]) |
77 call assert_equal('count total (s) self (s) function', lines[21]) | 78 call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[21]) |
78 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[22]) | 79 call assert_equal('count total (s) self (s) function', lines[22]) |
79 call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[23]) | 80 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[23]) |
80 call assert_equal('', lines[24]) | 81 call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[24]) |
81 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[25]) | 82 call assert_equal('', lines[25]) |
82 call assert_equal('count total (s) self (s) function', lines[26]) | 83 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[26]) |
83 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[27]) | 84 call assert_equal('count total (s) self (s) function', lines[27]) |
84 call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[28]) | 85 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[28]) |
85 call assert_equal('', lines[29]) | 86 call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[29]) |
87 call assert_equal('', lines[30]) | |
86 | 88 |
87 call delete('Xprofile_func.vim') | 89 call delete('Xprofile_func.vim') |
88 call delete('Xprofile_func.log') | 90 call delete('Xprofile_func.log') |
89 endfunc | 91 endfunc |
90 | 92 |