]> git.proxmox.com Git - mirror_zfs.git/blame - tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh
Fix typos in tests/
[mirror_zfs.git] / tests / zfs-tests / tests / functional / inuse / inuse_001_pos.ksh
CommitLineData
6bb24f4d
BB
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 2008 Sun Microsystems, Inc. All rights reserved.
25# Use is subject to license terms.
26#
27
28#
c1d9abf9 29# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
6bb24f4d
BB
30#
31
32. $STF_SUITE/include/libtest.shlib
33. $STF_SUITE/tests/functional/inuse/inuse.cfg
34
35#
36# DESCRIPTION:
37# ZFS will not interfere with devices that are in use by dumpadm.
38#
39# STRATEGY:
40# 1. Create crash dump device using 'dumpadm'
41# 2. Try to create a ZFS pool using the 'dumpadm' crash dump device.
42#
43
44verify_runnable "global"
45
95401cb6
BB
46if is_linux; then
47 log_unsupported "Test case isn't applicable to Linux"
48fi
49
6bb24f4d
BB
50function cleanup
51{
52 #
53 # Remove dump device.
54 #
55 if [[ -n $PREVDUMPDEV ]]; then
c1d9abf9 56 log_must dumpadm -u -d $PREVDUMPDEV > /dev/null
6bb24f4d
BB
57 fi
58
59 destroy_pool $TESTPOOL
60}
61
62log_assert "Ensure ZFS cannot use a device designated as a dump device"
63
64log_onexit cleanup
65
66typeset dumpdev=""
67typeset diskslice=""
68
c1d9abf9 69PREVDUMPDEV=`dumpadm | grep "Dump device" | awk '{print $3}'`
6bb24f4d
BB
70
71log_note "Zero $FS_DISK0 and place free space in to slice 0"
72log_must cleanup_devices $FS_DISK0
73
8b2174b9 74diskslice="${DEV_DSKDIR}/${FS_DISK0}${SLICE0}"
6bb24f4d 75log_note "Configuring $diskslice as dump device"
c1d9abf9 76log_must dumpadm -d $diskslice > /dev/null
6bb24f4d
BB
77
78log_note "Confirm that dump device has been setup"
c1d9abf9 79dumpdev=`dumpadm | grep "Dump device" | awk '{print $3}'`
6bb24f4d
BB
80[[ -z "$dumpdev" ]] && log_untested "No dump device has been configured"
81
82[[ "$dumpdev" != "$diskslice" ]] && \
220dd4ae 83 log_untested "Dump device has not been configured to $diskslice"
6bb24f4d
BB
84
85log_note "Attempt to zpool the dump device"
2171eb71 86unset NOINUSE_CHECK
c1d9abf9 87log_mustnot zpool create $TESTPOOL "$diskslice"
6bb24f4d
BB
88log_mustnot poolexists $TESTPOOL
89
90log_pass "Unable to zpool a device in use by dumpadm"