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
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.
17 . $STF_SUITE/include/libtest.shlib
18 . $STF_SUITE/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
22 # Verify zfs mount helper functions for both devices and pools.
25 verify_runnable "both"
27 set -A vdevs $(get_disklist_fullpath $TESTPOOL)
28 typeset -r mntpoint=$(get_prop mountpoint $TESTPOOL)
29 typeset -r helper="mount.zfs -o zfsutil"
30 typeset -r fs=$TESTPOOL/$TESTFS
35 [[ -d $TESTDIR/$$ ]] && (rm -rf $TESTDIR/$$ || log_fail)
36 mounted && zfs $mountcmd $TESTPOOL
41 log_note "Verify zfs mount helper functions for both devices and pools"
43 # Ensure that the ZFS filesystem is unmounted
44 force_unmount $TESTPOOL
46 log_note "Verify '<dataset> <path>'"
47 log_must $helper $fs $mntpoint
48 log_must ismounted $fs
51 log_note "Verify mount(8) does not canonicalize before calling helper"
52 # Canonicalization is confused by files in PWD matching [device|mountpoint]
53 mkdir -p $TESTDIR/$$/$TESTPOOL && cd $TESTDIR/$$ || log_fail
54 # The env flag directs zfs to exec /bin/mount, which then calls helper
55 log_must eval ZFS_MOUNT_HELPER=1 zfs $mountcmd -v $TESTPOOL
56 # mount (2.35.2) still suffers from a cosmetic PWD prefix bug
57 log_must mounted $TESTPOOL
58 force_unmount $TESTPOOL
60 log_note "Verify '-f <dataset> <path>' fakemount"
61 log_must $helper -f $fs $mntpoint
62 log_mustnot ismounted $fs
64 log_note "Verify '-o ro -v <dataset> <path>' verbose RO"
65 log_must ${helper},ro -v $fs $mntpoint
66 log_must ismounted $fs
69 log_note "Verify '-o abc -s <device> <path>' sloppy option"
70 log_must ${helper},abc -s ${vdevs[0]} $mntpoint
71 log_must mounted $mntpoint
72 force_unmount $TESTPOOL
74 log_note "Verify '<device> <path>'"
75 log_must $helper ${vdevs[0]} $mntpoint
76 log_must mounted $mntpoint
78 log_pass "zfs mount helper correctly handles both device and pool strings"