Skip to content

Commit 46c4d4a

Browse files
committed
patch 7.4.2157
Problem: Test_job_start_fails() is expected to report memory leaks, making it hard to see other leaks in test_partial. Solution: Move Test_job_start_fails() to a separate test file.
1 parent c90f2ae commit 46c4d4a

5 files changed

Lines changed: 23 additions & 22 deletions

File tree

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,7 @@ test_arglist \
20862086
test_history \
20872087
test_increment \
20882088
test_increment_dbcs \
2089+
test_job_fails \
20892090
test_join \
20902091
test_json \
20912092
test_jumps \

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ NEW_TESTS = test_arglist.res \
176176
test_history.res \
177177
test_increment.res \
178178
test_increment_dbcs.res \
179+
test_job_fails.res \
179180
test_json.res \
180181
test_langmap.res \
181182
test_man.res \

src/testdir/test_job_fails.vim

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
" This test is in a separate file, because it usually causes reports for memory
2+
" leaks under valgrind. That is because when fork/exec fails memory is not
3+
" freed. Since the process exists right away it's not a real leak.
4+
5+
source shared.vim
6+
7+
func Test_job_start_fails()
8+
if has('job')
9+
let g:job = job_start('axdfxsdf')
10+
if has('unix')
11+
call WaitFor('job_status(g:job) == "dead"')
12+
call assert_equal('dead', job_status(g:job))
13+
else
14+
call WaitFor('job_status(g:job) == "fail"')
15+
call assert_equal('fail', job_status(g:job))
16+
endif
17+
unlet g:job
18+
endif
19+
endfunc

src/testdir/test_partial.vim

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
" Test binding arguments to a Funcref.
22

3-
" NOTE: This function may cause memory leaks to be reported.
4-
" That is because when fork/exec fails memory is not freed. Since the process
5-
" exists right away it's not a real leak.
6-
func Test_job_start_fails()
7-
if has('job')
8-
let job = job_start('axdfxsdf')
9-
for i in range(100)
10-
let status = job_status(job)
11-
if status == 'dead' || status == 'fail'
12-
break
13-
endif
14-
sleep 10m
15-
endfor
16-
if has('unix')
17-
call assert_equal('dead', job_status(job))
18-
else
19-
call assert_equal('fail', job_status(job))
20-
endif
21-
unlet job
22-
endif
23-
endfunc
24-
253
func MyFunc(arg1, arg2, arg3)
264
return a:arg1 . '/' . a:arg2 . '/' . a:arg3
275
endfunc

src/version.c

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

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2157,
766768
/**/
767769
2156,
768770
/**/

0 commit comments

Comments
 (0)