7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 . $STF_SUITE/include/libtest.shlib
28
29 #
30 # Get the checksum and size of the file.
31 #
32 function get_cksum # <file path>
33 {
34 return $($CKSUM $1 | $AWK '{print $1 $2}')
35 }
36
37 #
38 # Compare the check sum of target files with the original file
39 #
40
41 function compare_cksum #<orig_data> <target_data1>...<target_datan>
42 {
43 typeset orig_data=$1
44 typeset orig_sum=$(get_cksum $orig_data)
45 typeset target_sum=""
46 typeset bad_data_list=""
47 typeset -i bad_count=0
48
49 shift
50 for data in $@; do
51 if [[ ! -e $data ]]; then
52 bad_data_list="$bad_data_list $data"
53 (( bad_count +=1 ))
54 continue
|
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 #
28 # Copyright (c) 2016 by Delphix. All rights reserved.
29 #
30
31 . $STF_SUITE/include/libtest.shlib
32
33 #
34 # Get the checksum and size of the file.
35 #
36 function get_cksum # <file path>
37 {
38 return $(cksum $1 | awk '{print $1 $2}')
39 }
40
41 #
42 # Compare the check sum of target files with the original file
43 #
44
45 function compare_cksum #<orig_data> <target_data1>...<target_datan>
46 {
47 typeset orig_data=$1
48 typeset orig_sum=$(get_cksum $orig_data)
49 typeset target_sum=""
50 typeset bad_data_list=""
51 typeset -i bad_count=0
52
53 shift
54 for data in $@; do
55 if [[ ! -e $data ]]; then
56 bad_data_list="$bad_data_list $data"
57 (( bad_count +=1 ))
58 continue
|