]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/no_space/enospc_003_pos.ksh
Update ZTS to work on FreeBSD
[mirror_zfs.git] / tests / zfs-tests / tests / functional / no_space / enospc_003_pos.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2017, loli10K. All rights reserved.
25 #
26
27 . $STF_SUITE/include/libtest.shlib
28 . $STF_SUITE/tests/functional/no_space/enospc.cfg
29 . $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
30
31 #
32 # DESCRIPTION:
33 # ENOSPC is returned on pools with large physical block size and small
34 # recordsize.
35 #
36 # STRATEGY:
37 # 1. Create a pool with property ashift=13 (8K block size)
38 # 2. Set property recordsize=512 and copies=3 on the root dataset
39 # 3. Write a file until the file system is full
40 # 4. Verify the return code is ENOSPC
41 #
42
43 verify_runnable "both"
44
45 function cleanup
46 {
47 log_must zpool destroy $TESTPOOL1
48 }
49
50 log_onexit cleanup
51
52 log_assert "ENOSPC is returned on pools with large physical block size"
53
54 log_must zpool create -o ashift=13 $TESTPOOL1 $DISK_LARGE
55 log_must zfs set mountpoint=$TESTDIR $TESTPOOL1
56 log_must zfs set compression=off $TESTPOOL1
57 log_must zfs set recordsize=512 $TESTPOOL1
58 log_must zfs set copies=3 $TESTPOOL1
59
60 log_note "Writing file: $TESTFILE0 until ENOSPC."
61 file_write -o create -f $TESTDIR/$TESTFILE0 -b $BLOCKSZ \
62 -c $NUM_WRITES -d $DATA
63 ret=$?
64
65 (( $ret != $ENOSPC )) && \
66 log_fail "$TESTFILE0 returned: $ret rather than ENOSPC."
67
68 log_pass "ENOSPC returned as expected."