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. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib 20 21# 22# DESCRIPTION: 23# "Getting {user,group}{quota,used}, should work correctly." 24# 25 26verify_runnable "global" 27 28fs=$TESTPOOL/$TESTFS/testchild 29fs1=$TESTPOOL/$TESTFS/nextchild 30userid='123' 31groupid='456' 32 33function cleanup 34{ 35 destroy_dataset $fs 36 destroy_dataset $fs1 37} 38 39log_onexit cleanup 40 41log_must zfs create -o userquota@$userid=$UQUOTA_SIZE \ 42 -o groupquota@$groupid=$GQUOTA_SIZE $fs 43 44log_must_program $TESTPOOL - <<-EOF 45 ans, setpoint = zfs.get_prop("$fs", "userquota@$userid") 46 assert(ans == $UQUOTA_SIZE) 47 assert(setpoint == "$fs") 48 49 ans, setpoint = zfs.get_prop("$fs", "userused@$userid") 50 assert(ans == 0) 51 assert(setpoint == "$fs") 52 53 ans, setpoint = zfs.get_prop("$fs", "groupquota@$groupid") 54 assert(ans == $GQUOTA_SIZE) 55 assert(setpoint == "$fs") 56 57 ans, setpoint = zfs.get_prop("$fs", "groupused@$groupid") 58 assert(ans == 0) 59 assert(setpoint == "$fs") 60EOF 61 62log_must zfs create $fs1 63log_must_program $TESTPOOL - <<-EOF 64 ans, setpoint = zfs.get_prop("$fs1", "userquota@$userid") 65 assert(ans == nil) 66 assert(setpoint == nil) 67 68 ans, setpoint = zfs.get_prop("$fs1", "userused@$userid") 69 assert(ans == 0) 70 assert(setpoint == "$fs1") 71 72 ans, setpoint = zfs.get_prop("$fs1", "groupquota@$groupid") 73 assert(ans == nil) 74 assert(setpoint == nil) 75 76 ans, setpoint = zfs.get_prop("$fs1", "groupused@$groupid") 77 assert(ans == 0) 78 assert(setpoint == "$fs1") 79EOF 80 81log_pass "Getting {user,group}{quota,used}, should work correctly." 82