1#!/usr/local/bin/ksh93 -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 http://www.opensolaris.org/os/licensing. 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# $FreeBSD$ 24 25# 26# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 27# Use is subject to license terms. 28# 29# ident "@(#)onoffs_001_pos.ksh 1.2 07/01/09 SMI" 30# 31 32. $STF_SUITE/include/libtest.kshlib 33. $STF_SUITE/tests/cli_root/zfs_set/zfs_set_common.kshlib 34 35############################################################################### 36# 37# __stc_assertion_start 38# 39# ID: onoffs_001_pos 40# 41# DESCRIPTION: 42# Setting a valid value to atime, readonly, or setuid on file 43# system or volume. It should be successful. 44# 45# STRATEGY: 46# 1. Create pool and filesystem & volume within it. 47# 2. Setting valid value, it should be successful. 48# 49# TESTABILITY: explicit 50# 51# TEST_AUTOMATION_LEVEL: automated 52# 53# CODING_STATUS: COMPLETED (2005-07-04) 54# 55# __stc_assertion_end 56# 57################################################################################ 58 59verify_runnable "both" 60 61function cleanup 62{ 63 log_must $ZFS mount -a 64} 65 66log_onexit cleanup 67 68set -A props "atime" "readonly" "setuid" 69set -A values "on" "off" 70 71if is_global_zone ; then 72 set -A dataset "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCTR" "$TESTPOOL/$TESTVOL" 73else 74 set -A dataset "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCTR" 75fi 76 77log_assert "Setting a valid value to atime, readonly, or setuid on file" \ 78 "system or volume. It should be successful." 79 80typeset -i i=0 81typeset -i j=0 82typeset -i k=0 83while (( i < ${#dataset[@]} )); do 84 j=0 85 while (( j < ${#props[@]} )); do 86 k=0 87 while (( k < ${#values[@]} )); do 88 if [[ ${dataset[i]} == "$TESTPOOL/$TESTVOL" && \ 89 ${props[j]} != "readonly" ]] 90 then 91 set_n_check_prop "${values[k]}" "${props[j]}" \ 92 "${dataset[i]}" "false" 93 else 94 set_n_check_prop "${values[k]}" "${props[j]}" \ 95 "${dataset[i]}" 96 fi 97 98 (( k += 1 )) 99 done 100 (( j += 1 )) 101 done 102 (( i += 1 )) 103done 104 105log_pass "Setting a valid value to atime, readonly, or setuid on file" \ 106 "system or volume pass." 107