]> git.proxmox.com Git - mirror_zfs.git/blame - 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
CommitLineData
047187c1 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
43verify_runnable "both"
44
45function cleanup
46{
47 log_must zpool destroy $TESTPOOL1
047187c1 48}
49
50log_onexit cleanup
51
52log_assert "ENOSPC is returned on pools with large physical block size"
53
7839c4b5 54log_must zpool create -o ashift=13 $TESTPOOL1 $DISK_LARGE
047187c1 55log_must zfs set mountpoint=$TESTDIR $TESTPOOL1
56log_must zfs set compression=off $TESTPOOL1
57log_must zfs set recordsize=512 $TESTPOOL1
58log_must zfs set copies=3 $TESTPOOL1
59
60log_note "Writing file: $TESTFILE0 until ENOSPC."
61file_write -o create -f $TESTDIR/$TESTFILE0 -b $BLOCKSZ \
62 -c $NUM_WRITES -d $DATA
63ret=$?
64
65(( $ret != $ENOSPC )) && \
66 log_fail "$TESTFILE0 returned: $ret rather than ENOSPC."
67
68log_pass "ENOSPC returned as expected."