dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / test / zfs-tests / tests / functional / holes / holes_sanity.ksh
blobcb1fda94301cc0a3131538d1975f04b1690ad9b1
1 #!/bin/ksh
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright (c) 2014, 2016 by Delphix. All rights reserved.
19 # Description:
20 # Verify that holes can be written and read back correctly in ZFS.
22 # Strategy:
23 # 1. Create a testfile with varying holes and data throughout the file.
24 # 2. Verify that each created file has the correct number of holes and
25 # data blocks as seen by both lseek and libzfs.
26 # 3. Do the same verification for a largefile.
27 # 4. Repeat for each recsize.
30 . $STF_SUITE/include/libtest.shlib
31 . $STF_SUITE/tests/functional/holes/holes.shlib
33 verify_runnable "both"
34 testfile="$TESTDIR/testfile"
36 for bs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
37 log_must zfs set recsize=$bs $TESTPOOL/$TESTFS
40 # Create combinations of holes and data to verify holes ending files
41 # and the like. (hhh, hhd, hdh...)
43 log_must mkholes -h 0:$((bs * 6)) $testfile
44 verify_holes_and_data_blocks $testfile 6 0
45 log_must rm $testfile
47 log_must mkholes -h 0:$((bs * 4)) -d $((bs * 4)):$((bs * 2)) $testfile
48 verify_holes_and_data_blocks $testfile 4 2
49 log_must rm $testfile
51 log_must mkholes -h 0:$((bs * 2)) -d $((bs * 2)):$((bs * 2)) \
52 -h $((bs * 4)):$((bs * 2)) $testfile
53 verify_holes_and_data_blocks $testfile 4 2
54 log_must rm $testfile
56 log_must mkholes -h 0:$((bs * 2)) -d $((bs * 2)):$((bs * 4)) $testfile
57 verify_holes_and_data_blocks $testfile 2 4
58 log_must rm $testfile
60 log_must mkholes -d 0:$((bs * 2)) -h $((bs * 2)):$((bs * 4)) $testfile
61 verify_holes_and_data_blocks $testfile 4 2
62 log_must rm $testfile
64 log_must mkholes -d 0:$((bs * 2)) -h $((bs * 2)):$((bs * 2)) \
65 -d $((bs * 4)):$((bs * 2)) $testfile
66 verify_holes_and_data_blocks $testfile 2 4
67 log_must rm $testfile
69 log_must mkholes -d 0:$((bs * 4)) -h $((bs * 4)):$((bs * 2)) $testfile
70 verify_holes_and_data_blocks $testfile 2 4
71 log_must rm $testfile
73 log_must mkholes -d 0:$((bs * 6)) $testfile
74 verify_holes_and_data_blocks $testfile 0 6
75 log_must rm $testfile
77 # Verify holes are correctly seen past the largefile limit.
78 len=$((1024**3 * 5))
79 nblks=$((len / bs))
80 log_must mkholes -h 0:$len -d $len:$bs $testfile
81 verify_holes_and_data_blocks $testfile $nblks 1
82 log_must rm $testfile
83 done
85 log_pass "Basic hole tests pass."