1#!/bin/ksh -p
2#
3# This file and its contents are supplied under the terms of the
4# Common Development and Distribution License ("CDDL"), version 1.0.
5# You may only use this file in accordance with the terms of version
6# 1.0 of the CDDL.
7#
8# A full copy of the text of the CDDL should have accompanied this
9# source.  A copy of the CDDL is also available via the Internet at
10# http://www.illumos.org/license/CDDL.
11#
12
13#
14# Copyright (c) 2016 by Delphix. All rights reserved.
15#
16
17. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
18
19#
20# DESCRIPTION:
21#	Try calling zfs.sync.destroy with various arguments that are not
22#	valid.  The script should fail.
23#
24
25verify_runnable "global"
26
27set -A progs "zfs.sync.destroy(\"foo\", \"bar\")" \
28	"zfs.sync.destroy(\"foo\", 12345)" \
29	"zfs.sync.destroy(12345)" \
30	"zfs.sync.destroy()" \
31	"zfs.sync.destroy{\"foo\", bar=true}" \
32	"zfs.sync.destroy{\"foo\", defer=12345}" \
33	"zfs.sync.destroy{\"foo\", defer=true, 12345}" \
34	"zfs.sync.destroy{\"foo\", defer=true, bar=12345}" \
35	"zfs.sync.destroy{\"foo\", bar=true, defer=true}" \
36	"zfs.sync.destroy{defer=true}" \
37	"zfs.sync.destroy{12345, defer=true}"
38
39
40typeset -i i=0
41while (( i < ${#progs[*]} )); do
42	log_note "running program: ${progs[i]}"
43	# output should contain the usage message, which starts with "destroy{"
44	echo ${progs[i]} | log_mustnot_checkerror_program "destroy{" $TESTPOOL -
45	((i = i + 1))
46done
47
48log_pass "Invalid arguments to zfs.sync.destroy generate errors."
49