Lines Matching refs:job
1 " Test for channel and job functions.
3 " When +channel is supported then +job is too, so we don't check for that.
74 " check that getjob without a job is handled correctly
509 let job = job_start(s:python . " test_channel_pipe.py",
511 call assert_equal(v:t_job, type(job))
512 call assert_equal("run", job_status(job))
514 call assert_equal("open", ch_status(job))
515 call assert_equal("open", ch_status(job), {"part": "out"})
516 call assert_equal("open", ch_status(job), {"part": "err"})
517 call assert_fails('call ch_status(job, {"in_mode": "raw"})', 'E475:')
518 call assert_fails('call ch_status(job, {"part": "in"})', 'E475:')
520 let dict = ch_info(job)
531 " For a change use the job where a channel is expected.
532 call ch_sendraw(job, "echo something\n")
533 let msg = ch_readraw(job)
536 call ch_sendraw(job, "double this\n")
537 let g:handle = job->job_getchannel()
540 let msg = ch_readraw(job)
544 call ch_sendraw(job, "double this\n", {'callback': 'Ch_handler'})
547 call assert_fails("let i = ch_evalraw(job, '2 + 2', {'callback' : 'abc'})", 'E917:')
548 call assert_fails("let i = ch_evalexpr(job, '2 + 2')", 'E912:')
549 call assert_fails("let i = ch_evalraw(job, '2 + 2', {'drop' : ''})", 'E475:')
552 let reply = job->ch_evalraw("quit\n", {'timeout': 100})
555 call job_stop(job)
558 let g:Ch_job = job
560 let info = job->job_info()
568 if j == job
575 call assert_fails("call job_stop(job, [])", 'E730:')
578 " Try to use the job and channel where a number is expected. This is not
580 " already created job/channel.
581 let ch = job_getchannel(job)
582 call assert_fails('let i = job + 1', 'E910:')
584 call assert_fails('echo 2.0 == job', 'E911:')
592 let job = job_start(s:python . " test_channel_pipe.py",
594 call assert_equal(v:t_job, type(job))
595 call assert_equal("run", job_status(job))
597 call assert_equal("open", ch_status(job))
598 call assert_equal("open", ch_status(job), {"part": "out"})
608 call ch_sendraw(job, blob)
611 let msg = job->ch_readblob()
617 let reply = ch_evalraw(job, "quit\n", {'timeout': 100})
620 call job_stop(job)
623 let g:Ch_job = job
625 let info = job_info(job)
630 let job = job_start([s:python, "test_channel_pipe.py"])
631 call assert_equal("run", job_status(job))
633 let handle = job_getchannel(job)
650 call job_stop(job)
655 call job_stop(g:job)
659 call WaitForAssert({-> assert_equal('dead', job_status(g:job))})
666 let g:job = job_start(s:python . " test_channel_pipe.py",
668 call assert_equal("run", job_status(g:job))
670 let handle = job_getchannel(g:job)
683 let g:job = job_start(s:python . " test_channel_pipe.py",
685 call assert_equal("run", job_status(g:job))
687 let handle = job_getchannel(g:job)
700 let g:job = job_start(s:python . " test_channel_pipe.py",
702 call assert_equal("run", job_status(g:job))
704 let handle = job_getchannel(g:job)
716 let g:job = job_start(s:python . " test_channel_pipe.py",
718 call assert_equal("run", job_status(g:job))
720 let handle = job_getchannel(g:job)
758 let job = job_start(s:python . " test_channel_pipe.py", options)
759 call assert_equal("run", job_status(job))
761 let handle = job_getchannel(job)
777 call job_stop(job)
806 let job = job_start(s:python . " test_channel_write.py", options)
807 call assert_equal("run", job_status(job))
821 call job_stop(job)
845 let job = job_start(s:python . " test_channel_pipe.py", options)
846 call assert_equal("run", job_status(job))
848 let handle = job_getchannel(job)
862 call job_stop(job)
883 let job = job_start(s:python . " test_channel_pipe.py",
885 call assert_equal("run", job_status(job))
886 let handle = job_getchannel(job)
899 call job_stop(job)
913 let job = job_start(s:python . " test_channel_pipe.py", options)
914 call assert_equal("run", job_status(job))
916 call assert_equal(bufnr('%'), ch_getbufnr(job, 'in'))
919 let handle = job_getchannel(job)
925 call job_stop(job)
952 let job = job_start('sort', options)
955 call assert_equal("run", job_status(job))
956 call ch_sendraw(job, "ccc\naaa\nddd\nbbb\neee\n")
957 eval job->ch_close_in()
960 call WaitForAssert({-> assert_equal("dead", job_status(job))})
971 call job_stop(job)
991 let job = job_start(s:python . " test_channel_pipe.py",
993 call assert_equal("run", job_status(job))
995 let handle = job_getchannel(job)
1003 call job_stop(job)
1010 let job = job_start(s:python . " test_channel_pipe.py",
1012 call assert_equal("run", job_status(job))
1014 let handle = job_getchannel(job)
1022 call job_stop(job)
1043 let job = job_start(s:python . " test_channel_pipe.py",
1047 call assert_equal("run", job_status(job))
1065 call job_stop(job)
1074 let job = job_start(s:python . " test_channel_pipe.py",
1078 call assert_equal("run", job_status(job))
1091 call job_stop(job)
1123 " We cannot check that no I/O works, we only check that the job starts
1125 let job = job_start(s:python . " test_channel_pipe.py something",
1127 call assert_equal("run", job_status(job))
1129 call assert_equal('something', ch_read(job))
1131 call job_stop(job)
1134 let job = job_start(s:python . " test_channel_pipe.py err-out",
1136 call assert_equal("run", job_status(job))
1138 call assert_equal('err-out', ch_read(job, {"part": "err"}))
1140 call job_stop(job)
1143 let job = job_start(s:python . " test_channel_pipe.py something",
1145 call assert_equal("run", job_status(job))
1147 call assert_equal('something', ch_read(job))
1149 call job_stop(job)
1152 let job = job_start(s:python . " test_channel_pipe.py something",
1154 call assert_equal("run", job_status(job))
1155 call job_stop(job)
1157 let job = job_start(s:python . " test_channel_pipe.py something",
1159 call assert_equal("run", job_status(job))
1160 call assert_equal('channel fail', string(job_getchannel(job)))
1161 call assert_equal('fail', ch_status(job))
1164 call job_stop(job)
1170 let job = job_start([s:python, '-c',
1172 " the job may be done quickly, also accept "dead"
1173 call assert_match('^\%(dead\|run\)$', job_status(job))
1183 call job_stop(job)
1189 let job = job_start(s:python . " test_channel_pipe.py")
1190 call assert_equal("run", job_status(job))
1191 let handle = job_getchannel(job)
1196 call job_stop(job)
1199 let job = job_start(s:python . " test_channel_pipe.py", {'channel': handle})
1200 call assert_equal("run", job_status(job))
1201 let handle = job_getchannel(job)
1206 call job_stop(job)
1223 let job = job_start(s:python . " test_channel_pipe.py",
1228 call assert_equal("run", job_status(job))
1233 call ch_sendraw(job, "echo [0, \"hello\"]\n")
1234 call ch_sendraw(job, "echoerr [0, \"there\"]\n")
1240 call ch_sendraw(job, "echosplit [0, {\"one\": 1,| \"tw|o\": 2, \"three\": 3|}]\n")
1249 call job_stop(job)
1267 let job = job_start(s:python . " test_channel_pipe.py quit now",
1270 " the job may be done quickly, also accept "dead"
1271 call assert_match('^\%(dead\|run\)$', job_status(job))
1276 call job_stop(job)
1287 let job = job_start(s:python . " test_channel_pipe.py quit now",
1289 " the job may be done quickly, also accept "dead"
1290 call assert_match('^\%(dead\|run\)$', job_status(job))
1294 call job_stop(job)
1307 let job = job_start(s:python . " test_channel_pipe.py incomplete",
1309 " the job may be done quickly, also accept "dead"
1310 call assert_match('^\%(dead\|run\)$', job_status(job))
1314 call job_stop(job)
1320 let job = job_start(s:python . " test_channel_pipe.py",
1325 call assert_equal("run", job_status(job))
1329 call ch_sendraw(job, "echo [0, \"hello\"]\n")
1330 call ch_sendraw(job, "echoerr [0, \"there\"]\n")
1334 call job_stop(job)
1344 func g:retdict.exit_cb(job, status) dict argument
1345 let self.ret['exit_cb'] = job_status(a:job)
1348 let job = job_start([&shell, &shellcmdflag, 'echo'],
1351 " the job may be done quickly, also accept "dead"
1352 call assert_match('^\%(dead\|run\)$', job_status(job))
1361 function ExitCbWipe(job, status) argument
1374 let job = job_start(has('win32') ? 'cmd /c echo:' : ['true'],
1378 call WaitForAssert({-> assert_equal("dead", job_status(job))})
1530 function MyExitCb(job, status) argument
1543 " wait up to a second for the job to exit
1558 function MyExitTimeCb(job, status) argument
1559 if job_info(a:job).process == g:exit_cb_val.process
1570 let job = [s:python, '-c', 'import time;time.sleep(0.5)']->job_start({'exit_cb': 'MyExitTimeCb'})
1571 let g:exit_cb_val.process = job_info(job).process
1577 " case: unreferenced job, using timer
1583 …let g:job = job_start([s:python, '-c', 'import time;time.sleep(0.5)'], {'exit_cb': 'MyExitTimeCb'})
1584 let g:exit_cb_val.process = job_info(g:job).process
1585 unlet g:job
1704 " Empty job tests
1706 call assert_fails('let job = job_start([""])', 'E474:')
1707 call assert_fails('let job = job_start([" "])', 'E474:')
1708 call assert_fails('let job = job_start("")', 'E474:')
1709 call assert_fails('let job = job_start(" ")', 'E474:')
1710 call assert_fails('let job = job_start(["ls", []])', 'E730:')
1716 let g:job = job_start([s:python, '-c', 'import time;time.sleep(10)'])
1718 eval g:job->job_stop()
1719 call WaitForAssert({-> assert_equal('dead', job_status(g:job))})
1721 call job_stop(g:job, 'kill')
1722 unlet g:job
1767 let job = job_start('echo hello', {'out_io': 'buffer', 'out_name': 'test_buffer', 'out_msg': 0})
1776 let job = job_start('echo hello', {'out_io': 'buffer', 'out_name': 'test_buffer', 'out_msg': 0})
1788 let job = job_start('touch "file with space"')
1792 let job = job_start('touch file\ with\ space')
1800 " Test lines from the job containing NUL are stored correctly in a buffer.
1816 " Test lines from a buffer with NUL bytes are written correctly to the job.
1871 let job = job_start(cmd, {'callback': {ch,msg -> execute(":let g:echostr .= msg")}})
1872 let info = job_info(job)
1902 let job = job_start(cmd, {'callback': {ch,msg -> execute(":let g:envstr .= msg")}, 'cwd': expect})
1912 call job_stop(job)
1943 …let job = job_start([s:python, '-c', a:cmd], {'callback': {ch, msg -> execute('let g:out .= msg')}…
1953 call job_stop(job)
1988 let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"',
1990 let elapsed = WaitFor({-> job_status(job) ==# 'dead'})
1992 call job_stop(job)
2003 func ExitCb(job, status) argument
2014 let g:job = job_start(cmd, {'out_cb': 'OutCb', 'exit_cb': 'ExitCb'})
2027 call job_stop(g:job)
2033 unlet! g:job
2039 let job = job_start(s:python . " test_channel_pipe.py",
2045 eval job->ch_sendraw(want)
2047 call WaitForAssert({-> assert_equal("dead", job_status(job))})
2050 call job_stop(job)
2059 let job = job_start(s:python . " test_channel_pipe.py busy",
2061 call assert_fails('call ch_sendraw(job, repeat("X", 80000))', 'E631:')
2063 call job_stop(job)
2070 " Terminate job normally
2072 let job = job_start(cmd)
2073 call WaitForAssert({-> assert_equal("dead", job_status(job))})
2074 let info = job_info(job)
2078 " Terminate job by signal
2080 let job = job_start(cmd)
2083 call job_stop(job)
2084 call WaitForAssert({-> assert_equal("dead", job_status(job))})
2085 let info = job_info(job)
2118 let job = job_start('echo', opt)
2119 let info = job_info(job)
2132 call WaitForAssert({-> assert_equal('dead', job_status(job))})
2145 let job = job_start(s:python . " test_channel_pipe.py", {'err_io': 'out'})
2146 call assert_equal("run", job_status(job))
2148 let handle = job_getchannel(job)
2155 call job_stop(job)
2173 if l =~ 'Stopping job with'
2209 let g:job = job_start(cmd, {})
2210 sleep 50m " give the job time to start
2211 call job_stop(g:job)
2212 call WaitForAssert({-> assert_equal(-1, job_info(g:job).exitval)})
2214 let g:job = job_start(cmd, {})
2216 call job_stop(g:job, 'term')
2217 call WaitForAssert({-> assert_equal(-1, job_info(g:job).exitval)})
2219 let g:job = job_start(cmd, {})
2221 call job_stop(g:job, 'kill')
2222 call WaitForAssert({-> assert_equal(-1, job_info(g:job).exitval)})
2228 …let l:job = job_start([&shell, &shellcmdflag, has('win32') ? 'echo %VAR1% %VAR2%' : 'echo $VAR1 $V…
2229 let g:Ch_job = l:job
2238 let job = job_start("cat ", #{in_io: 'null'})
2239 call WaitForAssert({-> assert_equal("dead", job_status(job))})
2240 call assert_equal(0, job_info(job).exitval)
2316 …let job = job_start(['cmd', '/c', 'echo', 'Hello', 'World'], {'out_io' : 'buffer', 'out_buf' : bnu…
2317 call WaitForAssert({-> assert_equal("dead", job_status(job))})
2322 func ExitCb_cb_with_input(job, status) argument
2337 let job = job_start(cmd, {'out_cb': 'ExitCb_cb_with_input'})
2338 call WaitFor({-> job_status(job) == "dead"})
2346 let job = job_start(['date'], {'callback': { j, d -> add(queue, d) }})