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, 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/include/libtest.shlib
33 . $STF_SUITE/tests/functional/snapshot/snapshot.cfg
37 # Verify that many snapshots can be made on a zfs file system.
40 # 1) Create a files in the zfs file system
41 # 2) Create a snapshot of the dataset
42 # 3) Remove all the files from the original file system
43 # 4) Verify consistency of each snapshot directory
46 verify_runnable "both"
51 while [ $i -lt $COUNT ]; do
53 if [[ $? -eq 0 ]]; then
54 log_must zfs destroy $SNAPFS.$i
57 if [[ -e $SNAPDIR.$i ]]; then
58 log_must rm -rf $SNAPDIR.$i > /dev/null 2>&1
64 if [[ -e $TESTDIR ]]; then
65 log_must rm -rf $TESTDIR/* > /dev/null 2>&1
69 log_assert "Verify many snapshots of a file system can be taken."
73 [[ -n $TESTDIR ]] && \
74 log_must rm -rf $TESTDIR/* > /dev/null 2>&1
78 log_note "Create some files in the $TESTDIR directory..."
80 while [[ $i -lt $COUNT ]]; do
81 log_must file_write -o create -f $TESTDIR/file$i \
82 -b $BLOCKSZ -c $NUM_WRITES -d $i
83 log_must zfs snapshot $SNAPFS.$i
88 log_note "Remove all of the original files"
89 [[ -n $TESTDIR ]] && \
90 log_must rm -rf $TESTDIR/file* > /dev/null 2>&1
93 while [[ $i -lt $COUNT ]]; do
94 FILECOUNT=`ls $SNAPDIR.$i/file* | wc -l`
96 while [ $j -lt $FILECOUNT ]; do
97 log_must file_check $SNAPDIR.$i/file$j $j
103 log_pass "All files are consistent"