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 a.0.
6# You may only use this file in accordance with the terms of version
7# a.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# Portions Copyright 2020 iXsystems, Inc.
16#
17
18. $STF_SUITE/include/libtest.shlib
19. $STF_SUITE/tests/functional/rsend/rsend.kshlib
20
21#
22# Description:
23# Verify that send with invalid options will fail gracefully.
24#
25# Strategy:
26# 1. Perform zfs send on the cli with the order of the snapshots reversed
27# 2. Perform zfs send using libzfs with the order of the snapshots reversed
28#
29
30verify_runnable "both"
31
32log_assert "Verify that send with invalid options will fail gracefully."
33
34function cleanup
35{
36	datasetexists $testfs && destroy_dataset $testfs -r
37}
38log_onexit cleanup
39
40testfs=$POOL/fs
41
42log_must zfs create $testfs
43log_must zfs snap $testfs@snap0
44log_must zfs snap $testfs@snap1
45
46# Test bad send with the CLI
47log_mustnot eval "zfs send -i $testfs@snap1 $testfs@snap0 > /dev/null"
48
49# Test bad send with libzfs/libzfs_core
50log_must badsend $testfs@snap0 $testfs@snap1
51
52log_pass "Send with invalid options fails gracefully."
53