Whamcloud - gitweb
LU-17310 tests: make m_assume_storage_prezeroed more robust 17/53217/2
authorAndreas Dilger <adilger@dilger.ca>
Thu, 23 Nov 2023 02:47:38 +0000 (19:47 -0700)
committerLi Dongyang <dongyangli@ddn.com>
Wed, 6 Dec 2023 23:45:11 +0000 (23:45 +0000)
commitc573b3c046027a995d7e25dfdc25231f958faee0
treed2301a54ab6328a33a5e1e561a4f7ae3a6ccc3cf
parent202e9820d5601aa376a7b42ae438978ecff94ec2
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/40th) of the number of blocks zeroed when
"-E assume_sotrage_prezeroed" is not given, which makes it more
robust when running in different environments.  This varies from
1/47 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