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 with the 249c3fd121SMatthew Ahrens# -e (embedded) flag in the presence of a corrupted stream. 259c3fd121SMatthew Ahrens# 269c3fd121SMatthew Ahrens# Strategy: 279c3fd121SMatthew Ahrens# 1. Start a full ZFS send with the -e flag (embedded), redirect output to 289c3fd121SMatthew Ahrens# a file 299c3fd121SMatthew Ahrens# 2. Mess up the contents of the stream state file on disk 309c3fd121SMatthew Ahrens# 3. Try ZFS receive, which should fail with a checksum mismatch error 319c3fd121SMatthew Ahrens# 4. ZFS send to the stream state file again using the receive_resume_token 329c3fd121SMatthew Ahrens# 5. ZFS receieve and verify the receive completes successfully 339c3fd121SMatthew Ahrens# 6. Repeat steps on an incremental ZFS send 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 "with the -e (embedded) flag" 409c3fd121SMatthew Ahrens 419c3fd121SMatthew Ahrenssendfs=$POOL/sendfs 429c3fd121SMatthew Ahrensrecvfs=$POOL2/recvfs 439c3fd121SMatthew Ahrensstreamfs=$POOL/stream 449c3fd121SMatthew Ahrens 455602294fSDan Kimmellog_onexit resume_cleanup $sendfs $streamfs 465602294fSDan Kimmel 47*544132fcSloli10Ktest_fs_setup $sendfs $recvfs $streamfs 481d32ba66SJohn Wren Kennedyresume_test "zfs send -v -e $sendfs@a" $streamfs $recvfs 491d32ba66SJohn Wren Kennedyresume_test "zfs send -v -e -i @a $sendfs@b" $streamfs $recvfs 509c3fd121SMatthew Ahrensfile_check $sendfs $recvfs 519c3fd121SMatthew Ahrens 529c3fd121SMatthew Ahrenslog_pass "Verify resumability of a full and incremental ZFS send/receive " \ 539c3fd121SMatthew Ahrens "with the -e (embedded) flag" 54