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