Source-Changes-HG archive

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

[src/trunk]: src/tests/sbin/sysctl When deadbeef is treated as a 32-bit signe...



details:   https://anonhg.NetBSD.org/src/rev/8b3c8a001b8e
branches:  trunk
changeset: 816097:8b3c8a001b8e
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Jun 17 03:55:35 2016 +0000

description:
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!

diffstat:

 tests/sbin/sysctl/t_perm.sh |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r ee54a36a659d -r 8b3c8a001b8e tests/sbin/sysctl/t_perm.sh
--- a/tests/sbin/sysctl/t_perm.sh       Fri Jun 17 03:27:50 2016 +0000
+++ b/tests/sbin/sysctl/t_perm.sh       Fri Jun 17 03:55:35 2016 +0000
@@ -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 @@
 sysctl_write() {
 
        deadbeef="3735928559"
+       deadbeef_signed="-559038737"
 
        sysctl $1 | cut -d= -f1 > $file
 
@@ -63,7 +64,7 @@
        # 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
 }



Home | Main Index | Thread Index | Old Index