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/holes/holes_sanity.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/holes/holes_sanity.ksh
↓ open down ↓ 4 lines elided ↑ open up ↑
   5    5  # Common Development and Distribution License ("CDDL"), version 1.0.
   6    6  # You may only use this file in accordance with the terms of version
   7    7  # 1.0 of the CDDL.
   8    8  #
   9    9  # A full copy of the text of the CDDL should have accompanied this
  10   10  # source.  A copy of the CDDL is also available via the Internet at
  11   11  # http://www.illumos.org/license/CDDL.
  12   12  #
  13   13  
  14   14  #
  15      -# Copyright (c) 2014 by Delphix. All rights reserved.
       15 +# Copyright (c) 2014, 2016 by Delphix. All rights reserved.
  16   16  #
  17   17  
  18   18  #
  19   19  # Description:
  20   20  # Verify that holes can be written and read back correctly in ZFS.
  21   21  #
  22   22  # Strategy:
  23   23  # 1. Create a testfile with varying holes and data throughout the file.
  24   24  # 2. Verify that each created file has the correct number of holes and
  25   25  # data blocks as seen by both lseek and libzfs.
↓ open down ↓ 1 lines elided ↑ open up ↑
  27   27  # 4. Repeat for each recsize.
  28   28  #
  29   29  
  30   30  . $STF_SUITE/include/libtest.shlib
  31   31  . $STF_SUITE/tests/functional/holes/holes.shlib
  32   32  
  33   33  verify_runnable "both"
  34   34  testfile="$TESTDIR/testfile"
  35   35  
  36   36  for bs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
  37      -        log_must $ZFS set recsize=$bs $TESTPOOL/$TESTFS
       37 +        log_must zfs set recsize=$bs $TESTPOOL/$TESTFS
  38   38  
  39   39          #
  40   40          # Create combinations of holes and data to verify holes ending files
  41   41          # and the like. (hhh, hhd, hdh...)
  42   42          #
  43      -        log_must $MKHOLES -h 0:$((bs * 6)) $testfile
       43 +        log_must mkholes -h 0:$((bs * 6)) $testfile
  44   44          verify_holes_and_data_blocks $testfile 6 0
  45      -        log_must $RM $testfile
       45 +        log_must rm $testfile
  46   46  
  47      -        log_must $MKHOLES -h 0:$((bs * 4)) -d $((bs * 4)):$((bs * 2)) $testfile
       47 +        log_must mkholes -h 0:$((bs * 4)) -d $((bs * 4)):$((bs * 2)) $testfile
  48   48          verify_holes_and_data_blocks $testfile 4 2
  49      -        log_must $RM $testfile
       49 +        log_must rm $testfile
  50   50  
  51      -        log_must $MKHOLES -h 0:$((bs * 2)) -d $((bs * 2)):$((bs * 2)) \
       51 +        log_must mkholes -h 0:$((bs * 2)) -d $((bs * 2)):$((bs * 2)) \
  52   52              -h $((bs * 4)):$((bs * 2)) $testfile
  53   53          verify_holes_and_data_blocks $testfile 4 2
  54      -        log_must $RM $testfile
       54 +        log_must rm $testfile
  55   55  
  56      -        log_must $MKHOLES -h 0:$((bs * 2)) -d $((bs * 2)):$((bs * 4)) $testfile
       56 +        log_must mkholes -h 0:$((bs * 2)) -d $((bs * 2)):$((bs * 4)) $testfile
  57   57          verify_holes_and_data_blocks $testfile 2 4
  58      -        log_must $RM $testfile
       58 +        log_must rm $testfile
  59   59  
  60      -        log_must $MKHOLES -d 0:$((bs * 2)) -h $((bs * 2)):$((bs * 4)) $testfile
       60 +        log_must mkholes -d 0:$((bs * 2)) -h $((bs * 2)):$((bs * 4)) $testfile
  61   61          verify_holes_and_data_blocks $testfile 4 2
  62      -        log_must $RM $testfile
       62 +        log_must rm $testfile
  63   63  
  64      -        log_must $MKHOLES -d 0:$((bs * 2)) -h $((bs * 2)):$((bs * 2)) \
       64 +        log_must mkholes -d 0:$((bs * 2)) -h $((bs * 2)):$((bs * 2)) \
  65   65              -d $((bs * 4)):$((bs * 2)) $testfile
  66   66          verify_holes_and_data_blocks $testfile 2 4
  67      -        log_must $RM $testfile
       67 +        log_must rm $testfile
  68   68  
  69      -        log_must $MKHOLES -d 0:$((bs * 4)) -h $((bs * 4)):$((bs * 2)) $testfile
       69 +        log_must mkholes -d 0:$((bs * 4)) -h $((bs * 4)):$((bs * 2)) $testfile
  70   70          verify_holes_and_data_blocks $testfile 2 4
  71      -        log_must $RM $testfile
       71 +        log_must rm $testfile
  72   72  
  73      -        log_must $MKHOLES -d 0:$((bs * 6)) $testfile
       73 +        log_must mkholes -d 0:$((bs * 6)) $testfile
  74   74          verify_holes_and_data_blocks $testfile 0 6
  75      -        log_must $RM $testfile
       75 +        log_must rm $testfile
  76   76  
  77   77          # Verify holes are correctly seen past the largefile limit.
  78   78          len=$((1024**3 * 5))
  79   79          nblks=$((len / bs))
  80      -        log_must $MKHOLES -h 0:$len -d $len:$bs $testfile
       80 +        log_must mkholes -h 0:$len -d $len:$bs $testfile
  81   81          verify_holes_and_data_blocks $testfile $nblks 1
  82      -        log_must $RM $testfile
       82 +        log_must rm $testfile
  83   83  done
  84   84  
  85   85  log_pass "Basic hole tests pass."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX