diff options
author | LOLi <[email protected]> | 2017-09-09 00:24:31 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-09-08 15:24:31 -0700 |
commit | 835db58592d7d947e5818eb7281882e2a46073e0 (patch) | |
tree | 5f99c47d3fa3ab2d18aeafb4b7be90975984f747 /tests | |
parent | 57858fb5ca4b1d0f28b054cb5e15aaf3bc54c99e (diff) |
Add -vnP support to 'zfs send' for bookmarks
This leverages the functionality introduced in cf7684b to expose
verbose, dry-run and parsable 'zfs send' options for bookmarks.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #3666
Closes #6601
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh index 801633e1f..1fe10a760 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh @@ -60,10 +60,8 @@ function get_estimate_size typeset total_size=$(zfs send $option $base_snapshot $snapshot \ 2>&1 | tail -1) fi - if [[ $options == *"P"* ]]; then - total_size=$(echo "$total_size" | awk '{print $2}') - else - total_size=$(echo "$total_size" | awk '{print $5}') + total_size=$(echo "$total_size" | awk '{print $NF}') + if [[ $options != *"P"* ]]; then total_size=${total_size%M} total_size=$(echo "$total_size * $block_count" | bc) fi @@ -106,14 +104,18 @@ for block_size in 64 128 256; do log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS1/file$block_size \ bs=1M count=$block_size log_must zfs snapshot $TESTPOOL/$TESTFS1@snap$block_size + log_must zfs bookmark $TESTPOOL/$TESTFS1@snap$block_size \ + "$TESTPOOL/$TESTFS1#bmark$block_size" done full_snapshot="$TESTPOOL/$TESTFS1@snap64" -increamental_snapshot="$TESTPOOL/$TESTFS1@snap256" +incremental_snapshot="$TESTPOOL/$TESTFS1@snap256" +full_bookmark="$TESTPOOL/$TESTFS1#bmark64" +incremental_bookmark="$TESTPOOL/$TESTFS1#bmark256" full_size=$(zfs send $full_snapshot 2>&1 | wc -c) -increamental_size=$(zfs send $increamental_snapshot 2>&1 | wc -c) -increamental_send=$(zfs send -i $full_snapshot $increamental_snapshot 2>&1 | wc -c) +incremental_size=$(zfs send $incremental_snapshot 2>&1 | wc -c) +incremental_send=$(zfs send -i $full_snapshot $incremental_snapshot 2>&1 | wc -c) log_note "verify zfs send -nv" options="-nv" @@ -129,31 +131,35 @@ log_must verify_size_estimates $options $full_size log_note "verify zfs send -nv for multiple snapshot send" options="-nv" -refer_size=$(get_prop refer $increamental_snapshot) +refer_size=$(get_prop refer $incremental_snapshot) -estimate_size=$(get_estimate_size $increamental_snapshot $options) -log_must verify_size_estimates $options $increamental_size +estimate_size=$(get_estimate_size $incremental_snapshot $options) +log_must verify_size_estimates $options $incremental_size log_note "verify zfs send -vPn for multiple snapshot send" options="-vPn" -estimate_size=$(get_estimate_size $increamental_snapshot $options) -log_must verify_size_estimates $options $increamental_size +estimate_size=$(get_estimate_size $incremental_snapshot $options) +log_must verify_size_estimates $options $incremental_size -log_note "verify zfs send -inv for increamental send" +log_note "verify zfs send -inv for incremental send" options="-nvi" -refer_size=$(get_prop refer $increamental_snapshot) +refer_size=$(get_prop refer $incremental_snapshot) deduct_size=$(get_prop refer $full_snapshot) refer_size=$(echo "$refer_size - $deduct_size" | bc) -estimate_size=$(get_estimate_size $increamental_snapshot $options $full_snapshot) -log_must verify_size_estimates $options $increamental_send +estimate_size=$(get_estimate_size $incremental_snapshot $options $full_snapshot) +log_must verify_size_estimates $options $incremental_send +estimate_size=$(get_estimate_size $incremental_snapshot $options $full_bookmark) +log_must verify_size_estimates $options $incremental_send -log_note "verify zfs send -ivPn for increamental send" +log_note "verify zfs send -ivPn for incremental send" options="-vPni" -estimate_size=$(get_estimate_size $increamental_snapshot $options $full_snapshot) -log_must verify_size_estimates $options $increamental_send +estimate_size=$(get_estimate_size $incremental_snapshot $options $full_snapshot) +log_must verify_size_estimates $options $incremental_send +estimate_size=$(get_estimate_size $incremental_snapshot $options $full_bookmark) +log_must verify_size_estimates $options $incremental_send log_must zfs destroy -r $TESTPOOL/$TESTFS1 |