diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.kshlib b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.kshlib index c574c34aff09..ab824d797b34 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.kshlib @@ -29,5 +29,5 @@ function zpool_export_cleanup { [[ -d $TESTDIR0 ]] && log_must rm -rf $TESTDIR0 - default_cleanup + default_cleanup_noexit } diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh index 5f5376a09113..c56f92b99043 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh @@ -38,8 +38,9 @@ # busy i.e. mounted. # # STRATEGY: -# 1. Try and export the default pool when mounted and busy. -# 2. Verify an error is returned. +# 1. Create a pool and filesystem for testing. +# 2. Try and export the pool when mounted and busy. +# 3. Verify an error is returned. # verify_runnable "global" @@ -56,6 +57,26 @@ log_onexit cleanup log_assert "Verify a busy ZPOOL cannot be exported." +# Set up the pool and filesystem manually +DISK=${DISKS%% *} + +# Clean up any existing pool +if poolexists $TESTPOOL ; then + destroy_pool $TESTPOOL +fi +[[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL + +# Create the pool +log_must zpool create -f $TESTPOOL $DISK + +# Create test directory +rm -rf $TESTDIR || log_unresolved "Could not remove $TESTDIR" +mkdir -p $TESTDIR || log_unresolved "Could not create $TESTDIR" + +# Create filesystem with mountpoint +log_must zfs create $TESTPOOL/$TESTFS +log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS + log_must ismounted "$TESTPOOL/$TESTFS" log_must cd $TESTDIR log_mustnot zpool export $TESTPOOL