Source-Changes-HG archive

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

[src/trunk]: src/tests/sbin/envstat PR 57284: rewrite test to extract all tem...



details:   https://anonhg.NetBSD.org/src/rev/98d06b329e15
branches:  trunk
changeset: 373980:98d06b329e15
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 23 11:32:49 2023 +0000

description:
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).

diffstat:

 tests/sbin/envstat/t_envstat.sh |  32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diffs (55 lines):

diff -r fe2296730f2e -r 98d06b329e15 tests/sbin/envstat/t_envstat.sh
--- a/tests/sbin/envstat/t_envstat.sh   Thu Mar 23 07:26:07 2023 +0000
+++ b/tests/sbin/envstat/t_envstat.sh   Thu Mar 23 11:32:49 2023 +0000
@@ -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.2 2023/03/23 11:32:49 martin 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
+               # 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"
 
-               tempf=$(envstat -d $dev | awk '/Current/{getline;print $3}')
-               tempi=$(printf "%.0f" $tempf)
+                       if [ $tempi -eq 0 ]; then
 
-               echo "$dev = $tempf =~ $tempi"
-
-               if [ $tempi -eq 0 ]; then
-                       atf_fail "Zero-temperature from $dev"
-               fi
+                               if [ $dev = "amdtemp0" ]; then
+                                       atf_expect_fail "PR kern/53410"
+                               fi
+                               atf_fail "Zero-temperature from $dev"
+                       fi
+               done
        done
 }
 



Home | Main Index | Thread Index | Old Index