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 is of the CDDL is also available via the Internet
12# at http://www.illumos.org/license/CDDL.
13#
14# CDDL HEADER END
15#
16
17#
18# Copyright (c) 2018 Datto Inc.
19#
20
21. $STF_SUITE/include/libtest.shlib
22
23#
24# DESCRIPTION:
25#	zfs inherit should inherit mountpoint on mountpoint=none children
26#
27# STRATEGY:
28#	1. Create a set of nested datasets with mountpoint=none
29#	2. Verify datasets aren't mounted
30#	3. Inherit mountpoint and verify all datasets are now mounted
31#
32
33verify_runnable "both"
34
35function inherit_cleanup
36{
37	log_must zfs destroy -fR $TESTPOOL/inherit_test
38}
39
40log_onexit inherit_cleanup
41
42
43log_must zfs create -o mountpoint=none $TESTPOOL/inherit_test
44log_must zfs create $TESTPOOL/inherit_test/child
45
46if ismounted $TESTPOOL/inherit_test; then
47	log_fail "$TESTPOOL/inherit_test is mounted"
48fi
49if ismounted $TESTPOOL/inherit_test/child; then
50	log_fail "$TESTPOOL/inherit_test/child is mounted"
51fi
52
53log_must zfs inherit mountpoint $TESTPOOL/inherit_test
54
55if ! ismounted $TESTPOOL/inherit_test; then
56	log_fail "$TESTPOOL/inherit_test is not mounted"
57fi
58if ! ismounted $TESTPOOL/inherit_test/child; then
59	log_fail "$TESTPOOL/inherit_test/child is not mounted"
60fi
61
62log_pass "Verified mountpoint for mountpoint=none children inherited."
63