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.