changeset 33603:5eab5c00bb7c v9.0.2045

patch 9.0.2045: tests: checking for swap files takes time Commit: https://github.com/vim/vim/commit/a0e1f06f04da3444e278ddf47e2ea3d5857a7dec Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Oct 18 11:50:37 2023 +0200 patch 9.0.2045: tests: checking for swap files takes time Problem: tests: checking for swap files takes time Solution: don't check for swap files when test has been skipped Check for swap files takes a considerable about of time, so don't do that for skipped tests to avoid wasting time. closes: #13371 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Wed, 18 Oct 2023 12:00:06 +0200
parents b14bcdcfc906
children 9390f81ff5e7
files src/testdir/runtest.vim src/version.c
diffstat 2 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -277,6 +277,8 @@ func RunTheTest(test)
     endtry
   endif
 
+  let skipped = v:false
+
   au VimLeavePre * call EarlyExit(g:testfunc)
   if a:test =~ 'Test_nocatch_'
     " Function handles errors itself.  This avoids skipping commands after the
@@ -286,6 +288,7 @@ func RunTheTest(test)
     if g:skipped_reason != ''
       call add(s:messages, '    Skipped')
       call add(s:skipped, 'SKIPPED ' . a:test . ': ' . g:skipped_reason)
+      let skipped = v:true
     endif
   else
     try
@@ -293,6 +296,7 @@ func RunTheTest(test)
     catch /^\cskipped/
       call add(s:messages, '    Skipped')
       call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '',  ''))
+      let skipped = v:true
     catch
       call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
     endtry
@@ -400,14 +404,16 @@ func RunTheTest(test)
     endif
   endwhile
 
-  " Check if the test has left any swap files behind.  Delete them before
-  " running tests again, they might interfere.
-  let swapfiles = s:GetSwapFileList()
-  if len(swapfiles) > 0
-    call add(s:messages, "Found swap files: " .. string(swapfiles))
-    for name in swapfiles
-      call delete(name)
-    endfor
+  if !skipped
+    " Check if the test has left any swap files behind.  Delete them before
+    " running tests again, they might interfere.
+    let swapfiles = s:GetSwapFileList()
+    if len(swapfiles) > 0
+      call add(s:messages, "Found swap files: " .. string(swapfiles))
+      for name in swapfiles
+        call delete(name)
+      endfor
+    endif
   endif
 endfunc
 
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2045,
+/**/
     2044,
 /**/
     2043,