egrep -> grep -E
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
689c53f2c5
commit
f8a124b104
|
@ -55,7 +55,7 @@ dnl #
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_ENUM_MEMBER], [
|
AC_DEFUN([ZFS_AC_KERNEL_ENUM_MEMBER], [
|
||||||
AC_MSG_CHECKING([whether enum $2 contains $1])
|
AC_MSG_CHECKING([whether enum $2 contains $1])
|
||||||
AS_IF([AC_TRY_COMMAND(
|
AS_IF([AC_TRY_COMMAND(
|
||||||
"${srcdir}/scripts/enum-extract.pl" "$2" "$3" | egrep -qx $1)],[
|
"${srcdir}/scripts/enum-extract.pl" "$2" "$3" | grep -Eqx $1)],[
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1,
|
AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1,
|
||||||
[enum $2 contains $1])
|
[enum $2 contains $1])
|
||||||
|
|
|
@ -96,10 +96,7 @@ function log_must_retry
|
||||||
out="cat $logfile"
|
out="cat $logfile"
|
||||||
|
|
||||||
if (( $status == 0 )); then
|
if (( $status == 0 )); then
|
||||||
$out | egrep -i "internal error|assertion failed" \
|
if $out | grep -qEi "internal error|assertion failed"; then
|
||||||
> /dev/null 2>&1
|
|
||||||
# internal error or assertion failed
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
print -u2 $($out)
|
print -u2 $($out)
|
||||||
_printerror "$@" "internal error or" \
|
_printerror "$@" "internal error or" \
|
||||||
" assertion failure exited $status"
|
" assertion failure exited $status"
|
||||||
|
@ -224,10 +221,7 @@ function log_neg_expect
|
||||||
print -u2 $($out)
|
print -u2 $($out)
|
||||||
_printerror "$@" "unexpectedly exited $status (SEGV)"
|
_printerror "$@" "unexpectedly exited $status (SEGV)"
|
||||||
else
|
else
|
||||||
$out | egrep -i "internal error|assertion failed" \
|
if $out | grep -qEi "internal error|assertion failed"; then
|
||||||
> /dev/null 2>&1
|
|
||||||
# internal error or assertion failed
|
|
||||||
if (( $? == 0 )); then
|
|
||||||
print -u2 $($out)
|
print -u2 $($out)
|
||||||
_printerror "$@" "internal error or assertion failure" \
|
_printerror "$@" "internal error or assertion failure" \
|
||||||
" exited $status"
|
" exited $status"
|
||||||
|
@ -275,10 +269,7 @@ function log_pos
|
||||||
print -u2 $($out)
|
print -u2 $($out)
|
||||||
_printerror "$@" "exited $status"
|
_printerror "$@" "exited $status"
|
||||||
else
|
else
|
||||||
$out | egrep -i "internal error|assertion failed" \
|
if $out | grep -qEi "internal error|assertion failed"; then
|
||||||
> /dev/null 2>&1
|
|
||||||
# internal error or assertion failed
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
print -u2 $($out)
|
print -u2 $($out)
|
||||||
_printerror "$@" "internal error or assertion failure" \
|
_printerror "$@" "internal error or assertion failure" \
|
||||||
" exited $status"
|
" exited $status"
|
||||||
|
|
|
@ -115,21 +115,18 @@ function is_physical_device #device
|
||||||
|
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
is_disk_device "$DEV_DSKDIR/$device" && \
|
is_disk_device "$DEV_DSKDIR/$device" && \
|
||||||
[[ -f /sys/module/loop/parameters/max_part ]]
|
[ -f /sys/module/loop/parameters/max_part ]
|
||||||
return $?
|
|
||||||
elif is_freebsd; then
|
elif is_freebsd; then
|
||||||
is_disk_device "$DEV_DSKDIR/$device" && \
|
is_disk_device "$DEV_DSKDIR/$device" && \
|
||||||
echo $device | egrep -q \
|
echo $device | grep -qE \
|
||||||
-e '^a?da[0-9]+$' \
|
-e '^a?da[0-9]+$' \
|
||||||
-e '^md[0-9]+$' \
|
-e '^md[0-9]+$' \
|
||||||
-e '^mfid[0-9]+$' \
|
-e '^mfid[0-9]+$' \
|
||||||
-e '^nda[0-9]+$' \
|
-e '^nda[0-9]+$' \
|
||||||
-e '^nvd[0-9]+$' \
|
-e '^nvd[0-9]+$' \
|
||||||
-e '^vtbd[0-9]+$'
|
-e '^vtbd[0-9]+$'
|
||||||
return $?
|
|
||||||
else
|
else
|
||||||
echo $device | egrep "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1
|
echo $device | grep -qE "^c[0-F]+([td][0-F]+)+$"
|
||||||
return $?
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,8 +140,7 @@ function is_real_device #disk
|
||||||
|
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
lsblk $DEV_RDSKDIR/$disk -o TYPE 2>/dev/null | \
|
lsblk $DEV_RDSKDIR/$disk -o TYPE 2>/dev/null | \
|
||||||
egrep disk >/dev/null
|
grep -q disk
|
||||||
return $?
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +154,7 @@ function is_loop_device #disk
|
||||||
|
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
lsblk $DEV_RDSKDIR/$disk -o TYPE 2>/dev/null | \
|
lsblk $DEV_RDSKDIR/$disk -o TYPE 2>/dev/null | \
|
||||||
egrep loop >/dev/null
|
grep -q loop
|
||||||
return $?
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +177,7 @@ function is_mpath_device #disk
|
||||||
|
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
lsblk $DEV_MPATHDIR/$disk -o TYPE 2>/dev/null | \
|
lsblk $DEV_MPATHDIR/$disk -o TYPE 2>/dev/null | \
|
||||||
egrep mpath >/dev/null
|
grep -q mpath
|
||||||
if (($? == 0)); then
|
if (($? == 0)); then
|
||||||
readlink $DEV_MPATHDIR/$disk > /dev/null 2>&1
|
readlink $DEV_MPATHDIR/$disk > /dev/null 2>&1
|
||||||
return $?
|
return $?
|
||||||
|
@ -301,12 +296,12 @@ function get_persistent_disk_name #device
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
if is_real_device $device; then
|
if is_real_device $device; then
|
||||||
dev_id="$(udevadm info -q all -n $DEV_DSKDIR/$device \
|
dev_id="$(udevadm info -q all -n $DEV_DSKDIR/$device \
|
||||||
| egrep disk/by-id | nawk '{print $2; exit}' \
|
| grep -E "disk/by-id" | nawk '{print $2; exit}' \
|
||||||
| nawk -F / '{print $3}')"
|
| nawk -F / '{print $3}')"
|
||||||
echo $dev_id
|
echo $dev_id
|
||||||
elif is_mpath_device $device; then
|
elif is_mpath_device $device; then
|
||||||
dev_id="$(udevadm info -q all -n $DEV_DSKDIR/$device \
|
dev_id="$(udevadm info -q all -n $DEV_DSKDIR/$device \
|
||||||
| egrep disk/by-id/dm-uuid \
|
| grep -E "disk/by-id/dm-uuid" \
|
||||||
| nawk '{print $2; exit}' \
|
| nawk '{print $2; exit}' \
|
||||||
| nawk -F / '{print $3}')"
|
| nawk -F / '{print $3}')"
|
||||||
echo $dev_id
|
echo $dev_id
|
||||||
|
@ -342,7 +337,7 @@ function on_off_disk # disk state{online,offline} host
|
||||||
| nawk '{print $1}')"
|
| nawk '{print $1}')"
|
||||||
while [[ -n $dep ]]; do
|
while [[ -n $dep ]]; do
|
||||||
#check if disk is online
|
#check if disk is online
|
||||||
lsscsi | egrep $dep > /dev/null
|
lsscsi | grep -qF $dep
|
||||||
if (($? == 0)); then
|
if (($? == 0)); then
|
||||||
dep_dir="/sys/block/${dm_name}"
|
dep_dir="/sys/block/${dm_name}"
|
||||||
dep_dir+="/slaves/${dep}/device"
|
dep_dir+="/slaves/${dep}/device"
|
||||||
|
@ -350,7 +345,7 @@ function on_off_disk # disk state{online,offline} host
|
||||||
sd="${dep_dir}/delete"
|
sd="${dep_dir}/delete"
|
||||||
log_must eval "echo 'offline' > ${ss}"
|
log_must eval "echo 'offline' > ${ss}"
|
||||||
log_must eval "echo '1' > ${sd}"
|
log_must eval "echo '1' > ${sd}"
|
||||||
lsscsi | egrep $dep > /dev/null
|
lsscsi | grep -qF $dep
|
||||||
if (($? == 0)); then
|
if (($? == 0)); then
|
||||||
log_fail "Offlining" \
|
log_fail "Offlining" \
|
||||||
"$disk failed"
|
"$disk failed"
|
||||||
|
@ -361,17 +356,14 @@ function on_off_disk # disk state{online,offline} host
|
||||||
done
|
done
|
||||||
elif [[ $state == "offline" ]] && ( is_real_device $disk ); then
|
elif [[ $state == "offline" ]] && ( is_real_device $disk ); then
|
||||||
#check if disk is online
|
#check if disk is online
|
||||||
lsscsi | egrep $disk > /dev/null
|
if lsscsi | grep -qF $disk; then
|
||||||
if (($? == 0)); then
|
|
||||||
dev_state="/sys/block/$disk/device/state"
|
dev_state="/sys/block/$disk/device/state"
|
||||||
dev_delete="/sys/block/$disk/device/delete"
|
dev_delete="/sys/block/$disk/device/delete"
|
||||||
log_must eval "echo 'offline' > ${dev_state}"
|
log_must eval "echo 'offline' > ${dev_state}"
|
||||||
log_must eval "echo '1' > ${dev_delete}"
|
log_must eval "echo '1' > ${dev_delete}"
|
||||||
lsscsi | egrep $disk > /dev/null
|
if lsscsi | grep -qF $disk; then
|
||||||
if (($? == 0)); then
|
log_fail "Offlining $disk failed"
|
||||||
log_fail "Offlining $disk" \
|
fi
|
||||||
"failed"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
log_note "$disk is already offline"
|
log_note "$disk is already offline"
|
||||||
fi
|
fi
|
||||||
|
@ -384,14 +376,14 @@ function on_off_disk # disk state{online,offline} host
|
||||||
| nawk -F / '{print $2}')"
|
| nawk -F / '{print $2}')"
|
||||||
dep="$(ls /sys/block/$dm_name/slaves \
|
dep="$(ls /sys/block/$dm_name/slaves \
|
||||||
| nawk '{print $1}')"
|
| nawk '{print $1}')"
|
||||||
lsscsi | egrep $dep > /dev/null
|
lsscsi | grep -qF $dep
|
||||||
if (($? != 0)); then
|
if (($? != 0)); then
|
||||||
log_fail "Onlining $disk failed"
|
log_fail "Onlining $disk failed"
|
||||||
fi
|
fi
|
||||||
elif is_real_device $disk; then
|
elif is_real_device $disk; then
|
||||||
block_device_wait
|
block_device_wait
|
||||||
typeset -i retries=0
|
typeset -i retries=0
|
||||||
while ! lsscsi | egrep -q $disk; do
|
while ! lsscsi | grep -qF $disk; do
|
||||||
if (( $retries > 2 )); then
|
if (( $retries > 2 )); then
|
||||||
log_fail "Onlining $disk failed"
|
log_fail "Onlining $disk failed"
|
||||||
break
|
break
|
||||||
|
@ -467,16 +459,14 @@ function load_scsi_debug # dev_size_mb add_host num_tgts max_luns blksz
|
||||||
log_unsupported "Platform does not have scsi_debug"
|
log_unsupported "Platform does not have scsi_debug"
|
||||||
"module"
|
"module"
|
||||||
fi
|
fi
|
||||||
lsmod | egrep scsi_debug > /dev/null
|
if lsmod | grep -q scsi_debug; then
|
||||||
if (($? == 0)); then
|
|
||||||
log_fail "scsi_debug module already installed"
|
log_fail "scsi_debug module already installed"
|
||||||
else
|
else
|
||||||
log_must modprobe scsi_debug dev_size_mb=$devsize \
|
log_must modprobe scsi_debug dev_size_mb=$devsize \
|
||||||
add_host=$hosts num_tgts=$tgts max_luns=$luns \
|
add_host=$hosts num_tgts=$tgts max_luns=$luns \
|
||||||
sector_size=$sector physblk_exp=$blkexp
|
sector_size=$sector physblk_exp=$blkexp
|
||||||
block_device_wait
|
block_device_wait
|
||||||
lsscsi | egrep scsi_debug > /dev/null
|
if ! lsscsi | grep -q scsi_debug; then
|
||||||
if (($? == 1)); then
|
|
||||||
log_fail "scsi_debug module install failed"
|
log_fail "scsi_debug module install failed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -32,7 +32,6 @@ export SYSTEM_FILES_COMMON='arp
|
||||||
dmesg
|
dmesg
|
||||||
du
|
du
|
||||||
echo
|
echo
|
||||||
egrep
|
|
||||||
env
|
env
|
||||||
expr
|
expr
|
||||||
false
|
false
|
||||||
|
|
|
@ -2143,7 +2143,7 @@ function get_disklist # pool
|
||||||
|
|
||||||
disklist=$(zpool iostat -v $1 | nawk '(NR >4) {print $1}' | \
|
disklist=$(zpool iostat -v $1 | nawk '(NR >4) {print $1}' | \
|
||||||
grep -v "\-\-\-\-\-" | \
|
grep -v "\-\-\-\-\-" | \
|
||||||
egrep -v -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
|
grep -vEe "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
|
||||||
|
|
||||||
echo $disklist
|
echo $disklist
|
||||||
}
|
}
|
||||||
|
@ -2315,8 +2315,7 @@ function check_pool_status # pool token keyword <verbose>
|
||||||
if [[ $verbose == true ]]; then
|
if [[ $verbose == true ]]; then
|
||||||
log_note $scan
|
log_note $scan
|
||||||
fi
|
fi
|
||||||
echo $scan | egrep -i "$keyword" > /dev/null 2>&1
|
echo $scan | grep -qi "$keyword"
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ log_onexit cleanup
|
||||||
log_note "Testing access to FILE"
|
log_note "Testing access to FILE"
|
||||||
log_must touch $TESTDIR/file.0
|
log_must touch $TESTDIR/file.0
|
||||||
log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:rw $TESTDIR/file.0
|
log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:rw $TESTDIR/file.0
|
||||||
getfacl $TESTDIR/file.0 2> /dev/null | egrep -q \
|
getfacl $TESTDIR/file.0 2> /dev/null | grep -q \
|
||||||
"^group:$ZFS_ACL_STAFF_GROUP:rw-$"
|
"^group:$ZFS_ACL_STAFF_GROUP:rw-$"
|
||||||
if [ "$?" -eq "0" ]; then
|
if [ "$?" -eq "0" ]; then
|
||||||
# Should be able to write to file
|
# Should be able to write to file
|
||||||
|
@ -76,7 +76,7 @@ if [ "$?" -eq "0" ]; then
|
||||||
log_note "expected mask drwxrw----+ but found $msk"
|
log_note "expected mask drwxrw----+ but found $msk"
|
||||||
log_fail "Expected permissions were not set."
|
log_fail "Expected permissions were not set."
|
||||||
fi
|
fi
|
||||||
getfacl $TESTDIR/dir.0 2> /dev/null | egrep -q \
|
getfacl $TESTDIR/dir.0 2> /dev/null | grep -q \
|
||||||
"^group:$ZFS_ACL_STAFF_GROUP:rw-$"
|
"^group:$ZFS_ACL_STAFF_GROUP:rw-$"
|
||||||
if [ "$?" -ne "0" ]; then
|
if [ "$?" -ne "0" ]; then
|
||||||
acl=$(getfacl $TESTDIR/dir.0 2> /dev/null)
|
acl=$(getfacl $TESTDIR/dir.0 2> /dev/null)
|
||||||
|
|
|
@ -59,7 +59,7 @@ if [ "$?" -ne "0" ]; then
|
||||||
log_note "expected mask drwx-wx---+ but found $msk"
|
log_note "expected mask drwx-wx---+ but found $msk"
|
||||||
log_fail "Expected permissions were not set."
|
log_fail "Expected permissions were not set."
|
||||||
fi
|
fi
|
||||||
getfacl $TESTDIR/dir.0 2> /dev/null | egrep -q \
|
getfacl $TESTDIR/dir.0 2> /dev/null | grep -q \
|
||||||
"^group:$ZFS_ACL_STAFF_GROUP:-wx$"
|
"^group:$ZFS_ACL_STAFF_GROUP:-wx$"
|
||||||
if [ "$?" -eq "0" ]; then
|
if [ "$?" -eq "0" ]; then
|
||||||
# Should be able to create file in directory
|
# Should be able to create file in directory
|
||||||
|
|
|
@ -43,16 +43,14 @@ log_note "Testing access to DIRECTORY"
|
||||||
log_must mkdir $ACLDIR
|
log_must mkdir $ACLDIR
|
||||||
log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
|
log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
|
||||||
log_must setfacl -d -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
|
log_must setfacl -d -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
|
||||||
getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str1"
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$?" -eq "0" ]; then
|
if getfacl $ACLDIR 2> /dev/null | grep -q "$acl_str1" &&
|
||||||
|
getfacl $ACLDIR 2> /dev/null | grep -q "$acl_str2"
|
||||||
|
then
|
||||||
log_must zfs unmount $TESTPOOL/$TESTFS
|
log_must zfs unmount $TESTPOOL/$TESTFS
|
||||||
log_must zfs mount $TESTPOOL/$TESTFS
|
log_must zfs mount $TESTPOOL/$TESTFS
|
||||||
log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str1\""
|
log_must eval "getfacl $ACLDIR 2> /dev/null | grep -q \"$acl_str1\""
|
||||||
log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str2\""
|
log_must eval "getfacl $ACLDIR 2> /dev/null | grep -q \"$acl_str2\""
|
||||||
log_pass "POSIX ACLs survive remount"
|
log_pass "POSIX ACLs survive remount"
|
||||||
else
|
else
|
||||||
log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rwx'"
|
log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rwx'"
|
||||||
|
|
|
@ -53,7 +53,7 @@ do
|
||||||
special $stype $sdisks
|
special $stype $sdisks
|
||||||
|
|
||||||
ac_value="$(zpool get -H -o property,value all | \
|
ac_value="$(zpool get -H -o property,value all | \
|
||||||
egrep allocation_classes | nawk '{print $2}')"
|
grep allocation_classes | nawk '{print $2}')"
|
||||||
if [ "$ac_value" = "active" ]; then
|
if [ "$ac_value" = "active" ]; then
|
||||||
log_note "feature@allocation_classes is active"
|
log_note "feature@allocation_classes is active"
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,7 +42,7 @@ do
|
||||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS
|
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS
|
||||||
fi
|
fi
|
||||||
ac_value="$(zpool get -H -o property,value all | \
|
ac_value="$(zpool get -H -o property,value all | \
|
||||||
egrep allocation_classes | awk '{print $2}')"
|
grep allocation_classes | awk '{print $2}')"
|
||||||
if [ "$ac_value" = "enabled" ]; then
|
if [ "$ac_value" = "enabled" ]; then
|
||||||
log_note "feature@allocation_classes is enabled"
|
log_note "feature@allocation_classes is enabled"
|
||||||
else
|
else
|
||||||
|
@ -57,7 +57,7 @@ do
|
||||||
$CLASS_DISK0 $CLASS_DISK1
|
$CLASS_DISK0 $CLASS_DISK1
|
||||||
fi
|
fi
|
||||||
ac_value="$(zpool get -H -o property,value all | \
|
ac_value="$(zpool get -H -o property,value all | \
|
||||||
egrep allocation_classes | awk '{print $2}')"
|
grep allocation_classes | awk '{print $2}')"
|
||||||
if [ "$ac_value" = "active" ]; then
|
if [ "$ac_value" = "active" ]; then
|
||||||
log_note "feature@allocation_classes is active"
|
log_note "feature@allocation_classes is active"
|
||||||
else
|
else
|
||||||
|
|
|
@ -115,8 +115,7 @@ function histo_populate_test_pool
|
||||||
of=/${pool}/B_${this_rs}/file_${filenum} \
|
of=/${pool}/B_${this_rs}/file_${filenum} \
|
||||||
bs=${this_rs} count=${thiscount} \
|
bs=${this_rs} count=${thiscount} \
|
||||||
iflag=fullblock 2>&1 | \
|
iflag=fullblock 2>&1 | \
|
||||||
egrep -v -e "records in" -e "records out" \
|
grep -ve "records in" -e "records out" -e "bytes.*copied"
|
||||||
-e "bytes.*copied"
|
|
||||||
((filenum+=1))
|
((filenum+=1))
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
|
@ -65,7 +65,7 @@ done
|
||||||
|
|
||||||
# Specifying a non-existent object identifier returns an error
|
# Specifying a non-existent object identifier returns an error
|
||||||
obj_id_highest=$(zdb -P -dd $TESTPOOL/$TESTFS 2>/dev/null |
|
obj_id_highest=$(zdb -P -dd $TESTPOOL/$TESTFS 2>/dev/null |
|
||||||
egrep "^ +-?([0-9]+ +){7}" | sort -n | tail -n 1 | awk '{print $1}')
|
grep -E "^ +-?([0-9]+ +){7}" | sort -n | tail -n 1 | awk '{print $1}')
|
||||||
obj_id_invalid=$(( $obj_id_highest + 1 ))
|
obj_id_invalid=$(( $obj_id_highest + 1 ))
|
||||||
log_mustnot zdb -dd $TESTPOOL/$TESTFS $obj_id_invalid
|
log_mustnot zdb -dd $TESTPOOL/$TESTFS $obj_id_invalid
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,7 @@ function get_object_list_range
|
||||||
function get_object_list
|
function get_object_list
|
||||||
{
|
{
|
||||||
zdb -P -dd $@ 2>/dev/null |
|
zdb -P -dd $@ 2>/dev/null |
|
||||||
egrep "^ +-?([0-9]+ +){7}" |
|
sed -E '/^ +-?([0-9]+ +){7}/!d;s/^[[:space:]]*//' |
|
||||||
sed 's/^[[:space:]]*//' |
|
|
||||||
sort -n
|
sort -n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
# STRATEGY:
|
# STRATEGY:
|
||||||
# 1. Create a multiple depth filesystem.
|
# 1. Create a multiple depth filesystem.
|
||||||
# 2. 'zfs get -d <n>' to get the output.
|
# 2. 'zfs get -d <n>' to get the output.
|
||||||
# 3. 'zfs get -r|egrep' to get the expected output.
|
# 3. 'zfs get -r|grep' to get the expected output.
|
||||||
# 4. Compare the two outputs, they should be same.
|
# 4. Compare the two outputs, they should be same.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ for dp in ${depth_array[@]}; do
|
||||||
done
|
done
|
||||||
for prop in $(gen_option_str "${all_props[*]}" "" "," $prop_numb); do
|
for prop in $(gen_option_str "${all_props[*]}" "" "," $prop_numb); do
|
||||||
log_must eval "zfs get -H -d $dp -o name $prop $DEPTH_FS > $DEPTH_OUTPUT"
|
log_must eval "zfs get -H -d $dp -o name $prop $DEPTH_FS > $DEPTH_OUTPUT"
|
||||||
log_must eval "zfs get -rH -o name $prop $DEPTH_FS | egrep -e '$eg_opt' > $EXPECT_OUTPUT"
|
log_must eval "zfs get -rH -o name $prop $DEPTH_FS | grep -E '$eg_opt' > $EXPECT_OUTPUT"
|
||||||
log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
|
log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
|
||||||
done
|
done
|
||||||
(( old_val=dp ))
|
(( old_val=dp ))
|
||||||
|
|
|
@ -90,7 +90,7 @@ do
|
||||||
$file.1 $file.2 $file.3 $file.4
|
$file.1 $file.2 $file.3 $file.4
|
||||||
! poolexists $TESTPOOL && \
|
! poolexists $TESTPOOL && \
|
||||||
log_fail "Creating pool with $opt fails."
|
log_fail "Creating pool with $opt fails."
|
||||||
mpt=`zfs mount | egrep "^$TESTPOOL[^/]" | awk '{print $2}'`
|
mpt=`zfs mount | grep -E "^$TESTPOOL[^/]" | awk '{print $2}'`
|
||||||
(( ${#mpt} == 0 )) && \
|
(( ${#mpt} == 0 )) && \
|
||||||
log_fail "$TESTPOOL created with $opt is not mounted."
|
log_fail "$TESTPOOL created with $opt is not mounted."
|
||||||
mpt_val=$(get_prop "mountpoint" $TESTPOOL)
|
mpt_val=$(get_prop "mountpoint" $TESTPOOL)
|
||||||
|
|
|
@ -181,7 +181,7 @@ function _translate_vdev
|
||||||
#
|
#
|
||||||
typeset keywords="mirror replacing raidz1 raidz2 raidz3 indirect draid1 draid2 draid3"
|
typeset keywords="mirror replacing raidz1 raidz2 raidz3 indirect draid1 draid2 draid3"
|
||||||
for word in $keywords; do
|
for word in $keywords; do
|
||||||
echo $vdev | egrep -qE \
|
echo $vdev | grep -qE \
|
||||||
"^${word}-[0-9]+\$|^${word}:[0-9]+d:[0-9]c:[0-9]+s-[0-9]+\$"
|
"^${word}-[0-9]+\$|^${word}:[0-9]+d:[0-9]c:[0-9]+s-[0-9]+\$"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
vdev=$word
|
vdev=$word
|
||||||
|
|
|
@ -79,7 +79,7 @@ while read -r offset_size; do
|
||||||
# Note we use '-t x4' instead of '-t x8' here because x8 is not
|
# Note we use '-t x4' instead of '-t x8' here because x8 is not
|
||||||
# a supported format on FreeBSD.
|
# a supported format on FreeBSD.
|
||||||
dd if=$SMALLFILE skip=$((offset / bs)) count=$((size / bs)) bs=$bs |
|
dd if=$SMALLFILE skip=$((offset / bs)) count=$((size / bs)) bs=$bs |
|
||||||
od -t x4 -Ad | egrep -q "deadbeef +deadbeef +deadbeef +deadbeef" ||
|
od -t x4 -Ad | grep -qE "deadbeef +deadbeef +deadbeef +deadbeef" ||
|
||||||
log_fail "Pattern not found in metaslab free space"
|
log_fail "Pattern not found in metaslab free space"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#
|
#
|
||||||
# STRATEGY:
|
# STRATEGY:
|
||||||
# 1. 'zfs list -d <n>' to get the output.
|
# 1. 'zfs list -d <n>' to get the output.
|
||||||
# 2. 'zfs list -r|egrep' to get the expected output.
|
# 2. 'zfs list -r|grep' to get the expected output.
|
||||||
# 3. Compare the two outputs, they should be same.
|
# 3. Compare the two outputs, they should be same.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -50,8 +50,7 @@ fi
|
||||||
|
|
||||||
function cleanup
|
function cleanup
|
||||||
{
|
{
|
||||||
log_must rm -f $DEPTH_OUTPUT
|
log_must rm -f $DEPTH_OUTPUT $EXPECT_OUTPUT
|
||||||
log_must rm -f $EXPECT_OUTPUT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log_onexit cleanup
|
log_onexit cleanup
|
||||||
|
@ -76,10 +75,10 @@ for dp in ${depth_array[@]}; do
|
||||||
log_must eval "zfs list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
|
log_must eval "zfs list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
|
||||||
[[ -s "$DEPTH_OUTPUT" ]] && \
|
[[ -s "$DEPTH_OUTPUT" ]] && \
|
||||||
log_fail "$DEPTH_OUTPUT should be null."
|
log_fail "$DEPTH_OUTPUT should be null."
|
||||||
log_mustnot zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | egrep -e '$eg_opt'
|
log_mustnot zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | grep -E "$eg_opt"
|
||||||
else
|
else
|
||||||
log_must eval "zfs list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
|
log_must eval "zfs list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
|
||||||
log_must eval "zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | egrep -e '$eg_opt' > $EXPECT_OUTPUT"
|
log_must eval "zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | grep -E '$eg_opt' > $EXPECT_OUTPUT"
|
||||||
log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
|
log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
|
||||||
fi
|
fi
|
||||||
(( fs+=1 ))
|
(( fs+=1 ))
|
||||||
|
|
|
@ -134,9 +134,8 @@ do
|
||||||
((timeout++))
|
((timeout++))
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
zpool events $TESTPOOL \
|
if zpool events $TESTPOOL \
|
||||||
| egrep sysevent.fs.zfs.resilver_finish > /dev/null
|
| grep -qF sysevent.fs.zfs.resilver_finish; then
|
||||||
if (($? == 0)); then
|
|
||||||
log_note "Auto-online of $offline_disk is complete"
|
log_note "Auto-online of $offline_disk is complete"
|
||||||
sleep 1
|
sleep 1
|
||||||
break
|
break
|
||||||
|
|
|
@ -221,7 +221,7 @@ function is_data_valid
|
||||||
log_must zpool scrub -w $pool
|
log_must zpool scrub -w $pool
|
||||||
|
|
||||||
record_data $pool $PST_RECORD_FILE
|
record_data $pool $PST_RECORD_FILE
|
||||||
if ! diff $PRE_RECORD_FILE $PST_RECORD_FILE > /dev/null 2>&1; then
|
if ! cmp $PRE_RECORD_FILE $PST_RECORD_FILE > /dev/null; then
|
||||||
log_must cat $PRE_RECORD_FILE
|
log_must cat $PRE_RECORD_FILE
|
||||||
log_must cat $PST_RECORD_FILE
|
log_must cat $PST_RECORD_FILE
|
||||||
diff -u $PRE_RECORD_FILE $PST_RECORD_FILE
|
diff -u $PRE_RECORD_FILE $PST_RECORD_FILE
|
||||||
|
@ -243,8 +243,8 @@ function get_vdevs #pool cnt
|
||||||
typeset -i cnt=$2
|
typeset -i cnt=$2
|
||||||
|
|
||||||
typeset all_devs=$(zpool iostat -v $pool | awk '{print $1}'| \
|
typeset all_devs=$(zpool iostat -v $pool | awk '{print $1}'| \
|
||||||
egrep -v "^pool$|^capacity$|^mirror\-[0-9]$|^raidz[1-3]\-[0-9]$|^draid[1-3].*\-[0-9]$|---" | \
|
grep -vEe "^pool$|^capacity$|^mirror\-[0-9]$|^raidz[1-3]\-[0-9]$|^draid[1-3].*\-[0-9]$|---" | \
|
||||||
egrep -v "/old$|^$pool$")
|
grep -vEe "/old$|^$pool$")
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
typeset vdevs
|
typeset vdevs
|
||||||
while ((i < cnt)); do
|
while ((i < cnt)); do
|
||||||
|
|
|
@ -46,7 +46,7 @@ function check_feature_flag
|
||||||
expected_value=$3
|
expected_value=$3
|
||||||
|
|
||||||
value="$(zpool get -H -o property,value all $pool | \
|
value="$(zpool get -H -o property,value all $pool | \
|
||||||
egrep "$feature" | awk '{print $2}')"
|
grep -E "$feature" | awk '{print $2}')"
|
||||||
if [ "$value" = "$expected_value" ]; then
|
if [ "$value" = "$expected_value" ]; then
|
||||||
log_note "$feature verified to be $value"
|
log_note "$feature verified to be $value"
|
||||||
else
|
else
|
||||||
|
|
|
@ -367,7 +367,7 @@ function fs_inherit_prop
|
||||||
else
|
else
|
||||||
fs_prop=$(zfs inherit 2>&1 | \
|
fs_prop=$(zfs inherit 2>&1 | \
|
||||||
awk '$2=="YES" && $3=="YES" {print $1}'|
|
awk '$2=="YES" && $3=="YES" {print $1}'|
|
||||||
egrep -v "devices|mlslabel|sharenfs|sharesmb|zoned")
|
grep -E -v "devices|mlslabel|sharenfs|sharesmb|zoned")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $fs_prop
|
echo $fs_prop
|
||||||
|
|
|
@ -52,7 +52,7 @@ function edited_prop
|
||||||
"get")
|
"get")
|
||||||
typeset props=$(zfs inherit 2>&1 | \
|
typeset props=$(zfs inherit 2>&1 | \
|
||||||
awk '$2=="YES" {print $1}' | \
|
awk '$2=="YES" {print $1}' | \
|
||||||
egrep -v "^vol|\.\.\.$")
|
grep -E -v "^vol|\.\.\.$")
|
||||||
for item in $props ; do
|
for item in $props ; do
|
||||||
if [[ $item == "mlslabel" ]] && \
|
if [[ $item == "mlslabel" ]] && \
|
||||||
! is_te_enabled ; then
|
! is_te_enabled ; then
|
||||||
|
|
|
@ -43,14 +43,14 @@ function get_conf_section # regex conf
|
||||||
function get_leaf_vd_zap # dsk conf
|
function get_leaf_vd_zap # dsk conf
|
||||||
{
|
{
|
||||||
typeset section=$(get_conf_section "$1" "$2")
|
typeset section=$(get_conf_section "$1" "$2")
|
||||||
echo "$section" | egrep \
|
echo "$section" | grep -E \
|
||||||
"com.delphix:vdev_zap_leaf: [0-9]+" | awk '{print $2}'
|
"com.delphix:vdev_zap_leaf: [0-9]+" | awk '{print $2}'
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_top_vd_zap # dsk conf
|
function get_top_vd_zap # dsk conf
|
||||||
{
|
{
|
||||||
typeset section=$(get_conf_section "$1" "$2")
|
typeset section=$(get_conf_section "$1" "$2")
|
||||||
echo "$section" | egrep \
|
echo "$section" | grep -E \
|
||||||
"com.delphix:vdev_zap_top: [0-9]+" | awk '{print $2}'
|
"com.delphix:vdev_zap_top: [0-9]+" | awk '{print $2}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue