summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/p4080ds/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p4080ds/rtc')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/p4080ds/rtc42
1 files changed, 42 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/p4080ds/rtc b/recipes-test/ddt-runner/files/scripts/p4080ds/rtc
new file mode 100755
index 0000000..0d38293
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/p4080ds/rtc
@@ -0,0 +1,42 @@
1#!/bin/sh
2
3RTC_DEVICE="/dev/rtc"
4
5if [ ! -e $RTC_DEVICE ]; then
6 echo "FAIL: rtc device does not exist"
7 exit 1
8else
9 echo "PASS: rtc device exists"
10fi
11
12/sbin/hwclock -f $RTC_DEVICE
13if [ $? -ne 0 ]; then
14 echo "FAIL: rtc device open failed"
15 exit 1
16else
17 echo "PASS: rtc device open success"
18fi
19
20
21/sbin/hwclock --systohc
22if [ $? -ne 0 ]; then
23 echo "FAIL: sync system clock and hardware clock failed"
24 exit 1
25else
26 echo "PASS: sync system clock and hardware clock success"
27fi
28
29RTC_TIME=$(/sbin/hwclock -r |awk '{print $4}')
30echo $RTC_TIME
31SYS_TIME=$(date +%m/%d/%Y-%X |awk '{print $1}' |awk -F- '{print $2}')
32echo $SYS_TIME
33
34if [ "$RTC_TIME" = "$SYS_TIME" ] ; then
35 echo "PASS: system time same with hardware time"
36else
37 echo "FAIL: system time different with hardware time"
38 exit 1
39fi
40
41echo "PASS: rtc test successful"
42exit 0