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 2007 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_006_neg
34#
35# DESCRIPTION:
36# 	Verify the following zfs subcommands are not logged.
37#      	    list, get, mount, unmount, share, unshare, send
38#
39# STRATEGY:
40#	1. Create a test pool.
41#	2. Separately invoke zfs list|get|mount|unmount|share|unshare|send
42#	3. Verify they was not recored in pool history.
43#
44# TESTABILITY: explicit
45#
46# TEST_AUTOMATION_LEVEL: automated
47#
48# CODING_STATUS: COMPLETED (2006-07-05)
49#
50# __stc_assertion_end
51#
52################################################################################
53
54verify_runnable "global"
55
56function cleanup
57{
58	[[ -f $EXPECT_HISTORY ]] && $RM -f $EXPECT_HISTORY
59	[[ -f $REAL_HISTORY ]] && $RM -f $REAL_HISTORY
60	if datasetexists $fs ; then
61		log_must $ZFS destroy -rf $fs
62	fi
63	log_must $ZFS create $fs
64}
65
66log_assert "Verify 'zfs list|get|mount|unmount|share|unshare|send' will not " \
67	"be logged."
68log_onexit cleanup
69
70# Create initial test environment
71fs=$TESTPOOL/$TESTFS; snap1=$fs@snap1; snap2=$fs@snap2
72log_must $ZFS set sharenfs=on $fs
73log_must $ZFS snapshot $snap1
74log_must $ZFS snapshot $snap2
75
76# Save initial TESTPOOL history
77log_must eval "$ZPOOL history $TESTPOOL > $EXPECT_HISTORY"
78
79log_must $ZFS list $fs > /dev/null
80log_must $ZFS get mountpoint $fs > /dev/null
81log_must $ZFS unmount $fs
82log_must $ZFS mount $fs
83log_must $ZFS share $fs
84log_must $ZFS unshare $fs
85log_must $ZFS send -i $snap1 $snap2 > /dev/null
86
87log_must eval "$ZPOOL history $TESTPOOL > $REAL_HISTORY"
88log_must $DIFF $EXPECT_HISTORY $REAL_HISTORY
89
90log_pass "Verify 'zfs list|get|mount|unmount|share|unshare|send' passed."
91