| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: t_envstat.sh,v 1.1 2020/06/25 15:01:35 jruoho Exp $ | | 1 | # $NetBSD: t_envstat.sh,v 1.1.6.1 2023/04/15 12:08:42 jdc Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2020 The NetBSD Foundation, Inc. | | 3 | # Copyright (c) 2020 The NetBSD Foundation, Inc. |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # This code is derived from software contributed to The NetBSD Foundation | | 6 | # This code is derived from software contributed to The NetBSD Foundation |
7 | # by Jukka Ruohonen. | | 7 | # by Jukka Ruohonen. |
8 | # | | 8 | # |
9 | # Redistribution and use in source and binary forms, with or without | | 9 | # Redistribution and use in source and binary forms, with or without |
10 | # modification, are permitted provided that the following conditions | | 10 | # modification, are permitted provided that the following conditions |
11 | # are met: | | 11 | # are met: |
12 | # 1. Redistributions of source code must retain the above copyright | | 12 | # 1. Redistributions of source code must retain the above copyright |
13 | # notice, this list of conditions and the following disclaimer. | | 13 | # notice, this list of conditions and the following disclaimer. |
14 | # 2. Redistributions in binary form must reproduce the above copyright | | 14 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -26,42 +26,46 @@ | | | @@ -26,42 +26,46 @@ |
26 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | # POSSIBILITY OF SUCH DAMAGE. | | 28 | # POSSIBILITY OF SUCH DAMAGE. |
29 | # | | 29 | # |
30 | | | 30 | |
31 | atf_test_case zerotemp | | 31 | atf_test_case zerotemp |
32 | zerotemp_head() { | | 32 | zerotemp_head() { |
33 | atf_set "descr" "Check with envstat(8) that CPU sensors " \ | | 33 | atf_set "descr" "Check with envstat(8) that CPU sensors " \ |
34 | "do not show zero temperatures (PR kern/53410)" | | 34 | "do not show zero temperatures (PR kern/53410)" |
35 | } | | 35 | } |
36 | | | 36 | |
37 | zerotemp_body() { | | 37 | zerotemp_body() { |
38 | | | 38 | |
39 | devices="amdtemp0 coretemp0 acpitz0" # XXX: What else? | | 39 | for dev in $( envstat -D | awk '{print $1}' ) |
40 | | | 40 | do |
41 | for dev in $devices; do | | | |
42 | | | 41 | |
43 | envstat -d $dev >/dev/null 2>&1 | | 42 | envstat -d $dev >/dev/null 2>&1 |
44 | | | 43 | |
45 | if [ ! $? -eq 0 ]; then | | 44 | if [ ! $? -eq 0 ]; then |
46 | echo "Skipping non-existent $dev" | | 45 | echo "Skipping non-existent $dev" |
47 | continue | | 46 | continue |
48 | fi | | 47 | fi |
49 | | | 48 | |
50 | if [ $dev = "amdtemp0" ]; then | | 49 | # extract all temperatures from $dev |
51 | atf_expect_fail "PR kern/53410" | | 50 | for tempf in $(envstat -d $dev | \ |
52 | fi | | 51 | awk -F: '/degC$/{print $2}' | \ |
53 | | | 52 | awk '{print $1}' ) |
54 | tempf=$(envstat -d $dev | awk '/Current/{getline;print $3}') | | 53 | do |
55 | tempi=$(printf "%.0f" $tempf) | | 54 | tempi=$(printf "%.0f" $tempf) |
56 | | | 55 | |
57 | echo "$dev = $tempf =~ $tempi" | | 56 | echo "$dev = $tempf =~ $tempi" |
58 | | | 57 | |
59 | if [ $tempi -eq 0 ]; then | | 58 | if [ $tempi -eq 0 ]; then |
60 | atf_fail "Zero-temperature from $dev" | | 59 | |
61 | fi | | 60 | if [ $dev = "amdtemp0" ]; then |
| | | 61 | atf_expect_fail "PR kern/53410" |
| | | 62 | fi |
| | | 63 | atf_fail "Zero-temperature from $dev" |
| | | 64 | fi |
| | | 65 | done |
62 | done | | 66 | done |
63 | } | | 67 | } |
64 | | | 68 | |
65 | atf_init_test_cases() { | | 69 | atf_init_test_cases() { |
66 | atf_add_test_case zerotemp | | 70 | atf_add_test_case zerotemp |
67 | } | | 71 | } |