From f7cc8dddf76f164be221c39b7687b1cb99af55e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 23 Mar 2022 21:08:55 +0100 Subject: [PATCH] tests: rsend_012_pos: backup/restore in one invocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia ZiemiaƄska Closes #13259 --- .../tests/functional/rsend/rsend_012_pos.ksh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh index b92e5c460c..48d70ec2d6 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh @@ -47,28 +47,21 @@ function edited_prop typeset behaviour=$1 typeset ds=$2 typeset backfile=$TESTDIR/edited_prop_$ds + typeset te=0 case $behaviour in "get") + is_te_enabled && te=1 typeset props=$(zfs inherit 2>&1 | \ - awk '$2=="YES" && $1 !~ /^vol|\.\.\.$/ {print $1}') - for item in $props ; do - if [[ $item == "mlslabel" ]] && \ - ! is_te_enabled ; then - continue - fi - log_must eval "zfs get -H -o property,value $item $ds >> $backfile" - done + awk -v te=$te '$2=="YES" && $1 !~ /^vol|\.\.\.$/ && (te || $1 != "mlslabel") {printf("%s,", $1)}') + log_must eval "zfs get -Ho property,value ${props%,} $ds >> $backfile" ;; "set") if [[ ! -f $backfile ]] ; then log_fail "$ds need backup properties firstly." fi - typeset prop value - while read -r prop value; do - log_must zfs set "$prop=$value" "$ds" - done < $backfile + log_must zfs set $(tr '\t' '=' < $backfile) "$ds" ;; *) log_fail "Unrecognized behaviour: $behaviour"