]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_invalid.ksh
OpenZFS: MFV 2.0-rc3-gfc5966
[FreeBSD/FreeBSD.git] / sys / contrib / openzfs / tests / zfs-tests / tests / functional / rsend / send_invalid.ksh
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
30 verify_runnable "both"
31
32 log_assert "Verify that send with invalid options will fail gracefully."
33
34 function cleanup
35 {
36         datasetexists $testfs && destroy_dataset $testfs -r
37 }
38 log_onexit cleanup
39
40 testfs=$POOL/fs
41
42 log_must zfs create $testfs
43 log_must zfs snap $testfs@snap0
44 log_must zfs snap $testfs@snap1
45
46 # Test bad send with the CLI
47 log_mustnot eval "zfs send -i $testfs@snap1 $testfs@snap0 >/dev/null"
48
49 # Test bad send with libzfs/libzfs_core
50 log_must badsend $testfs@snap0 $testfs@snap1
51
52 log_pass "Send with invalid options fails gracefully."