1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0820
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.1.0820
Problem: Test for sending large data over channel sometimes fails.
Solution: Handle that the job may have finished early. Also fix that file
changed test doesn't work in the GUI and reduce flakyness. (Ozaki
Kiichi, closes #3861)
Files: src/testdir/test_channel.vim, src/testdir/test_filechanged.vim
*** ../vim-8.1.0819/src/testdir/test_channel.vim 2019-01-24 23:11:44.631650199 +0100
--- src/testdir/test_channel.vim 2019-01-25 20:58:53.293743070 +0100
***************
*** 879,897 ****
func Test_pipe_err_to_buffer_name()
call Run_test_pipe_err_to_buffer(1, 0, 1)
endfunc
!
func Test_pipe_err_to_buffer_nr()
call Run_test_pipe_err_to_buffer(0, 0, 1)
endfunc
!
func Test_pipe_err_to_buffer_name_nomod()
call Run_test_pipe_err_to_buffer(1, 1, 1)
endfunc
!
func Test_pipe_err_to_buffer_name_nomsg()
call Run_test_pipe_err_to_buffer(1, 0, 0)
endfunc
!
func Test_pipe_both_to_buffer()
if !has('job')
return
--- 879,897 ----
func Test_pipe_err_to_buffer_name()
call Run_test_pipe_err_to_buffer(1, 0, 1)
endfunc
!
func Test_pipe_err_to_buffer_nr()
call Run_test_pipe_err_to_buffer(0, 0, 1)
endfunc
!
func Test_pipe_err_to_buffer_name_nomod()
call Run_test_pipe_err_to_buffer(1, 1, 1)
endfunc
!
func Test_pipe_err_to_buffer_name_nomsg()
call Run_test_pipe_err_to_buffer(1, 0, 0)
endfunc
!
func Test_pipe_both_to_buffer()
if !has('job')
return
***************
*** 966,980 ****
let options.in_top = 2
let options.in_bot = 4
endif
! let g:job = job_start('sort', options)
if !a:use_buffer
! call assert_equal("run", job_status(g:job))
! call ch_sendraw(g:job, "ccc\naaa\nddd\nbbb\neee\n")
! call ch_close_in(g:job)
endif
! call WaitForAssert({-> assert_equal("dead", job_status(g:job))})
sp sortout
call WaitFor('line("$") > 3')
--- 966,980 ----
let options.in_top = 2
let options.in_bot = 4
endif
! let job = job_start('sort', options)
if !a:use_buffer
! call assert_equal("run", job_status(job))
! call ch_sendraw(job, "ccc\naaa\nddd\nbbb\neee\n")
! call ch_close_in(job)
endif
! call WaitForAssert({-> assert_equal("dead", job_status(job))})
sp sortout
call WaitFor('line("$") > 3')
***************
*** 985,992 ****
call assert_equal(['aaa', 'bbb', 'ddd'], getline(2, 4))
endif
! call job_stop(g:job)
! unlet g:job
if a:use_buffer
bwipe! sortin
endif
--- 985,991 ----
call assert_equal(['aaa', 'bbb', 'ddd'], getline(2, 4))
endif
! call job_stop(job)
if a:use_buffer
bwipe! sortin
endif
***************
*** 1186,1192 ****
split testout
let job = job_start([s:python, '-c',
\ 'import sys; [sys.stdout.write(".") and sys.stdout.flush() for _ in range(10000)]'], options)
! call assert_equal("run", job_status(job))
call WaitFor('len(join(getline(1, "$"), "")) >= 10000')
try
let totlen = 0
--- 1185,1192 ----
split testout
let job = job_start([s:python, '-c',
\ 'import sys; [sys.stdout.write(".") and sys.stdout.flush() for _ in range(10000)]'], options)
! " the job may be done quickly, also accept "dead"
! call assert_match('^\%(dead\|run\)$', job_status(job))
call WaitFor('len(join(getline(1, "$"), "")) >= 10000')
try
let totlen = 0
***************
*** 1247,1255 ****
endfunc
let job = job_start(s:python . " test_channel_pipe.py",
\ {'out_cb': dict.outHandler,
! \ 'out_mode': 'json',
! \ 'err_cb': dict.errHandler,
! \ 'err_mode': 'json'})
call assert_equal("run", job_status(job))
try
let g:Ch_outmsg = ''
--- 1247,1255 ----
endfunc
let job = job_start(s:python . " test_channel_pipe.py",
\ {'out_cb': dict.outHandler,
! \ 'out_mode': 'json',
! \ 'err_cb': dict.errHandler,
! \ 'err_mode': 'json'})
call assert_equal("run", job_status(job))
try
let g:Ch_outmsg = ''
***************
*** 1290,1297 ****
endfunc
let job = job_start(s:python . " test_channel_pipe.py quit now",
\ {'out_cb': 'OutHandler',
! \ 'close_cb': 'CloseHandler'})
! call assert_equal("run", job_status(job))
try
call WaitForAssert({-> assert_equal('quit', g:Ch_msg1)})
call WaitForAssert({-> assert_equal(2, g:Ch_closemsg)})
--- 1290,1298 ----
endfunc
let job = job_start(s:python . " test_channel_pipe.py quit now",
\ {'out_cb': 'OutHandler',
! \ 'close_cb': 'CloseHandler'})
! " the job may be done quickly, also accept "dead"
! call assert_match('^\%(dead\|run\)$', job_status(job))
try
call WaitForAssert({-> assert_equal('quit', g:Ch_msg1)})
call WaitForAssert({-> assert_equal(2, g:Ch_closemsg)})
***************
*** 1314,1320 ****
endfunc
let job = job_start(s:python . " test_channel_pipe.py quit now",
\ {'close_cb': 'CloseHandler'})
! call assert_equal("run", job_status(job))
try
call WaitForAssert({-> assert_equal('quit', g:Ch_received)})
finally
--- 1315,1322 ----
endfunc
let job = job_start(s:python . " test_channel_pipe.py quit now",
\ {'close_cb': 'CloseHandler'})
! " the job may be done quickly, also accept "dead"
! call assert_match('^\%(dead\|run\)$', job_status(job))
try
call WaitForAssert({-> assert_equal('quit', g:Ch_received)})
finally
***************
*** 1338,1344 ****
endfunc
let job = job_start(s:python . " test_channel_pipe.py incomplete",
\ {'close_cb': 'CloseHandler'})
! call assert_equal("run", job_status(job))
try
call WaitForAssert({-> assert_equal('incomplete', g:Ch_received)})
finally
--- 1340,1347 ----
endfunc
let job = job_start(s:python . " test_channel_pipe.py incomplete",
\ {'close_cb': 'CloseHandler'})
! " the job may be done quickly, also accept "dead"
! call assert_match('^\%(dead\|run\)$', job_status(job))
try
call WaitForAssert({-> assert_equal('incomplete', g:Ch_received)})
finally
***************
*** 1354,1363 ****
call ch_log('Test_out_cb_lambda()')
let job = job_start(s:python . " test_channel_pipe.py",
! \ {'out_cb': {ch, msg -> execute("let g:Ch_outmsg = 'lambda: ' . msg")},
! \ 'out_mode': 'json',
! \ 'err_cb': {ch, msg -> execute(":let g:Ch_errmsg = 'lambda: ' . msg")},
! \ 'err_mode': 'json'})
call assert_equal("run", job_status(job))
try
let g:Ch_outmsg = ''
--- 1357,1366 ----
call ch_log('Test_out_cb_lambda()')
let job = job_start(s:python . " test_channel_pipe.py",
! \ {'out_cb': {ch, msg -> execute("let g:Ch_outmsg = 'lambda: ' . msg")},
! \ 'out_mode': 'json',
! \ 'err_cb': {ch, msg -> execute(":let g:Ch_errmsg = 'lambda: ' . msg")},
! \ 'err_mode': 'json'})
call assert_equal("run", job_status(job))
try
let g:Ch_outmsg = ''
***************
*** 1385,1398 ****
let self.ret['exit_cb'] = job_status(a:job)
endfunc
! let g:job = job_start(has('win32') ? 'cmd /c echo:' : 'echo', {
! \ 'close_cb': g:retdict.close_cb,
! \ 'exit_cb': g:retdict.exit_cb,
! \ })
! call assert_equal('run', job_status(g:job))
! unlet g:job
call WaitForAssert({-> assert_equal(2, len(g:retdict.ret))})
! call assert_match('^\%(dead\|run\)', g:retdict.ret['close_cb'])
call assert_equal('dead', g:retdict.ret['exit_cb'])
unlet g:retdict
endfunc
--- 1388,1400 ----
let self.ret['exit_cb'] = job_status(a:job)
endfunc
! let job = job_start([&shell, &shellcmdflag, 'echo'],
! \ {'close_cb': g:retdict.close_cb,
! \ 'exit_cb': g:retdict.exit_cb})
! " the job may be done quickly, also accept "dead"
! call assert_match('^\%(dead\|run\)$', job_status(job))
call WaitForAssert({-> assert_equal(2, len(g:retdict.ret))})
! call assert_match('^\%(dead\|run\)$', g:retdict.ret['close_cb'])
call assert_equal('dead', g:retdict.ret['exit_cb'])
unlet g:retdict
endfunc
***************
*** 1415,1421 ****
let g:wipe_buf = bufnr('')
let job = job_start(has('win32') ? 'cmd /c echo:' : ['true'],
! \ {'exit_cb': 'ExitCbWipe'})
let timer = timer_start(300, {-> feedkeys("\<Esc>", 'nt')}, {'repeat': 5})
call feedkeys(repeat('g', 1000) . 'o', 'ntx!')
call WaitForAssert({-> assert_equal("dead", job_status(job))})
--- 1417,1423 ----
let g:wipe_buf = bufnr('')
let job = job_start(has('win32') ? 'cmd /c echo:' : ['true'],
! \ {'exit_cb': 'ExitCbWipe'})
let timer = timer_start(300, {-> feedkeys("\<Esc>", 'nt')}, {'repeat': 5})
call feedkeys(repeat('g', 1000) . 'o', 'ntx!')
call WaitForAssert({-> assert_equal("dead", job_status(job))})
***************
*** 1933,1939 ****
return
endif
! let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"', {'out_io': 'null', 'err_io': 'null', 'pty': 1})
let elapsed = WaitFor({-> job_status(job) ==# 'dead'})
call assert_inrange(200, 1000, elapsed)
call job_stop(job)
--- 1935,1942 ----
return
endif
! let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"',
! \ {'out_io': 'null', 'err_io': 'null', 'pty': 1})
let elapsed = WaitFor({-> job_status(job) ==# 'dead'})
call assert_inrange(200, 1000, elapsed)
call job_stop(job)
***************
*** 1985,1997 ****
try
let g:out = ''
let job = job_start(s:python . " test_channel_pipe.py",
! \ {'mode': 'raw', 'drop': 'never', 'noblock': 1,
! \ 'callback': {ch, msg -> execute('let g:out .= msg')}})
! let want = repeat('X', 79999) . "\n"
call ch_sendraw(job, want)
! let g:Ch_job = job
! call WaitForAssert({-> assert_equal("dead", job_status(g:Ch_job))})
call assert_equal(want, substitute(g:out, '\r', '', 'g'))
finally
call job_stop(job)
--- 1988,2001 ----
try
let g:out = ''
let job = job_start(s:python . " test_channel_pipe.py",
! \ {'mode': 'raw', 'drop': 'never', 'noblock': 1,
! \ 'callback': {ch, msg -> execute('let g:out .= msg')}})
! let outlen = 79999
! let want = repeat('X', outlen) . "\n"
call ch_sendraw(job, want)
! call WaitFor({-> len(g:out) >= outlen}, 10000)
! call WaitForAssert({-> assert_equal("dead", job_status(job))})
call assert_equal(want, substitute(g:out, '\r', '', 'g'))
finally
call job_stop(job)
*** ../vim-8.1.0819/src/testdir/test_filechanged.vim 2019-01-24 21:57:11.574719854 +0100
--- src/testdir/test_filechanged.vim 2019-01-25 20:54:17.931364655 +0100
***************
*** 90,96 ****
endfunc
func Test_file_changed_dialog()
! if !has('unix')
return
endif
au! FileChangedShell
--- 90,96 ----
endfunc
func Test_file_changed_dialog()
! if !has('unix') || has('gui_running')
return
endif
au! FileChangedShell
*** ../vim-8.1.0819/src/version.c 2019-01-25 20:48:29.385157333 +0100
--- src/version.c 2019-01-25 21:00:22.821191796 +0100
***************
*** 789,790 ****
--- 789,792 ----
{ /* Add new patch number below this line */
+ /**/
+ 820,
/**/
--
FIRST GUARD: Ah! Now ... we're not allowed to ...
SIR LAUNCELOT runs him through, grabs his spear and stabs the other
guard who collapses in a heap. Hiccoughs quietly.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///
|