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
17. $STF_SUITE/include/libtest.shlib
18. $STF_SUITE/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
19
20#
21# DESCRIPTION:
22# Verify zfs mount helper failure on known bad parameters
23#
24
25verify_runnable "both"
26
27set -A vdevs $(get_disklist_fullpath $TESTPOOL)
28vdev=${vdevs[0]}
29
30mntpoint="$(get_prop mountpoint $TESTPOOL)"
31helper="mount.zfs -o zfsutil"
32fs=$TESTPOOL/$TESTFS
33
34function cleanup
35{
36	log_must force_unmount $vdev
37	return 0
38}
39log_onexit cleanup
40
41log_note "Verify zfs mount helper failure on known bad parameters"
42
43# Ensure that the ZFS filesystem is unmounted.
44force_unmount $fs
45
46log_note "Verify failure without '-o zfsutil'"
47log_mustnot mount.zfs $fs $mntpoint
48
49log_note "Verify '-o abc <device> <path>' bad option fails"
50log_mustnot ${helper},abc $vdev $mntpoint
51
52log_note "Verify '\$NONEXISTFSNAME <path>' fails"
53log_mustnot $helper $NONEXISTFSNAME $mntpoint
54
55log_note "Verify '<dataset> (\$NONEXISTFSNAME|/dev/null)' fails"
56log_mustnot $helper $fs $NONEXISTFSNAME
57log_mustnot $helper $fs /dev/null
58
59log_note "Verify '/dev/null <path>' fails"
60log_mustnot $helper /dev/null $mntpoint
61
62log_note "Verify '[device|pool]' fails"
63log_mustnot mount.zfs
64log_mustnot $helper
65log_mustnot $helper $vdev
66log_mustnot $helper $TESTPOOL
67
68log_pass "zfs mount helper fails when expected"