]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.1484: some tests are slow v8.1.1484
authorBram Moolenaar <Bram@vim.org>
Thu, 6 Jun 2019 16:05:25 +0000 (18:05 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 6 Jun 2019 16:05:25 +0000 (18:05 +0200)
Problem:    Some tests are slow.
Solution:   Add timing to the test messages.  Fix double free when quitting in
            VimLeavePre autocmd.

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

index af7a4af8a6e3c0aa453a63c4809c5053fcee5490..5452f45437d7ace82641ce6eaea0e88e1b76974b 100644 (file)
@@ -430,11 +430,12 @@ eval_clear(void)
        vim_free(SCRIPT_SV(i));
     ga_clear(&ga_scripts);
 
-    /* unreferenced lists and dicts */
-    (void)garbage_collect(FALSE);
-
-    /* functions */
+    // functions need to be freed before gargabe collecting, otherwise local
+    // variables might be freed twice.
     free_all_functions();
+
+    // unreferenced lists and dicts
+    (void)garbage_collect(FALSE);
 }
 #endif
 
index 02d4d20e340a38491c221a6a50cb023031479c81..f855f6800525ee5b0ca187df655c99a6d9594caf 100644 (file)
@@ -42,6 +42,10 @@ if &lines < 24 || &columns < 80
   cquit
 endif
 
+if has('reltime')
+  let s:start_time = reltime()
+endif
+
 " Common with all tests on all systems.
 source setup.vim
 
@@ -99,6 +103,9 @@ endfunc
 
 func RunTheTest(test)
   echo 'Executing ' . a:test
+  if has('reltime')
+    let func_start = reltime()
+  endif
 
   " Avoid stopping at the "hit enter" prompt
   set nomore
@@ -126,7 +133,11 @@ func RunTheTest(test)
     endtry
   endif
 
-  call add(s:messages, 'Executing ' . a:test)
+  let message = 'Executed ' . a:test
+  if has('reltime')
+    let message ..= ' in ' .. reltimestr(reltime(func_start)) .. ' seconds'
+  endif
+  call add(s:messages, message)
   let s:done += 1
 
   if a:test =~ 'Test_nocatch_'
@@ -232,6 +243,9 @@ func FinishTesting()
   else
     let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
   endif
+  if has('reltime')
+    let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds'
+  endif
   echo message
   call add(s:messages, message)
   if s:fail > 0
index c8a3cf6706bb48d65ad76806bcc0ec755a369d7b..bbfbfe17d7f4e0dd3b6315685aa9206c0a3c59ca 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1484,
 /**/
     1483,
 /**/