From 5a1abc4b5b4267ad8b03d14ba3b20df3d459202f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 4 Mar 2020 15:12:12 -0800 Subject: [PATCH] ZTS: Speed up write_dirs cleanup The write_dirs tests fill a filesystem with a bunch of files until it is full. In cleanup the files are truncated and removed individually. These tests already take a while to run. It is quicker and easier to destroy the whole dataset and create a new one to replace it in the cleanup functions. Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Signed-off-by: Ryan Moeller Closes #10098 --- .../tests/functional/write_dirs/write_dirs_001_pos.ksh | 7 ++----- .../tests/functional/write_dirs/write_dirs_002_pos.ksh | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh index 60da382cad3d..d8c82f722051 100755 --- a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh @@ -47,11 +47,8 @@ verify_runnable "both" function cleanup { - for file in `find $TESTDIR -type f`; do - cat /dev/null > $file - done - log_must sync - log_must rm -rf $TESTDIR/* + destroy_dataset $TESTPOOL/$TESTFS + zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS } typeset -i retval=0 diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh index dcb793e1f36d..29ef9eadf390 100755 --- a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh @@ -47,11 +47,8 @@ verify_runnable "both" function cleanup { - for file in `find $TESTDIR -type f`; do - cat /dev/null > $file - done - log_must sync - log_must rm -rf $TESTDIR/* + destroy_dataset $TESTPOOL/$TESTFS + zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS } typeset -i retval=0