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/cli_root/cli_common.kshlib
+++ new/usr/src/test/zfs-tests/tests/functional/cli_root/cli_common.kshlib
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
|
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 26
27 +#
28 +# Copyright (c) 2016 by Delphix. All rights reserved.
29 +#
30 +
27 31 . $STF_SUITE/include/libtest.shlib
28 32
29 33 #
30 34 # Get the checksum and size of the file.
31 35 #
32 36 function get_cksum # <file path>
33 37 {
34 - return $($CKSUM $1 | $AWK '{print $1 $2}')
38 + return $(cksum $1 | awk '{print $1 $2}')
35 39 }
36 40
37 41 #
38 42 # Compare the check sum of target files with the original file
39 43 #
40 44
41 45 function compare_cksum #<orig_data> <target_data1>...<target_datan>
42 46 {
43 47 typeset orig_data=$1
44 48 typeset orig_sum=$(get_cksum $orig_data)
45 49 typeset target_sum=""
46 50 typeset bad_data_list=""
47 51 typeset -i bad_count=0
48 52
49 53 shift
50 54 for data in $@; do
51 55 if [[ ! -e $data ]]; then
52 56 bad_data_list="$bad_data_list $data"
53 57 (( bad_count +=1 ))
54 58 continue
55 59 fi
56 60
57 61 target_sum=$(get_cksum $data)
58 62 if [[ $target_sum != $orig_sum ]]; then
59 63 bad_data_list="$bad_data_list $data"
60 64 (( bad_count +=1 ))
61 65 fi
62 66 done
63 67
64 68 [[ $bad_data_list != "" ]] && \
65 69 log_fail "Data corruptions appear during send->receive." \
66 70 "There are total $bad_count corruptions. They are:\n"\
67 71 "$bad_data_list"
68 72 }
69 73
70 74 #
71 75 # Check the received dataset exists or not
72 76 #
73 77 function receive_check #<dataset1>...<datasetn>
74 78 {
75 79 typeset bad_rst_tgts=""
76 80
77 81 for dataset in $@; do
78 82 ! datasetexists $dataset && \
79 83 bad_rst_tgts="$bad_rst_tgts $dataset"
80 84 done
81 85
82 86 if [[ $bad_rst_tgts != "" ]]; then
83 87 log_fail "Restoring fails. The specified datasets"\
84 88 "$bad_rst_tgts are not being received."
85 89 fi
86 90 }
|
↓ open down ↓ |
42 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX