1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or https://opensource.org/licenses/CDDL-1.0. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27 28# 29# Copyright (c) 2016 by Delphix. All rights reserved. 30# 31 32. $STF_SUITE/include/libtest.shlib 33. $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib 34 35# 36# DESCRIPTION: 37# Setting a valid value to atime, readonly, setuid or zoned on file 38# system or volume. It should be successful. 39# 40# STRATEGY: 41# 1. Create pool and filesystem & volume within it. 42# 2. Setting valid value, it should be successful. 43# 44 45verify_runnable "both" 46 47function cleanup 48{ 49 log_must zfs mount -a 50} 51 52log_onexit cleanup 53 54set -A props "atime" "readonly" "setuid" 55if is_freebsd; then 56 props+=("jailed") 57else 58 props+=("zoned") 59fi 60set -A values "on" "off" 61 62if is_global_zone ; then 63 set -A dataset "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCTR" "$TESTPOOL/$TESTVOL" 64else 65 set -A dataset "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCTR" 66fi 67 68log_assert "Setting a valid value to atime, readonly, setuid or zoned on file" \ 69 "system or volume. It should be successful." 70 71typeset -i i=0 72typeset -i j=0 73typeset -i k=0 74while (( i < ${#dataset[@]} )); do 75 j=0 76 while (( j < ${#props[@]} )); do 77 k=0 78 while (( k < ${#values[@]} )); do 79 if [[ ${dataset[i]} == "$TESTPOOL/$TESTVOL" && \ 80 ${props[j]} != "readonly" ]] 81 then 82 set_n_check_prop "${values[k]}" "${props[j]}" \ 83 "${dataset[i]}" "false" 84 elif [[ ${props[j]} == "zoned" ]] ; then 85 if is_global_zone ; then 86 set_n_check_prop \ 87 "${values[k]}" "${props[j]}" \ 88 "${dataset[i]}" 89 else 90 set_n_check_prop \ 91 "${values[k]}" "${props[j]}" \ 92 "${dataset[i]}" "false" 93 fi 94 95 else 96 set_n_check_prop "${values[k]}" "${props[j]}" \ 97 "${dataset[i]}" 98 fi 99 100 (( k += 1 )) 101 done 102 (( j += 1 )) 103 done 104 (( i += 1 )) 105done 106 107log_pass "Setting a valid value to atime, readonly, setuid or zoned on file" \ 108 "system or volume pass." 109