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