SPEC-2970: Improove logging size
[src/qa-testdefinitions.git] / common / scripts / service-check-gfx.sh
1 #!/bin/bash
2
3 export LANG=C
4 export TERM=dumb
5 export COLUMNS=1000
6
7 while getopts ":b:d:" option; do
8     case "${option}" in
9         b)
10             if [[ $OPTARG = -* ]]; then
11                 ((OPTIND--))
12                 continue
13             fi
14             BUILD_TAGS=${OPTARG}
15             ;;
16         d)
17             DEVICE_TAGS=${OPTARG}
18             ;;
19     esac
20 done
21
22 REQUIREDSOCKETS="dbus.socket security-manager.socket"
23 REQUIREDSERVICES="afm-system-daemon.service connman.service ofono.service weston.service bluetooth.service"
24
25 ALL="${REQUIREDSOCKETS} ${REQUIREDSERVICES}"
26 RESULT="unknown"
27
28 # add delay for services to fully start
29 sleep 10
30
31 for i in ${ALL} ; do
32     echo -e "\n\n########## Test for service ${i} being active ##########\n\n"
33     RESULT=""
34     if [[ ${i} == "weston.service" ]]; then
35         if [[ ${DEVICE_TAGS} != *"screen"* ]] || [[ ${BUILD_TAGS} != *"screen"* ]]; then
36             RESULT="skip"
37         fi
38     fi
39     if [[ -z $RESULT ]]; then
40         systemctl is-active ${i} >/dev/null 2>&1
41         if [ $? -eq 0 ] ; then
42             RESULT="pass"
43         else
44             RESULT="fail"
45         fi
46     fi
47
48     lava-test-case ${i} --result ${RESULT}
49     systemctl status ${i} || true
50     echo -e "\n\n"
51
52     echo -e "\n\n########## Result for service ${i} : $RESULT ##########\n\n"
53 done
54
55 echo "------------------------------------------------"
56 echo "All systemd units:"
57 echo "------------------------------------------------"
58 systemctl list-units || true
59 echo "------------------------------------------------"
60 echo "Only the failed systemd units:"
61 echo "------------------------------------------------"
62 ( systemctl list-units | grep failed ) || true
63
64 exit 0