Skip to content

Commit 75ee544

Browse files
committed
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.
1 parent 5d30ff1 commit 75ee544

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

src/eval.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,12 @@ eval_clear(void)
430430
vim_free(SCRIPT_SV(i));
431431
ga_clear(&ga_scripts);
432432

433-
/* unreferenced lists and dicts */
434-
(void)garbage_collect(FALSE);
435-
436-
/* functions */
433+
// functions need to be freed before gargabe collecting, otherwise local
434+
// variables might be freed twice.
437435
free_all_functions();
436+
437+
// unreferenced lists and dicts
438+
(void)garbage_collect(FALSE);
438439
}
439440
#endif
440441

src/testdir/runtest.vim

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ if &lines < 24 || &columns < 80
4242
cquit
4343
endif
4444

45+
if has('reltime')
46+
let s:start_time = reltime()
47+
endif
48+
4549
" Common with all tests on all systems.
4650
source setup.vim
4751

@@ -99,6 +103,9 @@ endfunc
99103

100104
func RunTheTest(test)
101105
echo 'Executing ' . a:test
106+
if has('reltime')
107+
let func_start = reltime()
108+
endif
102109

103110
" Avoid stopping at the "hit enter" prompt
104111
set nomore
@@ -126,7 +133,11 @@ func RunTheTest(test)
126133
endtry
127134
endif
128135

129-
call add(s:messages, 'Executing ' . a:test)
136+
let message = 'Executed ' . a:test
137+
if has('reltime')
138+
let message ..= ' in ' .. reltimestr(reltime(func_start)) .. ' seconds'
139+
endif
140+
call add(s:messages, message)
130141
let s:done += 1
131142

132143
if a:test =~ 'Test_nocatch_'
@@ -232,6 +243,9 @@ func FinishTesting()
232243
else
233244
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
234245
endif
246+
if has('reltime')
247+
let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds'
248+
endif
235249
echo message
236250
call add(s:messages, message)
237251
if s:fail > 0

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ static char *(features[]) =
767767

768768
static int included_patches[] =
769769
{ /* Add new patch number below this line */
770+
/**/
771+
1484,
770772
/**/
771773
1483,
772774
/**/

0 commit comments

Comments
 (0)