changeset 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 24fcf2b1ba72
children 0b7b0650000a
files src/testdir/test_profile.vim src/version.c
diffstat 2 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_profile.vim
+++ b/src/testdir/test_profile.vim
@@ -17,6 +17,7 @@ func Test_profile_func()
       while l:count > 0
         let l:count = l:count - 1
       endwhile
+      sleep 1m
     endfunc
     func! Foo3()
     endfunc
@@ -52,7 +53,7 @@ func Test_profile_func()
   " - Unlike Foo3(), Foo2() should not be deleted since there is a check
   "   for v:profiling.
   " - Bar() is not reported since it does not match "profile func Foo*".
-  call assert_equal(30, len(lines))
+  call assert_equal(31, len(lines))
 
   call assert_equal('FUNCTION  Foo1()',                            lines[0])
   call assert_match('Defined:.*Xprofile_func.vim:3',               lines[1])
@@ -72,17 +73,18 @@ func Test_profile_func()
   call assert_match('^\s*101\s\+.*\swhile l:count > 0$',           lines[16])
   call assert_match('^\s*100\s\+.*\s  let l:count = l:count - 1$', lines[17])
   call assert_match('^\s*101\s\+.*\sendwhile$',                    lines[18])
-  call assert_equal('',                                            lines[19])
-  call assert_equal('FUNCTIONS SORTED ON TOTAL TIME',              lines[20])
-  call assert_equal('count  total (s)   self (s)  function',       lines[21])
-  call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$',              lines[22])
-  call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$',              lines[23])
-  call assert_equal('',                                            lines[24])
-  call assert_equal('FUNCTIONS SORTED ON SELF TIME',               lines[25])
-  call assert_equal('count  total (s)   self (s)  function',       lines[26])
-  call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$',              lines[27])
-  call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$',              lines[28])
-  call assert_equal('',                                            lines[29])
+  call assert_match('^\s*1\s\+.\+sleep 1m$',                       lines[19])
+  call assert_equal('',                                            lines[20])
+  call assert_equal('FUNCTIONS SORTED ON TOTAL TIME',              lines[21])
+  call assert_equal('count  total (s)   self (s)  function',       lines[22])
+  call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$',              lines[23])
+  call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$',              lines[24])
+  call assert_equal('',                                            lines[25])
+  call assert_equal('FUNCTIONS SORTED ON SELF TIME',               lines[26])
+  call assert_equal('count  total (s)   self (s)  function',       lines[27])
+  call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$',              lines[28])
+  call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$',              lines[29])
+  call assert_equal('',                                            lines[30])
 
   call delete('Xprofile_func.vim')
   call delete('Xprofile_func.log')
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    398,
+/**/
     397,
 /**/
     396,