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/truncate/truncate_001_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/truncate/truncate_001_pos.ksh
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25   25  # Use is subject to license terms.
  26   26  #
  27   27  
       28 +#
       29 +# Copyright (c) 2016 by Delphix. All rights reserved.
       30 +#
       31 +
  28   32  . $STF_SUITE/tests/functional/truncate/truncate.cfg
  29   33  . $STF_SUITE/include/libtest.shlib
  30   34  
  31   35  #
  32   36  # DESCRIPTION:
  33   37  # Tests file truncation within ZFS.
  34   38  #
  35   39  # STRATEGY:
  36   40  # 1. Open file
  37   41  # 2. Write random blocks in random places
  38   42  # 3. Truncate the file
  39   43  # 4. Repeat steps 2 and 3 lots of times
  40   44  # 5. Close the file.
  41   45  #
  42   46  
  43   47  verify_runnable "global"
  44   48  
  45   49  function cleanup
  46   50  {
  47      -        [[ -e $TESTDIR ]] && log_must $RM -rf $TESTDIR/*
       51 +        [[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/*
  48   52  }
  49   53  
  50   54  log_assert "Ensure file with random blocks is truncated properly"
  51   55  
  52   56  options=""
  53   57  options_display="default options"
  54   58  
  55   59  log_onexit cleanup
  56   60  
  57   61  [[ -n "$TRUNC_FILESIZE" ]] && options=" $options -f $TRUNC_FILESIZE "
↓ open down ↓ 1 lines elided ↑ open up ↑
  59   63  [[ -n "$TRUNC_BLKSIZE" ]] && options="$options -b $TRUNC_BLKSIZE "
  60   64  
  61   65  [[ -n "$TRUNC_COUNT" ]] && options="$options -c $TRUNC_COUNT "
  62   66  
  63   67  [[ -n "$TRUNC_SEED" ]] && options="$options -s $TRUNC_SEED "
  64   68  
  65   69  [[ -n "$TRUNC_FILEOFFSET" ]] && options="$options -o $TRUNC_FILEOFFSET "
  66   70  
  67   71  [[ -n "$options" ]] && options_display=$options
  68   72  
  69      -log_note "Invoking $FILE_TRUNC with: $options_display"
  70      -log_must $FILE_TRUNC $options $TESTDIR/$TESTFILE
       73 +log_note "Invoking file_trunc with: $options_display"
       74 +log_must file_trunc $options $TESTDIR/$TESTFILE
  71   75  
  72   76  typeset dir=$(get_device_dir $DISKS)
  73   77  verify_filesys "$TESTPOOL" "$TESTPOOL/$TESTFS" "$dir"
  74   78  
  75   79  log_pass "Random blocks have been truncated properly."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX