CVS commit: src/tests/dev/sysmon

2021-06-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 13 14:45:36 UTC 2021

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

Log Message:
tests/dev/sysmon: Query bits of data, not bits of entropy.

Fixes PR kern/47661.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/tests/dev/sysmon/t_swsensor.sh:1.12
--- src/tests/dev/sysmon/t_swsensor.sh:1.11	Sat Mar 21 04:50:21 2020
+++ src/tests/dev/sysmon/t_swsensor.sh	Sun Jun 13 14:45:36 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.11 2020/03/21 04:50:21 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.12 2021/06/13 14:45:36 riastradh Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -24,7 +24,7 @@ get_rnd_bits_count() {
 	RUMP_SERVER=unix://t_swsensor_socket	\
 	LD_PRELOAD=/usr/lib/librumphijack.so	  rndctl -l | \
 	grep "swsensor-sensor" | \
-	awk '{print $2}'
+	awk '{print $3}'
 }
 
 check_powerd_event() {
@@ -296,19 +296,16 @@ common_body() {
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "14a: entropy bits did not increase after polling"
 	fi
 	rnd_bits=$new_rnd_bits
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "14b: entropy bits increased after poll with no value change"
 	fi
 
 	# Step 15 - make sure entropy collected when device is interrogated
-	# 
 	rump.envstat -c env0.conf
 	rump.sysctl -w hw.swsensor.cur_value=$3
 	get_sensor_key cur-value
@@ -317,14 +314,12 @@ common_body() {
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "15a: entropy bits did not increase after interrogation"
 	fi
 	rnd_bits=$new_rnd_bits
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "15b: entropy bits increased after interrogation with no value change"
 	fi
 }



CVS commit: src/tests/dev/sysmon

2021-06-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 13 14:45:36 UTC 2021

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

Log Message:
tests/dev/sysmon: Query bits of data, not bits of entropy.

Fixes PR kern/47661.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.



CVS commit: src/tests/dev/sysmon

2020-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 21 04:50:22 UTC 2020

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

Log Message:
These test cases should now succeed, after fixing rump kernel to handle
modules that establish their sysctls via SYSCTL_SETUP()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/tests/dev/sysmon/t_swsensor.sh:1.11
--- src/tests/dev/sysmon/t_swsensor.sh:1.10	Thu Mar 19 20:10:49 2020
+++ src/tests/dev/sysmon/t_swsensor.sh	Sat Mar 21 04:50:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.10 2020/03/19 20:10:49 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.11 2020/03/21 04:50:21 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -145,7 +145,6 @@ common_body() {
 	# Step 3 - verify that changes in sensor value are seen
 	rump.sysctl -w hw.swsensor.cur_value=$(( $2 + 1 ))
 	if [ $( get_sensor_key cur-value ) -ne $(( $2 + 1 )) ] ; then
-		atf_expect_fail "PR kern/55088"
 		atf_fail "3: Value not updated"
 	fi
 



CVS commit: src/tests/dev/sysmon

2020-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 21 04:50:22 UTC 2020

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

Log Message:
These test cases should now succeed, after fixing rump kernel to handle
modules that establish their sysctls via SYSCTL_SETUP()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.



CVS commit: src/tests/dev/sysmon

2020-03-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 19 20:10:49 UTC 2020

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

Log Message:
Mark the swsensor tests "expected failure" since the rump world doesn't
seem to handle the SYSCTL_SETUP stuff.  PR kern/55088


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.



CVS commit: src/tests/dev/sysmon

2020-03-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 19 20:10:49 UTC 2020

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

Log Message:
Mark the swsensor tests "expected failure" since the rump world doesn't
seem to handle the SYSCTL_SETUP stuff.  PR kern/55088


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/tests/dev/sysmon/t_swsensor.sh:1.10
--- src/tests/dev/sysmon/t_swsensor.sh:1.9	Thu Apr 23 23:23:28 2015
+++ src/tests/dev/sysmon/t_swsensor.sh	Thu Mar 19 20:10:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.9 2015/04/23 23:23:28 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.10 2020/03/19 20:10:49 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -145,6 +145,7 @@ common_body() {
 	# Step 3 - verify that changes in sensor value are seen
 	rump.sysctl -w hw.swsensor.cur_value=$(( $2 + 1 ))
 	if [ $( get_sensor_key cur-value ) -ne $(( $2 + 1 )) ] ; then
+		atf_expect_fail "PR kern/55088"
 		atf_fail "3: Value not updated"
 	fi
 



CVS commit: src/tests/dev/sysmon

2015-04-23 Thread Paul Goyette
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.



CVS commit: src/tests/dev/sysmon

2015-04-23 Thread Paul Goyette
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() {



CVS commit: src/tests/dev/sysmon

2015-04-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Apr 23 04:49:37 UTC 2015

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
When exiting, provide a reason.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/sysmon/t_swwdog.c

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



CVS commit: src/tests/dev/sysmon

2015-04-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Apr 23 04:49:37 UTC 2015

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
When exiting, provide a reason.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/sysmon/t_swwdog.c

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_swwdog.c
diff -u src/tests/dev/sysmon/t_swwdog.c:1.5 src/tests/dev/sysmon/t_swwdog.c:1.6
--- src/tests/dev/sysmon/t_swwdog.c:1.5	Sun Jun 26 12:14:59 2011
+++ src/tests/dev/sysmon/t_swwdog.c	Thu Apr 23 04:49:37 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_swwdog.c,v 1.5 2011/06/26 12:14:59 christos Exp $	*/
+/*	$NetBSD: t_swwdog.c,v 1.6 2015/04/23 04:49:37 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -121,6 +121,7 @@ testbody(int max)
 		_exit(2);
 	}
 	/* fail */
+	printf(no watchdog registered!\n);
 	_exit(1);
 }
 



CVS commit: src/tests/dev/sysmon

2015-02-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 27 09:16:07 UTC 2015

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

Log Message:
Double the timeout (to 120s) for slower machines


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.



CVS commit: src/tests/dev/sysmon

2015-02-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 27 09:16:07 UTC 2015

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

Log Message:
Double the timeout (to 120s) for slower machines


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/tests/dev/sysmon/t_swsensor.sh:1.8
--- src/tests/dev/sysmon/t_swsensor.sh:1.7	Sun Apr 14 16:07:46 2013
+++ src/tests/dev/sysmon/t_swsensor.sh	Fri Feb 27 09:16:07 2015
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.7 2013/04/14 16:07:46 martin Exp $
+# $NetBSD: t_swsensor.sh,v 1.8 2015/02/27 09:16:07 martin Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -60,7 +60,7 @@ start_rump() {
 
 common_head() {
 	atf_set	descr		$1
-	atf_set	timeout		60
+	atf_set	timeout		120
 	atf_set	require.progs	rump.powerd rump.envstat rump.modload	\
 rump.halt   rump.sysctl  rump_server	\
 sed grep awk		\



CVS commit: src/tests/dev/sysmon

2013-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 14 16:07:47 UTC 2013

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

Log Message:
The sh api calls it atf_expect_fail, while the c api calls it
atf_tc_expect_fail - this is shell, so fix the names accordingly.
XXX Why do they differ?


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/tests/dev/sysmon/t_swsensor.sh:1.7
--- src/tests/dev/sysmon/t_swsensor.sh:1.6	Sun Mar 17 06:29:55 2013
+++ src/tests/dev/sysmon/t_swsensor.sh	Sun Apr 14 16:07:46 2013
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.6 2013/03/17 06:29:55 jmmv Exp $
+# $NetBSD: t_swsensor.sh,v 1.7 2013/04/14 16:07:46 martin Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -290,14 +290,14 @@ common_body() {
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
-		atf_tc_expect_fail PR kern/47661
+		atf_expect_fail PR kern/47661
 		atf_fail 14a: entropy bits did not increase after polling
 	fi
 	rnd_bits=$new_rnd_bits
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
-		atf_tc_expect_fail PR kern/47661
+		atf_expect_fail PR kern/47661
 		atf_fail 14b: entropy bits increased after poll with no value change
 	fi
 
@@ -311,14 +311,14 @@ common_body() {
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
-		atf_tc_expect_fail PR kern/47661
+		atf_expect_fail PR kern/47661
 		atf_fail 15a: entropy bits did not increase after interrogation
 	fi
 	rnd_bits=$new_rnd_bits
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
-		atf_tc_expect_fail PR kern/47661
+		atf_expect_fail PR kern/47661
 		atf_fail 15b: entropy bits increased after interrogation with no value change
 	fi
 }



CVS commit: src/tests/dev/sysmon

2013-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 14 16:07:47 UTC 2013

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

Log Message:
The sh api calls it atf_expect_fail, while the c api calls it
atf_tc_expect_fail - this is shell, so fix the names accordingly.
XXX Why do they differ?


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.



CVS commit: src/tests/dev/sysmon

2013-03-17 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Mar 17 06:29:55 UTC 2013

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

Log Message:
These tests are flaky so mark them as expected failures... when they fail.
See PR kern/47661.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.5 src/tests/dev/sysmon/t_swsensor.sh:1.6
--- src/tests/dev/sysmon/t_swsensor.sh:1.5	Thu Jul 19 13:36:18 2012
+++ src/tests/dev/sysmon/t_swsensor.sh	Sun Mar 17 06:29:55 2013
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.5 2012/07/19 13:36:18 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.6 2013/03/17 06:29:55 jmmv Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -290,12 +290,14 @@ common_body() {
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
+		atf_tc_expect_fail PR kern/47661
 		atf_fail 14a: entropy bits did not increase after polling
 	fi
 	rnd_bits=$new_rnd_bits
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
+		atf_tc_expect_fail PR kern/47661
 		atf_fail 14b: entropy bits increased after poll with no value change
 	fi
 
@@ -309,12 +311,14 @@ common_body() {
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
+		atf_tc_expect_fail PR kern/47661
 		atf_fail 15a: entropy bits did not increase after interrogation
 	fi
 	rnd_bits=$new_rnd_bits
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
+		atf_tc_expect_fail PR kern/47661
 		atf_fail 15b: entropy bits increased after interrogation with no value change
 	fi
 }



CVS commit: src/tests/dev/sysmon

2013-03-17 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Mar 17 06:29:55 UTC 2013

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

Log Message:
These tests are flaky so mark them as expected failures... when they fail.
See PR kern/47661.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.



CVS commit: src/tests/dev/sysmon

2012-07-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 19 13:36:18 UTC 2012

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

Log Message:
Add new test cases for entropy-providing sensors


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/tests/dev/sysmon/t_swsensor.sh:1.5
--- src/tests/dev/sysmon/t_swsensor.sh:1.4	Fri Dec 31 00:35:42 2010
+++ src/tests/dev/sysmon/t_swsensor.sh	Thu Jul 19 13:36:18 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.4 2010/12/31 00:35:42 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.5 2012/07/19 13:36:18 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -13,6 +13,14 @@ get_powerd_event_count() {
 	grep not running powerd.log | wc -l
 }
 
+get_rnd_bits_count() {
+	env RUMPHIJACK=blanket=/dev/random:/dev/urandom	\
+	RUMP_SERVER=unix://t_swsensor_socket	\
+	LD_PRELOAD=/usr/lib/librumphijack.so	  rndctl -l | \
+	grep swsensor-sensor | \
+	awk '{print $2}'
+}
+
 check_powerd_event() {
 	event=$(grep not running powerd.log | \
 		sed -e $1p -e d )
@@ -40,7 +48,7 @@ check_powerd_event() {
 # requested properties
 
 start_rump() {
-	rump_server -l rumpvfs -l rumpdev -l rumpdev_sysmon ${RUMP_SERVER}
+	rump_allserver -l rumpvfs -l rumpdev -l rumpdev_sysmon ${RUMP_SERVER}
 	if [ $( get_sensor_info | wc -l ) -ne 0 ] ; then
 		rump.modunload swsensor
 		rump.modload -f $1 swsensor
@@ -55,7 +63,8 @@ common_head() {
 	atf_set	timeout		60
 	atf_set	require.progs	rump.powerd rump.envstat rump.modload	\
 rump.halt   rump.sysctl  rump_server	\
-sed grep
+sed grep awk		\
+rndctl  expr
 }
 
 common_cleanup() {
@@ -87,10 +96,12 @@ ENV2
 #	$3	initial limit
 #	$4	amount to lower limit
 #	$5	difference from limit to trigger event
+#	$6	sensor flags, for FHAS_ENTROPY and FMONNOTSUPP
 
 common_body() {
 	# Start the rump-server process and load the module
-	start_rump -i mode=$1 -i value=$2 -i limit=$3
+	modload_args=-i mode=$1 -i value=$2 -i limit=$3 ${6:+-i flags=$6}
+	start_rump $modload_args
 
 	# create configuration files for updates
 	create_envsys_conf_files $3 $4
@@ -173,81 +184,138 @@ common_body() {
 	fi
 
 	# Step 7 - verify that we can set our own limit
-	rump.envstat -c env1.conf
-	if [ $( get_sensor_key critical-min ) -ne $(( $3 - $4 )) ] ; then
-		atf_fail 7: Limit not set by envstat -c
-	fi
 
-	# Step 8 - make sure user-set limit works
-	if [ ${skip_events} -eq 0 ] ; then
-		rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $4 - $5 ))
-		sleep 5
-		cnt=$(get_powerd_event_count)
-		if [ ${cnt} -lt ${expected_event} ] ; then
-			atf_fail 8: No event triggered
-		elif [ ${cnt} -gt ${expected_event} ] ; then
-			atf_fail 8: Multiple events triggered
+	# Steps 7 thru 12 are skipped if the sensor cannot be monitored
+	if [ $( expr \( 0$6 / 2048 \) % 2 ) -ne 1 ] ; then
+		rump.envstat -c env1.conf
+		if [ $( get_sensor_key critical-min ) -ne $(( $3 - $4 )) ] ; then
+			atf_fail 7: Limit not set by envstat -c
 		fi
-		evt=$( check_powerd_event ${cnt} critical-under)
-		if [ -n ${evt} ] ; then
-			atf_fail 8: ${evt}
+
+	# Step 8 - make sure user-set limit works
+		if [ ${skip_events} -eq 0 ] ; then
+			rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $4 - $5 ))
+			sleep 5
+			cnt=$(get_powerd_event_count)
+			if [ ${cnt} -lt ${expected_event} ] ; then
+atf_fail 8: No event triggered
+			elif [ ${cnt} -gt ${expected_event} ] ; then
+atf_fail 8: Multiple events triggered
+			fi
+			evt=$( check_powerd_event ${cnt} critical-under)
+			if [ -n ${evt} ] ; then
+atf_fail 8: ${evt}
+			fi
+			expected_event=$(( 1 + ${expected_event} ))
 		fi
-		expected_event=$(( 1 + ${expected_event} ))
-	fi
 
 	# Step 9 - verify that we return to normal state
-	if [ ${skip_events} -eq 0 ] ; then
-		rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $4 + $5 ))
-		sleep 5
-		cnt=$(get_powerd_event_count)
-		if [ ${cnt} -lt ${expected_event} ] ; then
-			atf_fail 9: No event triggered
-		elif [ ${cnt} -gt ${expected_event} ] ; then
-			atf_fail 9: Multiple events triggered
-		fi
-		evt=$( check_powerd_event ${cnt} normal)
-		if [ -n ${evt} ] ; then
-			atf_fail 9: ${evt}
+		if [ ${skip_events} -eq 0 ] ; then
+			rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $4 + $5 ))
+			sleep 5
+			cnt=$(get_powerd_event_count)
+			if [ ${cnt} -lt ${expected_event} ] ; then
+atf_fail 9: No event triggered
+			elif [ ${cnt} -gt ${expected_event} ] ; then
+atf_fail 9: Multiple events triggered
+			fi
+			evt=$( check_powerd_event ${cnt} normal)
+			if [ -n ${evt} ] ; then
+atf_fail 9: ${evt}
+			fi
+			expected_event=$(( 1 + ${expected_event} ))
 		fi
-		expected_event=$(( 1 + ${expected_event} ))
-	fi
 
 	# Step 10 - reset to defaults
-	rump.envstat -S
-	if [ $1 -eq 0 

CVS commit: src/tests/dev/sysmon

2011-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 26 12:14:59 UTC 2011

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
need signal.h for kill()
this is why it was wrong for rump_syscalls.h to include this.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/sysmon/t_swwdog.c

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_swwdog.c
diff -u src/tests/dev/sysmon/t_swwdog.c:1.4 src/tests/dev/sysmon/t_swwdog.c:1.5
--- src/tests/dev/sysmon/t_swwdog.c:1.4	Sun Oct 24 09:16:12 2010
+++ src/tests/dev/sysmon/t_swwdog.c	Sun Jun 26 08:14:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_swwdog.c,v 1.4 2010/10/24 13:16:12 pgoyette Exp $	*/
+/*	$NetBSD: t_swwdog.c,v 1.5 2011/06/26 12:14:59 christos Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -38,6 +38,7 @@
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include signal.h
 
 #include rump/rump.h
 #include rump/rump_syscalls.h



CVS commit: src/tests/dev/sysmon

2011-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 26 12:14:59 UTC 2011

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
need signal.h for kill()
this is why it was wrong for rump_syscalls.h to include this.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/sysmon/t_swwdog.c

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



CVS commit: src/tests/dev/sysmon

2010-12-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Dec 31 00:35:42 UTC 2010

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

Log Message:
Now that 'rump_server -l stuff' works, use a less heavyweight rump_server
for this test.  Thanks, pooka!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/tests/dev/sysmon/t_swsensor.sh:1.4
--- src/tests/dev/sysmon/t_swsensor.sh:1.3	Thu Dec 30 04:01:59 2010
+++ src/tests/dev/sysmon/t_swsensor.sh	Fri Dec 31 00:35:42 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.3 2010/12/30 04:01:59 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.4 2010/12/31 00:35:42 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -40,7 +40,7 @@
 # requested properties
 
 start_rump() {
-	rump_allserver ${RUMP_SERVER}
+	rump_server -l rumpvfs -l rumpdev -l rumpdev_sysmon ${RUMP_SERVER}
 	if [ $( get_sensor_info | wc -l ) -ne 0 ] ; then
 		rump.modunload swsensor
 		rump.modload -f $1 swsensor
@@ -53,8 +53,8 @@
 common_head() {
 	atf_set	descr		$1
 	atf_set	timeout		60
-	atf_set	require.progs	rump.powerd rump.envstat rump.modload   \
-rump.halt   rump.sysctl  rump_allserver \
+	atf_set	require.progs	rump.powerd rump.envstat rump.modload	\
+rump.halt   rump.sysctl  rump_server	\
 sed grep
 }
 



CVS commit: src/tests/dev/sysmon

2010-12-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Dec 31 00:35:42 UTC 2010

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

Log Message:
Now that 'rump_server -l stuff' works, use a less heavyweight rump_server
for this test.  Thanks, pooka!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.



CVS commit: src/tests/dev/sysmon

2010-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec 30 04:01:59 UTC 2010

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

Log Message:
Now that we update the callout timer as soon as it is updated, we no longer
need to have an extended wait for the first powerd event to occur.  Revert
that portion of previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/tests/dev/sysmon/t_swsensor.sh:1.3
--- src/tests/dev/sysmon/t_swsensor.sh:1.2	Wed Dec 29 19:21:39 2010
+++ src/tests/dev/sysmon/t_swsensor.sh	Thu Dec 30 04:01:59 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.2 2010/12/29 19:21:39 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.3 2010/12/30 04:01:59 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -141,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 15
+		sleep 5
 		cnt=$(get_powerd_event_count)
 		if [ ${cnt} -lt ${expected_event} ] ; then
 			atf_fail 5: No event triggered



CVS commit: src/tests/dev/sysmon

2010-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Dec 29 19:21:39 UTC 2010

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

Log Message:
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.)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.



CVS commit: src/tests/dev/sysmon

2010-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec 30 04:01:59 UTC 2010

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

Log Message:
Now that we update the callout timer as soon as it is updated, we no longer
need to have an extended wait for the first powerd event to occur.  Revert
that portion of previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.



CVS commit: src/tests/dev/sysmon

2010-10-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Oct 24 13:11:41 UTC 2010

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
Add a third test-case to verify that disarming of the watchdog works.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/sysmon/t_swwdog.c

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_swwdog.c
diff -u src/tests/dev/sysmon/t_swwdog.c:1.2 src/tests/dev/sysmon/t_swwdog.c:1.3
--- src/tests/dev/sysmon/t_swwdog.c:1.2	Mon Aug 30 08:30:17 2010
+++ src/tests/dev/sysmon/t_swwdog.c	Sun Oct 24 13:11:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_swwdog.c,v 1.2 2010/08/30 08:30:17 pooka Exp $	*/
+/*	$NetBSD: t_swwdog.c,v 1.3 2010/10/24 13:11:41 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -60,7 +60,7 @@
  * something sensible back to atf.
  */
 static int
-testbody(void)
+testbody(int max)
 {
 	char wname[WDOG_NAMESIZE];
 	struct wdog_conf wc;
@@ -80,7 +80,7 @@
 	default:
 		p2 = wait(status);
 		ATF_REQUIRE_EQ(p1, p2);
-		ATF_REQUIRE_EQ(tcount, 1);
+		ATF_REQUIRE_EQ(tcount, max);
 		return status;
 	}
 
@@ -106,11 +106,18 @@
 			atf_tc_fail_errno(failed to set tickle);
 
 		usleep(50);
-		rump_sys_ioctl(fd, WDOGIOC_TICKLE);
+		if (max == 1)
+			rump_sys_ioctl(fd, WDOGIOC_TICKLE);
+		else {
+			wm.wm_mode = WDOG_MODE_DISARMED;
+			rump_sys_ioctl(fd, WDOGIOC_SMODE, wm);
+		}
 		kill(getppid(), SIGUSR1);
 
 		sleep(2);
 		printf(staying alive\n);
+		kill(getppid(), SIGUSR1);
+		_exit(2);
 	}
 	/* fail */
 	_exit(1);
@@ -130,7 +137,7 @@
 
 	/* XXX: should use sysctl */
 	rumpns_swwdog_reboot = true;
-	status = testbody();
+	status = testbody(1);
 
 	ATF_REQUIRE(WIFEXITED(status));
 	ATF_REQUIRE_EQ(WEXITSTATUS(status), 0);
@@ -150,17 +157,35 @@
 
 	/* XXX: should use sysctl */
 	rumpns_swwdog_reboot = false;
-	status = testbody();
+	status = testbody(1);
 
 	ATF_REQUIRE(WIFSIGNALED(status));
 	ATF_REQUIRE_EQ(WTERMSIG(status), SIGABRT);
 }
 
+ATF_TC(disarm);
+ATF_TC_HEAD(disarm, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, check swwdog disarm capability);
+}
+
+ATF_TC_BODY(disarm, tc)
+{
+	int status;
+
+	status = testbody(2);
+
+	ATF_REQUIRE(WIFEXITED(status));
+	ATF_REQUIRE_EQ(WEXITSTATUS(status), 2);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_ADD_TC(tp, panic);
 	ATF_TP_ADD_TC(tp, reboot);
+	ATF_TP_ADD_TC(tp, disarm);
 
 	return atf_no_error();
 }



CVS commit: src/tests/dev/sysmon

2010-10-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Oct 24 13:16:12 UTC 2010

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
Due to timing discrepancies desribed in PR kern/43997, tickle the
watchdog just a little bit sooner.  This maintains the spirit of the
test while avoiding the actual bug.  This can be reverted once (if)
the PR is fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/sysmon/t_swwdog.c

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_swwdog.c
diff -u src/tests/dev/sysmon/t_swwdog.c:1.3 src/tests/dev/sysmon/t_swwdog.c:1.4
--- src/tests/dev/sysmon/t_swwdog.c:1.3	Sun Oct 24 13:11:41 2010
+++ src/tests/dev/sysmon/t_swwdog.c	Sun Oct 24 13:16:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_swwdog.c,v 1.3 2010/10/24 13:11:41 pgoyette Exp $	*/
+/*	$NetBSD: t_swwdog.c,v 1.4 2010/10/24 13:16:12 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -105,7 +105,7 @@
 		if (rump_sys_ioctl(fd, WDOGIOC_SMODE, wm) == -1)
 			atf_tc_fail_errno(failed to set tickle);
 
-		usleep(50);
+		usleep(40);
 		if (max == 1)
 			rump_sys_ioctl(fd, WDOGIOC_TICKLE);
 		else {



CVS commit: src/tests/dev/sysmon

2010-10-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Oct 24 13:11:41 UTC 2010

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
Add a third test-case to verify that disarming of the watchdog works.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/sysmon/t_swwdog.c

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



CVS commit: src/tests/dev/sysmon

2010-10-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Oct 24 13:16:12 UTC 2010

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
Due to timing discrepancies desribed in PR kern/43997, tickle the
watchdog just a little bit sooner.  This maintains the spirit of the
test while avoiding the actual bug.  This can be reverted once (if)
the PR is fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/sysmon/t_swwdog.c

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



CVS commit: src/tests/dev/sysmon

2010-08-30 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 30 08:30:17 UTC 2010

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
Make tcount volatile since a signal handler plays with it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/sysmon/t_swwdog.c

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_swwdog.c
diff -u src/tests/dev/sysmon/t_swwdog.c:1.1 src/tests/dev/sysmon/t_swwdog.c:1.2
--- src/tests/dev/sysmon/t_swwdog.c:1.1	Fri Aug  6 16:13:26 2010
+++ src/tests/dev/sysmon/t_swwdog.c	Mon Aug 30 08:30:17 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_swwdog.c,v 1.1 2010/08/06 16:13:26 pooka Exp $	*/
+/*	$NetBSD: t_swwdog.c,v 1.2 2010/08/30 08:30:17 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -44,7 +44,7 @@
 
 #include ../../h_macros.h
 
-static sig_atomic_t tcount;
+static volatile sig_atomic_t tcount;
 
 static void
 sigcount(int sig)



CVS commit: src/tests/dev/sysmon

2010-08-30 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 30 08:30:17 UTC 2010

Modified Files:
src/tests/dev/sysmon: t_swwdog.c

Log Message:
Make tcount volatile since a signal handler plays with it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/sysmon/t_swwdog.c

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