tests: review all wc(1) invocations
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13259
This commit is contained in:
parent
23914a3b91
commit
964d41806f
|
@ -2158,8 +2158,7 @@ function check_pool_status # pool token keyword <verbose>
|
||||||
typeset keyword=$3
|
typeset keyword=$3
|
||||||
typeset verbose=${4:-false}
|
typeset verbose=${4:-false}
|
||||||
|
|
||||||
scan=$(zpool status -v "$pool" 2>/dev/null | awk -v token="$token:" '
|
scan=$(zpool status -v "$pool" 2>/dev/null | awk -v token="$token:" '$1==token')
|
||||||
($1==token) {print $0}')
|
|
||||||
if [[ $verbose == true ]]; then
|
if [[ $verbose == true ]]; then
|
||||||
log_note $scan
|
log_note $scan
|
||||||
fi
|
fi
|
||||||
|
@ -3075,7 +3074,7 @@ function vdevs_in_pool
|
||||||
typeset tmpfile=$(mktemp)
|
typeset tmpfile=$(mktemp)
|
||||||
zpool status -v "$pool" | grep -A 1000 "config:" >$tmpfile
|
zpool status -v "$pool" | grep -A 1000 "config:" >$tmpfile
|
||||||
for vdev in "$@"; do
|
for vdev in "$@"; do
|
||||||
grep -wq ${vdev##*/} $tmpfile || && return 1
|
grep -wq ${vdev##*/} $tmpfile || return 1
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f $tmpfile
|
rm -f $tmpfile
|
||||||
|
@ -3959,10 +3958,10 @@ function directory_diff # dir_a dir_b
|
||||||
# We check ctimes even with zil_replay=1 because the ZIL does store
|
# We check ctimes even with zil_replay=1 because the ZIL does store
|
||||||
# creation times and we should make sure they match (if the creation times
|
# creation times and we should make sure they match (if the creation times
|
||||||
# do not match there is a "c" entry in one of the columns).
|
# do not match there is a "c" entry in one of the columns).
|
||||||
if ( rsync --version | grep -q "[, ] crtimes" >/dev/null ); then
|
if rsync --version | grep -q "[, ] crtimes"; then
|
||||||
args+=("--crtimes")
|
args+=("--crtimes")
|
||||||
else
|
else
|
||||||
echo "NOTE: This rsync package does not support --crtimes (-N)."
|
log_note "This rsync package does not support --crtimes (-N)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we are testing a ZIL replay, we need to ignore timestamp changes.
|
# If we are testing a ZIL replay, we need to ignore timestamp changes.
|
||||||
|
|
|
@ -86,13 +86,10 @@ log_pos kill $CHILD
|
||||||
# Make sure the channel program did not fully complete by enforcing
|
# Make sure the channel program did not fully complete by enforcing
|
||||||
# that not all of the snapshots were created.
|
# that not all of the snapshots were created.
|
||||||
#
|
#
|
||||||
snap_count=$(zfs list -t snapshot | grep $TESTPOOL | wc -l)
|
snap_count=$(zfs list -t snapshot | grep -c $TESTPOOL)
|
||||||
log_note "$snap_count snapshots created by ZCP"
|
log_note "$snap_count snapshots created by ZCP"
|
||||||
|
|
||||||
if [ "$snap_count" -eq 0 ]; then
|
log_mustnot [ "$snap_count" -eq 0 ]
|
||||||
log_fail "Channel program failed to run."
|
log_mustnot [ "$snap_count" -gt 90 ]
|
||||||
elif [ "$snap_count" -gt 90 ]; then
|
|
||||||
log_fail "Too many snapshots after a cancel ($snap_count)."
|
log_pass "Cancelling a long-running channel program works."
|
||||||
else
|
|
||||||
log_pass "Canceling a long-running channel program works."
|
|
||||||
fi
|
|
||||||
|
|
|
@ -69,16 +69,16 @@ obj=${array[0]}
|
||||||
log_note "file $init_data has object number $obj"
|
log_note "file $init_data has object number $obj"
|
||||||
|
|
||||||
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|
||||||
|grep -m 1 "L1 DVA" |head -n1)
|
|grep -m 1 "L1 DVA" )
|
||||||
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*/\1/p' <<< "$output")
|
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*/\1/p' <<< "$output")
|
||||||
log_note "first L1 block $init_data has a DVA of $dva"
|
log_note "first L1 block $init_data has a DVA of $dva"
|
||||||
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|
||||||
|grep -m 1 "L0 DVA" |head -n1)
|
|grep -m 1 "L0 DVA" )
|
||||||
blk_out0=${output##*>}
|
blk_out0=${output##*>}
|
||||||
blk_out0=${blk_out0##+([[:space:]])}
|
blk_out0=${blk_out0##+([[:space:]])}
|
||||||
|
|
||||||
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|
||||||
|grep -m 1 "1000 L0 DVA" |head -n1)
|
|grep -m 1 "1000 L0 DVA" )
|
||||||
blk_out1=${output##*>}
|
blk_out1=${output##*>}
|
||||||
blk_out1=${blk_out1##+([[:space:]])}
|
blk_out1=${blk_out1##+([[:space:]])}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ vdev=$(echo "$dva" | cut -d: -f1)
|
||||||
offset=$(echo "$dva" | cut -d: -f2)
|
offset=$(echo "$dva" | cut -d: -f2)
|
||||||
output=$(export ZDB_NO_ZLE=\"true\";\
|
output=$(export ZDB_NO_ZLE=\"true\";\
|
||||||
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
|
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
|
||||||
block_cnt=$(echo "$output" | grep 'L0' | wc -l)
|
block_cnt=$(echo "$output" | grep -c 'L0')
|
||||||
if [ $block_cnt -ne $write_count ]; then
|
if [ $block_cnt -ne $write_count ]; then
|
||||||
log_fail "zdb -R :id (indirect block display) failed"
|
log_fail "zdb -R :id (indirect block display) failed"
|
||||||
fi
|
fi
|
||||||
|
@ -120,7 +120,7 @@ vdev="$vdev.0"
|
||||||
log_note "Reading from DVA $vdev:$offset:$l1_read_size"
|
log_note "Reading from DVA $vdev:$offset:$l1_read_size"
|
||||||
output=$(export ZDB_NO_ZLE=\"true\";\
|
output=$(export ZDB_NO_ZLE=\"true\";\
|
||||||
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
|
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
|
||||||
block_cnt=$(echo "$output" | grep 'L0' | wc -l)
|
block_cnt=$(echo "$output" | grep -c 'L0')
|
||||||
if [ $block_cnt -ne $write_count ]; then
|
if [ $block_cnt -ne $write_count ]; then
|
||||||
log_fail "zdb -R 0.0:offset:length:id (indirect block display) failed"
|
log_fail "zdb -R 0.0:offset:length:id (indirect block display) failed"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -167,7 +167,7 @@ while (( i < ${#opts[*]} )); do
|
||||||
log_fail "There is no property for" \
|
log_fail "There is no property for" \
|
||||||
"dataset $ds in 'get all' output."
|
"dataset $ds in 'get all' output."
|
||||||
|
|
||||||
propnum=$(awk -v ds="${ds}$" '$1 ~ ds {print $1}' $propfile | wc -l)
|
propnum=$(awk -v ds="${ds}$" '$1 ~ ds {++cnt} END {print cnt}' $propfile)
|
||||||
case $(zfs get -H -o value type $ds) in
|
case $(zfs get -H -o value type $ds) in
|
||||||
filesystem )
|
filesystem )
|
||||||
(( propnum < fspropnum )) && \
|
(( propnum < fspropnum )) && \
|
||||||
|
|
|
@ -120,7 +120,7 @@ for x in {1..$ITERATIONS}; do
|
||||||
for y in {1..$NUM_SNAPS}; do
|
for y in {1..$NUM_SNAPS}; do
|
||||||
log_must zfs snapshot $TESTPOOL/$MYTEST@$y
|
log_must zfs snapshot $TESTPOOL/$MYTEST@$y
|
||||||
done;
|
done;
|
||||||
n=$(ls -1 /$TESTPOOL/$MYTEST/.zfs/snapshot | wc -l)
|
n=$(ls /$TESTPOOL/$MYTEST/.zfs/snapshot | wc -l)
|
||||||
verify_eq $n $NUM_SNAPS "count"
|
verify_eq $n $NUM_SNAPS "count"
|
||||||
zfs destroy -r $TESTPOOL/$MYTEST;
|
zfs destroy -r $TESTPOOL/$MYTEST;
|
||||||
done;
|
done;
|
||||||
|
|
|
@ -115,7 +115,7 @@ function do_test
|
||||||
out="$(zpool status -p | grep $VDEV1)"
|
out="$(zpool status -p | grep $VDEV1)"
|
||||||
|
|
||||||
if [ "$ERR" == "corrupt" ] ; then
|
if [ "$ERR" == "corrupt" ] ; then
|
||||||
events=$(zpool events | grep checksum | wc -l)
|
events=$(zpool events | grep -c checksum)
|
||||||
val=$(echo "$out" | awk '{print $5}')
|
val=$(echo "$out" | awk '{print $5}')
|
||||||
str="checksum"
|
str="checksum"
|
||||||
elif [ "$ERR" == "io" ] ; then
|
elif [ "$ERR" == "io" ] ; then
|
||||||
|
|
|
@ -49,14 +49,14 @@ log_must eval "zpool events -H -f > $EVENTS_FILE &"
|
||||||
pid=$!
|
pid=$!
|
||||||
|
|
||||||
# 3. Generate some ZFS events
|
# 3. Generate some ZFS events
|
||||||
for i in `seq 1 $EVENTS_NUM`; do
|
for i in {1..$EVENTS_NUM}; do
|
||||||
log_must zpool clear $TESTPOOL
|
log_must zpool clear $TESTPOOL
|
||||||
done
|
done
|
||||||
# wait a bit to allow the kernel module to process new events
|
# wait a bit to allow the kernel module to process new events
|
||||||
zpool_events_settle
|
zpool_events_settle
|
||||||
|
|
||||||
# 4. Verify 'zpool events -f' successfully recorded these new events
|
# 4. Verify 'zpool events -f' successfully recorded these new events
|
||||||
EVENTS_LOG=$(cat $EVENTS_FILE | wc -l)
|
EVENTS_LOG=$(wc -l < $EVENTS_FILE)
|
||||||
if [[ $EVENTS_LOG -ne $EVENTS_NUM ]]; then
|
if [[ $EVENTS_LOG -ne $EVENTS_NUM ]]; then
|
||||||
log_fail "Unexpected number of events: $EVENTS_LOG != $EVENTS_NUM"
|
log_fail "Unexpected number of events: $EVENTS_LOG != $EVENTS_NUM"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -62,7 +62,7 @@ fi
|
||||||
|
|
||||||
zpool iostat $TESTPOOL 1 4 > $tmpfile 2>&1 &
|
zpool iostat $TESTPOOL 1 4 > $tmpfile 2>&1 &
|
||||||
sleep 4
|
sleep 4
|
||||||
stat_count=$(grep $TESTPOOL $tmpfile | wc -l)
|
stat_count=$(grep -c $TESTPOOL $tmpfile)
|
||||||
|
|
||||||
if [[ $stat_count -ne 4 ]]; then
|
if [[ $stat_count -ne 4 ]]; then
|
||||||
log_fail "zpool iostat [pool_name] [interval] [count] failed"
|
log_fail "zpool iostat [pool_name] [interval] [count] failed"
|
||||||
|
|
|
@ -68,10 +68,9 @@ sync_pool $TESTPOOL
|
||||||
|
|
||||||
log_must zinject -c all
|
log_must zinject -c all
|
||||||
SLOW_IOS=$(zpool status -sp | awk -v d="$DISK" '$0 ~ d {print $6}')
|
SLOW_IOS=$(zpool status -sp | awk -v d="$DISK" '$0 ~ d {print $6}')
|
||||||
DELAY_EVENTS=$(zpool events | grep delay | wc -l)
|
DELAY_EVENTS=$(zpool events | grep -c delay)
|
||||||
|
|
||||||
if [ $SLOW_IOS -gt 0 ] && [ $DELAY_EVENTS -gt 0 ] ; then
|
log_must [ $SLOW_IOS -gt 0 ]
|
||||||
log_pass "Correctly saw $SLOW_IOS slow IOs and $DELAY_EVENTS delay events"
|
log_must [ $DELAY_EVENTS -gt 0 ]
|
||||||
else
|
|
||||||
log_fail "Only saw $SLOW_IOS slow IOs and $DELAY_EVENTS delay events"
|
log_pass "Correctly saw $SLOW_IOS slow IOs and $DELAY_EVENTS delay events"
|
||||||
fi
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ function cleanup
|
||||||
log_onexit cleanup
|
log_onexit cleanup
|
||||||
|
|
||||||
LOGSM_POOL="logsm_import"
|
LOGSM_POOL="logsm_import"
|
||||||
TESTDISK="$(echo $DISKS | cut -d' ' -f1)"
|
read -r TESTDISK _ <<<"$DISKS"
|
||||||
|
|
||||||
log_must zpool create -o cachefile=none -f $LOGSM_POOL $TESTDISK
|
log_must zpool create -o cachefile=none -f $LOGSM_POOL $TESTDISK
|
||||||
log_must zfs create $LOGSM_POOL/fs
|
log_must zfs create $LOGSM_POOL/fs
|
||||||
|
@ -70,10 +70,7 @@ sync_all_pools
|
||||||
log_must set_tunable64 KEEP_LOG_SPACEMAPS_AT_EXPORT 1
|
log_must set_tunable64 KEEP_LOG_SPACEMAPS_AT_EXPORT 1
|
||||||
log_must zpool export $LOGSM_POOL
|
log_must zpool export $LOGSM_POOL
|
||||||
|
|
||||||
LOGSM_COUNT=$(zdb -m -e $LOGSM_POOL | grep "Log Spacemap object" | wc -l)
|
log_must eval "zdb -m -e $LOGSM_POOL | grep -q \"Log Spacemap object\""
|
||||||
if (( LOGSM_COUNT == 0 )); then
|
|
||||||
log_fail "Pool does not have any log spacemaps after being exported"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_must set_tunable64 METASLAB_DEBUG_LOAD 1
|
log_must set_tunable64 METASLAB_DEBUG_LOAD 1
|
||||||
log_must zpool import $LOGSM_POOL
|
log_must zpool import $LOGSM_POOL
|
||||||
|
|
|
@ -114,9 +114,7 @@ function mv_files
|
||||||
#
|
#
|
||||||
function count_files
|
function count_files
|
||||||
{
|
{
|
||||||
typeset -i file_num
|
(( $(find $1 -type f -print | wc -l) != $2 )) && \
|
||||||
file_num=$(find $1 -type f -print | wc -l | tr -d ' ')
|
|
||||||
(( file_num != $2 )) && \
|
|
||||||
log_fail "The file number of target directory"\
|
log_fail "The file number of target directory"\
|
||||||
"$2 is not equal to that of the source "\
|
"$2 is not equal to that of the source "\
|
||||||
"directory $1"
|
"directory $1"
|
||||||
|
|
|
@ -48,8 +48,8 @@ function cleanup
|
||||||
function count_snap_cmds
|
function count_snap_cmds
|
||||||
{
|
{
|
||||||
typeset expected_count=$1
|
typeset expected_count=$1
|
||||||
count=$(grep -E "command: (lt-)?zfs snapshot $FS@testsnapshot" | wc -l)
|
count=$(grep -cE "command: (lt-)?zfs snapshot $FS@testsnapshot")
|
||||||
log_must eval "[[ $count -eq $expected_count ]]"
|
log_must [ "$count" -eq "$expected_count" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
typeset -r ZFS_DBGMSG=/proc/spl/kstat/zfs/dbgmsg
|
typeset -r ZFS_DBGMSG=/proc/spl/kstat/zfs/dbgmsg
|
||||||
|
|
|
@ -64,7 +64,7 @@ objset=$(zdb -d $TESTPOOL1/ | sed -ne 's/.*ID \([0-9]*\).*/\1/p')
|
||||||
object=$(ls -i /$TESTPOOL1/file | awk '{print $1}')
|
object=$(ls -i /$TESTPOOL1/file | awk '{print $1}')
|
||||||
|
|
||||||
# inject event to cause error during resilver
|
# inject event to cause error during resilver
|
||||||
log_must zinject -b `printf "%x:%x:0:3fff" $objset $object` $TESTPOOL1
|
log_must zinject -b $(printf "%x:%x:0:3fff" $objset $object) $TESTPOOL1
|
||||||
|
|
||||||
# clear events and start resilver
|
# clear events and start resilver
|
||||||
log_must zpool events -c
|
log_must zpool events -c
|
||||||
|
@ -84,7 +84,7 @@ done
|
||||||
log_note "waiting for resilver to finish"
|
log_note "waiting for resilver to finish"
|
||||||
for iter in {0..59}
|
for iter in {0..59}
|
||||||
do
|
do
|
||||||
finish=$(zpool events | grep "sysevent.fs.zfs.resilver_finish" | wc -l)
|
finish=$(zpool events | grep -cF "sysevent.fs.zfs.resilver_finish")
|
||||||
(( $finish > 0 )) && break
|
(( $finish > 0 )) && break
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
@ -96,7 +96,7 @@ sync_pool $TESTPOOL1
|
||||||
sync_pool $TESTPOOL1
|
sync_pool $TESTPOOL1
|
||||||
|
|
||||||
# check if resilver was restarted
|
# check if resilver was restarted
|
||||||
start=$(zpool events | grep "sysevent.fs.zfs.resilver_start" | wc -l)
|
start=$(zpool events | grep -cF "sysevent.fs.zfs.resilver_start")
|
||||||
(( $start != 1 )) && log_fail "resilver restarted unnecessarily"
|
(( $start != 1 )) && log_fail "resilver restarted unnecessarily"
|
||||||
|
|
||||||
log_pass "Resilver did not restart unnecessarily from scan errors"
|
log_pass "Resilver did not restart unnecessarily from scan errors"
|
||||||
|
|
|
@ -142,8 +142,7 @@ while (( i < ${#args[*]} )); do
|
||||||
if [[ -n ${args[i+3]} ]] ; then
|
if [[ -n ${args[i+3]} ]] ; then
|
||||||
log_must zfs set mountpoint=${args[i+3]} ${args[i+2]}
|
log_must zfs set mountpoint=${args[i+3]} ${args[i+2]}
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al ${args[i+3]} | grep -v "total" \
|
FILE_COUNT=$(ls -A ${args[i+3]} | grep -cvF ".zfs")
|
||||||
| grep -v "\.zfs" | wc -l`
|
|
||||||
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
||||||
ls -Al ${args[i+3]}
|
ls -Al ${args[i+3]}
|
||||||
log_fail "AFTER: ${args[i+3]} contains $FILE_COUNT files(s)."
|
log_fail "AFTER: ${args[i+3]} contains $FILE_COUNT files(s)."
|
||||||
|
@ -157,7 +156,7 @@ while (( i < ${#args[*]} )); do
|
||||||
(( j = j + 1 ))
|
(( j = j + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al ${args[i+3]}/after* | grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A ${args[i+3]}/after* | wc -l)
|
||||||
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
||||||
ls -Al ${args[i+3]}
|
ls -Al ${args[i+3]}
|
||||||
log_fail "${args[i+3]} contains $FILE_COUNT after* files(s)."
|
log_fail "${args[i+3]} contains $FILE_COUNT after* files(s)."
|
||||||
|
|
|
@ -76,7 +76,7 @@ done
|
||||||
|
|
||||||
log_must zfs snapshot $SNAPFS
|
log_must zfs snapshot $SNAPFS
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
|
||||||
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
||||||
ls -Al $SNAPDIR
|
ls -Al $SNAPDIR
|
||||||
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
|
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
|
||||||
|
@ -97,14 +97,13 @@ sync_pool $TESTPOOL
|
||||||
#
|
#
|
||||||
log_must zfs rollback $SNAPFS
|
log_must zfs rollback $SNAPFS
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $TESTDIR/after* 2> /dev/null | grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A $TESTDIR/after* 2> /dev/null | wc -l)
|
||||||
if [[ $FILE_COUNT -ne 0 ]]; then
|
if [[ $FILE_COUNT -ne 0 ]]; then
|
||||||
ls -Al $TESTDIR
|
ls -Al $TESTDIR
|
||||||
log_fail "$TESTDIR contains $FILE_COUNT after* files(s)."
|
log_fail "$TESTDIR contains $FILE_COUNT after* files(s)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $TESTDIR/before* 2> /dev/null \
|
FILE_COUNT=$(ls -A $TESTDIR/before* 2> /dev/null | wc -l)
|
||||||
| grep -v "total" | wc -l`
|
|
||||||
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
||||||
ls -Al $TESTDIR
|
ls -Al $TESTDIR
|
||||||
log_fail "$TESTDIR contains $FILE_COUNT before* files(s)."
|
log_fail "$TESTDIR contains $FILE_COUNT before* files(s)."
|
||||||
|
|
|
@ -79,7 +79,7 @@ done
|
||||||
|
|
||||||
log_must zfs snapshot $SNAPFS
|
log_must zfs snapshot $SNAPFS
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
|
||||||
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
if [[ $FILE_COUNT -ne $COUNT ]]; then
|
||||||
ls -Al $SNAPDIR
|
ls -Al $SNAPDIR
|
||||||
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
|
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
|
||||||
|
@ -112,14 +112,13 @@ done
|
||||||
#
|
#
|
||||||
log_must zfs rollback $SNAPFS.1
|
log_must zfs rollback $SNAPFS.1
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $TESTDIR/aftersecond* 2> /dev/null \
|
FILE_COUNT=$(ls -A $TESTDIR/aftersecond* 2> /dev/null | wc -l)
|
||||||
| grep -v "total" | wc -l`
|
|
||||||
if [[ $FILE_COUNT -ne 0 ]]; then
|
if [[ $FILE_COUNT -ne 0 ]]; then
|
||||||
ls -Al $TESTDIR
|
ls -Al $TESTDIR
|
||||||
log_fail "$TESTDIR contains $FILE_COUNT aftersecond* files(s)."
|
log_fail "$TESTDIR contains $FILE_COUNT aftersecond* files(s)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $TESTDIR/original* $TESTDIR/afterfirst*| grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A $TESTDIR/original* $TESTDIR/afterfirst* | wc -l)
|
||||||
if [[ $FILE_COUNT -ne 20 ]]; then
|
if [[ $FILE_COUNT -ne 20 ]]; then
|
||||||
ls -Al $TESTDIR
|
ls -Al $TESTDIR
|
||||||
log_fail "$TESTDIR contains $FILE_COUNT original* files(s)."
|
log_fail "$TESTDIR contains $FILE_COUNT original* files(s)."
|
||||||
|
|
|
@ -86,7 +86,7 @@ log_note "Remove all of the original files"
|
||||||
|
|
||||||
i=1
|
i=1
|
||||||
while [[ $i -lt $COUNT ]]; do
|
while [[ $i -lt $COUNT ]]; do
|
||||||
FILECOUNT=`ls $SNAPDIR.$i/file* | wc -l`
|
FILECOUNT=$(ls $SNAPDIR.$i/file* | wc -l)
|
||||||
typeset j=1
|
typeset j=1
|
||||||
while [ $j -lt $FILECOUNT ]; do
|
while [ $j -lt $FILECOUNT ]; do
|
||||||
log_must file_check $SNAPDIR.$i/file$j $j
|
log_must file_check $SNAPDIR.$i/file$j $j
|
||||||
|
|
|
@ -60,7 +60,7 @@ log_onexit cleanup
|
||||||
[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
|
[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
|
||||||
|
|
||||||
log_must zfs snapshot $SNAPFS
|
log_must zfs snapshot $SNAPFS
|
||||||
FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total 0" | wc -l`
|
FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
|
||||||
if [[ $FILE_COUNT -ne 0 ]]; then
|
if [[ $FILE_COUNT -ne 0 ]]; then
|
||||||
ls $SNAPDIR
|
ls $SNAPDIR
|
||||||
log_fail "BEFORE: $SNAPDIR contains $FILE_COUNT files(s)."
|
log_fail "BEFORE: $SNAPDIR contains $FILE_COUNT files(s)."
|
||||||
|
@ -77,7 +77,7 @@ while [[ $i -lt $COUNT ]]; do
|
||||||
(( i = i + 1 ))
|
(( i = i + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total 0" | wc -l`
|
FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
|
||||||
if [[ $FILE_COUNT -ne 0 ]]; then
|
if [[ $FILE_COUNT -ne 0 ]]; then
|
||||||
ls $SNAPDIR
|
ls $SNAPDIR
|
||||||
log_fail "AFTER: $SNAPDIR contains $FILE_COUNT files(s)."
|
log_fail "AFTER: $SNAPDIR contains $FILE_COUNT files(s)."
|
||||||
|
|
|
@ -90,7 +90,7 @@ log_note "Remove all of the original files"
|
||||||
|
|
||||||
i=1
|
i=1
|
||||||
while [[ $i -lt $COUNT ]]; do
|
while [[ $i -lt $COUNT ]]; do
|
||||||
FILECOUNT=`echo $SNAPDIR1.$i/file* | wc -w`
|
FILECOUNT=$(ls $SNAPDIR1.$i/file* 2>/dev/null | wc -l)
|
||||||
typeset j=1
|
typeset j=1
|
||||||
while [ $j -lt $FILECOUNT ]; do
|
while [ $j -lt $FILECOUNT ]; do
|
||||||
log_must file_check $SNAPDIR1.$i/file$j $j
|
log_must file_check $SNAPDIR1.$i/file$j $j
|
||||||
|
|
|
@ -74,7 +74,7 @@ done
|
||||||
|
|
||||||
log_must zfs snapshot -r $SNAPPOOL
|
log_must zfs snapshot -r $SNAPPOOL
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
|
||||||
if (( FILE_COUNT != COUNT )); then
|
if (( FILE_COUNT != COUNT )); then
|
||||||
ls -Al $SNAPDIR
|
ls -Al $SNAPDIR
|
||||||
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
|
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
|
||||||
|
@ -94,14 +94,13 @@ done
|
||||||
#
|
#
|
||||||
log_must zfs rollback $SNAPFS
|
log_must zfs rollback $SNAPFS
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $TESTDIR/after* 2> /dev/null | grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A $TESTDIR/after* 2> /dev/null | wc -l)
|
||||||
if (( FILE_COUNT != 0 )); then
|
if (( FILE_COUNT != 0 )); then
|
||||||
ls -Al $TESTDIR
|
ls -Al $TESTDIR
|
||||||
log_fail "$TESTDIR contains $FILE_COUNT after* files(s)."
|
log_fail "$TESTDIR contains $FILE_COUNT after* files(s)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE_COUNT=`ls -Al $TESTDIR/before* 2> /dev/null \
|
FILE_COUNT=$(ls -A $TESTDIR/before* 2> /dev/null | wc -l)
|
||||||
| grep -v "total" | wc -l`
|
|
||||||
if (( FILE_COUNT != $COUNT )); then
|
if (( FILE_COUNT != $COUNT )); then
|
||||||
ls -Al $TESTDIR
|
ls -Al $TESTDIR
|
||||||
log_fail "$TESTDIR contains $FILE_COUNT before* files(s)."
|
log_fail "$TESTDIR contains $FILE_COUNT before* files(s)."
|
||||||
|
|
|
@ -87,7 +87,7 @@ if ! datasetexists $ctrfs || ! snapexists $snapctrfs; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for dir in $fsdir $snapdir; do
|
for dir in $fsdir $snapdir; do
|
||||||
FILE_COUNT=`ls -Al $dir | grep -v "total" | wc -l`
|
FILE_COUNT=$(ls -A $dir | wc -l)
|
||||||
(( FILE_COUNT != COUNT )) && log_fail "Got $FILE_COUNT expected $COUNT"
|
(( FILE_COUNT != COUNT )) && log_fail "Got $FILE_COUNT expected $COUNT"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue