1# CDDL HEADER START 2# 3# The contents of this file are subject to the terms of the 4# Common Development and Distribution License (the "License"). 5# You may not use this file except in compliance with the License. 6# 7# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 8# or http://www.opensolaris.org/os/licensing. 9# See the License for the specific language governing permissions 10# and limitations under the License. 11# 12# When distributing Covered Code, include this CDDL HEADER in each 13# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 14# If applicable, add the following below this CDDL HEADER, with the 15# fields enclosed by brackets "[]" replaced with your own identifying 16# information: Portions Copyright [yyyy] [name of copyright owner] 17# 18# CDDL HEADER END 19# 20 21# $FreeBSD$ 22 23# 24# Copyright 2012 Spectra Logic. All rights reserved. 25# Use is subject to license terms. 26# 27 28 29atf_test_case zpool_clear_001_pos cleanup 30zpool_clear_001_pos_head() 31{ 32 atf_set "descr" "Verify 'zpool clear' can clear errors of a storage pool." 33 atf_set "require.progs" "ksh93 zpool zfs" 34 atf_set "timeout" 2100 35} 36zpool_clear_001_pos_body() 37{ 38 . $(atf_get_srcdir)/../../../include/default.cfg 39 . $(atf_get_srcdir)/zpool_clear.cfg 40 41 ksh93 $(atf_get_srcdir)/zpool_clear_001_pos.ksh || atf_fail "Testcase failed" 42} 43zpool_clear_001_pos_cleanup() 44{ 45 . $(atf_get_srcdir)/../../../include/default.cfg 46 . $(atf_get_srcdir)/zpool_clear.cfg 47 48 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 49} 50 51 52atf_test_case zpool_clear_002_neg cleanup 53zpool_clear_002_neg_head() 54{ 55 atf_set "descr" "Execute 'zpool clear' using invalid parameters." 56 atf_set "require.progs" "ksh93 zpool" 57 atf_set "timeout" 2100 58} 59zpool_clear_002_neg_body() 60{ 61 . $(atf_get_srcdir)/../../../include/default.cfg 62 . $(atf_get_srcdir)/zpool_clear.cfg 63 64 ksh93 $(atf_get_srcdir)/zpool_clear_002_neg.ksh || atf_fail "Testcase failed" 65} 66zpool_clear_002_neg_cleanup() 67{ 68 . $(atf_get_srcdir)/../../../include/default.cfg 69 . $(atf_get_srcdir)/zpool_clear.cfg 70 71 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 72} 73 74 75atf_test_case zpool_clear_003_neg cleanup 76zpool_clear_003_neg_head() 77{ 78 atf_set "descr" "Verify 'zpool clear' cannot clear error for available spare devices." 79 atf_set "require.progs" "ksh93 zpool" 80 atf_set "timeout" 2100 81} 82zpool_clear_003_neg_body() 83{ 84 . $(atf_get_srcdir)/../../../include/default.cfg 85 . $(atf_get_srcdir)/zpool_clear.cfg 86 87 ksh93 $(atf_get_srcdir)/zpool_clear_003_neg.ksh || atf_fail "Testcase failed" 88} 89zpool_clear_003_neg_cleanup() 90{ 91 . $(atf_get_srcdir)/../../../include/default.cfg 92 . $(atf_get_srcdir)/zpool_clear.cfg 93 94 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 95} 96 97atf_test_case zpool_clear_004_pos cleanup 98zpool_clear_004_pos_head() 99{ 100 atf_set "descr" "Verify 'zpool clear' can work on spare vdevs" 101 atf_set "require.progs" "ksh93 zpool" 102 atf_set "timeout" 2100 103} 104zpool_clear_004_pos_body() 105{ 106 . $(atf_get_srcdir)/../../../include/default.cfg 107 . $(atf_get_srcdir)/zpool_clear.cfg 108 109 ksh93 $(atf_get_srcdir)/zpool_clear_004_pos.ksh || atf_fail "Testcase failed" 110} 111zpool_clear_004_pos_cleanup() 112{ 113 . $(atf_get_srcdir)/../../../include/default.cfg 114 . $(atf_get_srcdir)/zpool_clear.cfg 115 116 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 117} 118 119atf_test_case zpool_clear_005_pos cleanup 120zpool_clear_005_pos_head() 121{ 122 atf_set "descr" "'zpool clear' can online an UNAVAIL pool after all vdevs have reappeared" 123 atf_set "require.progs" "ksh93 gnop zpool" 124} 125zpool_clear_005_pos_body() 126{ 127 atf_skip "Fails on OpenZFS, causing eventual deadlock. PR tests/248910" 128 . $(atf_get_srcdir)/../../../include/default.cfg 129 . $(atf_get_srcdir)/zpool_clear.cfg 130 131 verify_disk_count "$DISKS" 3 132 ksh93 $(atf_get_srcdir)/zpool_clear_005_pos.ksh || atf_fail "Testcase failed" 133} 134zpool_clear_005_pos_cleanup() 135{ 136 . $(atf_get_srcdir)/../../../include/default.cfg 137 . $(atf_get_srcdir)/zpool_clear.cfg 138 139 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 140} 141 142 143 144atf_init_test_cases() 145{ 146 147 atf_add_test_case zpool_clear_001_pos 148 atf_add_test_case zpool_clear_002_neg 149 atf_add_test_case zpool_clear_003_neg 150 atf_add_test_case zpool_clear_004_pos 151 atf_add_test_case zpool_clear_005_pos 152} 153