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/compression/compress_003_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/compression/compress_003_pos.ksh
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  25   25  # Use is subject to license terms.
  26   26  #
  27   27  
  28   28  #
  29      -# Copyright (c) 2013 by Delphix. All rights reserved.
       29 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  30   30  #
  31   31  
  32   32  . $STF_SUITE/include/libtest.shlib
  33   33  
  34   34  #
  35   35  # DESCRIPTION:
  36   36  # With 'compression' or 'compress'  set, changing filesystem blocksize cannot
  37   37  # cause system panic
  38   38  #
  39   39  # STRATEGY:
  40   40  #       1. Set 'compression' or "compress" to on
  41   41  #       2. Set different blocksize with ZFS filesystem
  42   42  #       3. Use 'mkfile' create single block and multi-block files
  43   43  #       4. Verify the system continued work
  44   44  #
  45   45  
  46   46  verify_runnable "both"
  47   47  
  48   48  function cleanup
  49   49  {
  50      -        $RM -f $TESTDIR/*
       50 +        rm -f $TESTDIR/*
  51   51  }
  52   52  
  53   53  log_assert "Changing blocksize doesn't casue system panic with compression settings"
  54   54  log_onexit cleanup
  55   55  
  56   56  fs=$TESTPOOL/$TESTFS
  57   57  single_blk_file=$TESTDIR/singleblkfile.$$
  58   58  multi_blk_file=$TESTDIR/multiblkfile.$$
  59   59  typeset -i blksize=512
  60   60  typeset -i fsize=0
  61   61  typeset -i offset=0
  62   62  
  63   63  for propname in "compression" "compress"
  64   64  do
  65   65          for value in $(get_compress_opts zfs_compress)
  66   66          do
  67      -                log_must $ZFS set $propname=$value $fs
       67 +                log_must zfs set $propname=$value $fs
  68   68                  if [[ $value == "gzip-6" ]]; then
  69   69                          value="gzip"
  70   70                  fi
  71   71                  real_val=$(get_prop $propname $fs)
  72   72                  [[ $real_val != $value ]] && \
  73   73                          log_fail "Set property $propname=$value failed."
  74   74  
  75   75                  (( blksize = 512 ))
  76   76                  while (( blksize <= 131072 )); do
  77      -                        log_must $ZFS set recordsize=$blksize $fs
       77 +                        log_must zfs set recordsize=$blksize $fs
  78   78                          (( offset = $RANDOM ))
  79   79                          if (( offset > blksize )); then
  80   80                                  (( offset = offset % blksize ))
  81   81                          fi
  82   82                          if (( (offset % 2) == 0 )); then
  83   83                                  #keep offset as non-power-of-2
  84   84                                  (( offset = offset + 1 ))
  85   85                          fi
  86   86                          (( fsize = offset ))
  87      -                        log_must $MKFILE $fsize $single_blk_file
       87 +                        log_must mkfile $fsize $single_blk_file
  88   88                          (( fsize = blksize + offset ))
  89      -                        log_must $MKFILE $fsize $multi_blk_file
       89 +                        log_must mkfile $fsize $multi_blk_file
  90   90  
  91   91                          (( blksize = blksize * 2 ))
  92   92                  done
  93   93          done
  94   94  done
  95   95  
  96   96  log_pass "The system works as expected while changing blocksize with compression settings"
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX