-
Notifications
You must be signed in to change notification settings - Fork 39
/
test.sh
executable file
·76 lines (63 loc) · 1.53 KB
/
test.sh
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
#!/bin/sh
set -e -x
LIB=./libxkbswitch.so
X=./xkb-switch
if ! test -f "$LIB" ; then
echo "$LIB not found. Did you run ./test.sh from the build directory?" >&2
exit 1
fi
if ! test -f "$X" ; then
echo "$X not found. Did you run ./test.sh from the build directory?" >&2
exit 1
fi
if ! which gcc ; then
echo "GCC not found, check your environment" >&2
exit 1
fi
if ! which vim; then
echo "VIM is required for this test, check your environment" >&2
exit 1
fi
if test -z "$DISPLAY" ; then
echo "This test requires X-server connection" >&2
exit 1
fi
not() {(
set +e
$@
if test "$?" = "0" ; then
exit 1
else
exit 0
fi
)}
if which git; then
git status -vv
fi
setxkbmap -query
"$X" --version
"$X" --version 2>&1 | grep -q xkb-switch
"$X" --help 2>&1 | grep -q 'xkb-switch -s ARG'
test "$($X --help)" = "$($X -h)"
test "$($X --list)" = "$($X -l)"
for l in $($X --list) ; do
"$X" -s "$l" # Set the layout
"$X" -ds "$l" # Set the layout with debug info
"$X" --set="$l" # Set the layout using long form
test "$($X -p)" = "$l" # Make sure the layout is set
done
"$X" -n
"$X" --next
not "$X" -s fooo # Sets non-zero error code
$X --fancy # Fancy name
test "$($X --fancy)" != "$($X -p)"
cat >/tmp/vimxkbswitch <<EOF
let g:XkbSwitchLib = "$LIB"
echo libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
call libcall(g:XkbSwitchLib, 'Xkb_Switch_setXkbLayout', 'us')
quit
EOF
STDLIB=$(gcc --print-file-name=libstdc++.so)
LD_LIBRARY_PATH="`dirname $STDLIB`:$LD_LIBRARY_PATH" \
vim -S /tmp/vimxkbswitch
echo OK