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 2020 iXsystems, Inc.
15#
16
17. $STF_SUITE/include/libtest.shlib
18
19#
20# DESCRIPTION:
21# zfs create -u should leave the new file system unmounted.
22# It should not work for a volume.
23#
24# STRATEGY:
25# 1. Create a file system using -u and make sure the file system is not mounted.
26# 3. Do it for a volume to verify it fails.
27#
28
29verify_runnable "both"
30
31function cleanup
32{
33	typeset ds
34
35	for ds in "$fs" "$vol"; do
36		datasetexists "$ds" && destroy_dataset "$ds"
37	done
38}
39log_onexit cleanup
40
41log_assert "zfs create -u leaves the new file system unmounted"
42
43typeset fs="$TESTPOOL/$TESTFS1"
44typeset vol="$TESTPOOL/$TESTVOL1"
45
46log_must create_dataset "$fs" "-u"
47log_mustnot ismounted "$fs"
48
49log_mustnot zfs create -V $VOLSIZE -u "$vol"
50
51log_pass "zfs create -u leaves the new file system unmounted"
52