~ubuntu-x-swat/xorg-server/xsmoke

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
#!/bin/sh

. $(dirname $0)/lib/xsmoke.lib

if [ "$1" = "prerequisites" ] ; then
    is_installed "wmctrl"   "run glxgears test" || exit 1
    is_installed "glxgears" "run glxgears test" || exit 1
    exit 0
fi

RUNTIME=6
INT=1
TMPFILE=$(mktemp) || die "Could not create temp file"

glxgears > $TMPFILE 2> /dev/null &

for i in $(seq 1 $INT $RUNTIME) ; do
    test_count=$(( $test_count + 1 ))
    sleep $INT
    x=$(( $i * 80 ))
    y=$x

    wmctrl -r glxgears -e 0,$x,$y,-1,-1
    if [ $? = 0 ]; then
        pass "Moved glxgears window"
    else
        fail "Error encountered while moving glxgears window"
    fi

done

# Close glxgears gracefully
test_count=$(( $test_count + 1 ))
wmctrl -c glxgears
if [ $? = 0 ]; then
    pass "glxgears was closed successfully"
else
    fail "glxgears could not be closed properly"
fi

cat $TMPFILE | cut -d'=' -f2
rm $TMPFILE

echo "Completed all tests"
if [ "${1%.json}" != "$1" ] ; then
    JSON=$1
    json_test_summary > $JSON
fi

print_test_summary