]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_012_neg.ksh
Update ZTS to work on FreeBSD
[mirror_zfs.git] / tests / zfs-tests / tests / functional / cli_root / zfs_mount / zfs_mount_012_neg.ksh
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) 2015 by Delphix. All rights reserved.
15 #
16
17 . $STF_SUITE/include/libtest.shlib
18
19 #
20 # DESCRIPTION:
21 # Linux:
22 # Verify that zfs mount fails with a non-empty directory
23 # FreeSD:
24 # Verify that zfs mount succeeds with a non-empty directory
25 #
26
27 #
28 # STRATEGY:
29 # 1. Unmount the dataset
30 # 2. Create a new empty directory
31 # 3. Set the dataset's mountpoint
32 # 4. Attempt to mount the dataset
33 # 5. Verify the mount succeeds
34 # 6. Unmount the dataset
35 # 7. Create a file in the directory created in step 2
36 # 8. Attempt to mount the dataset
37 # 9. Verify the mount fails
38 #
39
40 verify_runnable "both"
41
42 if is_linux; then
43 behaves="fails"
44 else
45 behaves="succeeds"
46 fi
47
48 log_assert "zfs mount $behaves with non-empty directory"
49
50 fs=$TESTPOOL/$TESTFS
51
52 log_must zfs umount $fs
53 log_must mkdir -p $TESTDIR
54 log_must zfs set mountpoint=$TESTDIR $fs
55 log_must zfs mount $fs
56 log_must zfs umount $fs
57 log_must touch $TESTDIR/testfile.$$
58 if is_linux; then
59 log_mustnot zfs mount $fs
60 else
61 log_must zfs mount $fs
62 log_must zfs umount $fs
63 fi
64 log_must rm -rf $TESTDIR
65
66 log_pass "zfs mount $behaves with non-empty directory as expected."