Index: head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh =================================================================== --- head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh (revision 353359) +++ head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh (revision 353360) @@ -1,62 +1,47 @@ #!/usr/local/bin/ksh93 -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # $FreeBSD$ # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cleanup.ksh 1.3 08/11/03 SMI" # . $STF_SUITE/include/libtest.kshlib verify_runnable "global" for pool in "$TESTPOOL" "$TESTPOOL1"; do datasetexists $pool/$TESTFS && \ log_must $ZFS destroy -Rf $pool/$TESTFS destroy_pool "$pool" done -ismounted $DEVICE_DIR ufs -(( $? == 0 )) && log_must $UMOUNT -f $DEVICE_DIR - for dir in "$TESTDIR" "$TESTDIR1" "$DEVICE_DIR" ; do [[ -d $dir ]] && \ log_must $RM -rf $dir done - -# recreate and destroy a zpool over the disks to restore the partitions to -# normal -case $DISK_COUNT in -0|1) - log_note "No disk devices to restore" - ;; -*) - log_must cleanup_devices $ZFS_DISK1 - log_must cleanup_devices $ZFS_DISK2 - ;; -esac log_pass Index: head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh =================================================================== --- head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh (revision 353359) +++ head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh (revision 353360) @@ -1,79 +1,55 @@ #!/usr/local/bin/ksh93 -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # $FreeBSD$ # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)setup.ksh 1.4 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib verify_runnable "global" -DISK=${DISKS%% *} +create_pool "$TESTPOOL" "$DISK0" -for dev in $ZFS_DISK1 $ZFS_DISK2 ; do - log_must cleanup_devices $dev -done - -typeset -i i=0 -if [[ $DISK_COUNT -lt 2 ]]; then - partition_disk $PART_SIZE $ZFS_DISK1 $GROUP_NUM -fi - -create_pool "$TESTPOOL" "$ZFSSIDE_DISK1" - if [[ -d $TESTDIR ]]; then $RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR $MKDIR -p $TESTDIR || log_unresolved Could not create $TESTDIR fi log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS -# Limit the filesystem size to 32GiB; this should be sufficient. -(( MAXSECTS = 32 * 1024 * 1024 )) -NUMSECTS=`diskinfo ${ZFSSIDE_DISK2} | awk '{print $4}'` -if [[ $NUMSECTS -gt $MAXSECTS ]]; then - NUMSECTS=$MAXSECTS -fi - -$ECHO "y" | $NEWFS -s $NUMSECTS $ZFSSIDE_DISK2 >/dev/null 2>&1 -(( $? != 0 )) && - log_untested "Unable to setup a UFS file system" - [[ ! -d $DEVICE_DIR ]] && \ log_must $MKDIR -p $DEVICE_DIR - -log_must $MOUNT $ZFSSIDE_DISK2 $DEVICE_DIR i=0 while (( i < $MAX_NUM )); do log_must create_vdevs ${DEVICE_DIR}/${DEVICE_FILE}$i (( i = i + 1 )) done log_pass Index: head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg =================================================================== --- head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg (revision 353359) +++ head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg (revision 353360) @@ -1,135 +1,109 @@ # vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # $FreeBSD$ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_import.cfg 1.6 08/11/03 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib -set -A disk_array $(find_disks $DISKS) -case "${#disk_array[*]}" in -0) - # - # on stf_configure, disk_freelist returns empty. - # - DISK_COUNT=0 - ;; -1) - # We need to repartition the single disk to two slices. - DISK_COUNT=1 - ZFS_DISK1=${disk_array[0]} - ZFSSIDE_DISK1=${ZFS_DISK1}p1 - ZFS_DISK2=${disk_array[0]} - ZFSSIDE_DISK2=${ZFS_DISK2}p2 - ;; -*) - # We don't need to repartition anything - DISK_COUNT=2 - ZFS_DISK1=${disk_array[0]} - ZFSSIDE_DISK1=${ZFS_DISK1} - ZFS_DISK2=${disk_array[1]} - ZFSSIDE_DISK2=${ZFS_DISK2} - ;; -esac +set_disks -export DISK_COUNT ZFS_DISK1 ZFSSIDE_DISK1 ZFS_DISK2 ZFSSIDE_DISK2 - export FS_SIZE=2gb export FILE_SIZE=64m export PART_SIZE=128m export MAX_NUM=5 export GROUP_NUM=3 -export DEVICE_DIR=${TMPDIR}/dev${TESTCASE_ID} -export BACKUP_DEVICE_DIR=/bakdev${TESTCASE_ID} +export DEVICE_DIR=$(pwd)/dev +export BACKUP_DEVICE_DIR=$(pwd)/bakdev export DEVICE_FILE=disk -export DEVICE_ARCHIVE=${TMPDIR}/archive${TESTCASE_ID}.tar +export DEVICE_ARCHIVE=$(pwd)/archive${TESTCASE_ID}.tar # MYTESTFILE can be any file that exists and we have r access to export MYTESTFILE=$STF_SUITE/include/default.cfg # NB: It's easier just to repeat the expansion patterns than to reuse. for (( num=0 ; $num < $GROUP_NUM ; num += 1 )); do eval export VDEV\${num}F="${DEVICE_FILE}${num}" eval export VDEV\${num}="${DEVICE_DIR}/${DEVICE_FILE}${num}" DEVICE_FILES="$DEVICE_FILES ${DEVICE_DIR}/${DEVICE_FILE}${num}" done export DEVICE_FILES for (( num = GROUP_NUM ; $num < $MAX_NUM ; num += 1 )); do eval export VDEV\${num}F="${DEVICE_FILE}${num}" eval export VDEV\${num}="${DEVICE_DIR}/${DEVICE_FILE}${num}" done export ALTER_ROOT=/alter${TESTCASE_ID} export STF_TIMEOUT=2400 export ZPOOL_VERSION=$(get_zpool_version) # Version 1 pools export ZPOOL_VERSION_1_FILES="zfs-pool-v1.dat" export ZPOOL_VERSION_1_NAME="v1-pool" # Version 2 pools export ZPOOL_VERSION_2_FILES="zfs-pool-v2.dat" export ZPOOL_VERSION_2_NAME="v2-pool" # This is a v3 pool export ZPOOL_VERSION_3_FILES="zfs-pool-v3.dat" export ZPOOL_VERSION_3_NAME="v3-pool" # This is a v6 pool export ZPOOL_VERSION_6_FILES="zfs-pool-v6.dat" export ZPOOL_VERSION_6_NAME="v6-pool" # This is a v7 pool export ZPOOL_VERSION_7_FILES="zfs-pool-v7.dat" export ZPOOL_VERSION_7_NAME="v7-pool" # This is a v8 pool export ZPOOL_VERSION_8_FILES="zfs-pool-v8.dat" export ZPOOL_VERSION_8_NAME="v8-pool" # This statement builds up a list of configurations we should be able to # upgrade, for each pool version. Once we've built this variable, we'll # call the functions above for each value. case $ZPOOL_VERSION in 6) CONFIGS="6" ;; 7) CONFIGS="6 7" ;; 8) CONFIGS="6 7 8" ;; *) # we should be able to upgrade pools of version 1, 2 & 3 # but we should also log a note about the unknown pool version CONFIGS="6 7 8" ;; esac export CONFIGS Index: head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh =================================================================== --- head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh (revision 353359) +++ head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh (revision 353360) @@ -1,238 +1,238 @@ #!/usr/local/bin/ksh93 -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # $FreeBSD$ # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_import_all_001_pos.ksh 1.5 08/11/03 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/cli_root/zfs_mount/zfs_mount.kshlib ################################################################################# # # __stc_assertion_start # # ID: zpool_import_all_001_pos # # DESCRIPTION: # Verify that 'zpool import -a' succeeds as root. # # STRATEGY: # 1. Create a group of pools with specified vdev. # 2. Create zfs filesystems within the given pools. # 3. Export the pools. # 4. Verify that import command succeed. # # TESTABILITY: explicit # # TEST_AUTOMATION_LEVEL: automated # # CODING_STATUS: COMPLETED (2005-07-04) # # __stc_assertion_end # ################################################################################ verify_runnable "global" set -A options "" "-R $ALTER_ROOT" typeset -i number=0 typeset -i id=0 typeset -i i=0 typeset checksum1 typeset unwantedpool function setup_single_disk #disk #pool #fs #mtpt { typeset disk=$1 typeset pool=$2 typeset fs=${3##/} typeset mtpt=$4 setup_filesystem "$disk" "$pool" "$fs" "$mtpt" log_must $CP $MYTESTFILE $mtpt/$TESTFILE0 log_must $ZPOOL export $pool [[ -d $mtpt ]] && \ $RM -rf $mtpt } function cleanup_all { typeset -i id=0 # # Try import individually if 'import -a' failed. # for pool in `$ZPOOL import | $GREP "pool:" | $AWK '{print $2}'`; do $ZPOOL import -f $pool done for pool in `$ZPOOL import -d $DEVICE_DIR | $GREP "pool:" | $AWK '{print $2}'`; do log_must $ZPOOL import -d $DEVICE_DIR -f $pool done while (( id < number )); do if ! poolexists ${TESTPOOL}-$id ; then (( id = id + 1 )) continue fi if (( id == 0 )); then log_must $ZPOOL export ${TESTPOOL}-$id [[ -d /${TESTPOOL}-$id ]] && \ log_must $RM -rf /${TESTPOOL}-$id log_must $ZPOOL import -f ${TESTPOOL}-$id $TESTPOOL [[ -e $TESTDIR/$TESTFILE0 ]] && \ log_must $RM -rf $TESTDIR/$TESTFILE0 else cleanup_filesystem "${TESTPOOL}-$id" $TESTFS destroy_pool ${TESTPOOL}-$id fi (( id = id + 1 )) done [[ -d $ALTER_ROOT ]] && \ $RM -rf $ALTER_ROOT } function checksum_all #alter_root { typeset alter_root=$1 typeset -i id=0 typeset file typeset checksum2 while (( id < number )); do if (( id == 2 )); then (( id = id + 1 )) continue fi if (( id == 0 )); then file=${alter_root}/$TESTDIR/$TESTFILE0 else file=${alter_root}/$TESTDIR.$id/$TESTFILE0 fi [[ ! -e $file ]] && \ log_fail "$file missing after import." checksum2=$($SUM $file | $AWK '{print $1}') [[ "$checksum1" != "$checksum2" ]] && \ log_fail "Checksums differ ($checksum1 != $checksum2)" (( id = id + 1 )) done return 0 } log_assert "Verify that 'zpool import -a' succeeds as root." log_onexit cleanup_all checksum1=$($SUM $MYTESTFILE | $AWK '{print $1}') log_must $ZPOOL export $TESTPOOL log_must $ZPOOL import $TESTPOOL ${TESTPOOL}-0 log_must $CP $MYTESTFILE $TESTDIR/$TESTFILE0 log_must $ZPOOL export ${TESTPOOL}-0 [[ -d /${TESTPOOL}-0 ]] && \ log_must $RM -rf /${TESTPOOL}-0 # # setup exported pools on normal devices # number=1 while (( number <= $GROUP_NUM )); do if [[ `$UNAME -s` != "FreeBSD" ]]; then if (( number == 2)); then (( number = number + 1 )) continue fi fi - set_partition $number "" $PART_SIZE ${ZFS_DISK2} + set_partition $number "" $PART_SIZE ${DISK1} - setup_single_disk "${ZFS_DISK2}p${number}" \ + setup_single_disk "${DISK1}p${number}" \ "${TESTPOOL}-$number" \ "$TESTFS" \ "$TESTDIR.$number" (( number = number + 1 )) done # # setup exported pools on raw files # for disk in $DEVICE_FILES do setup_single_disk "$disk" \ "${TESTPOOL}-$number" \ "$TESTFS" \ "$TESTDIR.$number" (( number = number + 1 )) done while (( i < ${#options[*]} )); do log_must $ZPOOL import -d /dev -d $DEVICE_DIR ${options[i]} -a -f # destroy unintentional imported pools typeset exclude=`eval $ECHO \"'(${KEEP})'\"` for unwantedpool in $($ZPOOL list -H -o name \ | $EGREP -v "$exclude" | $GREP -v $TESTPOOL); do log_must $ZPOOL export $unwantedpool done if [[ -n ${options[i]} ]]; then checksum_all $ALTER_ROOT else checksum_all fi id=0 while (( id < number )); do if poolexists ${TESTPOOL}-$id ; then log_must $ZPOOL export ${TESTPOOL}-$id fi (( id = id + 1 )) done (( i = i + 1 )) done log_pass "'zpool import -a' succeeds as root." Index: head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh =================================================================== --- head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh (revision 353359) +++ head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh (revision 353360) @@ -1,589 +1,589 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # $FreeBSD$ # # Copyright 2012 Spectra Logic. All rights reserved. # Use is subject to license terms. # atf_test_case zpool_import_002_pos cleanup zpool_import_002_pos_head() { atf_set "descr" "Verify that an exported pool can be imported and cannot be imported more than once." atf_set "require.progs" zfs zpool sum zdb atf_set "timeout" 2400 } zpool_import_002_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_002_pos.ksh || atf_fail "Testcase failed" } zpool_import_002_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_003_pos cleanup zpool_import_003_pos_head() { atf_set "descr" "Destroyed pools are not listed unless with -D option is specified." atf_set "require.progs" zpool zfs atf_set "timeout" 2400 } zpool_import_003_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_003_pos.ksh || atf_fail "Testcase failed" } zpool_import_003_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_004_pos cleanup zpool_import_004_pos_head() { atf_set "descr" "Destroyed pools devices was moved to another directory,it still can be imported correctly." atf_set "require.progs" zpool zfs zdb atf_set "timeout" 2400 } zpool_import_004_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_004_pos.ksh || atf_fail "Testcase failed" } zpool_import_004_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_005_pos cleanup zpool_import_005_pos_head() { atf_set "descr" "Destroyed pools devices was renamed, it still can be importedcorrectly." atf_set "require.progs" zpool zfs zdb atf_set "timeout" 2400 } zpool_import_005_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_005_pos.ksh || atf_fail "Testcase failed" } zpool_import_005_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_006_pos cleanup zpool_import_006_pos_head() { atf_set "descr" "For mirror, N-1 destroyed pools devices was removed or usedby other pool, it still can be imported correctly." atf_set "require.progs" zpool zfs zdb atf_set "timeout" 2400 } zpool_import_006_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_006_pos.ksh || atf_fail "Testcase failed" } zpool_import_006_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_007_pos cleanup zpool_import_007_pos_head() { atf_set "descr" "For raidz, one destroyed pools devices was removed or used byother pool, it still can be imported correctly." atf_set "require.progs" zpool zfs zdb atf_set "timeout" 2400 } zpool_import_007_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_007_pos.ksh || atf_fail "Testcase failed" } zpool_import_007_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_008_pos cleanup zpool_import_008_pos_head() { atf_set "descr" "For raidz2, two destroyed pools devices was removed or used byother pool, it still can be imported correctly." atf_set "require.progs" zpool zfs zdb atf_set "timeout" 2400 } zpool_import_008_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_008_pos.ksh || atf_fail "Testcase failed" } zpool_import_008_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_009_neg cleanup zpool_import_009_neg_head() { atf_set "descr" "Badly-formed 'zpool import' with inapplicable scenariosshould return an error." atf_set "require.progs" zfs zpool atf_set "timeout" 2400 } zpool_import_009_neg_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_009_neg.ksh || atf_fail "Testcase failed" } zpool_import_009_neg_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_010_pos cleanup zpool_import_010_pos_head() { atf_set "descr" "'zpool -D -a' can import all the specified directoriesdestroyed pools." atf_set "require.progs" zpool zfs atf_set "timeout" 2400 } zpool_import_010_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_010_pos.ksh || atf_fail "Testcase failed" } zpool_import_010_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_011_neg cleanup zpool_import_011_neg_head() { atf_set "descr" "For strip pool, any destroyed pool devices was demaged,zpool import -D will failed." atf_set "require.progs" zpool zfs zdb atf_set "timeout" 2400 } zpool_import_011_neg_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_011_neg.ksh || atf_fail "Testcase failed" } zpool_import_011_neg_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_012_pos cleanup zpool_import_012_pos_head() { atf_set "descr" "Verify all mount & share status of sub-filesystems within a poolcan be restored after import [-Df]." atf_set "require.progs" zfs zpool zdb share atf_set "timeout" 2400 } zpool_import_012_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_012_pos.ksh || atf_fail "Testcase failed" } zpool_import_012_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_013_neg zpool_import_013_neg_head() { atf_set "descr" "'zpool import' fails for pool that was not cleanly exported" atf_set "require.progs" zfs zpool } zpool_import_013_neg_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/zpool_import_013_neg.ksh || atf_fail "Testcase failed" } atf_test_case zpool_import_014_pos cleanup zpool_import_014_pos_head() { atf_set "descr" "'zpool import' can import destroyed disk-backed pools" atf_set "require.progs" zfs zpool } zpool_import_014_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/zpool_import_014_pos.ksh || atf_fail "Testcase failed" } zpool_import_014_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_all_001_pos cleanup zpool_import_all_001_pos_head() { atf_set "descr" "Verify that 'zpool import -a' succeeds as root." atf_set "require.progs" zfs zpool sum atf_set "timeout" 2400 } zpool_import_all_001_pos_body() { atf_skip "This test relies heavily on Solaris slices. It could be ported, but that is difficult due to the high degree of obfuscation in the code" . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_all_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_all_001_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_001_pos cleanup zpool_import_missing_001_pos_head() { atf_set "descr" "Verify that import could handle damaged or missing device." atf_set "require.progs" zfs sum zpool zdb atf_set "timeout" 2400 } zpool_import_missing_001_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_missing_001_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_002_pos cleanup zpool_import_missing_002_pos_head() { atf_set "descr" "Verify that import could handle moving device." atf_set "require.progs" zpool zfs zdb atf_set "timeout" 2400 } zpool_import_missing_002_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_002_pos.ksh || atf_fail "Testcase failed" } zpool_import_missing_002_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_003_pos cleanup zpool_import_missing_003_pos_head() { atf_set "descr" "Verify that import could handle device overlapped." atf_set "require.progs" zpool sum zfs atf_set "timeout" 2400 } zpool_import_missing_003_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_missing_003_pos.ksh || atf_fail "Testcase failed" } zpool_import_missing_003_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_missing_004_pos zpool_import_missing_004_pos_head() { atf_set "descr" "Verify that zpool import succeeds when devices are missing" atf_set "require.progs" zfs zpool atf_set "timeout" 300 } zpool_import_missing_004_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/zpool_import_missing_004_pos.ksh || atf_fail "Testcase failed" } atf_test_case zpool_import_missing_005_pos zpool_import_missing_005_pos_head() { atf_set "descr" "Verify that zpool import succeeds when devices of all types have been renamed" atf_set "require.progs" mdconfig zfs zpool atf_set "timeout" 300 } zpool_import_missing_005_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/zpool_import_missing_005_pos.ksh || atf_fail "Testcase failed" } atf_test_case zpool_import_rename_001_pos cleanup zpool_import_rename_001_pos_head() { atf_set "descr" "Verify that an imported pool can be renamed." atf_set "require.progs" zfs zpool sum zdb atf_set "timeout" 2400 } zpool_import_rename_001_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg - verify_disk_count "$DISKS" 2 + verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zpool_import_rename_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_rename_001_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_corrupt_001_pos cleanup zpool_import_corrupt_001_pos_head() { atf_set "descr" "Verify that a disk-backed exported pool with some of its vdev labels corrupted can still be imported" atf_set "require.progs" zfs zpool zdb atf_set "timeout" 2400 } zpool_import_corrupt_001_pos_body() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg verify_disk_count "$DISKS" 1 ksh93 $(atf_get_srcdir)/zpool_import_corrupt_001_pos.ksh || atf_fail "Testcase failed" } zpool_import_corrupt_001_pos_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg . $(atf_get_srcdir)/zpool_import.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_test_case zpool_import_destroyed_001_neg cleanup zpool_import_destroyed_001_neg_head() { atf_set "descr" "'zpool import' will not show destroyed pools, even if an out-of-date non-destroyed label remains" atf_set "require.progs" zpool } zpool_import_destroyed_001_neg_body() { . $(atf_get_srcdir)/../../../include/default.cfg verify_disk_count "$DISKS" 3 ksh93 $(atf_get_srcdir)/zpool_import_destroyed_001_neg.ksh || atf_fail "Testcase failed" } zpool_import_destroyed_001_neg_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg destroy_pool "$TESTPOOL" cleanup_devices "$DISKS" } atf_test_case zpool_import_destroyed_002_neg cleanup zpool_import_destroyed_002_neg_head() { atf_set "descr" "'zpool import' will not show destroyed pools, even if an out-of-date non-destroyed label remains" atf_set "require.progs" zpool } zpool_import_destroyed_002_neg_body() { . $(atf_get_srcdir)/../../../include/default.cfg verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/zpool_import_destroyed_002_neg.ksh || atf_fail "Testcase failed" } zpool_import_destroyed_002_neg_cleanup() { . $(atf_get_srcdir)/../../../include/default.cfg destroy_pool "$TESTPOOL" cleanup_devices "$DISKS" } atf_init_test_cases() { atf_add_test_case zpool_import_002_pos atf_add_test_case zpool_import_003_pos atf_add_test_case zpool_import_004_pos atf_add_test_case zpool_import_005_pos atf_add_test_case zpool_import_006_pos atf_add_test_case zpool_import_007_pos atf_add_test_case zpool_import_008_pos atf_add_test_case zpool_import_009_neg atf_add_test_case zpool_import_010_pos atf_add_test_case zpool_import_011_neg atf_add_test_case zpool_import_012_pos atf_add_test_case zpool_import_013_neg atf_add_test_case zpool_import_014_pos atf_add_test_case zpool_import_all_001_pos atf_add_test_case zpool_import_missing_001_pos atf_add_test_case zpool_import_missing_002_pos atf_add_test_case zpool_import_missing_003_pos atf_add_test_case zpool_import_missing_004_pos atf_add_test_case zpool_import_missing_005_pos atf_add_test_case zpool_import_rename_001_pos atf_add_test_case zpool_import_corrupt_001_pos atf_add_test_case zpool_import_destroyed_001_neg atf_add_test_case zpool_import_destroyed_002_neg }