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# 24# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/tests/history/history_common.kshlib 28 29################################################################################# 30# 31# __stc_assertion_start 32# 33# ID: history_010_pos 34# 35# DESCRIPTION: 36# Verify internal long history information are correct. 37# 38# STRATEGY: 39# 1. Create non-root test user and group. 40# 2. Do some zfs operation test by root and non-root user. 41# 3. Verify the long history information are correct. 42# 43# TESTABILITY: explicit 44# 45# TEST_AUTOMATION_LEVEL: automated 46# 47# CODING_STATUS: COMPLETED (2006-12-27) 48# 49# __stc_assertion_end 50# 51################################################################################ 52 53verify_runnable "global" 54 55$ZFS 2>&1 | $GREP "allow" > /dev/null 56(($? != 0)) && log_unsupported 57 58function cleanup 59{ 60 [[ -f $REAL_HISTORY ]] && $RM -f $REAL_HISTORY 61 [[ -f $EXPECT_HISTORY ]] && $RM -f $EXPECT_HISTORY 62 63 del_user $HIST_USER 64 del_group $HIST_GROUP 65 66 datasetexists $root_testfs && log_must $ZFS destroy -rf $root_testfs 67} 68 69log_assert "Verify internal long history information are correct." 70log_onexit cleanup 71 72root_testfs=$TESTPOOL/$TESTFS1 73 74# Create history test group and user and get user id and group id 75add_group $HIST_GROUP 76add_user $HIST_GROUP $HIST_USER 77uid=$($ID $HIST_USER | $AWK -F= '{print $2}'| $AWK -F"(" '{print $1}' ) 78gid=$($ID $HIST_USER | $AWK -F= '{print $3}'| $AWK -F"(" '{print $1}' ) 79 80# Get original long history 81format_history $TESTPOOL $EXPECT_HISTORY "-l" 82 83exec_record -l $ZFS create $root_testfs 84exec_record -l $ZFS allow $HIST_GROUP snapshot,mount $root_testfs 85exec_record -l $ZFS allow $HIST_USER destroy,mount $root_testfs 86exec_record -l $ZFS allow $HIST_USER reservation $root_testfs 87exec_record -l $ZFS allow $HIST_USER allow $root_testfs 88 89exec_record -l -u $HIST_USER "$ZFS snapshot $root_testfs@snap" 90exec_record -l -u $HIST_USER "$ZFS destroy $root_testfs@snap" 91exec_record -l -u $HIST_USER "$ZFS reservation=64M $root_testfs" 92exec_record -l -u $HIST_USER "$ZFS allow $HIST_USER reservation $root_testfs" 93exec_record -l $ZFS unallow $HIST_USER create $root_testfs 94exec_record -l $ZFS unallow $HIST_GROUP snapshot $root_testfs 95exec_record -l $ZFS destroy -r $root_testfs 96 97format_history $TESTPOOL $REAL_HISTORY "-l" 98log_must $DIFF $REAL_HISTORY $EXPECT_HISTORY 99 100del_user $HIST_USER 101del_group $HIST_GROUP 102 103log_pass "Verify internal long history information pass." 104