Print this page
    
NEX-3363 Test suites don't cleanup after themselves properly.
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
4206 history_003_pos relies on exact size of history log and entries
4207 history_008_pos depends on obsolete internal history log message
4208 Typo in zfs_main.c: "posxiuser"
4209 Populate zfstest with the remainder of the STF tests
Reviewed by: Sonu Pillai <sonu.pillai@delphix.com>
Reviewed by: Will Guyette <will.guyette@delphix.com>
Reviewed by: Eric Diven <eric.diven@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/test/zfs-tests/tests/functional/replacement/replacement_003_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/replacement/replacement_003_pos.ksh
   1    1  #!/usr/bin/ksh -p
   2    2  #
   3    3  # CDDL HEADER START
   4    4  #
   5    5  # The contents of this file are subject to the terms of the
   6    6  # Common Development and Distribution License (the "License").
   7    7  # You may not use this file except in compliance with the License.
   8    8  #
   9    9  # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10   10  # or http://www.opensolaris.org/os/licensing.
  11   11  # See the License for the specific language governing permissions
  12   12  # and limitations under the License.
  13   13  #
  14   14  # When distributing Covered Code, include this CDDL HEADER in each
  15   15  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16  # If applicable, add the following below this CDDL HEADER, with the
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  
    | 
      ↓ open down ↓ | 
    19 lines elided | 
    
      ↑ open up ↑ | 
  
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  25   25  # Use is subject to license terms.
  26   26  #
  27   27  
  28   28  #
  29   29  # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
       30 +# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  30   31  #
  31   32  
  32   33  . $STF_SUITE/include/libtest.shlib
  33   34  . $STF_SUITE/tests/functional/replacement/replacement.cfg
  34   35  
  35   36  #
  36   37  # DESCRIPTION:
  37   38  #       Detaching disks during I/O should pass for supported pools.
  38   39  #
  39   40  # STRATEGY:
  40   41  #       1. Create multidisk pools (stripe/mirror/raidz) and
  41   42  #          start some random I/O
  42   43  #       2. Detach a disk from the pool.
  43   44  #       3. Verify the integrity of the file system and the resilvering.
  44   45  #
  45   46  
  46   47  verify_runnable "global"
  47   48  
  48   49  function cleanup
  49   50  {
  50   51          if [[ -n "$child_pids" ]]; then
  
    | 
      ↓ open down ↓ | 
    11 lines elided | 
    
      ↑ open up ↑ | 
  
  51   52                  for wait_pid in $child_pids
  52   53                  do
  53   54                          kill $wait_pid
  54   55                  done
  55   56          fi
  56   57  
  57   58          if poolexists $TESTPOOL1; then
  58   59                  destroy_pool $TESTPOOL1
  59   60          fi
  60   61  
       62 +        [[ -e $TESTDIR1 ]] && log_must rm -rf $TESTDIR1
  61   63          [[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/*
  62   64  }
  63   65  
  64   66  log_assert "Replacing a disk during I/O completes."
  65   67  
  66   68  options=""
  67   69  options_display="default options"
  68   70  
  69   71  log_onexit cleanup
  70   72  
  71   73  [[ -n "$HOLES_FILESIZE" ]] && options=" $options -f $HOLES_FILESIZE "
  72   74  
  73   75  [[ -n "$HOLES_BLKSIZE" ]] && options="$options -b $HOLES_BLKSIZE "
  74   76  
  75   77  [[ -n "$HOLES_COUNT" ]] && options="$options -c $HOLES_COUNT "
  76   78  
  77   79  [[ -n "$HOLES_SEED" ]] && options="$options -s $HOLES_SEED "
  78   80  
  79   81  [[ -n "$HOLES_FILEOFFSET" ]] && options="$options -o $HOLES_FILEOFFSET "
  80   82  
  81   83  ptions="$options -r "
  82   84  
  83   85  [[ -n "$options" ]] && options_display=$options
  84   86  
  85   87  child_pids=""
  86   88  
  87   89  function detach_test
  88   90  {
  89   91          typeset -i iters=2
  90   92          typeset -i index=0
  91   93          typeset disk1=$1
  92   94  
  93   95          typeset i=0
  94   96          while [[ $i -lt $iters ]]; do
  95   97                  log_note "Invoking file_trunc with: $options_display"
  96   98                  file_trunc $options $TESTDIR/$TESTFILE.$i &
  97   99                  typeset pid=$!
  98  100  
  99  101                  sleep 1
 100  102                  if ! ps -p $pid > /dev/null 2>&1; then
 101  103                          log_fail "file_trunc $options $TESTDIR/$TESTFILE.$i"
 102  104                  fi
 103  105  
 104  106                  child_pids="$child_pids $pid"
 105  107                  ((i = i + 1))
 106  108          done
 107  109  
 108  110          log_must zpool detach $TESTPOOL1 $disk1
 109  111  
 110  112          sleep 10
 111  113  
 112  114          for wait_pid in $child_pids
 113  115          do
 114  116                  kill $wait_pid
 115  117          done
 116  118          child_pids=""
 117  119  
 118  120          log_must zpool export $TESTPOOL1
 119  121          log_must zpool import -d $TESTDIR $TESTPOOL1
 120  122          log_must zfs umount $TESTPOOL1/$TESTFS1
 121  123          log_must zdb -cdui $TESTPOOL1/$TESTFS1
 122  124          log_must zfs mount $TESTPOOL1/$TESTFS1
 123  125  }
 124  126  
 125  127  specials_list=""
 126  128  i=0
 127  129  while [[ $i != 2 ]]; do
 128  130          mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i
 129  131          specials_list="$specials_list $TESTDIR/$TESTFILE1.$i"
 130  132  
 131  133          ((i = i + 1))
 132  134  done
 133  135  
 134  136  create_pool $TESTPOOL1 mirror $specials_list
 135  137  log_must zfs create $TESTPOOL1/$TESTFS1
 136  138  log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
 137  139  
 138  140  detach_test $TESTDIR/$TESTFILE1.1
 139  141  
 140  142  zpool iostat -v $TESTPOOL1 | grep "$TESTDIR/$TESTFILE1.1"
 141  143  if [[ $? -eq 0 ]]; then
 142  144          log_fail "$TESTFILE1.1 should no longer be present."
 143  145  fi
 144  146  
 145  147  destroy_pool $TESTPOOL1
 146  148  
 147  149  log_note "Verify 'zpool detach' fails with non-mirrors."
 148  150  
 149  151  for type in "" "raidz" "raidz1" ; do
 150  152          create_pool $TESTPOOL1 $type $specials_list
 151  153          log_must zfs create $TESTPOOL1/$TESTFS1
 152  154          log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
 153  155  
 154  156          log_mustnot zpool detach $TESTDIR/$TESTFILE1.1
 155  157  
 156  158          zpool iostat -v $TESTPOOL1 | grep "$TESTDIR/$TESTFILE1.1"
 157  159          if [[ $? -ne 0 ]]; then
 158  160                  log_fail "$TESTFILE1.1 is not present."
 159  161          fi
 160  162  
 161  163          destroy_pool $TESTPOOL1
 162  164  done
 163  165  
 164  166  log_pass
  
    | 
      ↓ open down ↓ | 
    94 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX