]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_002_neg.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / cli_root / zpool_sync / zpool_sync_002_neg.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
8 # 1.0 of the CDDL.
9 #
10 # A full copy of the text of the CDDL should have accompanied this
11 # source.  A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
13 #
14 # CDDL HEADER END
15 #
16 # Copyright (c) 2017 Datto Inc.
17 #
18
19 . $STF_SUITE/include/libtest.shlib
20
21 #
22 # DESCRIPTION:
23 # A badly formed parameter passed to 'zpool sync' should
24 # return an error.
25 #
26 # STRATEGY:
27 # 1. Create an array containing bad 'zpool sync' parameters.
28 # 2. For each element, execute the sub-command.
29 # 3. Verify it returns an error.
30 #
31
32 verify_runnable "global"
33
34 set -A args "1" "-a" "-?" "--%" "-123456" "0.5" "-o" "-b" "-b no" "-z 2"
35
36 log_assert "Execute 'zpool sync' using invalid parameters."
37
38 typeset -i i=0
39 while [[ $i -lt ${#args[*]} ]]; do
40         log_mustnot zpool sync ${args[i]}
41         ((i = i + 1))
42 done
43
44 log_pass "Invalid parameters to 'zpool sync' fail as expected."