Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/zfs-tests/tests/functional/snapshot/snapshot_003_pos.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/snapshot/snapshot_003_pos.ksh
1 1 #! /bin/ksh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27
28 28 #
29 -# Copyright (c) 2013 by Delphix. All rights reserved.
29 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 30 #
31 31
32 32 . $STF_SUITE/include/libtest.shlib
33 33 . $STF_SUITE/tests/functional/snapshot/snapshot.cfg
34 34
35 35 #
36 36 # DESCRIPTION:
37 37 # Verify that many snapshots can be made on a zfs file system.
38 38 #
39 39 # STRATEGY:
40 40 # 1) Create a files in the zfs file system
41 41 # 2) Create a snapshot of the dataset
42 42 # 3) Remove all the files from the original file system
43 43 # 4) Verify consistency of each snapshot directory
|
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
44 44 #
45 45
46 46 verify_runnable "both"
47 47
48 48 function cleanup
49 49 {
50 50 typeset -i i=1
51 51 while [ $i -lt $COUNT ]; do
52 52 snapexists $SNAPFS.$i
53 53 if [[ $? -eq 0 ]]; then
54 - log_must $ZFS destroy $SNAPFS.$i
54 + log_must zfs destroy $SNAPFS.$i
55 55 fi
56 56
57 57 if [[ -e $SNAPDIR.$i ]]; then
58 - log_must $RM -rf $SNAPDIR.$i > /dev/null 2>&1
58 + log_must rm -rf $SNAPDIR.$i > /dev/null 2>&1
59 59 fi
60 60
61 61 (( i = i + 1 ))
62 62 done
63 63
64 64 if [[ -e $TESTDIR ]]; then
65 - log_must $RM -rf $TESTDIR/* > /dev/null 2>&1
65 + log_must rm -rf $TESTDIR/* > /dev/null 2>&1
66 66 fi
67 67 }
68 68
69 69 log_assert "Verify many snapshots of a file system can be taken."
70 70
71 71 log_onexit cleanup
72 72
73 73 [[ -n $TESTDIR ]] && \
74 - log_must $RM -rf $TESTDIR/* > /dev/null 2>&1
74 + log_must rm -rf $TESTDIR/* > /dev/null 2>&1
75 75
76 76 typeset -i COUNT=10
77 77
78 78 log_note "Create some files in the $TESTDIR directory..."
79 79 typeset -i i=1
80 80 while [[ $i -lt $COUNT ]]; do
81 - log_must $FILE_WRITE -o create -f $TESTDIR/file$i \
81 + log_must file_write -o create -f $TESTDIR/file$i \
82 82 -b $BLOCKSZ -c $NUM_WRITES -d $i
83 - log_must $ZFS snapshot $SNAPFS.$i
83 + log_must zfs snapshot $SNAPFS.$i
84 84
85 85 (( i = i + 1 ))
86 86 done
87 87
88 88 log_note "Remove all of the original files"
89 89 [[ -n $TESTDIR ]] && \
90 - log_must $RM -rf $TESTDIR/file* > /dev/null 2>&1
90 + log_must rm -rf $TESTDIR/file* > /dev/null 2>&1
91 91
92 92 i=1
93 93 while [[ $i -lt $COUNT ]]; do
94 - FILECOUNT=`$LS $SNAPDIR.$i/file* | wc -l`
94 + FILECOUNT=`ls $SNAPDIR.$i/file* | wc -l`
95 95 typeset j=1
96 96 while [ $j -lt $FILECOUNT ]; do
97 - log_must $FILE_CHECK $SNAPDIR.$i/file$j $j
97 + log_must file_check $SNAPDIR.$i/file$j $j
98 98 (( j = j + 1 ))
99 99 done
100 100 (( i = i + 1 ))
101 101 done
102 102
103 103 log_pass "All files are consistent"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX