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 ZFS send/receive with the -D (dedup) flag in 249c3fd121SMatthew Ahrens# the presence of a corrupted stream. 259c3fd121SMatthew Ahrens# 269c3fd121SMatthew Ahrens# Strategy: 279c3fd121SMatthew Ahrens# 1. Start a full ZFS send with the -D flag (dedup), 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# 339c3fd121SMatthew Ahrens 349c3fd121SMatthew Ahrensverify_runnable "both" 359c3fd121SMatthew Ahrens 369c3fd121SMatthew Ahrenslog_assert "Verify resumability of full ZFS send/receive with the -D " \ 379c3fd121SMatthew Ahrens "(dedup) flag" 389c3fd121SMatthew Ahrens 399c3fd121SMatthew Ahrenssendfs=$POOL/sendfs 409c3fd121SMatthew Ahrensrecvfs=$POOL2/recvfs 419c3fd121SMatthew Ahrensstreamfs=$POOL/stream 429c3fd121SMatthew Ahrens 435602294fSDan Kimmellog_onexit resume_cleanup $sendfs $streamfs 445602294fSDan Kimmel 45*544132fcSlolitest_fs_setup $sendfs $recvfs $streamfs 461d32ba66SJohn Wren Kennedyresume_test "zfs send -D -v $sendfs@a" $streamfs $recvfs 479c3fd121SMatthew Ahrensfile_check $sendfs $recvfs 489c3fd121SMatthew Ahrens 499c3fd121SMatthew Ahrenslog_pass "Verify resumability of full ZFS send/receive with the -D " \ 509c3fd121SMatthew Ahrens "(dedup) flag" 51