From e538ec68a54ee8658f32d604bd1344dd82134e7e Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 29 Dec 2023 15:10:58 -0500 Subject: [PATCH] EX-7601 tests: add mmap write test This improves the existing mmap test to test mmap writing as well as mmap reading. Test-Parameters: trivial Test-Parameters: testlist=sanity-compr env=ONLY="1003",ONLY_REPEAT=10 Signed-off-by: Patrick Farrell Change-Id: I81840c7bbbefbc5c3bae6b270c2d94297a254d19 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53307 Reviewed-by: Artem Blagodarenko Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- lustre/tests/sanity-compr.sh | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/lustre/tests/sanity-compr.sh b/lustre/tests/sanity-compr.sh index d971c89..6112f57 100644 --- a/lustre/tests/sanity-compr.sh +++ b/lustre/tests/sanity-compr.sh @@ -442,32 +442,53 @@ test_1003() { echo "Compression, using ${chunksize}K chunksize" $LFS setstripe -E -1 -Z lz4:0 --compress-chunk="$chunksize" "$tf" || error "setstripe on $tf failed, chunsksize $chunksize" + $LFS setstripe -E -1 -Z lz4:0 --compress-chunk="$chunksize" "$tf.2" || + error "setstripe on $tf.2 failed, chunsksize ${chunksize}K" - dd if=$source bs=1M of=$tf oflag=direct || - error "copy to create $tf failed" - flush_and_compare $source $tf "(0)" + mmap_copy_file -b $blocksize $source $tf || + error "mmap file copy failed (0)" - # Copy from compressed file to non-compressed file - # (test reading) + flush_and_compare $source $tf "(1)" + + # Test partial overwrite by copying a random 50% of the file + # This overwrites *parts* of the previously copied file + mmap_copy_file -p 50 -b $blocksize $source $tf || + error "mmap file copy failed (2)" + + flush_and_compare $source $tf "(3)" + + # Copy from one compressed layout to another mmap_copy_file -b $blocksize $tf $tf.2 || - error "mmap file copy failed (1)" + error "mmap file copy failed (4)" + + flush_and_compare $source $tf.2 "(5)" - flush_and_compare $source $tf.2 "(2)" + # Create a secondary copy of the source on a non-lustre fs + cp $source $source.2 + + # Partial overwrite with source compressed (tests reading) + mmap_copy_file -p 50 -b $blocksize $tf $source.2 || + error "mmap file copy failed (6)" + + flush_and_compare $source $source.2 "(7)" rm -f $tf.2 rm -f $tf.3 - # Test reading again by copying random chunks totalling 50% of + $LFS setstripe -E -1 -Z lz4:0 --compress-chunk="$chunksize" "$tf.2" || + error "setstripe on $tf.2 failed, chunsksize ${chunksize}K" + + # Test again by copying random chunks totalling 50% of # file size (but copies are at random offsets) # We seed the random copy and copy from the original source, # then repeat the random copy from the compressed file with the # same seed and compare those two mmap_copy_file -s $seed -p 50 -b $blocksize $source $tf.2 || - error "mmap file copy failed (3)" + error "mmap file copy failed (8)" mmap_copy_file -s $seed -p 50 -b $blocksize $tf $tf.3 || - error "mmap file copy failed (4)" + error "mmap file copy failed (9)" - flush_and_compare $tf.2 $tf.3 "(5)" + flush_and_compare $tf.2 $tf.3 "(10)" done done } -- 1.8.3.1