[PATCH v2] tests: _fail on _scratch_mkfs_sized failure

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



If _scratch_mkfs_sized() fails, e.g. due to an FS not supporting the
provided size, tests may subsequently mount and run atop a previously
created (e.g. non-size-bound) filesystem.
This can lead to difficult to debug failures, or for some -ENOSPC
exercising tests, near infinite runtimes. Avoid this by renaming the
current function to _try_scratch_mkfs_sized() and _fail in the parent
_scratch_mkfs_sized() wrapper.

Signed-off-by: David Disseldorp <ddiss@xxxxxxx>
Suggested-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
Changes since v1:
- call _fail in a wrapper function, instead of adding failure handlers
  to individual test _scratch_mkfs_sized() callers.

 common/rc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/rc b/common/rc
index 56f1afb6..e95070dd 100644
--- a/common/rc
+++ b/common/rc
@@ -968,8 +968,8 @@ _small_fs_size_mb()
 }
 
 # Create fs of certain size on scratch device
-# _scratch_mkfs_sized <size in bytes> [optional blocksize]
-_scratch_mkfs_sized()
+# _try_scratch_mkfs_sized <size in bytes> [optional blocksize]
+_try_scratch_mkfs_sized()
 {
 	local fssize=$1
 	local blocksize=$2
@@ -1111,6 +1111,11 @@ _scratch_mkfs_sized()
 	esac
 }
 
+_scratch_mkfs_sized()
+{
+	_try_scratch_mkfs_sized $* || _fail "_scratch_mkfs_sized failed"
+}
+
 # Emulate an N-data-disk stripe w/ various stripe units
 # _scratch_mkfs_geom <sunit bytes> <swidth multiplier> [optional blocksize]
 _scratch_mkfs_geom()
-- 
2.35.3





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux