1
0
forked from aniani/vim

patch 9.0.0532: edit test is flaky when run under valgrind

Problem:    Edit test is flaky when run under valgrind.
Solution:   Send some text to the terminal to trigger a redraw.
This commit is contained in:
Bram Moolenaar
2022-09-21 15:13:52 +01:00
parent c20a41972c
commit 14f91765c0
2 changed files with 24 additions and 27 deletions

View File

@@ -452,7 +452,7 @@ func Test_edit_CR()
" has been taken care of by other tests " has been taken care of by other tests
CheckFeature quickfix CheckFeature quickfix
botright new botright new
call writefile(range(1, 10), 'Xqflist.txt') call writefile(range(1, 10), 'Xqflist.txt', 'D')
call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}]) call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}])
copen copen
set modifiable set modifiable
@@ -472,9 +472,9 @@ func Test_edit_CR()
call feedkeys("A\n", 'tnix') call feedkeys("A\n", 'tnix')
call feedkeys("A\r", 'tnix') call feedkeys("A\r", 'tnix')
call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], getline(1, '$')) call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], getline(1, '$'))
bw! bw!
lclose lclose
call delete('Xqflist.txt')
endfunc endfunc
func Test_edit_CTRL_() func Test_edit_CTRL_()
@@ -569,7 +569,7 @@ func Test_edit_CTRL_I()
call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix') call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix')
call assert_match('runtest\.vim', getline(1)) call assert_match('runtest\.vim', getline(1))
%d %d
call writefile(['one', 'two', 'three'], 'Xinclude.txt') call writefile(['one', 'two', 'three'], 'Xinclude.txt', 'D')
let include='#include Xinclude.txt' let include='#include Xinclude.txt'
call setline(1, [include, '']) call setline(1, [include, ''])
call cursor(2, 1) call cursor(2, 1)
@@ -581,14 +581,13 @@ func Test_edit_CTRL_I()
call assert_equal([include, 'three', ''], getline(1, '$')) call assert_equal([include, 'three', ''], getline(1, '$'))
call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix') call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
call assert_equal([include, '', ''], getline(1, '$')) call assert_equal([include, '', ''], getline(1, '$'))
call delete("Xinclude.txt")
bw! bw!
endfunc endfunc
func Test_edit_CTRL_K() func Test_edit_CTRL_K()
" Test pressing CTRL-K (basically only dictionary completion and digraphs " Test pressing CTRL-K (basically only dictionary completion and digraphs
" the rest is already covered " the rest is already covered
call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt') call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt', 'D')
set dictionary=Xdictionary.txt set dictionary=Xdictionary.txt
new new
call setline(1, 'A') call setline(1, 'A')
@@ -644,7 +643,6 @@ func Test_edit_CTRL_K()
" error sleeps 2 seconds, when v:testing is not set " error sleeps 2 seconds, when v:testing is not set
let v:testing = 0 let v:testing = 0
endtry endtry
call delete('Xdictionary.txt')
call test_override("char_avail", 1) call test_override("char_avail", 1)
set showcmd set showcmd
@@ -842,7 +840,7 @@ func Test_edit_CTRL_T()
call assert_equal(["\<tab>abcxyz"], getline(1, '$')) call assert_equal(["\<tab>abcxyz"], getline(1, '$'))
set nopaste set nopaste
" CTRL-X CTRL-T (thesaurus complete) " CTRL-X CTRL-T (thesaurus complete)
call writefile(['angry furious mad enraged'], 'Xthesaurus') call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D')
set thesaurus=Xthesaurus set thesaurus=Xthesaurus
call setline(1, 'mad') call setline(1, 'mad')
call cursor(1, 1) call cursor(1, 1)
@@ -899,13 +897,12 @@ func Test_edit_CTRL_T()
let v:testing = 0 let v:testing = 0
endtry endtry
call assert_equal(['mad'], getline(1, '$')) call assert_equal(['mad'], getline(1, '$'))
call delete('Xthesaurus')
bw! bw!
endfunc endfunc
" Test thesaurus completion with different encodings " Test thesaurus completion with different encodings
func Test_thesaurus_complete_with_encoding() func Test_thesaurus_complete_with_encoding()
call writefile(['angry furious mad enraged'], 'Xthesaurus') call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D')
set thesaurus=Xthesaurus set thesaurus=Xthesaurus
for e in ['latin1', 'utf-8'] for e in ['latin1', 'utf-8']
exe 'set encoding=' .. e exe 'set encoding=' .. e
@@ -917,7 +914,6 @@ func Test_thesaurus_complete_with_encoding()
bw! bw!
endfor endfor
set thesaurus= set thesaurus=
call delete('Xthesaurus')
endfunc endfunc
" Test 'thesaurusfunc' " Test 'thesaurusfunc'
@@ -1495,7 +1491,7 @@ func Test_edit_complete_very_long_name()
let dirname = getcwd() . "/Xlongdir" let dirname = getcwd() . "/Xlongdir"
let longdirname = dirname . repeat('/' . repeat('d', 255), 4) let longdirname = dirname . repeat('/' . repeat('d', 255), 4)
try try
call mkdir(longdirname, 'p') call mkdir(longdirname, 'pR')
catch /E739:/ catch /E739:/
" Long directory name probably not supported. " Long directory name probably not supported.
call delete(dirname, 'rf') call delete(dirname, 'rf')
@@ -1535,7 +1531,6 @@ func Test_edit_complete_very_long_name()
bwipe! bwipe!
exe 'bwipe! ' . longfilename exe 'bwipe! ' . longfilename
call delete(dirname, 'rf')
let &columns = save_columns let &columns = save_columns
if winposx >= 0 && winposy >= 0 if winposx >= 0 && winposy >= 0
exe 'winpos ' . winposx . ' ' . winposy exe 'winpos ' . winposx . ' ' . winposy
@@ -1754,19 +1749,18 @@ endfunc
" Test for editing a file using invalid file encoding " Test for editing a file using invalid file encoding
func Test_edit_invalid_encoding() func Test_edit_invalid_encoding()
CheckEnglish CheckEnglish
call writefile([], 'Xinvfile') call writefile([], 'Xinvfile', 'D')
redir => msg redir => msg
new ++enc=axbyc Xinvfile new ++enc=axbyc Xinvfile
redir END redir END
call assert_match('\[NOT converted\]', msg) call assert_match('\[NOT converted\]', msg)
call delete('Xinvfile')
close! close!
endfunc endfunc
" Test for the "charconvert" option " Test for the "charconvert" option
func Test_edit_charconvert() func Test_edit_charconvert()
CheckEnglish CheckEnglish
call writefile(['one', 'two'], 'Xccfile') call writefile(['one', 'two'], 'Xccfile', 'D')
" set 'charconvert' to a non-existing function " set 'charconvert' to a non-existing function
set charconvert=NonExitingFunc() set charconvert=NonExitingFunc()
@@ -1826,8 +1820,6 @@ func Test_edit_charconvert()
close! close!
delfunc Cconv3 delfunc Cconv3
set charconvert& set charconvert&
call delete('Xccfile')
endfunc endfunc
" Test for editing a file without read permission " Test for editing a file without read permission
@@ -1835,7 +1827,7 @@ func Test_edit_file_no_read_perm()
CheckUnix CheckUnix
CheckNotRoot CheckNotRoot
call writefile(['one', 'two'], 'Xnrpfile') call writefile(['one', 'two'], 'Xnrpfile', 'D')
call setfperm('Xnrpfile', '-w-------') call setfperm('Xnrpfile', '-w-------')
new new
redir => msg redir => msg
@@ -1845,7 +1837,6 @@ func Test_edit_file_no_read_perm()
call assert_equal([''], getline(1, '$')) call assert_equal([''], getline(1, '$'))
call assert_match('\[Permission Denied\]', msg) call assert_match('\[Permission Denied\]', msg)
close! close!
call delete('Xnrpfile')
endfunc endfunc
" Using :edit without leaving 'insertmode' should not cause Insert mode to be " Using :edit without leaving 'insertmode' should not cause Insert mode to be
@@ -1857,19 +1848,24 @@ func Test_edit_insertmode_ex_edit()
set insertmode noruler set insertmode noruler
inoremap <C-B> <Cmd>edit Xfoo<CR> inoremap <C-B> <Cmd>edit Xfoo<CR>
END END
call writefile(lines, 'Xtest_edit_insertmode_ex_edit') call writefile(lines, 'Xtest_edit_insertmode_ex_edit', 'D')
let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6}) let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6, wait_for_ruler: 0})
" Somehow this can be very slow with valgrind. A separate TermWait() works " Somehow when using valgrind "INSERT" does not show up unless we send
" better than a longer time with WaitForAssert() (why?) " something to the terminal.
call TermWait(buf, 1000) for i in range(30)
if term_getline(buf, 6) =~ 'INSERT'
break
endif
call term_sendkeys(buf, "-")
sleep 100m
endfor
call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, 6))}) call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, 6))})
call term_sendkeys(buf, "\<C-B>\<C-L>") call term_sendkeys(buf, "\<C-B>\<C-L>")
call WaitForAssert({-> assert_notmatch('^-- INSERT --\s*$', term_getline(buf, 6))}) call WaitForAssert({-> assert_notmatch('^-- INSERT --\s*$', term_getline(buf, 6))})
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xtest_edit_insertmode_ex_edit')
endfunc endfunc
" Pressing escape in 'insertmode' should beep " Pressing escape in 'insertmode' should beep
@@ -2083,7 +2079,7 @@ func Test_edit_shift_bs()
let lines =<< trim END let lines =<< trim END
call setline(1, ['abc']) call setline(1, ['abc'])
END END
call writefile(lines, 'Xtest_edit_shift_bs') call writefile(lines, 'Xtest_edit_shift_bs', 'D')
let buf = RunVimInTerminal('-S Xtest_edit_shift_bs', #{rows: 3}) let buf = RunVimInTerminal('-S Xtest_edit_shift_bs', #{rows: 3})
call term_sendkeys(buf, "A\<S-BS>-\<esc>") call term_sendkeys(buf, "A\<S-BS>-\<esc>")
@@ -2092,7 +2088,6 @@ func Test_edit_shift_bs()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xtest_edit_shift_bs')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
532,
/**/ /**/
531, 531,
/**/ /**/