1#!/bin/ksh -p
2
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright (c) 2023 by Delphix. All rights reserved.
16#
17
18. $STF_SUITE/tests/functional/rsend/rsend.kshlib
19
20#
21# Description:
22# Verify recursive incremental sends missing snapshots behave correctly.
23#
24# Strategy:
25# 1. Create snapshots on source filesystem.
26# 2. Recursively send snapshots.
27# 3. Delete snapshot on source filesystem
28# 4. Perform incremental recursive send.
29# 5. Verify matching snapshot lists.
30#
31
32verify_runnable "both"
33
34sendfs=$POOL/sendfs
35recvfs=$POOL2/recvfs
36
37function cleanup {
38	rm $BACKDIR/stream1
39	rm $BACKDIR/stream2
40	zfs destroy -r $sendfs
41	zfs destroy -r $recvfs
42}
43
44log_assert "Verify recursive incremental sends missing snapshots behave correctly."
45log_onexit cleanup
46
47log_must zfs create $sendfs
48log_must zfs snapshot $sendfs@A
49log_must zfs snapshot $sendfs@B
50log_must zfs snapshot $sendfs@C
51log_must eval "zfs send -Rpv $sendfs@C > $BACKDIR/stream1"
52log_must eval "zfs receive -F $recvfs < $BACKDIR/stream1"
53log_must zfs list $sendfs@C
54
55log_must zfs destroy $sendfs@C
56log_must zfs snapshot $sendfs@D
57log_must zfs snapshot $sendfs@E
58log_must eval "zfs send -Rpv -I $sendfs@A $sendfs@E > $BACKDIR/stream2"
59log_must eval "zfs receive -Fv $recvfs < $BACKDIR/stream2"
60log_must zfs list $sendfs@D
61log_must zfs list $sendfs@E
62log_mustnot zfs list $sendfs@C
63log_pass "Verify recursive incremental sends missing snapshots behave correctly."
64