BugFix: Package test script.
[profile/ivi/ico-uxf-device-input-controller.git] / tests / input-controller-test
1 #!/bin/sh
2 #
3 #       Device Input Controller Test for G27 steering switch
4 #
5 #         Remark: This examination premises that Weston does not run.
6
7 # 1 Delete log file
8 mkdir ../tests/testlog 2> /dev/null
9 rm -fr ../tests/testlog/* 2> /dev/null
10
11 # 2 set weston environment
12 export XDG_RUNTIME_DIR=/run/user/5000
13
14 # 3 Start Device Input Controllers
15 export DIC_GTFORCE_CONF="./testdata/g27racingwheel.conf"
16 ../gtforce/ico_dic-gtforce -Dstdout -L > ../tests/testlog/gtforce.log 2>&1 &
17 sleep 0.5
18
19 # 4 Start Weston
20 /usr/bin/weston --tty=1 --idle-time=0 $WESTON_BACKEND --log=../tests/testlog/weston.log &
21 sleep 180
22
23 # 5 End of Test
24 sleep 1
25 /usr/bin/killall ico_dic-gtforce
26 sleep 0.4
27 /usr/bin/killall -9 ico_dic-gtforce > /dev/nul 2>&1
28 sleep 0.1
29 /usr/bin/killall weston
30 sleep 1
31
32 # 9 Check Error
33 FOUND_ERR=0
34 /bin/grep "ERR>" testlog/*
35 if [ "$?" != "1" ] ; then
36         FOUND_ERR=1
37 fi
38 /bin/grep "WRN>" testlog/*
39 if [ "$?" != "1" ] ; then
40         FOUND_ERR=1
41 fi
42 /bin/grep "Error" testlog/*
43 if [ "$?" != "1" ] ; then
44         FOUND_ERR=1
45 fi
46 /bin/grep "error" testlog/*
47 if [ "$?" != "1" ] ; then
48         FOUND_ERR=1
49 fi
50 /bin/grep "Fail" testlog/* | /bin/grep -v "error_but_no_problem_for_test" | /bin/grep -v "initialize backlight" | /bin/grep -v "disconnect"
51 if [ "$?" != "1" ] ; then
52         FOUND_ERR=1
53 fi
54
55 if [ $FOUND_ERR = 0 ] ; then
56         echo "Device Input Controller Test: OK"
57 else
58         echo "Device Input Controller Test: ERROR"
59 fi
60