diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2016-10-17 18:18:10 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2016-10-17 18:18:10 +0300 |
commit | 61fb197638fb70b62f70b2147254caa4171c1a42 (patch) | |
tree | 6cdf1277022f5a5a3a904dab4af83d2f112c1ba9 | |
parent | 1641f4c88f150d9bac7bbe665036c697cd44fd57 (diff) |
[BOOT-5202] changes to uptime measurement for macOS and others
-rw-r--r-- | include/tests_boot_services | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/tests_boot_services b/include/tests_boot_services index 0484c70f..9167b155 100644 --- a/include/tests_boot_services +++ b/include/tests_boot_services @@ -693,17 +693,25 @@ fi ;; - DragonFly|FreeBSD|MacOS) + DragonFly | FreeBSD | MacOS) if [ ! -z "${SYSCTLBINARY}" ]; then - FIND=$(${SYSCTLBINARY} kern.boottime | ${AWKBINARY} '{ print $5 }' | ${SEDBINARY} -e 's/,//' | ${GREPBINARY} "[0-9]") + TIME_BOOT=$(${SYSCTLBINARY} kern.boottime | ${AWKBINARY} '{ print $5 }' | ${SEDBINARY} -e 's/,//' | ${GREPBINARY} "[0-9]") + TIME_NOW=$(date "+%s") + LogText "Boot time: ${TIME_BOOT}" + LogText "Current time: ${TIME_NOW}" + if [ ! -z "${TIME_BOOT}" -a ! -z "${TIME_NOW}" ]; then + UPTIME_IN_SECS=$((TIME_NOW - TIME_BOOT)) + else + ReportException "${TEST_NO}:5" "Most likely kern.boottime empty, unable to determine uptime" + fi else Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW ReportException "${TEST_NO}:4" "No uptime test available for this operating system (sysctl missing)" fi ;; - NetBSD|OpenBSD) - if [ ! "${SYSCTLBINARY}" = "" ]; then + NetBSD | OpenBSD) + if [ ! -z "${SYSCTLBINARY}" ]; then TIME_BOOT=$(${SYSCTLBINARY} -n kern.boottime) TIME_NOW=$(date "+%s") LogText "Boot time: ${TIME_BOOT}" |