19c3fd121SMatthew Ahrens#!/usr/bin/ksh 29c3fd121SMatthew Ahrens 39c3fd121SMatthew Ahrens# 49c3fd121SMatthew Ahrens# This file and its contents are supplied under the terms of the 59c3fd121SMatthew Ahrens# Common Development and Distribution License ("CDDL"), version 1.0. 69c3fd121SMatthew Ahrens# You may only use this file in accordance with the terms of version 79c3fd121SMatthew Ahrens# 1.0 of the CDDL. 89c3fd121SMatthew Ahrens# 99c3fd121SMatthew Ahrens# A full copy of the text of the CDDL should have accompanied this 109c3fd121SMatthew Ahrens# source. A copy of the CDDL is also available via the Internet at 119c3fd121SMatthew Ahrens# http://www.illumos.org/license/CDDL. 129c3fd121SMatthew Ahrens# 139c3fd121SMatthew Ahrens 149c3fd121SMatthew Ahrens# 151d32ba66SJohn Wren Kennedy# Copyright (c) 2014, 2016 by Delphix. All rights reserved. 169c3fd121SMatthew Ahrens# 179c3fd121SMatthew Ahrens 189c3fd121SMatthew Ahrens. $STF_SUITE/include/libtest.shlib 199c3fd121SMatthew Ahrens. $STF_SUITE/tests/functional/rsend/rsend.kshlib 209c3fd121SMatthew Ahrens 219c3fd121SMatthew Ahrens# 229c3fd121SMatthew Ahrens# Description: 239c3fd121SMatthew Ahrens# Verify resumability of a full and incremental ZFS send/receive in the 249c3fd121SMatthew Ahrens# presence of a corrupted stream. 259c3fd121SMatthew Ahrens# 269c3fd121SMatthew Ahrens# Strategy: 279c3fd121SMatthew Ahrens# 1. Start a full ZFS send, redirect output to a file 289c3fd121SMatthew Ahrens# 2. Mess up the contents of the stream state file on disk 299c3fd121SMatthew Ahrens# 3. Try ZFS receive, which should fail with a checksum mismatch error 309c3fd121SMatthew Ahrens# 4. ZFS send to the stream state file again using the receive_resume_token 319c3fd121SMatthew Ahrens# 5. ZFS receieve and verify the receive completes successfully 329c3fd121SMatthew Ahrens# 6. Repeat steps on an incremental ZFS send 33ac89d1e8SJohn Kennedy# 7. Repeat the entire procedure for a dataset at the pool root 349c3fd121SMatthew Ahrens# 359c3fd121SMatthew Ahrens 369c3fd121SMatthew Ahrensverify_runnable "both" 379c3fd121SMatthew Ahrens 389c3fd121SMatthew Ahrenslog_assert "Verify resumability of a full and incremental ZFS send/receive " \ 399c3fd121SMatthew Ahrens "in the presence of a corrupted stream" 405602294fSDan Kimmellog_onexit resume_cleanup $sendfs $streamfs 419c3fd121SMatthew Ahrens 425602294fSDan Kimmelsendfs=$POOL/sendfs 43ac89d1e8SJohn Kennedyrecvfs=$POOL3/recvfs 44ac89d1e8SJohn Kennedystreamfs=$POOL2/stream 459c3fd121SMatthew Ahrens 46*544132fcSloli10Kfor sendfs in $POOL2/sendfs $POOL3; do 47*544132fcSloli10K test_fs_setup $sendfs $recvfs $streamfs 481d32ba66SJohn Wren Kennedy resume_test "zfs send -v $sendfs@a" $streamfs $recvfs 491d32ba66SJohn Wren Kennedy resume_test "zfs send -v -i @a $sendfs@b" $streamfs $recvfs 509c3fd121SMatthew Ahrens file_check $sendfs $recvfs 51ac89d1e8SJohn Kennedydone 529c3fd121SMatthew Ahrens 539c3fd121SMatthew Ahrenslog_pass "Verify resumability of a full and incremental ZFS send/receive " \ 549c3fd121SMatthew Ahrens "in the presence of a corrupted stream" 55