forked from sergei-mironov/xkb-switch
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
executable file
·64 lines (52 loc) · 1.24 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
#!/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
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"
"$X" -ds "$l"
"$X" --set="$l"
test "$($X -p)" = "$l"
done
"$X" -n
"$X" --next
! test "$X" -s fooooo
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