1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

ZFS: multiple fixes to the zpool_import tests

* Don't create a UFS mountpoint just to store some temporary files.  The
  tests should always be executed with a sufficiently large TMPDIR.
  Creating the UFS mountpoint is not only unneccessary, but it slowed
  zpool_import_missing_002_pos greatly, because that test moves large files
  between TMPDIR and the UFS mountpoint.  This change also allows many of
  the tests to be executed with just a single test disk, instead of two.

* Move zpool_import_missing_002_pos's backup device dir from / to $PWD to
  prevent cross-device moves.  On my system, these two changes improved that
  test's speed by 39x.  It should also prevent ENOSPC errors seen in CI.

* If insufficient disks are available, don't try to partition one of them.
  Just rely on Kyua to skip the test.  Users who care will configure Kyua
  with sufficient disks.

MFC after:	2 weeks
Sponsored by:	Axcient
This commit is contained in:
Alan Somers 2019-10-09 17:24:09 +00:00
parent eabddb25a3
commit 560c0f4573
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353360
5 changed files with 22 additions and 87 deletions

View File

@ -39,24 +39,9 @@ for pool in "$TESTPOOL" "$TESTPOOL1"; do
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

View File

@ -33,18 +33,7 @@
verify_runnable "global"
DISK=${DISKS%% *}
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"
create_pool "$TESTPOOL" "$DISK0"
if [[ -d $TESTDIR ]]; then
$RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
@ -54,22 +43,9 @@ 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

View File

@ -32,43 +32,17 @@
. $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
export DISK_COUNT ZFS_DISK1 ZFSSIDE_DISK1 ZFS_DISK2 ZFSSIDE_DISK2
set_disks
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

View File

@ -183,9 +183,9 @@ while (( number <= $GROUP_NUM )); do
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"

View File

@ -38,7 +38,7 @@ 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"
}
@ -63,7 +63,7 @@ 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"
}
@ -88,7 +88,7 @@ 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"
}
@ -113,7 +113,7 @@ 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"
}
@ -138,7 +138,7 @@ 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"
}
@ -163,7 +163,7 @@ 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"
}
@ -188,7 +188,7 @@ 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"
}
@ -213,7 +213,7 @@ 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"
}
@ -238,7 +238,7 @@ 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"
}
@ -263,7 +263,7 @@ 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"
}
@ -288,7 +288,7 @@ 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"
}
@ -377,7 +377,7 @@ 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"
}
@ -402,7 +402,7 @@ 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"
}
@ -427,7 +427,7 @@ 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"
}
@ -482,7 +482,7 @@ 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"
}