CVS commit: src/tests/sbin/sysctl

2020-06-30 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Jun 30 11:49:26 UTC 2020

Modified Files:
src/tests/sbin/sysctl: t_random_garbage.sh

Log Message:
Skip a few more nodes, and enable this test for Qemu runs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/sysctl/t_random_garbage.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/sysctl/t_random_garbage.sh
diff -u src/tests/sbin/sysctl/t_random_garbage.sh:1.1 src/tests/sbin/sysctl/t_random_garbage.sh:1.2
--- src/tests/sbin/sysctl/t_random_garbage.sh:1.1	Sat Jun 27 08:50:46 2020
+++ src/tests/sbin/sysctl/t_random_garbage.sh	Tue Jun 30 11:49:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_random_garbage.sh,v 1.1 2020/06/27 08:50:46 jruoho Exp $
+# $NetBSD: t_random_garbage.sh,v 1.2 2020/06/30 11:49:26 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -46,18 +46,32 @@ random_garbage_head() {
 
 random_garbage_body() {
 
-	atf_skip "The test is not safe"
+	sysctl machdep.cpu_brand 2>/dev/null | grep "QEMU"
+
+	if [ $? -eq 1 ]; then
+		atf_skip "The test is not safe"
+	fi
 
 	while read line; do
 
 		var=$(echo $line | awk '{print $1}')
 
 		case $var in
+			hw.acpi.sleep.state)
+			echo "Skipping $var"
+			continue
+			;;
+
 			kern.securelevel*)
 			echo "Skipping $var"
 			continue
 			;;
 
+			kern.veriexec.strict)
+			echo "Skipping $var"
+			continue
+			;;
+
 			security*)
 			echo "Skipping $var"
 			continue
@@ -76,7 +90,11 @@ random_garbage_body() {
 
 random_garbage_cleanup() {
 
-	atf_skip "The test is not safe"
+	sysctl machdep.cpu_brand 2>/dev/null | grep "QEMU"
+
+	if [ $? -eq 1 ]; then
+		atf_skip "The test is not safe"
+	fi
 
 	while read line; do
 		var=$(echo $line | awk '{print $1}')



CVS commit: src/tests/sbin/sysctl

2016-06-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jun 17 03:55:35 UTC 2016

Modified Files:
src/tests/sbin/sysctl: t_perm.sh

Log Message:
When deadbeef is treated as a 32-bit signed integer, it actually has a
negative value.  So, if the value gets written into a sysctl variable,
and then is read back, the twos-complement value is displayed.

So, when checking for the value having been written, make sure we check
for the correct value!


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/sbin/sysctl/t_perm.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/sysctl/t_perm.sh
diff -u src/tests/sbin/sysctl/t_perm.sh:1.6 src/tests/sbin/sysctl/t_perm.sh:1.7
--- src/tests/sbin/sysctl/t_perm.sh:1.6	Sun Mar 18 09:46:50 2012
+++ src/tests/sbin/sysctl/t_perm.sh	Fri Jun 17 03:55:35 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_perm.sh,v 1.6 2012/03/18 09:46:50 jruoho Exp $
+# $NetBSD: t_perm.sh,v 1.7 2016/06/17 03:55:35 pgoyette Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -39,6 +39,7 @@ clean() {
 sysctl_write() {
 
 	deadbeef="3735928559"
+	deadbeef_signed="-559038737"
 
 	sysctl $1 | cut -d= -f1 > $file
 
@@ -63,7 +64,7 @@ sysctl_write() {
 	# A functional verification that $deadbeef
 	# was not actually written to the node.
 	#
-	if [ ! -z $(sysctl $1 | grep $deadbeef) ]; then
+	if [ ! -z $(sysctl $1 | grep -e $deadbeef -e $deadbeef_signed) ]; then
 		atf_fail "value was written"
 	fi
 }



CVS commit: src/tests/sbin/sysctl

2014-05-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri May 16 18:50:29 UTC 2014

Modified Files:
src/tests/sbin/sysctl: t_sysctl.sh

Log Message:
Added test of -d option to sysctl


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/sysctl/t_sysctl.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/sysctl/t_sysctl.sh
diff -u src/tests/sbin/sysctl/t_sysctl.sh:1.1 src/tests/sbin/sysctl/t_sysctl.sh:1.2
--- src/tests/sbin/sysctl/t_sysctl.sh:1.1	Tue Apr 10 02:39:33 2012
+++ src/tests/sbin/sysctl/t_sysctl.sh	Fri May 16 18:50:28 2014
@@ -1,4 +1,4 @@
-# $NetBSD: t_sysctl.sh,v 1.1 2012/04/10 02:39:33 jruoho Exp $
+# $NetBSD: t_sysctl.sh,v 1.2 2014/05/16 18:50:28 palle Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,6 +36,7 @@ basic_head() {
 basic_body() {
 
 	atf_check -s exit:0 -o ignore -e empty -x sysctl -a
+	atf_check -s exit:0 -o ignore -e empty -x sysctl -d
 }
 
 atf_init_test_cases() {



CVS commit: src/tests/sbin/sysctl

2012-03-12 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Mon Mar 12 08:14:02 UTC 2012

Modified Files:
src/tests/sbin/sysctl: t_perm.sh

Log Message:
Remove xfail, as PR kern/44946 was fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/sysctl/t_perm.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/sysctl/t_perm.sh
diff -u src/tests/sbin/sysctl/t_perm.sh:1.4 src/tests/sbin/sysctl/t_perm.sh:1.5
--- src/tests/sbin/sysctl/t_perm.sh:1.4	Wed May 11 22:08:12 2011
+++ src/tests/sbin/sysctl/t_perm.sh	Mon Mar 12 08:14:02 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_perm.sh,v 1.4 2011/05/11 22:08:12 njoly Exp $
+# $NetBSD: t_perm.sh,v 1.5 2012/03/12 08:14:02 jruoho Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -100,7 +100,7 @@ sysctl_hw_cleanup() {
 	clean
 }
 
-# kern.
+# kern (cf. closed PR kern/44946).
 #
 atf_test_case sysctl_kern cleanup
 sysctl_kern_head() {
@@ -109,7 +109,6 @@ sysctl_kern_head() {
 }
 
 sysctl_kern_body() {
-	atf_expect_fail PR kern/44946
 	sysctl_write kern
 }
 



CVS commit: src/tests/sbin/sysctl

2011-05-11 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 11 07:07:41 UTC 2011

Modified Files:
src/tests/sbin/sysctl: t_perm.sh

Log Message:
Do also a small functional verification that user did not succeed in writing
garbage values, even if sysctl(8) reported a failure.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/sbin/sysctl/t_perm.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/sysctl/t_perm.sh
diff -u src/tests/sbin/sysctl/t_perm.sh:1.2 src/tests/sbin/sysctl/t_perm.sh:1.3
--- src/tests/sbin/sysctl/t_perm.sh:1.2	Mon May  9 17:55:37 2011
+++ src/tests/sbin/sysctl/t_perm.sh	Wed May 11 07:07:41 2011
@@ -1,6 +1,6 @@
 #! /usr/bin/atf-sh
 #
-# $NetBSD: t_perm.sh,v 1.2 2011/05/09 17:55:37 jruoho Exp $
+# $NetBSD: t_perm.sh,v 1.3 2011/05/11 07:07:41 jruoho Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -29,41 +29,45 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
+file=/tmp/d_sysctl.out
+
 clean() {
 
-	if [ -f /tmp/d_sysctl.out ]; then
-		rm /tmp/d_sysctl.out
+	if [ -f $file ]; then
+		rm $file
 	fi
 }
 
 sysctl_write() {
 
-
 	deadbeef=3735928559
-	file=/tmp/d_sysctl.out
 
-	sysctl $1 | cut -d= -f1  $file
+	sysctl $1 | cut -d= -f1  $file
 
 	if [ ! -f $file ]; then
-		atf_fail sysctl -a failed
+		atf_fail sysctl failed
 	fi
 
-	# This should probably include a functional verification
-	# that $deadbeef was not actually written to the node...
-	#
 	while read line; do
 
-		node=$(echo $line)
+		node=$(echo $line)
 
-		case $node in
+		case $node in
 
 		$1.*)
 			atf_check -s not-exit:0 -e ignore \
--x sysctl -w $node=$deadbeef
+-x sysctl -w $node=$deadbeef
 			;;
 		esac
 
 	done  $file
+
+	# A functional verification that $deadbeef
+	# was not actually written to the node.
+	#
+	if [ ! -z $(sysctl $1 | grep $deadbeef) ]; then
+		atf_fail value was written
+	fi
 }
 
 # ddb.



CVS commit: src/tests/sbin/sysctl

2011-05-09 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Mon May  9 17:55:38 UTC 2011

Modified Files:
src/tests/sbin/sysctl: t_perm.sh

Log Message:
Add one missing cleanup routine declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/sysctl/t_perm.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/sysctl/t_perm.sh
diff -u src/tests/sbin/sysctl/t_perm.sh:1.1 src/tests/sbin/sysctl/t_perm.sh:1.2
--- src/tests/sbin/sysctl/t_perm.sh:1.1	Mon May  9 17:53:54 2011
+++ src/tests/sbin/sysctl/t_perm.sh	Mon May  9 17:55:37 2011
@@ -1,6 +1,6 @@
 #! /usr/bin/atf-sh
 #
-# $NetBSD: t_perm.sh,v 1.1 2011/05/09 17:53:54 jruoho Exp $
+# $NetBSD: t_perm.sh,v 1.2 2011/05/09 17:55:37 jruoho Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -100,7 +100,7 @@
 
 # kern.
 #
-atf_test_case sysctl_kern #cleanup
+atf_test_case sysctl_kern cleanup
 sysctl_kern_head() {
 	atf_set require.user unprivileged
 	atf_set descr Test writing to 'kern' sysctl node as an user