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 hotspare_add_001_pos cleanup 30hotspare_add_001_pos_head() 31{ 32 atf_set "descr" "'zpool add <pool> spare <vdev> ...' can add devices to the pool." 33 atf_set "timeout" 3600 34} 35hotspare_add_001_pos_body() 36{ 37 . $(atf_get_srcdir)/../../include/default.cfg 38 . $(atf_get_srcdir)/hotspare.kshlib 39 . $(atf_get_srcdir)/hotspare.cfg 40 41 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 42 ksh93 $(atf_get_srcdir)/hotspare_add_001_pos.ksh || atf_fail "Testcase failed" 43} 44hotspare_add_001_pos_cleanup() 45{ 46 . $(atf_get_srcdir)/../../include/default.cfg 47 . $(atf_get_srcdir)/hotspare.kshlib 48 . $(atf_get_srcdir)/hotspare.cfg 49 50 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 51} 52 53 54atf_test_case hotspare_add_002_pos cleanup 55hotspare_add_002_pos_head() 56{ 57 atf_set "descr" "'zpool add <pool> spare <vdev> ...' can add devices to the pool while it has spare-in device." 58 atf_set "require.progs" "ksh93 zpool" 59 atf_set "timeout" 3600 60} 61hotspare_add_002_pos_body() 62{ 63 . $(atf_get_srcdir)/../../include/default.cfg 64 . $(atf_get_srcdir)/hotspare.kshlib 65 . $(atf_get_srcdir)/hotspare.cfg 66 67 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 68 ksh93 $(atf_get_srcdir)/hotspare_add_002_pos.ksh || atf_fail "Testcase failed" 69} 70hotspare_add_002_pos_cleanup() 71{ 72 . $(atf_get_srcdir)/../../include/default.cfg 73 . $(atf_get_srcdir)/hotspare.kshlib 74 . $(atf_get_srcdir)/hotspare.cfg 75 76 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 77} 78 79 80atf_test_case hotspare_add_003_neg cleanup 81hotspare_add_003_neg_head() 82{ 83 atf_set "descr" "'zpool add [-f]' with hot spares should fail with inapplicable scenarios." 84 atf_set "require.progs" "ksh93 zpool" 85 atf_set "timeout" 3600 86} 87hotspare_add_003_neg_body() 88{ 89 . $(atf_get_srcdir)/../../include/default.cfg 90 . $(atf_get_srcdir)/hotspare.kshlib 91 . $(atf_get_srcdir)/hotspare.cfg 92 93 verify_disk_count "$DISKS" 3 94 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 95 ksh93 $(atf_get_srcdir)/hotspare_add_003_neg.ksh || atf_fail "Testcase failed" 96} 97hotspare_add_003_neg_cleanup() 98{ 99 . $(atf_get_srcdir)/../../include/default.cfg 100 . $(atf_get_srcdir)/hotspare.kshlib 101 . $(atf_get_srcdir)/hotspare.cfg 102 103 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 104} 105 106 107atf_test_case hotspare_add_004_neg cleanup 108hotspare_add_004_neg_head() 109{ 110 atf_set "descr" "'zpool add [-f]' will not allow a swap device to be used as a hotspare'" 111 atf_set "require.progs" "ksh93 zpool swapon swapoff swapctl" 112} 113hotspare_add_004_neg_body() 114{ 115 . $(atf_get_srcdir)/../../include/default.cfg 116 . $(atf_get_srcdir)/hotspare.kshlib 117 . $(atf_get_srcdir)/hotspare.cfg 118 119 verify_disk_count "$DISKS" 2 120 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 121 ksh93 $(atf_get_srcdir)/hotspare_add_004_neg.ksh || atf_fail "Testcase failed" 122} 123hotspare_add_004_neg_cleanup() 124{ 125 . $(atf_get_srcdir)/../../include/default.cfg 126 . $(atf_get_srcdir)/hotspare.kshlib 127 . $(atf_get_srcdir)/hotspare.cfg 128 129 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 130} 131 132 133atf_test_case hotspare_clone_001_pos cleanup 134hotspare_clone_001_pos_head() 135{ 136 atf_set "descr" "'zpool detach <pool> <vdev> ...' against hotspare should do no harm to clone." 137 atf_set "require.progs" "ksh93 zfs zpool sum" 138 atf_set "timeout" 3600 139} 140hotspare_clone_001_pos_body() 141{ 142 . $(atf_get_srcdir)/../../include/default.cfg 143 . $(atf_get_srcdir)/hotspare.kshlib 144 . $(atf_get_srcdir)/hotspare.cfg 145 146 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 147 ksh93 $(atf_get_srcdir)/hotspare_clone_001_pos.ksh || atf_fail "Testcase failed" 148} 149hotspare_clone_001_pos_cleanup() 150{ 151 . $(atf_get_srcdir)/../../include/default.cfg 152 . $(atf_get_srcdir)/hotspare.kshlib 153 . $(atf_get_srcdir)/hotspare.cfg 154 155 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 156} 157 158 159atf_test_case hotspare_clone_002_pos cleanup 160hotspare_clone_002_pos_head() 161{ 162 atf_set "descr" "'zpool detach <pool> <vdev> ...' against basic vdev should do no harm to clone." 163 atf_set "require.progs" "ksh93 zfs zpool sum" 164 atf_set "timeout" 3600 165} 166hotspare_clone_002_pos_body() 167{ 168 . $(atf_get_srcdir)/../../include/default.cfg 169 . $(atf_get_srcdir)/hotspare.kshlib 170 . $(atf_get_srcdir)/hotspare.cfg 171 172 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 173 ksh93 $(atf_get_srcdir)/hotspare_clone_002_pos.ksh || atf_fail "Testcase failed" 174} 175hotspare_clone_002_pos_cleanup() 176{ 177 . $(atf_get_srcdir)/../../include/default.cfg 178 . $(atf_get_srcdir)/hotspare.kshlib 179 . $(atf_get_srcdir)/hotspare.cfg 180 181 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 182} 183 184 185atf_test_case hotspare_create_001_neg cleanup 186hotspare_create_001_neg_head() 187{ 188 atf_set "descr" "'zpool create [-f]' with hot spares should be failedwith inapplicable scenarios." 189 atf_set "require.progs" "ksh93 zpool" 190 atf_set "timeout" 3600 191} 192hotspare_create_001_neg_body() 193{ 194 . $(atf_get_srcdir)/../../include/default.cfg 195 . $(atf_get_srcdir)/hotspare.kshlib 196 . $(atf_get_srcdir)/hotspare.cfg 197 198 verify_disk_count "$DISKS" 3 199 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 200 ksh93 $(atf_get_srcdir)/hotspare_create_001_neg.ksh || atf_fail "Testcase failed" 201} 202hotspare_create_001_neg_cleanup() 203{ 204 . $(atf_get_srcdir)/../../include/default.cfg 205 . $(atf_get_srcdir)/hotspare.kshlib 206 . $(atf_get_srcdir)/hotspare.cfg 207 208 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 209} 210 211 212atf_test_case hotspare_detach_001_pos cleanup 213hotspare_detach_001_pos_head() 214{ 215 atf_set "descr" "'zpool detach <pool> <vdev> ...' should deactivate the spared-in hot spare device successfully." 216 atf_set "require.progs" "ksh93 zpool" 217 atf_set "timeout" 3600 218} 219hotspare_detach_001_pos_body() 220{ 221 . $(atf_get_srcdir)/../../include/default.cfg 222 . $(atf_get_srcdir)/hotspare.kshlib 223 . $(atf_get_srcdir)/hotspare.cfg 224 225 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 226 ksh93 $(atf_get_srcdir)/hotspare_detach_001_pos.ksh || atf_fail "Testcase failed" 227} 228hotspare_detach_001_pos_cleanup() 229{ 230 . $(atf_get_srcdir)/../../include/default.cfg 231 . $(atf_get_srcdir)/hotspare.kshlib 232 . $(atf_get_srcdir)/hotspare.cfg 233 234 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 235} 236 237 238atf_test_case hotspare_detach_002_pos cleanup 239hotspare_detach_002_pos_head() 240{ 241 atf_set "descr" "'zpool detach <pool> <vdev> ...' against a functioning device that have spared should take the hot spare permanently swapping in successfully." 242 atf_set "require.progs" "ksh93 zpool" 243 atf_set "timeout" 3600 244} 245hotspare_detach_002_pos_body() 246{ 247 . $(atf_get_srcdir)/../../include/default.cfg 248 . $(atf_get_srcdir)/hotspare.kshlib 249 . $(atf_get_srcdir)/hotspare.cfg 250 251 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 252 ksh93 $(atf_get_srcdir)/hotspare_detach_002_pos.ksh || atf_fail "Testcase failed" 253} 254hotspare_detach_002_pos_cleanup() 255{ 256 . $(atf_get_srcdir)/../../include/default.cfg 257 . $(atf_get_srcdir)/hotspare.kshlib 258 . $(atf_get_srcdir)/hotspare.cfg 259 260 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 261} 262 263 264atf_test_case hotspare_detach_003_pos cleanup 265hotspare_detach_003_pos_head() 266{ 267 atf_set "descr" "'zpool replace <pool> <vdev> <ndev>' against a functioning device that have spared should complete and the hot spare should return to available." 268 atf_set "require.progs" "ksh93 zpool" 269 atf_set "timeout" 3600 270} 271hotspare_detach_003_pos_body() 272{ 273 . $(atf_get_srcdir)/../../include/default.cfg 274 . $(atf_get_srcdir)/hotspare.kshlib 275 . $(atf_get_srcdir)/hotspare.cfg 276 277 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 278 ksh93 $(atf_get_srcdir)/hotspare_detach_003_pos.ksh || atf_fail "Testcase failed" 279} 280hotspare_detach_003_pos_cleanup() 281{ 282 . $(atf_get_srcdir)/../../include/default.cfg 283 . $(atf_get_srcdir)/hotspare.kshlib 284 . $(atf_get_srcdir)/hotspare.cfg 285 286 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 287} 288 289 290atf_test_case hotspare_detach_004_pos cleanup 291hotspare_detach_004_pos_head() 292{ 293 atf_set "descr" "'zpool replace <pool> <vdev> <ndev>' against a hot spare device that have been activated should successful while the another dev is a available hot spare." 294 atf_set "require.progs" "ksh93 zpool" 295 atf_set "timeout" 3600 296} 297hotspare_detach_004_pos_body() 298{ 299 . $(atf_get_srcdir)/../../include/default.cfg 300 . $(atf_get_srcdir)/hotspare.kshlib 301 . $(atf_get_srcdir)/hotspare.cfg 302 303 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 304 ksh93 $(atf_get_srcdir)/hotspare_detach_004_pos.ksh || atf_fail "Testcase failed" 305} 306hotspare_detach_004_pos_cleanup() 307{ 308 . $(atf_get_srcdir)/../../include/default.cfg 309 . $(atf_get_srcdir)/hotspare.kshlib 310 . $(atf_get_srcdir)/hotspare.cfg 311 312 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 313} 314 315 316atf_test_case hotspare_detach_005_neg cleanup 317hotspare_detach_005_neg_head() 318{ 319 atf_set "descr" "'zpool detach <pool> <vdev>' against a hot spare device that NOT activated should fail and issue an error message." 320 atf_set "require.progs" "ksh93 zpool" 321 atf_set "timeout" 3600 322} 323hotspare_detach_005_neg_body() 324{ 325 . $(atf_get_srcdir)/../../include/default.cfg 326 . $(atf_get_srcdir)/hotspare.kshlib 327 . $(atf_get_srcdir)/hotspare.cfg 328 329 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 330 ksh93 $(atf_get_srcdir)/hotspare_detach_005_neg.ksh || atf_fail "Testcase failed" 331} 332hotspare_detach_005_neg_cleanup() 333{ 334 . $(atf_get_srcdir)/../../include/default.cfg 335 . $(atf_get_srcdir)/hotspare.kshlib 336 . $(atf_get_srcdir)/hotspare.cfg 337 338 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 339} 340 341 342atf_test_case hotspare_export_001_neg cleanup 343hotspare_export_001_neg_head() 344{ 345 atf_set "descr" "export pool that using shared hotspares will fail" 346 atf_set "require.progs" "ksh93 zpool" 347 atf_set "timeout" 3600 348} 349hotspare_export_001_neg_body() 350{ 351 . $(atf_get_srcdir)/../../include/default.cfg 352 . $(atf_get_srcdir)/hotspare.kshlib 353 . $(atf_get_srcdir)/hotspare.cfg 354 355 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 356 ksh93 $(atf_get_srcdir)/hotspare_export_001_neg.ksh || atf_fail "Testcase failed" 357} 358hotspare_export_001_neg_cleanup() 359{ 360 . $(atf_get_srcdir)/../../include/default.cfg 361 . $(atf_get_srcdir)/hotspare.kshlib 362 . $(atf_get_srcdir)/hotspare.cfg 363 364 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 365} 366 367 368atf_test_case hotspare_import_001_pos cleanup 369hotspare_import_001_pos_head() 370{ 371 atf_set "descr" "'zpool export/import <pool>' should runs successfully regardless the hotspare is only in list, activated, or offline." 372 atf_set "require.progs" "ksh93 zpool sum" 373 atf_set "timeout" 3600 374} 375hotspare_import_001_pos_body() 376{ 377 . $(atf_get_srcdir)/../../include/default.cfg 378 . $(atf_get_srcdir)/hotspare.kshlib 379 . $(atf_get_srcdir)/hotspare.cfg 380 381 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 382 ksh93 $(atf_get_srcdir)/hotspare_import_001_pos.ksh || atf_fail "Testcase failed" 383} 384hotspare_import_001_pos_cleanup() 385{ 386 . $(atf_get_srcdir)/../../include/default.cfg 387 . $(atf_get_srcdir)/hotspare.kshlib 388 . $(atf_get_srcdir)/hotspare.cfg 389 390 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 391} 392 393 394atf_test_case hotspare_onoffline_003_neg cleanup 395hotspare_onoffline_003_neg_head() 396{ 397 atf_set "descr" "'zpool offline/online <pool> <vdev>' should fail on inactive spares" 398 atf_set "require.progs" "ksh93 zpool zdb" 399 atf_set "timeout" 3600 400} 401hotspare_onoffline_003_neg_body() 402{ 403 . $(atf_get_srcdir)/../../include/default.cfg 404 . $(atf_get_srcdir)/hotspare.kshlib 405 . $(atf_get_srcdir)/hotspare.cfg 406 407 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 408 ksh93 $(atf_get_srcdir)/hotspare_onoffline_003_neg.ksh || atf_fail "Testcase failed" 409} 410hotspare_onoffline_003_neg_cleanup() 411{ 412 . $(atf_get_srcdir)/../../include/default.cfg 413 . $(atf_get_srcdir)/hotspare.kshlib 414 . $(atf_get_srcdir)/hotspare.cfg 415 416 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 417} 418 419 420atf_test_case hotspare_onoffline_004_neg cleanup 421hotspare_onoffline_004_neg_head() 422{ 423 atf_set "descr" "'zpool offline/online <pool> <vdev>' against a spared basic vdev during I/O completes." 424 atf_set "require.progs" "ksh93 zfs zpool zdb" 425 atf_set "timeout" 3600 426} 427hotspare_onoffline_004_neg_body() 428{ 429 . $(atf_get_srcdir)/../../include/default.cfg 430 . $(atf_get_srcdir)/hotspare.kshlib 431 . $(atf_get_srcdir)/hotspare.cfg 432 433 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 434 ksh93 $(atf_get_srcdir)/hotspare_onoffline_004_neg.ksh || atf_fail "Testcase failed" 435} 436hotspare_onoffline_004_neg_cleanup() 437{ 438 . $(atf_get_srcdir)/../../include/default.cfg 439 . $(atf_get_srcdir)/hotspare.kshlib 440 . $(atf_get_srcdir)/hotspare.cfg 441 442 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 443} 444 445 446atf_test_case hotspare_remove_001_pos cleanup 447hotspare_remove_001_pos_head() 448{ 449 atf_set "descr" "'zpool remove <pool> <vdev> ...' can remove spare device from the pool." 450 atf_set "require.progs" "ksh93 zpool" 451 atf_set "timeout" 3600 452} 453hotspare_remove_001_pos_body() 454{ 455 . $(atf_get_srcdir)/../../include/default.cfg 456 . $(atf_get_srcdir)/hotspare.kshlib 457 . $(atf_get_srcdir)/hotspare.cfg 458 459 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 460 ksh93 $(atf_get_srcdir)/hotspare_remove_001_pos.ksh || atf_fail "Testcase failed" 461} 462hotspare_remove_001_pos_cleanup() 463{ 464 . $(atf_get_srcdir)/../../include/default.cfg 465 . $(atf_get_srcdir)/hotspare.kshlib 466 . $(atf_get_srcdir)/hotspare.cfg 467 468 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 469} 470 471 472atf_test_case hotspare_remove_002_neg cleanup 473hotspare_remove_002_neg_head() 474{ 475 atf_set "descr" "'zpool remove <pool> <vdev> ...' should fail with inapplicable scenarios." 476 atf_set "require.progs" "ksh93 zpool" 477 atf_set "timeout" 3600 478} 479hotspare_remove_002_neg_body() 480{ 481 . $(atf_get_srcdir)/../../include/default.cfg 482 . $(atf_get_srcdir)/hotspare.kshlib 483 . $(atf_get_srcdir)/hotspare.cfg 484 485 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 486 ksh93 $(atf_get_srcdir)/hotspare_remove_002_neg.ksh || atf_fail "Testcase failed" 487} 488hotspare_remove_002_neg_cleanup() 489{ 490 . $(atf_get_srcdir)/../../include/default.cfg 491 . $(atf_get_srcdir)/hotspare.kshlib 492 . $(atf_get_srcdir)/hotspare.cfg 493 494 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 495} 496 497 498atf_test_case hotspare_remove_003_neg cleanup 499hotspare_remove_003_neg_head() 500{ 501 atf_set "descr" "Executing 'zpool remove' with bad options fails" 502 atf_set "require.progs" "ksh93 zpool" 503 atf_set "timeout" 3600 504} 505hotspare_remove_003_neg_body() 506{ 507 . $(atf_get_srcdir)/../../include/default.cfg 508 . $(atf_get_srcdir)/hotspare.kshlib 509 . $(atf_get_srcdir)/hotspare.cfg 510 511 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 512 ksh93 $(atf_get_srcdir)/hotspare_remove_003_neg.ksh || atf_fail "Testcase failed" 513} 514hotspare_remove_003_neg_cleanup() 515{ 516 . $(atf_get_srcdir)/../../include/default.cfg 517 . $(atf_get_srcdir)/hotspare.kshlib 518 . $(atf_get_srcdir)/hotspare.cfg 519 520 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 521} 522 523 524atf_test_case hotspare_remove_004_pos cleanup 525hotspare_remove_004_pos_head() 526{ 527 atf_set "descr" "'zpool remove <pool> <vdev> ...' can remove spare device from the pool." 528 atf_set "require.progs" "ksh93 zpool" 529 atf_set "timeout" 3600 530} 531hotspare_remove_004_pos_body() 532{ 533 . $(atf_get_srcdir)/../../include/default.cfg 534 . $(atf_get_srcdir)/hotspare.kshlib 535 . $(atf_get_srcdir)/hotspare.cfg 536 537 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 538 ksh93 $(atf_get_srcdir)/hotspare_remove_004_pos.ksh || atf_fail "Testcase failed" 539} 540hotspare_remove_004_pos_cleanup() 541{ 542 . $(atf_get_srcdir)/../../include/default.cfg 543 . $(atf_get_srcdir)/hotspare.kshlib 544 . $(atf_get_srcdir)/hotspare.cfg 545 546 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 547} 548 549 550atf_test_case hotspare_replace_001_neg cleanup 551hotspare_replace_001_neg_head() 552{ 553 atf_set "descr" "'zpool replace <pool> <odev> <ndev>' should fail with inapplicable scenarios." 554 atf_set "require.progs" "ksh93 zpool" 555 atf_set "timeout" 3600 556} 557hotspare_replace_001_neg_body() 558{ 559 . $(atf_get_srcdir)/../../include/default.cfg 560 . $(atf_get_srcdir)/hotspare.kshlib 561 . $(atf_get_srcdir)/hotspare.cfg 562 563 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 564 ksh93 $(atf_get_srcdir)/hotspare_replace_001_neg.ksh || atf_fail "Testcase failed" 565} 566hotspare_replace_001_neg_cleanup() 567{ 568 . $(atf_get_srcdir)/../../include/default.cfg 569 . $(atf_get_srcdir)/hotspare.kshlib 570 . $(atf_get_srcdir)/hotspare.cfg 571 572 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 573} 574 575 576atf_test_case hotspare_replace_002_neg cleanup 577hotspare_replace_002_neg_head() 578{ 579 atf_set "descr" "'zpool replace <pool> <odev> <ndev>' should fail while the hot spares smaller than the basic vdev." 580 atf_set "require.progs" "ksh93 zpool" 581 atf_set "timeout" 3600 582} 583hotspare_replace_002_neg_body() 584{ 585 . $(atf_get_srcdir)/../../include/default.cfg 586 . $(atf_get_srcdir)/hotspare.kshlib 587 . $(atf_get_srcdir)/hotspare.cfg 588 589 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 590 ksh93 $(atf_get_srcdir)/hotspare_replace_002_neg.ksh || atf_fail "Testcase failed" 591} 592hotspare_replace_002_neg_cleanup() 593{ 594 . $(atf_get_srcdir)/../../include/default.cfg 595 . $(atf_get_srcdir)/hotspare.kshlib 596 . $(atf_get_srcdir)/hotspare.cfg 597 598 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 599} 600 601 602atf_test_case hotspare_scrub_001_pos cleanup 603hotspare_scrub_001_pos_head() 604{ 605 atf_set "descr" "'zpool scrub <pool>' should runs successfully regardlessthe hotspare is only in list or activated." 606 atf_set "require.progs" "ksh93 zpool" 607 atf_set "timeout" 3600 608} 609hotspare_scrub_001_pos_body() 610{ 611 . $(atf_get_srcdir)/../../include/default.cfg 612 . $(atf_get_srcdir)/hotspare.kshlib 613 . $(atf_get_srcdir)/hotspare.cfg 614 615 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 616 ksh93 $(atf_get_srcdir)/hotspare_scrub_001_pos.ksh || atf_fail "Testcase failed" 617} 618hotspare_scrub_001_pos_cleanup() 619{ 620 . $(atf_get_srcdir)/../../include/default.cfg 621 . $(atf_get_srcdir)/hotspare.kshlib 622 . $(atf_get_srcdir)/hotspare.cfg 623 624 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 625} 626 627 628atf_test_case hotspare_scrub_002_pos cleanup 629hotspare_scrub_002_pos_head() 630{ 631 atf_set "descr" "'zpool scrub' scans spare vdevs" 632 atf_set "require.progs" "ksh93 zpool" 633} 634hotspare_scrub_002_pos_body() 635{ 636 . $(atf_get_srcdir)/../../include/default.cfg 637 . $(atf_get_srcdir)/hotspare.kshlib 638 . $(atf_get_srcdir)/hotspare.cfg 639 640 atf_expect_fail "PR 241069 scrub does not detect all errors on active spares" 641 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 642 ksh93 $(atf_get_srcdir)/hotspare_scrub_002_pos.ksh || atf_fail "Testcase failed" 643} 644hotspare_scrub_002_pos_cleanup() 645{ 646 . $(atf_get_srcdir)/../../include/default.cfg 647 . $(atf_get_srcdir)/hotspare.kshlib 648 . $(atf_get_srcdir)/hotspare.cfg 649 650 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 651} 652 653 654atf_test_case hotspare_shared_001_pos cleanup 655hotspare_shared_001_pos_head() 656{ 657 atf_set "descr" "'zpool add <pool> spare <vdev> ...' can add a disk as a shared spare to multiple pools." 658 atf_set "require.progs" "ksh93 zpool" 659 atf_set "timeout" 3600 660} 661hotspare_shared_001_pos_body() 662{ 663 . $(atf_get_srcdir)/../../include/default.cfg 664 . $(atf_get_srcdir)/hotspare.kshlib 665 . $(atf_get_srcdir)/hotspare.cfg 666 667 verify_disk_count "$DISKS" 5 668 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 669 ksh93 $(atf_get_srcdir)/hotspare_shared_001_pos.ksh || atf_fail "Testcase failed" 670} 671hotspare_shared_001_pos_cleanup() 672{ 673 . $(atf_get_srcdir)/../../include/default.cfg 674 . $(atf_get_srcdir)/hotspare.kshlib 675 . $(atf_get_srcdir)/hotspare.cfg 676 677 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 678} 679 680 681atf_test_case hotspare_snapshot_001_pos cleanup 682hotspare_snapshot_001_pos_head() 683{ 684 atf_set "descr" "'zpool detach <pool> <vdev> ...' against hotspare should do no harm to snapshot." 685 atf_set "require.progs" "ksh93 zfs zpool sum" 686 atf_set "timeout" 3600 687} 688hotspare_snapshot_001_pos_body() 689{ 690 . $(atf_get_srcdir)/../../include/default.cfg 691 . $(atf_get_srcdir)/hotspare.kshlib 692 . $(atf_get_srcdir)/hotspare.cfg 693 694 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 695 ksh93 $(atf_get_srcdir)/hotspare_snapshot_001_pos.ksh || atf_fail "Testcase failed" 696} 697hotspare_snapshot_001_pos_cleanup() 698{ 699 . $(atf_get_srcdir)/../../include/default.cfg 700 . $(atf_get_srcdir)/hotspare.kshlib 701 . $(atf_get_srcdir)/hotspare.cfg 702 703 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 704} 705 706 707atf_test_case hotspare_snapshot_002_pos cleanup 708hotspare_snapshot_002_pos_head() 709{ 710 atf_set "descr" "'zpool detach <pool> <vdev> ...' against basic vdev do no harm to snapshot." 711 atf_set "require.progs" "ksh93 zfs zpool sum" 712 atf_set "timeout" 3600 713} 714hotspare_snapshot_002_pos_body() 715{ 716 . $(atf_get_srcdir)/../../include/default.cfg 717 . $(atf_get_srcdir)/hotspare.kshlib 718 . $(atf_get_srcdir)/hotspare.cfg 719 720 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 721 ksh93 $(atf_get_srcdir)/hotspare_snapshot_002_pos.ksh || atf_fail "Testcase failed" 722} 723hotspare_snapshot_002_pos_cleanup() 724{ 725 . $(atf_get_srcdir)/../../include/default.cfg 726 . $(atf_get_srcdir)/hotspare.kshlib 727 . $(atf_get_srcdir)/hotspare.cfg 728 729 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 730} 731 732 733atf_init_test_cases() 734{ 735 736 atf_add_test_case hotspare_add_001_pos 737 atf_add_test_case hotspare_add_002_pos 738 atf_add_test_case hotspare_add_003_neg 739 atf_add_test_case hotspare_add_004_neg 740 atf_add_test_case hotspare_clone_001_pos 741 atf_add_test_case hotspare_clone_002_pos 742 atf_add_test_case hotspare_create_001_neg 743 atf_add_test_case hotspare_detach_001_pos 744 atf_add_test_case hotspare_detach_002_pos 745 atf_add_test_case hotspare_detach_003_pos 746 atf_add_test_case hotspare_detach_004_pos 747 atf_add_test_case hotspare_detach_005_neg 748 atf_add_test_case hotspare_export_001_neg 749 atf_add_test_case hotspare_import_001_pos 750 atf_add_test_case hotspare_onoffline_003_neg 751 atf_add_test_case hotspare_onoffline_004_neg 752 atf_add_test_case hotspare_remove_001_pos 753 atf_add_test_case hotspare_remove_002_neg 754 atf_add_test_case hotspare_remove_003_neg 755 atf_add_test_case hotspare_remove_004_pos 756 atf_add_test_case hotspare_replace_001_neg 757 atf_add_test_case hotspare_replace_002_neg 758 atf_add_test_case hotspare_scrub_001_pos 759 atf_add_test_case hotspare_scrub_002_pos 760 atf_add_test_case hotspare_shared_001_pos 761 atf_add_test_case hotspare_snapshot_001_pos 762 atf_add_test_case hotspare_snapshot_002_pos 763} 764