#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify 'zfs send' can generate valid streams with a property setup.
#
# STRATEGY:
# 1. Setup property for filesystem
# 2. Fill in some data into filesystem
# 3. Create a full send streams
# 4. Receive the send stream
# 5. Verify the receive result
#
verify_runnable "both"
function cleanup
{
snapexists $snap && \
datasetexists $ctr && \
[[ -e $origfile ]] && \
[[ -e $stream ]] && \
}
{
typeset property=$1
typeset prop_val=$2
file_write -o create -f $origfile -b $BLOCK_SIZE -c $WRITE_COUNT
(( $? != 0 )) && \
log_fail "'zfs send' fails to create send streams."
(( $? != 0 )) && \
log_fail "'zfs receive' fails to receive send streams."
#verify receive result
! datasetexists $rstfs && \
! snapexists $rstfssnap && \
log_fail "'zfs receive' fails to restore $rstfssnap"
if [[ ! -e $rstfile ]] || [[ ! -e $rstsnapfile ]]; then
log_fail " Data lost after receiving stream"
fi
#Destroy datasets and stream for next testing
if is_global_zone ; then
else
fi
}
log_assert "Verify 'zfs send' generates valid streams with a property setup"
if is_global_zone; then
else
fi
set -A props "compression" "checksum" "recordsize"
set -A propval "on lzjb" "on fletcher2 fletcher4 sha256" \
"512 1k 4k 8k 16k 32k 64k 128k"
#Create a dataset to receive the send stream
typeset -i i=0
while (( i < ${#props[*]} ))
do
do
do_testing ${props[i]} $value
done
(( i = i + 1 ))
done
log_pass "'zfs send' generates streams with a property setup as expected."