From e26776f14ccddc8086d22d0ae607da5a0ca84102 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Thu, 28 Jan 2021 04:33:30 +0300 Subject: [PATCH] ZTS: pool_state test check for pool existence in cleanup If there is no scsi_debug module, then this test must be skipped, in this case cleanup routine should be prepared for absent pool. Reviewed-by: Brian Behlendorf Signed-off-by: George Melikov Closes #11534 --- .../tests/functional/procfs/pool_state.ksh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/zfs-tests/tests/functional/procfs/pool_state.ksh b/tests/zfs-tests/tests/functional/procfs/pool_state.ksh index f4df839be6..080fdddb2d 100755 --- a/tests/zfs-tests/tests/functional/procfs/pool_state.ksh +++ b/tests/zfs-tests/tests/functional/procfs/pool_state.ksh @@ -61,16 +61,18 @@ function cleanup log_must rm -f $BACKUP fi - # Our disk is back. Now we can clear errors and destroy the - # pool cleanly. - log_must zpool clear $TESTPOOL2 + if poolexists $TESTPOOL2 ; then + # Our disk is back. Now we can clear errors and destroy the + # pool cleanly. + log_must zpool clear $TESTPOOL2 - # Now that the disk is back and errors cleared, wait for our - # hung 'zpool scrub' to finish. - wait + # Now that the disk is back and errors cleared, wait for our + # hung 'zpool scrub' to finish. + wait - destroy_pool $TESTPOOL2 - log_must rm $REALDISK + destroy_pool $TESTPOOL2 + fi + log_must rm -f $REALDISK unload_scsi_debug fi }