diff mbox series

[v2,1/2] clean-up; Remove left files after test finishes

Message ID 20220922185502.1046115-1-preichl@redhat.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] clean-up; Remove left files after test finishes | expand

Commit Message

Pavel Reichl Sept. 22, 2022, 6:55 p.m. UTC
Fix file leak in _get_max_file_size - This is obviously mostly
problematic for FS lacking support for sparse files.

There seems to be some seek_sanity_testfile files that are not
cleaned up and take up space:

-rwxr-xr-x. 1 root root 8.0G Sep 22 13:39 seek_sanity_testfile10

g/394: Clean up test files taking space:

-rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.1183899
-rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.1183899-1
-rwxr-xr-x. 1 root root    0 sep 22 14:58 394.1183899+1

Signed-off-by: Pavel Reichl <preichl@redhat.com>
---
 common/rc         | 1 +
 tests/generic/285 | 2 +-
 tests/generic/394 | 2 +-
 tests/generic/436 | 2 +-
 tests/generic/445 | 2 +-
 tests/generic/448 | 2 +-
 6 files changed, 6 insertions(+), 5 deletions(-)

Comments

Zorro Lang Sept. 29, 2022, 1:58 a.m. UTC | #1
On Thu, Sep 22, 2022 at 08:55:01PM +0200, Pavel Reichl wrote:
> Fix file leak in _get_max_file_size - This is obviously mostly
> problematic for FS lacking support for sparse files.
> 
> There seems to be some seek_sanity_testfile files that are not
> cleaned up and take up space:
> 
> -rwxr-xr-x. 1 root root 8.0G Sep 22 13:39 seek_sanity_testfile10
> 
> g/394: Clean up test files taking space:
> 
> -rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.1183899
> -rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.1183899-1
> -rwxr-xr-x. 1 root root    0 sep 22 14:58 394.1183899+1
> 
> Signed-off-by: Pavel Reichl <preichl@redhat.com>
> ---

This patch looks good to me, although I doubt _get_max_file_size() really can
give you a proper max file size for your exfat testing. I even doubt if those
cases test max file size are suit for exfat which doesn't support sparse file
and fallocate. Anyway, you can deal with that problem later, this patch can be
merged at first. Thanks.

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  common/rc         | 1 +
>  tests/generic/285 | 2 +-
>  tests/generic/394 | 2 +-
>  tests/generic/436 | 2 +-
>  tests/generic/445 | 2 +-
>  tests/generic/448 | 2 +-
>  6 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 228fcb37..c9078649 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4637,6 +4637,7 @@ _get_max_file_size()
>  			l=$m
>  		fi
>  	done
> +	rm -f $testfile
>  	echo $l
>  }
>  
> diff --git a/tests/generic/285 b/tests/generic/285
> index 6c755b5f..d1850021 100755
> --- a/tests/generic/285
> +++ b/tests/generic/285
> @@ -28,7 +28,7 @@ _require_test_program "seek_sanity_test"
>  # Override the default cleanup function.
>  _cleanup()
>  {
> -	eval "rm -f $BASE_TEST_FILE.*"
> +	rm -f $BASE_TEST_FILE*
>  }
>  
>  _run_seek_sanity_test $BASE_TEST_FILE > $seqres.full 2>&1 ||
> diff --git a/tests/generic/394 b/tests/generic/394
> index fc03e2f3..cbc2ce13 100755
> --- a/tests/generic/394
> +++ b/tests/generic/394
> @@ -14,7 +14,7 @@ _cleanup()
>  {
>  	cd /
>  	ulimit -f unlimited
> -	rm -f $tmp.*
> +	rm -f $tmp.* $TEST_DIR/$seq.*
>  }
>  
>  # Import common functions.
> diff --git a/tests/generic/436 b/tests/generic/436
> index 7fb24b41..d54af436 100755
> --- a/tests/generic/436
> +++ b/tests/generic/436
> @@ -16,7 +16,7 @@ BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
>  # Override the default cleanup function.
>  _cleanup()
>  {
> -	rm -f $tmp.* $BASE_TEST_FILE.*
> +	rm -f $tmp.* $BASE_TEST_FILE*
>  }
>  
>  # Import common functions.
> diff --git a/tests/generic/445 b/tests/generic/445
> index 05d1c5b3..d9e9f84b 100755
> --- a/tests/generic/445
> +++ b/tests/generic/445
> @@ -16,7 +16,7 @@ BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
>  # Override the default cleanup function.
>  _cleanup()
>  {
> -	rm -f $tmp.* $BASE_TEST_FILE.*
> +	rm -f $tmp.* $BASE_TEST_FILE*
>  }
>  
>  # Import common functions.
> diff --git a/tests/generic/448 b/tests/generic/448
> index d66967bc..11945549 100755
> --- a/tests/generic/448
> +++ b/tests/generic/448
> @@ -15,7 +15,7 @@ BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile_$seq
>  _cleanup()
>  {
>  	cd /
> -	rm -f $tmp.* $BASE_TEST_FILE
> +	rm -f $tmp.* $BASE_TEST_FILE*
>  }
>  
>  # Import common functions.
> -- 
> 2.37.3
>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 228fcb37..c9078649 100644
--- a/common/rc
+++ b/common/rc
@@ -4637,6 +4637,7 @@  _get_max_file_size()
 			l=$m
 		fi
 	done
+	rm -f $testfile
 	echo $l
 }
 
diff --git a/tests/generic/285 b/tests/generic/285
index 6c755b5f..d1850021 100755
--- a/tests/generic/285
+++ b/tests/generic/285
@@ -28,7 +28,7 @@  _require_test_program "seek_sanity_test"
 # Override the default cleanup function.
 _cleanup()
 {
-	eval "rm -f $BASE_TEST_FILE.*"
+	rm -f $BASE_TEST_FILE*
 }
 
 _run_seek_sanity_test $BASE_TEST_FILE > $seqres.full 2>&1 ||
diff --git a/tests/generic/394 b/tests/generic/394
index fc03e2f3..cbc2ce13 100755
--- a/tests/generic/394
+++ b/tests/generic/394
@@ -14,7 +14,7 @@  _cleanup()
 {
 	cd /
 	ulimit -f unlimited
-	rm -f $tmp.*
+	rm -f $tmp.* $TEST_DIR/$seq.*
 }
 
 # Import common functions.
diff --git a/tests/generic/436 b/tests/generic/436
index 7fb24b41..d54af436 100755
--- a/tests/generic/436
+++ b/tests/generic/436
@@ -16,7 +16,7 @@  BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
 # Override the default cleanup function.
 _cleanup()
 {
-	rm -f $tmp.* $BASE_TEST_FILE.*
+	rm -f $tmp.* $BASE_TEST_FILE*
 }
 
 # Import common functions.
diff --git a/tests/generic/445 b/tests/generic/445
index 05d1c5b3..d9e9f84b 100755
--- a/tests/generic/445
+++ b/tests/generic/445
@@ -16,7 +16,7 @@  BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
 # Override the default cleanup function.
 _cleanup()
 {
-	rm -f $tmp.* $BASE_TEST_FILE.*
+	rm -f $tmp.* $BASE_TEST_FILE*
 }
 
 # Import common functions.
diff --git a/tests/generic/448 b/tests/generic/448
index d66967bc..11945549 100755
--- a/tests/generic/448
+++ b/tests/generic/448
@@ -15,7 +15,7 @@  BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile_$seq
 _cleanup()
 {
 	cd /
-	rm -f $tmp.* $BASE_TEST_FILE
+	rm -f $tmp.* $BASE_TEST_FILE*
 }
 
 # Import common functions.