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