fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian BoehmDisable some more tests under CI2508cc9de

master
1.7 KiB62 linesraw
1#!/usr/bin/env python3
2from pexpect_helper import SpawnedProc
3
4sp = SpawnedProc()
5send, sendline, sleep, expect_prompt, expect_re, expect_str = (
6    sp.send,
7    sp.sendline,
8    sp.sleep,
9    sp.expect_prompt,
10    sp.expect_re,
11    sp.expect_str,
12)
13
14from time import sleep
15from subprocess import call
16import os
17import signal
18import sys
19
20# Disable under CI - keeps failing because the timing is too tight
21if "CI" in os.environ:
22    sys.exit(127)
23
24# Test job summary for interactive shells.
25expect_prompt()
26
27sendline("function fish_job_summary; string join ':' $argv; end")
28expect_prompt()
29
30# fish_job_summary is called when background job ends.
31sendline("sleep 0.5 &")
32expect_prompt()
33expect_re("[0-9]+:0:sleep 0.5 &:ENDED", timeout=20)
34sendline("")
35expect_prompt()
36
37# fish_job_summary is called when background job is signalled.
38# cmd_line correctly prints only the actually backgrounded job.
39sendline("false; sleep 20 &; true")
40expect_prompt()
41sendline("set -l my_pid $last_pid")
42expect_prompt("")
43sendline("jobs")
44expect_re("Job.*Group.*(CPU)?.*State.*Command")
45expect_re(".*running.*sleep 20 &")
46expect_prompt()
47sendline("echo $my_pid")
48m = expect_re("\\d+\r\n")
49expect_prompt()
50os.kill(int(m.group()), signal.SIGTERM)
51expect_re("[0-9]+:0:sleep 20 &:SIGTERM:Polite quit request", timeout=20)
52sendline("")
53expect_prompt()
54
55# fish_job_summary is called when foreground job is signalled.
56# cmd_line contains the entire pipeline. proc_id and proc_name are set in a pipeline.
57sendline("true | sleep 6")
58sleep(0.200)
59# Beware: Mac pkill requires that the -P argument come before the process name,
60# else the -P argument is ignored.
61call(["pkill", "-KILL", "-P", str(sp.spawn.pid), "sleep"])
62expect_re("[0-9]+:1:true|sleep 6:SIGKILL:Forced quit:[0-9]+:sleep", timeout=10)