comparison src/testdir/test_signals.vim @ 29281:cf881b3169ce v8.2.5158

patch 8.2.5158: TSTP and INT signal tests are not run with valgrind Commit: https://github.com/vim/vim/commit/61e3784819d3776ec6fb40d97a12a1bb659e8143 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 25 12:13:28 2022 +0100 patch 8.2.5158: TSTP and INT signal tests are not run with valgrind Problem: TSTP and INT signal tests are not run with valgrind. Solution: Sleep a bit longer. (closes https://github.com/vim/vim/issues/10614)
author Bram Moolenaar <Bram@vim.org>
date Sat, 25 Jun 2022 13:15:03 +0200
parents b4c111ea83b1
children eae1e99e66de
comparison
equal deleted inserted replaced
29280:7e89a967ee84 29281:cf881b3169ce
83 CheckRunVimInTerminal 83 CheckRunVimInTerminal
84 if !HasSignal('INT') 84 if !HasSignal('INT')
85 throw 'Skipped: INT signal not supported' 85 throw 'Skipped: INT signal not supported'
86 endif 86 endif
87 87
88 " Skip the test when running with valgrind as signal INT is not received
89 " somehow by Vim when running with valgrind.
90 let cmd = GetVimCommand()
91 if cmd =~ 'valgrind'
92 throw 'Skipped: cannot test signal INT with valgrind'
93 endif
94
95 let buf = RunVimInTerminal('', {'rows': 6}) 88 let buf = RunVimInTerminal('', {'rows': 6})
96 let pid_vim = term_getjob(buf)->job_info().process 89 let pid_vim = term_getjob(buf)->job_info().process
97 90
98 " Check that an endless loop in Vim is interrupted by signal INT. 91 " Check that an endless loop in Vim is interrupted by signal INT.
92 call term_sendkeys(buf, ":call setline(1, 'running')\n")
99 call term_sendkeys(buf, ":while 1 | endwhile\n") 93 call term_sendkeys(buf, ":while 1 | endwhile\n")
100 call WaitForAssert({-> assert_equal(':while 1 | endwhile', term_getline(buf, 6))}) 94 call WaitForAssert({-> assert_equal(':while 1 | endwhile', term_getline(buf, 6))})
101 exe 'silent !kill -s INT ' .. pid_vim 95 exe 'silent !kill -s INT ' .. pid_vim
96 sleep 50m
102 call term_sendkeys(buf, ":call setline(1, 'INTERRUPTED')\n") 97 call term_sendkeys(buf, ":call setline(1, 'INTERRUPTED')\n")
103 call WaitForAssert({-> assert_equal('INTERRUPTED', term_getline(buf, 1))}) 98 call WaitForAssert({-> assert_equal('INTERRUPTED', term_getline(buf, 1))})
104 99
105 call StopVimInTerminal(buf) 100 call StopVimInTerminal(buf)
106 endfunc 101 endfunc
110 CheckRunVimInTerminal 105 CheckRunVimInTerminal
111 if !HasSignal('TSTP') 106 if !HasSignal('TSTP')
112 throw 'Skipped: TSTP signal not supported' 107 throw 'Skipped: TSTP signal not supported'
113 endif 108 endif
114 109
115 " Skip the test when running with valgrind as signal TSTP is not received
116 " somehow by Vim when running with valgrind.
117 let cmd = GetVimCommand()
118 if cmd =~ 'valgrind'
119 throw 'Skipped: cannot test signal TSTP with valgrind'
120 endif
121
122 " If test fails once, it can leave temporary files and trying to rerun 110 " If test fails once, it can leave temporary files and trying to rerun
123 " the test would then fail again if they are not deleted first. 111 " the test would then fail again if they are not deleted first.
124 call delete('.Xsig_TERM.swp') 112 call delete('.Xsig_TERM.swp')
125 call delete('XsetupAucmd') 113 call delete('XsetupAucmd')
126 call delete('XautoOut') 114 call delete('XautoOut')
140 128
141 " After TSTP the file is not saved (same function as ^Z) 129 " After TSTP the file is not saved (same function as ^Z)
142 exe 'silent !kill -s TSTP ' .. pid_vim 130 exe 'silent !kill -s TSTP ' .. pid_vim
143 call WaitForAssert({-> assert_true(filereadable('.Xsig_TERM.swp'))}) 131 call WaitForAssert({-> assert_true(filereadable('.Xsig_TERM.swp'))})
144 132
145 " We resume after the suspend 133 " We resume after the suspend. Sleep a bit for the signal to take effect,
134 " also when running under valgrind.
146 exe 'silent !kill -s CONT ' .. pid_vim 135 exe 'silent !kill -s CONT ' .. pid_vim
147 exe 'silent !sleep 0.006' 136 sleep 100m
148 137
149 call StopVimInTerminal(buf) 138 call StopVimInTerminal(buf)
150 139
151 let result = readfile('XautoOut') 140 let result = readfile('XautoOut')
152 call assert_equal(["VimSuspend triggered", "VimResume triggered"], result) 141 call assert_equal(["VimSuspend triggered", "VimResume triggered"], result)