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

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

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

# TODO:  Detect or take as an input
OUTPUT=VGA-0
XRANDR_RES=$(dirname $0)/lib/xrandr-res

# xrandr version testing
test_count=$(( $test_count + 1 ))
xrandr_expected_version=$(get_installed_version "xrandr" | sed -e "s/^[0-9]://" | cut -d- -f1)
xrandr_version=$(xrandr -d $DISPLAY --version)
if [ $? = 0 ]; then
    version=$(echo $xrandr_version | sed -e "s/^.*version \([0-9\.]\+\)$/\1/")
    if [ $? = 0 ]; then
        output=$(echo $xrandr_expected_version | egrep "^$version" > /dev/null)
        if [ $? = 0 ]; then
            pass "xrandr --version meets $xrandr_version_expected"
        else
            fail "Expected xrandr version $xrandr_expected_version, but xrandr reports $version"
        fi
    else
        fail "Could not determine version from xrandr --version: $xrandr_version"
    fi
else
    fail "xrandr --version returned an error: $xrandr_version"
fi

# xrandr output testing
#test_count=$(( $test_count + 1 ))
#xrandr_verbose=`xrandr -d :0 --verbose`
#if [ $? = 0 ]; then
#    pass "xrandr generated verbose output"
#else
#    fail "xrandr failed to provide verbose  output"
#fi


MODES=$(${XRANDR_RES} | grep -e "^VGA-0" | cut -d ":" -f2 | cut -d "=" -f1)
for mode in $MODES; do
    echo $mode 
    xrandr --output $OUTPUT --mode $mode
    sleep 3
done

xrandr --output $OUTPUT --auto
sleep 3

xrandr --output $OUTPUT --reflect xy
sleep 3

xrandr --output $OUTPUT --reflect normal
sleep 3

xrandr --output $OUTPUT --off
sleep 3

xrandr --output $OUTPUT --auto
sleep 3

xrandr --output $OUTPUT --rotate inverted
sleep 3

xrandr --output $OUTPUT --rotate left
sleep 3

xrandr --output $OUTPUT --rotate right
sleep 3

xrandr --output $OUTPUT --rotate normal
sleep 3

# Verify Xorg restarts correctly as currently configured
test_xorg_restart

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

print_test_summary