diff options
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p4080ds/rtc')
| -rwxr-xr-x | recipes-test/ddt-runner/files/scripts/p4080ds/rtc | 42 |
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 | |||
| 3 | RTC_DEVICE="/dev/rtc" | ||
| 4 | |||
| 5 | if [ ! -e $RTC_DEVICE ]; then | ||
| 6 | echo "FAIL: rtc device does not exist" | ||
| 7 | exit 1 | ||
| 8 | else | ||
| 9 | echo "PASS: rtc device exists" | ||
| 10 | fi | ||
| 11 | |||
| 12 | /sbin/hwclock -f $RTC_DEVICE | ||
| 13 | if [ $? -ne 0 ]; then | ||
| 14 | echo "FAIL: rtc device open failed" | ||
| 15 | exit 1 | ||
| 16 | else | ||
| 17 | echo "PASS: rtc device open success" | ||
| 18 | fi | ||
| 19 | |||
| 20 | |||
| 21 | /sbin/hwclock --systohc | ||
| 22 | if [ $? -ne 0 ]; then | ||
| 23 | echo "FAIL: sync system clock and hardware clock failed" | ||
| 24 | exit 1 | ||
| 25 | else | ||
| 26 | echo "PASS: sync system clock and hardware clock success" | ||
| 27 | fi | ||
| 28 | |||
| 29 | RTC_TIME=$(/sbin/hwclock -r |awk '{print $4}') | ||
| 30 | echo $RTC_TIME | ||
| 31 | SYS_TIME=$(date +%m/%d/%Y-%X |awk '{print $1}' |awk -F- '{print $2}') | ||
| 32 | echo $SYS_TIME | ||
| 33 | |||
| 34 | if [ "$RTC_TIME" = "$SYS_TIME" ] ; then | ||
| 35 | echo "PASS: system time same with hardware time" | ||
| 36 | else | ||
| 37 | echo "FAIL: system time different with hardware time" | ||
| 38 | exit 1 | ||
| 39 | fi | ||
| 40 | |||
| 41 | echo "PASS: rtc test successful" | ||
| 42 | exit 0 | ||
