# HG changeset patch # User Bram Moolenaar # Date 1663769704 -7200 # Node ID 409ddc3fa5cec02720ea30c8f1e3ae00dda906b3 # Parent 50944debc25e88d8e2988d500f9d581f34ba179f patch 9.0.0532: edit test is flaky when run under valgrind Commit: https://github.com/vim/vim/commit/14f91765c07e147e0c8554a50560ae24dbd5ecea Author: Bram Moolenaar Date: Wed Sep 21 15:13:52 2022 +0100 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. diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -452,7 +452,7 @@ func Test_edit_CR() " has been taken care of by other tests CheckFeature quickfix botright new - call writefile(range(1, 10), 'Xqflist.txt') + call writefile(range(1, 10), 'Xqflist.txt', 'D') call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}]) copen set modifiable @@ -472,9 +472,9 @@ func Test_edit_CR() call feedkeys("A\n", 'tnix') call feedkeys("A\r", 'tnix') call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], getline(1, '$')) + bw! lclose - call delete('Xqflist.txt') endfunc func Test_edit_CTRL_() @@ -569,7 +569,7 @@ func Test_edit_CTRL_I() call feedkeys("Arunt\\\\\", 'tnix') call assert_match('runtest\.vim', getline(1)) %d - call writefile(['one', 'two', 'three'], 'Xinclude.txt') + call writefile(['one', 'two', 'three'], 'Xinclude.txt', 'D') let include='#include Xinclude.txt' call setline(1, [include, '']) call cursor(2, 1) @@ -581,14 +581,13 @@ func Test_edit_CTRL_I() call assert_equal([include, 'three', ''], getline(1, '$')) call feedkeys("2ggC\\\\\\\", 'tnix') call assert_equal([include, '', ''], getline(1, '$')) - call delete("Xinclude.txt") bw! endfunc func Test_edit_CTRL_K() " Test pressing CTRL-K (basically only dictionary completion and digraphs " 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 new call setline(1, 'A') @@ -644,7 +643,6 @@ func Test_edit_CTRL_K() " error sleeps 2 seconds, when v:testing is not set let v:testing = 0 endtry - call delete('Xdictionary.txt') call test_override("char_avail", 1) set showcmd @@ -842,7 +840,7 @@ func Test_edit_CTRL_T() call assert_equal(["\abcxyz"], getline(1, '$')) set nopaste " CTRL-X CTRL-T (thesaurus complete) - call writefile(['angry furious mad enraged'], 'Xthesaurus') + call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D') set thesaurus=Xthesaurus call setline(1, 'mad') call cursor(1, 1) @@ -899,13 +897,12 @@ func Test_edit_CTRL_T() let v:testing = 0 endtry call assert_equal(['mad'], getline(1, '$')) - call delete('Xthesaurus') bw! endfunc " Test thesaurus completion with different encodings func Test_thesaurus_complete_with_encoding() - call writefile(['angry furious mad enraged'], 'Xthesaurus') + call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D') set thesaurus=Xthesaurus for e in ['latin1', 'utf-8'] exe 'set encoding=' .. e @@ -917,7 +914,6 @@ func Test_thesaurus_complete_with_encodi bw! endfor set thesaurus= - call delete('Xthesaurus') endfunc " Test 'thesaurusfunc' @@ -1495,7 +1491,7 @@ func Test_edit_complete_very_long_name() let dirname = getcwd() . "/Xlongdir" let longdirname = dirname . repeat('/' . repeat('d', 255), 4) try - call mkdir(longdirname, 'p') + call mkdir(longdirname, 'pR') catch /E739:/ " Long directory name probably not supported. call delete(dirname, 'rf') @@ -1535,7 +1531,6 @@ func Test_edit_complete_very_long_name() bwipe! exe 'bwipe! ' . longfilename - call delete(dirname, 'rf') let &columns = save_columns if winposx >= 0 && winposy >= 0 exe 'winpos ' . winposx . ' ' . winposy @@ -1754,19 +1749,18 @@ endfunc " Test for editing a file using invalid file encoding func Test_edit_invalid_encoding() CheckEnglish - call writefile([], 'Xinvfile') + call writefile([], 'Xinvfile', 'D') redir => msg new ++enc=axbyc Xinvfile redir END call assert_match('\[NOT converted\]', msg) - call delete('Xinvfile') close! endfunc " Test for the "charconvert" option func Test_edit_charconvert() CheckEnglish - call writefile(['one', 'two'], 'Xccfile') + call writefile(['one', 'two'], 'Xccfile', 'D') " set 'charconvert' to a non-existing function set charconvert=NonExitingFunc() @@ -1826,8 +1820,6 @@ func Test_edit_charconvert() close! delfunc Cconv3 set charconvert& - - call delete('Xccfile') endfunc " Test for editing a file without read permission @@ -1835,7 +1827,7 @@ func Test_edit_file_no_read_perm() CheckUnix CheckNotRoot - call writefile(['one', 'two'], 'Xnrpfile') + call writefile(['one', 'two'], 'Xnrpfile', 'D') call setfperm('Xnrpfile', '-w-------') new redir => msg @@ -1845,7 +1837,6 @@ func Test_edit_file_no_read_perm() call assert_equal([''], getline(1, '$')) call assert_match('\[Permission Denied\]', msg) close! - call delete('Xnrpfile') endfunc " 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 inoremap edit Xfoo 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}) - " Somehow this can be very slow with valgrind. A separate TermWait() works - " better than a longer time with WaitForAssert() (why?) - call TermWait(buf, 1000) + let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6, wait_for_ruler: 0}) + " Somehow when using valgrind "INSERT" does not show up unless we send + " something to the terminal. + 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 term_sendkeys(buf, "\\") call WaitForAssert({-> assert_notmatch('^-- INSERT --\s*$', term_getline(buf, 6))}) " clean up call StopVimInTerminal(buf) - call delete('Xtest_edit_insertmode_ex_edit') endfunc " Pressing escape in 'insertmode' should beep @@ -2083,7 +2079,7 @@ func Test_edit_shift_bs() let lines =<< trim END call setline(1, ['abc']) 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}) call term_sendkeys(buf, "A\-\") @@ -2092,7 +2088,6 @@ func Test_edit_shift_bs() " clean up call StopVimInTerminal(buf) - call delete('Xtest_edit_shift_bs') endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -700,6 +700,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 532, +/**/ 531, /**/ 530,