blob: d4d0eef31a31ccc6fca8416f57aa7c71c2cf9b7a (
plain)
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
|
#!/bin/bash
. tests/shlib/common.sh
. tests/shlib/vterm.sh
enter_suite vshells
vterm_setup
HAS_SOCAT=
HAS_C_CLIENT=
git init "$TEST_ROOT/3rd"
git --git-dir="$TEST_ROOT/3rd/.git" checkout -b BRANCH
export DIR1="[32m"
export DIR2=""
mkdir "$TEST_ROOT/3rd/$DIR1"
mkdir "$TEST_ROOT/3rd/$DIR2"
mkdir "$TEST_ROOT"/3rd/'\[\]'
mkdir "$TEST_ROOT"/3rd/'%%'
mkdir "$TEST_ROOT"/3rd/'#[bold]'
mkdir "$TEST_ROOT"/3rd/'(echo)'
mkdir "$TEST_ROOT"/3rd/'$(echo)'
mkdir "$TEST_ROOT"/3rd/'`echo`'
mkdir "$TEST_ROOT"/3rd/'«Unicode!»'
mkdir "$TEST_ROOT/fish_home"
mkdir "$TEST_ROOT/fish_home/fish"
mkdir "$TEST_ROOT/fish_home/fish/generated_completions"
cp -r "$ROOT/tests/test_shells/ipython_home" "$TEST_ROOT"
ln -s "$(which env)" "$TEST_ROOT/path"
ln -s "$(which git)" "$TEST_ROOT/path"
ln -s "$(which sleep)" "$TEST_ROOT/path"
ln -s "$(which cat)" "$TEST_ROOT/path"
ln -s "$(which false)" "$TEST_ROOT/path"
ln -s "$(which true)" "$TEST_ROOT/path"
ln -s "$(which kill)" "$TEST_ROOT/path"
ln -s "$(which echo)" "$TEST_ROOT/path"
ln -s "$(which which)" "$TEST_ROOT/path"
ln -s "$(which dirname)" "$TEST_ROOT/path"
ln -s "$(which wc)" "$TEST_ROOT/path"
ln -s "$(which stty)" "$TEST_ROOT/path"
ln -s "$(which cut)" "$TEST_ROOT/path"
ln -s "$(which bc)" "$TEST_ROOT/path"
ln -s "$(which expr)" "$TEST_ROOT/path"
ln -s "$(which mktemp)" "$TEST_ROOT/path"
ln -s "$(which grep)" "$TEST_ROOT/path"
ln -s "$(which sed)" "$TEST_ROOT/path"
ln -s "$(which rm)" "$TEST_ROOT/path"
ln -s "$(which tr)" "$TEST_ROOT/path"
ln -s "$(which uname)" "$TEST_ROOT/path"
ln -s "$(which test)" "$TEST_ROOT/path"
ln -s "$(which pwd)" "$TEST_ROOT/path"
ln -s "$(which hostname)" "$TEST_ROOT/path"
ln -s "$ROOT/tests/test_shells/bgscript.sh" "$TEST_ROOT/path"
ln -s "$ROOT/tests/test_shells/waitpid.sh" "$TEST_ROOT/path"
ln -s "$ROOT/scripts/powerline-config" "$TEST_ROOT/path"
ln -s "$ROOT/scripts/powerline-render" "$TEST_ROOT/path"
ln -s "$ROOT/client/powerline.py" "$TEST_ROOT/path"
if test -e "$ROOT/scripts/powerline" ; then
ln -s "$ROOT/scripts/powerline" "$TEST_ROOT/path"
elif test -e client/powerline ; then
ln -s "$ROOT/client/powerline" "$TEST_ROOT/path"
elif which powerline ; then
ln -s "$(which powerline)" "$TEST_ROOT/path"
else
echo "Executable powerline was not found"
exit 1
fi
if test "$(
file --mime-type --brief --dereference "$TEST_ROOT/path/powerline" \
| cut -d/ -f1)" = "application" ; then
HAS_C_CLIENT=1
fi
if which socat ; then
HAS_SOCAT=1
ln -s "$(which socat)" "$TEST_ROOT/path"
ln -s "$ROOT/client/powerline.sh" "$TEST_ROOT/path"
fi
# Test type: daemon, renderer, …
# Test client: python, shell, c, none
# Test binding: *sh, ipython, pdb, …
test_shell() {
local test_type="$1" ; shift
local test_client="$1" ; shift
local test_binding="$1" ; shift
if test "$test_client" = shell && test -z "$HAS_SOCAT" ; then
echo "Skipping test, socat not available"
return
fi
if test "$test_client" = c && test -z "$HAS_C_CLIENT" ; then
echo "Skipping test, C client not available"
return
fi
if which "$test_binding" ; then
ln -s "$(which "$test_binding")" "$TEST_ROOT/path"
fi
if ! "${PYTHON}" "$ROOT/tests/test_in_vterm/test_shells.py" \
--type=$test_type \
--client=$test_client \
--binding=$test_binding \
-- "$@"
then
local test_name="$test_type-$test_client-$test_binding"
fail "$test_name" F "Failed vterm shell test"
fi
}
test_shell renderer python dash -i || true
vterm_shutdown
exit_suite
|