summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog64
1 files changed, 64 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog
new file mode 100755
index 0000000..71429fc
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog
@@ -0,0 +1,64 @@
1#!/bin/sh
2#
3# This script is used to test watchdog functionality for bsc9131rdb.
4
5WATCHDOG=`which watchdog`
6if [ "x$WATCHDOG" != "x" ]; then
7 echo "PASS: watchdog found"
8else
9 echo "FAIL: watchdog not found"
10 exit 1
11fi
12
13WATCHDOG_CONF=/etc/watchdog.conf
14if [ -f $WATCHDOG_CONF ]; then
15 echo "PASS: watchdog config file found"
16 sed -i '23,23 s/#//' $WATCHDOG_CONF
17else
18 echo "FAIL: watchdog config file not found"
19 exit 1
20fi
21
22$WATCHDOG -v /dev/watchdog
23watchdog_thread=`ps | grep -c 'watchdog -v /dev/watchdog'`
24if [ $watchdog_thread -eq 2 ]; then
25 echo "PASS: Watchdog daemon started successfully"
26else
27 echo "FAIL: Failed to start watchdog daemon"
28 exit 1
29fi
30
31sleep 5s
32
33killall watchdog
34
35retry=0
36while [ $retry -lt 10 ]
37do
38 watchdog_thread=`ps | grep -c 'watchdog -v /dev/watchdog'`
39 if [ $watchdog_thread -eq 1 ]; then
40 echo "PASS: Watchdog daemon stopped successfully"
41 break;
42 fi
43 sleep 1s
44 retry=`expr $retry + 1`
45done
46
47if [ $retry -eq 10 ]; then
48 echo "FAIL: Failed to stop watchdog daemon"
49fi
50
51found=0
52while read line
53do
54 result=`echo $line | grep -c 'still alive after 1 interval'`
55 if [ $result -eq 1 ]; then
56 echo "PASS: Watchdog is still alive after 1 interval"
57 found=1
58 fi
59done < /var/log/messages
60
61if [ $found -eq 0 ]; then
62 echo "FAIL: Watchdog is not alive after 1 interval"
63fi
64