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/migration/migration.kshlib
          +++ new/usr/src/test/zfs-tests/tests/functional/migration/migration.kshlib
↓ open down ↓ 17 lines elided ↑ open up ↑
  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   27  #
  28      -# Copyright (c) 2013 by Delphix. All rights reserved.
       28 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  29   29  #
  30   30  
  31   31  . $STF_SUITE/tests/functional/migration/migration.cfg
  32   32  
  33   33  #
  34   34  # This function creates the test archive for migration.
  35   35  #
  36   36  # Usage:
  37   37  # prepare srcdir cmd
  38   38  #
  39   39  # Return value: 0 on success
  40   40  #               1 on failure
  41   41  #
  42   42  # Where:
  43   43  #       srcdir: is the directory where the testfile is
  44   44  #       cmd:    is the command to be executed.
  45   45  #               E.g.
  46      -#               $TAR cf $TESTDIR/tar$$.tar
       46 +#               tar cf $TESTDIR/tar$$.tar
  47   47  #
  48   48  function prepare #srcdir cmd
  49   49  {
  50   50          typeset srcdir=$1
  51   51          typeset cmd=$2
  52   52          typeset -i retval=0
  53   53  
  54   54          cwd=$PWD
  55   55          cd $srcdir
  56   56          (( $? != 0 )) && return 1
↓ open down ↓ 18 lines elided ↑ open up ↑
  75   75  #
  76   76  # Return value: 0 on success
  77   77  #               1 on failure
  78   78  #
  79   79  # Where:
  80   80  #       destdir: is the directory where the command is to be executed on
  81   81  #       oldsuma: is the first part of the values returned by sum
  82   82  #       oldsumb: is the second part of the values returned by sum
  83   83  #       cmd: is the command to be executed;
  84   84  #               E.g.
  85      -#               "$TAR xf $TESTDIR/tar$$.tar"
       85 +#               "tar xf $TESTDIR/tar$$.tar"
  86   86  #
  87   87  function migrate #destdir oldsuma oldsumb cmd
  88   88  {
  89   89          typeset destdir=$1
  90   90          typeset oldsuma=$2
  91   91          typeset oldsumb=$3
  92   92          typeset cmd=$4
  93   93          typeset -i retval=0
  94   94  
  95   95          cwd=$PWD
  96   96          cd $destdir
  97   97          (( $? != 0 )) && return 1
  98   98  
  99   99          $cmd
 100  100          (( $? != 0 )) && return 1
 101  101  
 102      -        sumy=`$SUM ./$BNAME`
 103      -        suma=`$ECHO $sumy | $AWK '{print $1}'`
 104      -        sumb=`$ECHO $sumy | $AWK '{print $2}'`
      102 +        sumy=`sum ./$BNAME`
      103 +        suma=`echo $sumy | awk '{print $1}'`
      104 +        sumb=`echo $sumy | awk '{print $2}'`
 105  105  
 106  106          if (( $oldsuma != $suma )); then
 107      -                log_note "$SUM values are not the same"
      107 +                log_note "sum values are not the same"
 108  108                  retval=1
 109  109          fi
 110  110  
 111  111          if (( $oldsumb != $sumb )); then
 112      -                log_note "$SUM values are not the same"
      112 +                log_note "sum values are not the same"
 113  113                  retval=1
 114  114          fi
 115  115  
 116  116          cd $cwd
 117  117          (( $? != 0 )) && return 1
 118  118          return $retval
 119  119  }
 120  120  
 121  121  function migrate_cpio
 122  122  {
 123  123          typeset destdir=$1
 124  124          typeset archive=$2
 125  125          typeset oldsuma=$3
 126  126          typeset oldsumb=$4
 127  127          typeset -i retval=0
 128  128  
 129  129          cwd=$PWD
 130  130          cd $destdir
 131  131          (( $? != 0 )) && return 1
 132  132  
 133      -        $CPIO -iv < $archive
      133 +        cpio -iv < $archive
 134  134          (( $? != 0 )) && return 1
 135  135  
 136      -        sumy=`$SUM ./$BNAME`
 137      -        suma=`$ECHO $sumy | $AWK '{print $1}'`
 138      -        sumb=`$ECHO $sumy | $AWK '{print $2}'`
      136 +        sumy=`sum ./$BNAME`
      137 +        suma=`echo $sumy | awk '{print $1}'`
      138 +        sumb=`echo $sumy | awk '{print $2}'`
 139  139  
 140  140          if (( $oldsuma != $suma )); then
 141      -                log_note "$SUM values are not the same"
      141 +                log_note "sum values are not the same"
 142  142                  retval=1
 143  143          fi
 144  144  
 145  145          if (( $oldsumb != $sumb )); then
 146      -                log_note "$SUM values are not the same"
      146 +                log_note "sum values are not the same"
 147  147                  retval=1
 148  148          fi
 149  149  
 150  150          cd $cwd
 151  151          (( $? != 0 )) && return 1
 152  152          return $retval
 153  153  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX