To: vim_dev@googlegroups.com Subject: Patch 8.2.0433 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0433 Problem: INT signal not properly tested. Solution: Add a test. Also clean up some unnecessary lines. (Dominique Pelle, closes #5828) Files: src/testdir/test_display.vim, src/testdir/test_ex_mode.vim, src/testdir/test_excmd.vim, src/testdir/test_messages.vim, src/testdir/test_signals.vim *** ../vim-8.2.0432/src/testdir/test_display.vim 2019-12-14 17:52:37.253322578 +0100 --- src/testdir/test_display.vim 2020-03-23 20:50:25.344675478 +0100 *************** *** 192,199 **** call VerifyScreenDump(buf, 'Test_long_file_name_1', {}) - call term_sendkeys(buf, ":q\") - " clean up call StopVimInTerminal(buf) call delete(longName) --- 192,197 ---- *** ../vim-8.2.0432/src/testdir/test_ex_mode.vim 2020-03-10 07:48:06.571619551 +0100 --- src/testdir/test_ex_mode.vim 2020-03-23 20:50:25.344675478 +0100 *************** *** 92,98 **** call term_sendkeys(buf, ":vi\") call WaitForAssert({-> assert_match('foo bar', term_getline(buf, 1))}, 1000) - call term_sendkeys(buf, ":q!\n") call StopVimInTerminal(buf) endfunc --- 92,97 ---- *** ../vim-8.2.0432/src/testdir/test_excmd.vim 2020-03-18 19:32:22.510363327 +0100 --- src/testdir/test_excmd.vim 2020-03-23 20:50:25.344675478 +0100 *************** *** 255,261 **** call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', \ term_getline(buf, 20))}, 1000) call term_sendkeys(buf, "N") - call term_sendkeys(buf, ":quit\n") call StopVimInTerminal(buf) call delete('foo') --- 255,260 ---- *** ../vim-8.2.0432/src/testdir/test_messages.vim 2020-02-02 15:55:16.072876269 +0100 --- src/testdir/test_messages.vim 2020-03-23 20:50:25.344675478 +0100 *************** *** 265,271 **** call term_sendkeys(buf, 'q') call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))}) - call term_sendkeys(buf, ":q!\n") call StopVimInTerminal(buf) endfunc --- 265,270 ---- *************** *** 295,301 **** call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))}) call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))}) - call term_sendkeys(buf, ":q!\n") call StopVimInTerminal(buf) endfunc --- 294,299 ---- *** ../vim-8.2.0432/src/testdir/test_signals.vim 2019-08-07 22:14:58.000000000 +0200 --- src/testdir/test_signals.vim 2020-03-23 20:50:25.344675478 +0100 *************** *** 1,6 **** --- 1,8 ---- " Test signal handling. source check.vim + source term_util.vim + CheckUnix source shared.vim *************** *** 50,56 **** " Test signal PWR, which should update the swap file. func Test_signal_PWR() if !HasSignal('PWR') ! return endif " Set a very large 'updatetime' and 'updatecount', so that we can be sure --- 52,58 ---- " Test signal PWR, which should update the swap file. func Test_signal_PWR() if !HasSignal('PWR') ! throw 'Skipped: PWR signal not supported' endif " Set a very large 'updatetime' and 'updatecount', so that we can be sure *************** *** 75,77 **** --- 77,108 ---- bwipe! set updatetime& updatecount& endfunc + + " Test signal INT. Handler sets got_int. It should be like typing CTRL-C. + func Test_signal_INT() + if !HasSignal('INT') + throw 'Skipped: INT signal not supported' + endif + + " Skip the rest of the test when running with valgrind as signal INT is not + " received somehow by Vim when running with valgrind. + let cmd = GetVimCommand() + if cmd =~ 'valgrind' + throw 'Skipped: cannot test signal INT with valgrind' + endif + + if !CanRunVimInTerminal() + throw 'Skipped: cannot run vim in terminal' + endif + let buf = RunVimInTerminal('', {'rows': 6}) + let pid_vim = term_getjob(buf)->job_info().process + + " Check that an endless loop in Vim is interrupted by signal INT. + call term_sendkeys(buf, ":while 1 | endwhile\n") + call WaitForAssert({-> assert_equal(':while 1 | endwhile', term_getline(buf, 6))}) + exe 'silent !kill -s INT ' .. pid_vim + call term_sendkeys(buf, ":call setline(1, 'INTERUPTED')\n") + call WaitForAssert({-> assert_equal('INTERUPTED', term_getline(buf, 1))}) + + call StopVimInTerminal(buf) + endfunc *** ../vim-8.2.0432/src/version.c 2020-03-23 19:28:40.599056151 +0100 --- src/version.c 2020-03-23 20:52:03.662473892 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 433, /**/ -- Nothing is impossible for the man who doesn't have to do it. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///