fork/fish-shell

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

Daniel Rainerci: disable pexpect and tmux tests in sanitizer jobs64e3b419b

master
2.1 KiB69 linesraw
1#!/usr/bin/env python3
2from pexpect_helper import SpawnedProc
3import platform
4
5import sys
6
7
8# Set a 0 terminal size
9sp = SpawnedProc(args=["-d", "term-support"], dimensions=(0, 0))
10send, sendline, sleep, expect_prompt, expect_re, expect_str = (
11    sp.send,
12    sp.sendline,
13    sp.sleep,
14    sp.expect_prompt,
15    sp.expect_re,
16    sp.expect_str,
17)
18
19expect_prompt()
20# Now confirm it defaulted to 80x24
21sendline("echo $COLUMNS $LINES")
22expect_str("80 24")
23expect_str("term-support: Terminal has 0 columns, falling back to default width")
24expect_str("term-support: Terminal has 0 rows, falling back to default height")
25expect_prompt()
26
27# See if $LINES/$COLUMNS change in response to sigwinch, also in a --on-signal function
28sendline("function on-winch --on-signal winch; echo $LINES $COLUMNS; end")
29expect_prompt()
30sleep(4)
31sp.spawn.setwinsize(40, 50)
32expect_str("40 50")
33sendline("echo $LINES $COLUMNS")
34expect_prompt("40 50")
35
36sp.spawn.setwinsize(20, 70)
37expect_str("20 70")
38sendline("echo $LINES $COLUMNS")
39expect_prompt("20 70")
40
41sendline("stty -a")
42expect_prompt()
43# Confirm flow control in the shell is disabled - we should ignore the ctrl-s in there.
44sendline("echo hello\x13hello")
45expect_prompt("hellohello")
46
47# Confirm it is off for external commands
48sendline("stty -a | string match -q '*-ixon -ixoff*'; echo $status")
49expect_prompt("0")
50
51# Turn flow control on
52sendline("stty ixon ixoff")
53expect_prompt()
54sendline("stty -a | string match -q '*ixon ixoff*'; echo $status")
55expect_prompt("0")
56
57sys.exit(0)
58# HACK: This fails on FreeBSD, macOS and NetBSD for some reason, maybe
59# a pexpect issue?
60# So disable it everywhere but linux for now.
61if platform.system() in ["Linux"]:
62    # Flow control does not work in CSI u mode, but it works while we are running an external process.
63    sendline("sh -c 'for i in $(seq 10); do echo $i; sleep 1; done")
64    sendline("hello\x13hello")
65    # This should not match because we should not get any output.
66    # Unfortunately we have to wait for the timeout to expire - set it to a second.
67    expect_str("hellohello", timeout=1, shouldfail=True)
68    send("\x11")  # ctrl-q to resume flow
69    expect_prompt("hellohello")