Module Name:    src
Committed By:   pgoyette
Date:           Thu Apr 23 23:23:28 UTC 2015

Modified Files:
        src/tests/dev/sysmon: t_swsensor.sh

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


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/dev/sysmon/t_swsensor.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/sysmon/t_swsensor.sh
diff -u src/tests/dev/sysmon/t_swsensor.sh:1.8 src/tests/dev/sysmon/t_swsensor.sh:1.9
--- src/tests/dev/sysmon/t_swsensor.sh:1.8	Fri Feb 27 09:16:07 2015
+++ src/tests/dev/sysmon/t_swsensor.sh	Thu Apr 23 23:23:28 2015
@@ -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_info() {
 }
 
 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() {

Reply via email to