4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
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.
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]
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
28 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
31 . $STF_SUITE/tests/functional/migration/migration.cfg
34 # This function creates the test archive for migration.
39 # Return value: 0 on success
43 # srcdir: is the directory where the testfile is
44 # cmd: is the command to be executed.
46 # tar cf $TESTDIR/tar$$.tar
48 function prepare #srcdir cmd
56 (( $? != 0 )) && return 1
59 (( $? != 0 )) && return 1
62 (( $? != 0 )) && return 1
68 # This function executes a passed in command and then determines the chksum
69 # of the resulting file. The chksum components are checked against the ones
70 # passed in to determine if they are equal. If they are equal, 0 is returned
71 # otherwise 1 is returned.
74 # migrate destdir oldsuma oldsumb command_to_execute
76 # Return value: 0 on success
80 # destdir: is the directory where the command is to be executed on
81 # oldsuma: is the first part of the values returned by sum
82 # oldsumb: is the second part of the values returned by sum
83 # cmd: is the command to be executed;
85 # "tar xf $TESTDIR/tar$$.tar"
87 function migrate #destdir oldsuma oldsumb cmd
97 (( $? != 0 )) && return 1
100 (( $? != 0 )) && return 1
103 suma=`echo $sumy | awk '{print $1}'`
104 sumb=`echo $sumy | awk '{print $2}'`
106 if (( $oldsuma != $suma )); then
107 log_note "sum values are not the same"
111 if (( $oldsumb != $sumb )); then
112 log_note "sum values are not the same"
117 (( $? != 0 )) && return 1
121 function migrate_cpio
131 (( $? != 0 )) && return 1
134 (( $? != 0 )) && return 1
137 suma=`echo $sumy | awk '{print $1}'`
138 sumb=`echo $sumy | awk '{print $2}'`
140 if (( $oldsuma != $suma )); then
141 log_note "sum values are not the same"
145 if (( $oldsumb != $sumb )); then
146 log_note "sum values are not the same"
151 (( $? != 0 )) && return 1