xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_002_neg.ksh (revision 4e5ef1cee66fbfbbd2b3e56b81e2bb5700f4a59e)
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
32verify_runnable "global"
33
34set -A args "1" "-a" "-?" "--%" "-123456" "0.5" "-o" "-b" "-b no" "-z 2"
35
36log_assert "Execute 'zpool sync' using invalid parameters."
37
38typeset -i i=0
39while [[ $i -lt ${#args[*]} ]]; do
40	log_mustnot zpool sync ${args[i]}
41	((i = i + 1))
42done
43
44log_pass "Invalid parameters to 'zpool sync' fail as expected."
45