Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

*** 23,33 **** # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/devices/devices.cfg . $STF_SUITE/include/libtest.shlib --- 23,33 ---- # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013, 2016 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/devices/devices.cfg . $STF_SUITE/include/libtest.shlib
*** 42,76 **** typeset filetype=$1 typeset filename=$2 case $filetype in b) ! devtype=$($DF -n / | $AWK '{print $3}') case $devtype in zfs) ! rootpool=$($DF / | \ ! $AWK '{print $2}') rootpool=${rootpool#\(} rootpool=${rootpool%%/*} devstr=$(get_disklist $rootpool) ! devstr=$($ECHO "$devstr" | \ ! $AWK '{print $1}') [[ -z $devstr ]] && \ log_fail "Can not get block device file." devstr=/dev/dsk/${devstr} ;; ufs) # # Get the existing block device file in current system. # And bring out the first one. # ! devstr=$($DF -lhF ufs | \ ! $GREP "^/dev/dsk" | \ ! $AWK '{print $1}') ! devstr=$($ECHO "$devstr" | \ ! $AWK '{print $1}') [[ -z $devstr ]] && \ log_fail "Can not get block device file." ;; *) log_unsupported "Unsupported fstype " \ --- 42,76 ---- typeset filetype=$1 typeset filename=$2 case $filetype in b) ! devtype=$(df -n / | awk '{print $3}') case $devtype in zfs) ! rootpool=$(df / | \ ! awk '{print $2}') rootpool=${rootpool#\(} rootpool=${rootpool%%/*} devstr=$(get_disklist $rootpool) ! devstr=$(echo "$devstr" | \ ! awk '{print $1}') [[ -z $devstr ]] && \ log_fail "Can not get block device file." devstr=/dev/dsk/${devstr} ;; ufs) # # Get the existing block device file in current system. # And bring out the first one. # ! devstr=$(df -lhF ufs | \ ! grep "^/dev/dsk" | \ ! awk '{print $1}') ! devstr=$(echo "$devstr" | \ ! awk '{print $1}') [[ -z $devstr ]] && \ log_fail "Can not get block device file." ;; *) log_unsupported "Unsupported fstype " \
*** 81,107 **** # # Get the device file information. i.e: # /dev/dsk/c0t0d0s0: block special (28/768) # ! devstr=$($FILE $devstr) # # Bring out major and minor number. # major=${devstr##*\(} major=${major%%/*} minor=${devstr##*/} minor=${minor%\)} ! log_must $MKNOD $filename b $major $minor ;; c) # # Create device file '/dev/null' # ! log_must $MKNOD $filename c $($GETMAJOR mm) 2 ;; *) log_fail "'$filetype' is wrong." ;; esac --- 81,107 ---- # # Get the device file information. i.e: # /dev/dsk/c0t0d0s0: block special (28/768) # ! devstr=$(file $devstr) # # Bring out major and minor number. # major=${devstr##*\(} major=${major%%/*} minor=${devstr##*/} minor=${minor%\)} ! log_must mknod $filename b $major $minor ;; c) # # Create device file '/dev/null' # ! log_must mknod $filename c $(getmajor mm) 2 ;; *) log_fail "'$filetype' is wrong." ;; esac
*** 109,119 **** return 0 } function cleanup { ! log_must $ZFS set devices=on $TESTPOOL/$TESTFS ! log_must $RM -f $TESTDIR/$TESTFILE1 ! log_must $RM -f $TESTDIR/$TESTFILE2 ! log_must $RM -f $TESTDIR/$TESTFILE1.out ! log_must $RM -f $TESTDIR/$TESTFILE2.out } --- 109,119 ---- return 0 } function cleanup { ! log_must zfs set devices=on $TESTPOOL/$TESTFS ! log_must rm -f $TESTDIR/$TESTFILE1 ! log_must rm -f $TESTDIR/$TESTFILE2 ! log_must rm -f $TESTDIR/$TESTFILE1.out ! log_must rm -f $TESTDIR/$TESTFILE2.out }