1#!/bin/ksh
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) 2019 by Lawrence Livermore National Security, LLC.
16#
17
18. $STF_SUITE/include/libtest.shlib
19. $STF_SUITE/tests/functional/rsend/rsend.kshlib
20
21#
22# Description:
23# Verify send_doall stream is properly received
24#
25# Strategy:
26# 1) Create a set of snapshots.
27# 2) Send these snapshots (from origin to the last one) to a file using send_doall.
28# 3) Receive the file to newfs to test if the stream is properly handled.
29#
30
31verify_runnable "both"
32
33log_assert "Verify send_doall stream is correct"
34
35function cleanup
36{
37	rm -f $BACKDIR/fs@*
38	destroy_dataset $POOL/fs "-rR"
39	destroy_dataset $POOL/newfs "-rR"
40}
41
42log_onexit cleanup
43
44log_must zfs create $POOL/fs
45log_must zfs create $POOL/fs/child
46
47# Create 3 files and a snapshot between each file creation.
48for i in {1..3}; do
49	log_must mkfile 16384 "/$POOL/fs/file$i" "/$POOL/fs/child/file$i"
50	log_must zfs snapshot -r $POOL/fs@snap$i
51done
52
53# Snapshot the pool and send it to the new dataset.
54log_must eval "send_doall $POOL/fs@snap3 >$BACKDIR/fs@snap3"
55log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs@snap3"
56
57log_mustnot datasetexists $POOL/newfs/child
58
59log_pass "Verify send_doall stream is correct"
60