Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/dev/sysmon Include better diagnostic info when a requi...



details:   https://anonhg.NetBSD.org/src/rev/0f5fe88e4aec
branches:  trunk
changeset: 337694:0f5fe88e4aec
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Thu Apr 23 23:23:28 2015 +0000

description:
Include better diagnostic info when a required key value cannot be retrieved from envstat -x

diffstat:

 tests/dev/sysmon/t_swsensor.sh |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r eb164454f3ff -r 0f5fe88e4aec tests/dev/sysmon/t_swsensor.sh
--- a/tests/dev/sysmon/t_swsensor.sh    Thu Apr 23 23:23:20 2015 +0000
+++ b/tests/dev/sysmon/t_swsensor.sh    Thu Apr 23 23:23:28 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.8 2015/02/27 09:16:07 martin Exp $
+# $NetBSD: t_swsensor.sh,v 1.9 2015/04/23 23:23:28 pgoyette Exp $
 
 get_sensor_info() {
        rump.envstat -x | \
@@ -6,7 +6,13 @@
 }
 
 get_sensor_key() {
-       get_sensor_info | grep -A1 $1 | grep integer | sed -e 's;<[/a-z]*>;;g'
+       local v
+       v=$(get_sensor_info | grep -A1 $1 | grep integer | \
+           sed -e 's;<[/a-z]*>;;g')
+       if [ -z "$v" ] ; then
+               v="key_$1_not_found"
+       fi
+       echo $v
 }
 
 get_powerd_event_count() {



Home | Main Index | Thread Index | Old Index