]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/history/history_003_pos.ksh
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.
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.
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]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
36 # zpool history will truncate on small pools, leaving pool creation intact
39 # 1. Create two 100M virtual disk files.
40 # 2. Create test pool using the two virtual files.
41 # 3. Loop 100 times to set and remove compression to test dataset.
42 # 4. Make sure 'zpool history' output is truncated
43 # 5. Verify that the initial pool creation is preserved.
46 verify_runnable
"global"
50 datasetexists
$spool && log_must
$ZPOOL destroy
$spool
51 [[ -f $VDEV0 ]] && log_must
$RM -f $VDEV0
52 [[ -f $VDEV1 ]] && log_must
$RM -f $VDEV1
53 [[ -f $TMPFILE ]] && log_must
$RM -f $TMPFILE
56 log_assert
"zpool history limitation test."
59 mntpnt
=$
(get_prop mountpoint
$TESTPOOL)
60 (( $?
!= 0 )) && log_fail
"get_prop mountpoint $TESTPOOL"
62 VDEV0
=$mntpnt/vdev0
; VDEV1
=$mntpnt/vdev1
63 log_must
$MKFILE 100m
$VDEV0 $VDEV1
65 spool
=smallpool.$$
; sfs
=smallfs.$$
66 log_must
$ZPOOL create
$spool $VDEV0 $VDEV1
67 log_must
$ZFS create
$spool/$sfs
69 typeset
-i orig_count
=$
($ZPOOL history $spool |
$WC -l)
70 typeset orig_md5
=$
($ZPOOL history $spool |
$HEAD -2 |
$MD5SUM | \
75 $ZFS set compression
=off
$spool/$sfs
76 $ZFS set compression
=on
$spool/$sfs
77 $ZFS set compression
=off
$spool/$sfs
78 $ZFS set compression
=on
$spool/$sfs
79 $ZFS set compression
=off
$spool/$sfs
85 $ZPOOL history $spool >$TMPFILE
86 typeset
-i entry_count
=$
($WC -l $TMPFILE |
$AWK '{print $1}')
87 typeset final_md5
=$
($HEAD -2 $TMPFILE |
$MD5SUM |
$AWK '{print $1}')
89 $GREP 'zpool create' $TMPFILE >/dev
/null
2>&1 ||
90 log_fail
"'zpool create' was not found in pool history"
92 $GREP 'zfs create' $TMPFILE >/dev
/null
2>&1 &&
93 log_fail
"'zfs create' was found in pool history"
95 $GREP 'zfs set compress' $TMPFILE >/dev
/null
2>&1 ||
96 log_fail
"'zfs set compress' was found in pool history"
98 # Verify that the creation of the pool was preserved in the history.
99 if [[ $orig_md5 != $final_md5 ]]; then
100 log_fail
"zpool creation history was not preserved."
103 log_pass
"zpool history limitation test passed."