]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1675: test may run into timeout when using valgrind v9.0.1675
authorBram Moolenaar <Bram@vim.org>
Fri, 7 Jul 2023 23:25:56 +0000 (00:25 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 7 Jul 2023 23:25:56 +0000 (00:25 +0100)
Problem:    Test may run into timeout when using valgrind.
Solution:   Use a longer timeout when using valgrind.

src/testdir/runtest.vim
src/version.c

index 7ad8539c93b4a79c745c1ef5269ec54951420b98..e2bc28d374b1648c925e0a2a787f37d0b112431c 100644 (file)
@@ -92,6 +92,9 @@ set shellslash
 " Common with all tests on all systems.
 source setup.vim
 
+" Needed for RunningWithValgrind().
+source shared.vim
+
 " For consistency run all tests with 'nocompatible' set.
 " This also enables use of line continuation.
 set nocp viminfo+=nviminfo
@@ -219,12 +222,18 @@ unlet name
 func TestTimeout(id)
   split test.log
   call append(line('$'), '')
-  call append(line('$'), 'Test timed out: ' .. g:testfunc)
+
+  let text = 'Test timed out: ' .. g:testfunc
+  if g:timeout_start > 0
+    let text ..= strftime(' after %s seconds', localtime() - g:timeout_start)
+  endif
+  call append(line('$'), text)
   write
-  call add(v:errors, 'Test timed out: ' . g:testfunc)
+  call add(v:errors, text)
 
   cquit! 42
 endfunc
+let g:timeout_start = 0
 
 func RunTheTest(test)
   let prefix = ''
@@ -237,7 +246,9 @@ func RunTheTest(test)
   if has('timers')
     " No test should take longer than 30 seconds.  If it takes longer we
     " assume we are stuck and need to break out.
-    let test_timeout_timer = timer_start(30000, 'TestTimeout')
+    let test_timeout_timer =
+          \ timer_start(RunningWithValgrind() ? 50000 : 30000, 'TestTimeout')
+    let g:timeout_start = localtime()
   endif
 
   " Avoid stopping at the "hit enter" prompt
@@ -307,6 +318,7 @@ func RunTheTest(test)
 
   if has('timers')
     call timer_stop(test_timeout_timer)
+    let g:timeout_start = 0
   endif
 
   " Clear any autocommands and put back the catch-all for SwapExists.
@@ -371,7 +383,7 @@ func RunTheTest(test)
 
   " close any split windows
   while winnr('$') > 1
-    bwipe!
+    noswapfile bwipe!
   endwhile
 
   " May be editing some buffer, wipe it out.  Then we may end up in another
index cf845141e0908568867b9d6f8fc0ac1fad4ea1c8..bacb9fcbd7439f41c8733d9f525c940c5b3c7162 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1675,
 /**/
     1674,
 /**/