CVS commit: [netbsd-10] src/tests/sbin/envstat

2023-04-15 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Apr 15 12:08:42 UTC 2023

Modified Files:
src/tests/sbin/envstat [netbsd-10]: t_envstat.sh

Log Message:
Pull up the following revision (requested by martin in ticket #127):

tests/sbin/envstat/t_envstat.sh: revision 1.2

PR 57284: rewrite test to extract all temperaturs from all local sensors
and test them (instead of only one temperature from a tiny list of hard
coded possible devices).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.6.1 src/tests/sbin/envstat/t_envstat.sh

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



CVS commit: [netbsd-10] src/tests/sbin/envstat

2023-04-15 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Apr 15 12:08:42 UTC 2023

Modified Files:
src/tests/sbin/envstat [netbsd-10]: t_envstat.sh

Log Message:
Pull up the following revision (requested by martin in ticket #127):

tests/sbin/envstat/t_envstat.sh: revision 1.2

PR 57284: rewrite test to extract all temperaturs from all local sensors
and test them (instead of only one temperature from a tiny list of hard
coded possible devices).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.6.1 src/tests/sbin/envstat/t_envstat.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/sbin/envstat/t_envstat.sh
diff -u src/tests/sbin/envstat/t_envstat.sh:1.1 src/tests/sbin/envstat/t_envstat.sh:1.1.6.1
--- src/tests/sbin/envstat/t_envstat.sh:1.1	Thu Jun 25 15:01:35 2020
+++ src/tests/sbin/envstat/t_envstat.sh	Sat Apr 15 12:08:42 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_envstat.sh,v 1.1 2020/06/25 15:01:35 jruoho Exp $
+# $NetBSD: t_envstat.sh,v 1.1.6.1 2023/04/15 12:08:42 jdc Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,9 +36,8 @@ zerotemp_head() {
 
 zerotemp_body() {
 
-	devices="amdtemp0 coretemp0 acpitz0" # XXX: What else?
-
-	for dev in $devices; do
+	for dev in $( envstat -D | awk '{print $1}' )
+	do
 
 		envstat -d $dev >/dev/null 2>&1
 
@@ -47,18 +46,23 @@ zerotemp_body() {
 			continue
 		fi
 
-		if [ $dev = "amdtemp0" ]; then
-			atf_expect_fail "PR kern/53410"
-		fi
-
-		tempf=$(envstat -d $dev | awk '/Current/{getline;print $3}')
-		tempi=$(printf "%.0f" $tempf)
-
-		echo "$dev = $tempf =~ $tempi"
-
-		if [ $tempi -eq 0 ]; then
-			atf_fail "Zero-temperature from $dev"
-		fi
+		# extract all temperatures from $dev
+		for tempf in $(envstat -d $dev | \
+			awk -F: '/degC$/{print $2}' | \
+			awk '{print $1}' )
+		do
+			tempi=$(printf "%.0f" $tempf)
+
+			echo "$dev = $tempf =~ $tempi"
+
+			if [ $tempi -eq 0 ]; then
+
+if [ $dev = "amdtemp0" ]; then
+	atf_expect_fail "PR kern/53410"
+fi
+atf_fail "Zero-temperature from $dev"
+			fi
+		done
 	done
 }