Patch 8.2.0742

10 views
Skip to first unread message

Bram Moolenaar

unread,
May 12, 2020, 8:42:35 AM5/12/20
to vim...@googlegroups.com

Patch 8.2.0742
Problem: Handling of a TERM signal not tested.
Solution: Add a test for SIGTERM. (Dominique Pelle, closes #6055)
Files: src/testdir/test_signals.vim


*** ../vim-8.2.0741/src/testdir/test_signals.vim 2020-03-23 20:54:28.220520961 +0100
--- src/testdir/test_signals.vim 2020-05-12 14:40:53.191370508 +0200
***************
*** 106,108 ****
--- 106,154 ----

call StopVimInTerminal(buf)
endfunc
+
+ " Test a deadly signal.
+ "
+ " There are several deadly signals: SISEGV, SIBUS, SIGTERM...
+ " Test uses signal SIGTERM as it does not create a core
+ " dump file unlike SIGSEGV, SIGBUS, etc. See "man 7 signals.
+ "
+ " Vim should exit with a deadly signal and unsaved changes
+ " should be recoverable from the swap file preserved as a
+ " result of the deadly signal handler.
+ func Test_deadly_signal_TERM()
+ if !HasSignal('TERM')
+ throw 'Skipped: TERM signal not supported'
+ endif
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot run vim in terminal'
+ endif
+ let cmd = GetVimCommand()
+ if cmd =~ 'valgrind'
+ throw 'Skipped: cannot test signal TERM with valgrind'
+ endif
+
+ let buf = RunVimInTerminal('Xsig_TERM', {'rows': 6})
+ let pid_vim = term_getjob(buf)->job_info().process
+
+ call term_sendkeys(buf, ":call setline(1, 'foo')\n")
+ call WaitForAssert({-> assert_equal('foo', term_getline(buf, 1))})
+
+ call assert_false(filereadable('Xsig_TERM'))
+ exe 'silent !kill -s TERM ' .. pid_vim
+ call WaitForAssert({-> assert_equal('Vim: Caught deadly signal TERM', term_getline(buf, 1))})
+ call WaitForAssert({-> assert_match('Vim: preserving files\.\.\.$', term_getline(buf, 2))})
+ call WaitForAssert({-> assert_true(filereadable('.Xsig_TERM.swp'))})
+
+ " Don't call StopVimInTerminal() as it expects job to be still running.
+ call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
+
+ new
+ silent recover .Xsig_TERM.swp
+ call assert_equal(['foo'], getline(1, '$'))
+
+ %bwipe!
+ call delete('.Xsig_TERM.swp')
+ endfunc
+
+ " vim: ts=8 sw=2 sts=2 tw=80 fdm=marker
*** ../vim-8.2.0741/src/version.c 2020-05-12 13:08:03.432962765 +0200
--- src/version.c 2020-05-12 14:40:20.699526638 +0200
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 742,
/**/

--
From "know your smileys":
<>:-) Bishop

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages