vim-patch:8.1.1484: some tests are slow

Problem:    Some tests are slow.
Solution:   Add timing to the test messages.  Fix double free when quitting in
            VimLeavePre autocmd.
75ee544f99
This commit is contained in:
Daniel Hahler
2019-06-17 17:11:41 +02:00
committed by erw7
parent 7ac46b5d37
commit 0cab85df4d
2 changed files with 18 additions and 4 deletions

View File

@@ -439,12 +439,12 @@ void eval_clear(void)
xfree(SCRIPT_SV(i)); xfree(SCRIPT_SV(i));
ga_clear(&ga_scripts); ga_clear(&ga_scripts);
// unreferenced lists and dicts
(void)garbage_collect(false);
// functions need to be freed before gargabe collecting, otherwise local // functions need to be freed before gargabe collecting, otherwise local
// variables might be freed twice. // variables might be freed twice.
free_all_functions(); free_all_functions();
// unreferenced lists and dicts
(void)garbage_collect(false);
} }
#endif #endif

View File

@@ -44,6 +44,10 @@ if &lines < 24 || &columns < 80
qa! qa!
endif endif
if has('reltime')
let s:start_time = reltime()
endif
" Common with all tests on all systems. " Common with all tests on all systems.
source setup.vim source setup.vim
@@ -100,6 +104,9 @@ endfunc
func RunTheTest(test) func RunTheTest(test)
echo 'Executing ' . a:test echo 'Executing ' . a:test
if has('reltime')
let func_start = reltime()
endif
" Avoid stopping at the "hit enter" prompt " Avoid stopping at the "hit enter" prompt
set nomore set nomore
@@ -124,7 +131,11 @@ func RunTheTest(test)
endtry endtry
endif 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 let s:done += 1
if a:test =~ 'Test_nocatch_' if a:test =~ 'Test_nocatch_'
@@ -230,6 +241,9 @@ func FinishTesting()
else else
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
endif endif
if has('reltime')
let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds'
endif
echo message echo message
call add(s:messages, message) call add(s:messages, message)
if s:fail > 0 if s:fail > 0