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/quota/quota.cfg
# BLOCK_SIZE, QUOTA_VALUE and TOLERANCE set in quota.cfg
--- 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/quota/quota.cfg
# BLOCK_SIZE, QUOTA_VALUE and TOLERANCE set in quota.cfg
*** 42,64 ****
function fill_quota
{
typeset FILESYSTEM="$1"
typeset MNTPT="$2"
! log_must $ZFS set quota=$QUOTA_VALUE $FILESYSTEM
typeset -i write_size=0
(( write_size = 2 * QUOTA_VALUE ))
typeset -i zret=0
! $FILE_WRITE -o create -f $MNTPT/$TESTFILE1 -b $BLOCK_SIZE \
-c $write_size -d 0
zret=$?
[[ $zret -ne EDQUOT ]] && \
log_fail "Returned error code: $zret. Expected: $EDQUOT."
! typeset -i file_size=`$LS -ls $MNTPT/$TESTFILE1 | $AWK '{ print $1 }'`
typeset -i limit=0
(( file_size = file_size * 512 ))
(( limit = QUOTA_VALUE + TOLERANCE ))
(( file_size > limit )) && \
log_fail "File was created larger than the quota value, aborting!!!"
--- 42,64 ----
function fill_quota
{
typeset FILESYSTEM="$1"
typeset MNTPT="$2"
! log_must zfs set quota=$QUOTA_VALUE $FILESYSTEM
typeset -i write_size=0
(( write_size = 2 * QUOTA_VALUE ))
typeset -i zret=0
! file_write -o create -f $MNTPT/$TESTFILE1 -b $BLOCK_SIZE \
-c $write_size -d 0
zret=$?
[[ $zret -ne EDQUOT ]] && \
log_fail "Returned error code: $zret. Expected: $EDQUOT."
! typeset -i file_size=`ls -ls $MNTPT/$TESTFILE1 | awk '{ print $1 }'`
typeset -i limit=0
(( file_size = file_size * 512 ))
(( limit = QUOTA_VALUE + TOLERANCE ))
(( file_size > limit )) && \
log_fail "File was created larger than the quota value, aborting!!!"
*** 80,90 ****
typeset -i zret=0
#
# Writing a file without API to access return code
#
log_note "Creating a file in a FS that has already exceeded its quota"
! $FILE_WRITE -o create -f $MNTPT/$TESTFILE2 \
-b $BLOCK_SIZE -c $write_size -d 0
zret=$?
[[ $zret -ne EDQUOT ]] && \
log_fail "Returned error code: $zret. Expected: EDQUOT."
return 0
--- 80,90 ----
typeset -i zret=0
#
# Writing a file without API to access return code
#
log_note "Creating a file in a FS that has already exceeded its quota"
! file_write -o create -f $MNTPT/$TESTFILE2 \
-b $BLOCK_SIZE -c $write_size -d 0
zret=$?
[[ $zret -ne EDQUOT ]] && \
log_fail "Returned error code: $zret. Expected: EDQUOT."
return 0