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