15602294fSDan Kimmel#!/usr/bin/ksh 25602294fSDan Kimmel 35602294fSDan Kimmel# 45602294fSDan Kimmel# This file and its contents are supplied under the terms of the 55602294fSDan Kimmel# Common Development and Distribution License ("CDDL"), version 1.0. 65602294fSDan Kimmel# You may only use this file in accordance with the terms of version 75602294fSDan Kimmel# 1.0 of the CDDL. 85602294fSDan Kimmel# 95602294fSDan Kimmel# A full copy of the text of the CDDL should have accompanied this 105602294fSDan Kimmel# source. A copy of the CDDL is also available via the Internet at 115602294fSDan Kimmel# http://www.illumos.org/license/CDDL. 125602294fSDan Kimmel# 135602294fSDan Kimmel 145602294fSDan Kimmel# 155602294fSDan Kimmel# Copyright (c) 2015 by Delphix. All rights reserved. 165602294fSDan Kimmel# 175602294fSDan Kimmel 185602294fSDan Kimmel. $STF_SUITE/tests/functional/rsend/rsend.kshlib 195602294fSDan Kimmel 205602294fSDan Kimmel# 215602294fSDan Kimmel# Description: 225602294fSDan Kimmel# Verify resumability of full and incremental ZFS send/receive with the -c 235602294fSDan Kimmel# (compress) flag in the presence of a corrupted stream. 245602294fSDan Kimmel# 255602294fSDan Kimmel# Strategy: 265602294fSDan Kimmel# 1. Start a full ZFS send with the -c flag (compress), redirect output to 275602294fSDan Kimmel# a file 285602294fSDan Kimmel# 2. Mess up the contents of the stream state file on disk 295602294fSDan Kimmel# 3. Try ZFS receive, which should fail with a checksum mismatch error 305602294fSDan Kimmel# 4. ZFS send to the stream state file again using the receive_resume_token 315602294fSDan Kimmel# 5. ZFS receieve and verify the receive completes successfully 325602294fSDan Kimmel# 6. Repeat steps on an incremental ZFS send 335602294fSDan Kimmel# 345602294fSDan Kimmel 355602294fSDan Kimmelverify_runnable "both" 365602294fSDan Kimmel 375602294fSDan Kimmelsendfs=$POOL/sendfs 385602294fSDan Kimmelrecvfs=$POOL2/recvfs 395602294fSDan Kimmelstreamfs=$POOL/stream 405602294fSDan Kimmel 415602294fSDan Kimmellog_assert "Verify compressed send streams can be resumed if interrupted" 425602294fSDan Kimmellog_onexit resume_cleanup $sendfs $streamfs 435602294fSDan Kimmel 44*544132fcSlolitest_fs_setup $sendfs $recvfs $streamfs 455602294fSDan Kimmelresume_test "zfs send -c -v $sendfs@a" $streamfs $recvfs 465602294fSDan Kimmelresume_test "zfs send -c -v -i @a $sendfs@b" $streamfs $recvfs 475602294fSDan Kimmelfile_check $sendfs $recvfs 485602294fSDan Kimmel 495602294fSDan Kimmellog_pass "Compressed send streams can be resumed if interrupted" 50