Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
↓ open down ↓ 62 lines elided ↑ open up ↑
  63   63  log_onexit cleanup
  64   64  
  65   65  rootfs=$TESTPOOL/$TESTFS
  66   66  typeset output=/tmp/zfs-versions.$$
  67   67  typeset oldoutput=/tmp/zfs-versions-old.$$
  68   68  typeset expect_str1="This system is currently running ZFS filesystem version"
  69   69  typeset expect_str2="All filesystems are formatted with the current version"
  70   70  typeset expect_str3="The following filesystems are out of date, and can be upgraded"
  71   71  typeset -i COUNT OLDCOUNT
  72   72  
  73      -$ZFS upgrade | $NAWK '$1 ~ "^[0-9]+$" {print $2}'> $oldoutput
       73 +$ZFS upgrade | $AWK '$1 ~ "^[0-9]+$" {print $2}'> $oldoutput
  74   74  OLDCOUNT=$( $WC -l $oldoutput | $AWK '{print $1}' )
  75   75  
  76   76  old_datasets=""
  77   77  for version in $ZFS_ALL_VERSIONS ; do
  78   78          typeset verfs
  79   79          eval verfs=\$ZFS_VERSION_$version
  80   80          typeset current_fs=$rootfs/$verfs
  81   81          typeset current_snap=${current_fs}@snap
  82   82          typeset current_clone=$rootfs/clone$verfs
  83   83          log_must $ZFS create -o version=${version} ${current_fs}
↓ open down ↓ 7 lines elided ↑ open up ↑
  91   91  
  92   92  if is_global_zone; then
  93   93          log_must $ZFS create -V 100m $rootfs/$TESTVOL
  94   94  fi
  95   95  
  96   96  log_must eval '$ZFS upgrade > $output 2>&1'
  97   97  
  98   98  # we also check that the usage message contains at least a description
  99   99  # of the current ZFS version.
 100  100  log_must eval '$GREP "${expect_str1} $ZFS_VERSION" $output > /dev/null 2>&1'
 101      -$ZFS upgrade | $NAWK '$1 ~ "^[0-9]+$" {print $2}'> $output
      101 +$ZFS upgrade | $AWK '$1 ~ "^[0-9]+$" {print $2}'> $output
 102  102  COUNT=$( $WC -l $output | $AWK '{print $1}' )
 103  103  
 104  104  typeset -i i=0
 105  105  for fs in ${old_datasets}; do
 106  106          log_must $GREP "^$fs$" $output
 107  107          (( i = i + 1 ))
 108  108  done
 109  109  
 110  110  if (( i != COUNT - OLDCOUNT )); then
 111  111          $CAT $output
↓ open down ↓ 6 lines elided ↑ open up ↑
 118  118          fi
 119  119  done
 120  120  
 121  121  log_must eval '$ZFS upgrade > $output 2>&1'
 122  122  log_must eval '$GREP "${expect_str1} $ZFS_VERSION" $output > /dev/null 2>&1'
 123  123  if (( OLDCOUNT == 0 )); then
 124  124          log_must eval '$GREP "${expect_str2}" $output > /dev/null 2>&1'
 125  125  else
 126  126          log_must eval '$GREP "${expect_str3}" $output > /dev/null 2>&1'
 127  127  fi
 128      -$ZFS upgrade | $NAWK '$1 ~ "^[0-9]+$" {print $2}'> $output
      128 +$ZFS upgrade | $AWK '$1 ~ "^[0-9]+$" {print $2}'> $output
 129  129  COUNT=$( $WC -l $output | $AWK '{print $1}' )
 130  130  
 131  131  if (( COUNT != OLDCOUNT )); then
 132  132          $CAT $output
 133  133          log_fail "Unexpect old-version filesystems print out."
 134  134  fi
 135  135  
 136  136  log_pass "Executing 'zfs upgrade' command succeeds."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX