Whamcloud - gitweb
LU-17310 tests: make m_assume_storage_prezeroed more robust
authorAndreas Dilger <adilger@dilger.ca>
Thu, 23 Nov 2023 02:47:38 +0000 (19:47 -0700)
committerLi Dongyang <dongyangli@ddn.com>
Fri, 24 May 2024 11:00:27 +0000 (21:00 +1000)
commit21ca52c92cd8ee26b3574c511c669e58c496cd46
tree11b469b028ec529e4c4d8ecbeb8d7f0fc02e2ac5
parenta7a6c6c079bda1137ec0544c07177b709b1400ff
LU-17310 tests: make m_assume_storage_prezeroed more robust

Don't assume that mke2fs is going to zero out an exact number
of blocks when run with/without "-E assume_storage_prezeroed",
since this depends on a number of different options that are
not specified in the test script.

Instead, check that the number of blocks zeroed in the image is
a small fraction (1/15th) of the number of blocks zeroed when
"-E assume_storage_prezeroed" is not given, which makes it more
robust when running in different environments.  This varies from
1/16 in the original test to 1/91 in my local test environment.

Avoid "losetup --sector-size 4096", use "mke2fs -b 4096" instead.
Clean up the loop device before checking "stat" so that all
blocks are flushed to the backing storage before calling sync.
Only one loop device and test file is needed for the test.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Change-Id: I98fc3f5334cb8e2dd754c5d4994f2ca582300c13
Reviewed-on: https://review.whamcloud.com/c/tools/e2fsprogs/+/53217
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
tests/m_assume_storage_prezeroed/expect [deleted file]
tests/m_assume_storage_prezeroed/script