Source-Changes-HG archive

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

[src/trunk]: src/tests/dev/sysmon Various cleanup (most from pooka@)



details:   https://anonhg.NetBSD.org/src/rev/3ee147281ff3
branches:  trunk
changeset: 760170:3ee147281ff3
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Dec 29 19:21:39 2010 +0000

description:
Various cleanup (most from pooka@)
        - Does not require root access on the host, only in the rump
          environment (which it gets by default)
        - Manual clean-up of powerd process and rump-server socket is
          not necessary - happens automatically
        - Don't use a global, absolute path for the rump-server socket

For alarm_sensor, make sure events are still delivered after 'envstat -S'
(the cur_value was deliberately left at an alarm level and should not be
affected by the reset).

No longer need to skip the alarm_sensor and limit_sensor tests, since
pooka fixed passing of proplist to built-in modules.

Increase wait time for first powerd event report.  (This should not be
needed, so there's probably a bug somewhere, but the increased timeout
lets us validate the rest of the sensor functionality.)

diffstat:

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

diffs (71 lines):

diff -r 3eaaab32e3e8 -r 3ee147281ff3 tests/dev/sysmon/t_swsensor.sh
--- a/tests/dev/sysmon/t_swsensor.sh    Wed Dec 29 18:49:41 2010 +0000
+++ b/tests/dev/sysmon/t_swsensor.sh    Wed Dec 29 19:21:39 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.1 2010/12/20 04:56:18 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.2 2010/12/29 19:21:39 pgoyette Exp $
 
 get_sensor_info() {
        rump.envstat -x | \
@@ -56,17 +56,11 @@
        atf_set require.progs   rump.powerd rump.envstat rump.modload   \
                                rump.halt   rump.sysctl  rump_allserver \
                                sed         grep
-       atf_set require.user    root
 }
 
 common_cleanup() {
-       if [ -n "$(jobs)" ] ; then
-               kill %1                 # get rid of our rump.powerd
-       fi
-
        rump.modunload swsensor
        rump.halt
-       rm -f ${RUMP_SERVER}
 }
 
 create_envsys_conf_files() {
@@ -95,10 +89,6 @@
 #      $5      difference from limit to trigger event
 
 common_body() {
-       if [ $1 -ne 0 ] ; then
-               atf_skip "rump.modload doesn't pass proplist attributes"
-       fi
-
        # Start the rump-server process and load the module
        start_rump "-i mode=$1 -i value=$2 -i limit=$3"
 
@@ -151,7 +141,7 @@
        # Step 5 - if sensor provides hw limit, make sure it works
        if [ $1 -ne 0 -a ${skip_events} -eq 0 ] ; then
                rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $5 ))
-               sleep 5
+               sleep 15
                cnt=$(get_powerd_event_count)
                if [ ${cnt} -lt ${expected_event} ] ; then
                        atf_fail "5: No event triggered"
@@ -240,7 +230,13 @@
                sleep 5
                cnt=$(get_powerd_event_count)
                if [ ${cnt} -ge ${expected_event} ] ; then
-                       atf_fail "9: Event triggered after reset"
+                       if [ $1 -ne 2 ] ; then
+                               atf_fail "11b Event triggered after reset"
+                       fi
+                       evt=$( check_powerd_event ${cnt} "critical-under")
+                       if [ -n "${evt}" ] ; then
+                               atf_fail "11a: ${evt}"
+                       fi
                fi
        fi
 
@@ -295,7 +291,7 @@
 }
 
 atf_init_test_cases() {
-       RUMP_SERVER="unix:///tmp/t_swsensor" ; export RUMP_SERVER
+       RUMP_SERVER="unix://t_swsensor_socket" ; export RUMP_SERVER
        atf_add_test_case simple_sensor
        atf_add_test_case limit_sensor
        atf_add_test_case alarm_sensor



Home | Main Index | Thread Index | Old Index