]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh
Drop path prefix workaround
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / cli_root / zfs_mount / zfs_mount_013_pos.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
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 functions for both devices and pools.
23 #
24
25 verify_runnable "both"
26
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
31
32 function cleanup
33 {
34         cd $STF_SUITE
35         [[ -d $TESTDIR/$$ ]] && (rm -rf $TESTDIR/$$ || log_fail)
36         mounted && zfs $mountcmd $TESTPOOL
37         return 0
38 }
39 log_onexit cleanup
40
41 log_note "Verify zfs mount helper functions for both devices and pools"
42
43 # Ensure that the ZFS filesystem is unmounted
44 force_unmount $TESTPOOL
45
46 log_note "Verify '<dataset> <path>'"
47 log_must $helper $fs $mntpoint
48 log_must ismounted $fs
49 force_unmount $fs
50
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
59
60 log_note "Verify '-f <dataset> <path>' fakemount"
61 log_must $helper -f $fs $mntpoint
62 log_mustnot ismounted $fs
63
64 log_note "Verify '-o ro -v <dataset> <path>' verbose RO"
65 log_must ${helper},ro -v $fs $mntpoint
66 log_must ismounted $fs
67 force_unmount $fs
68
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
73
74 log_note "Verify '<device> <path>'"
75 log_must $helper ${vdevs[0]} $mntpoint
76 log_must mounted $mntpoint
77
78 log_pass "zfs mount helper correctly handles both device and pool strings"