1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# http://www.illumos.org/license/CDDL. 12# 13 14# 15# Copyright (c) 2016 by Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib 19 20# 21# DESCRIPTION: 22# Getting dataset mountpoint should work correctly. 23# 24 25verify_runnable "global" 26 27fs=$TESTPOOL/testmount 28snap=$fs@$TESTSNAP 29clone=$TESTPOOL/$TESTCLONE 30mnt1=/$fs/mnt1 31mnt2=/$fs/mnt2 32 33function cleanup 34{ 35 destroy_dataset $clone 36 destroy_dataset $fs "-R" 37 log_must rm -rf $mnt1 38 log_must rm -rf $mnt2 39} 40 41log_onexit cleanup 42 43log_must zfs create $fs 44create_snapshot $fs $TESTSNAP 45create_clone $snap $clone 46 47log_must_program $TESTPOOL - <<-EOF 48 ans, src = zfs.get_prop("$fs", "mountpoint") 49 assert(ans == '/$fs') 50 assert(src == 'default') 51EOF 52 53log_must_program $TESTPOOL - <<-EOF 54 ans, src = zfs.get_prop("$snap", "mountpoint") 55 assert(ans == nil) 56 assert(src == nil) 57EOF 58 59log_must_program $TESTPOOL - <<-EOF 60 ans, src = zfs.get_prop("$clone", "mountpoint") 61 assert(ans == '/$clone') 62 assert(src == 'default') 63EOF 64 65log_must mkdir $mnt1 66log_must mkdir $mnt2 67 68log_must zfs set mountpoint=$mnt1 $fs 69log_must zfs set mountpoint=$mnt2 $clone 70 71log_must_program $TESTPOOL - <<-EOF 72 ans, src = zfs.get_prop("$fs", "mountpoint") 73 assert(ans == '$mnt1') 74 assert(src == '$fs') 75EOF 76 77log_must_program $TESTPOOL - <<-EOF 78 ans, src = zfs.get_prop("$snap", "mountpoint") 79 assert(ans == nil) 80 assert(src == nil) 81EOF 82 83log_must_program $TESTPOOL - <<-EOF 84 ans, src = zfs.get_prop("$clone", "mountpoint") 85 assert(ans == '$mnt2') 86 assert(src == '$clone') 87EOF 88 89log_pass "Getting dataset mountpoint should work correctly." 90