From 6c4c4d75990f558fdb598259a56bab317a8b1f23 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 29 Dec 2023 15:10:36 -0500 Subject: [PATCH] EX-7601 tests: add multi-mount compression test This adds a multi-mount correctness test for compression. This races IO from two mountpoints at varying sizes to stress test compression. Test-Parameters: trivial Test-Parameters: testlist=sanity-compr env=ONLY=1006 Signed-off-by: Patrick Farrell Change-Id: If49cbd6d171068faa802835146f273d835b39bc3 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51842 Reviewed-by: Artem Blagodarenko Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- lustre/tests/sanity-compr.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/lustre/tests/sanity-compr.sh b/lustre/tests/sanity-compr.sh index a0f78ee..d971c89 100644 --- a/lustre/tests/sanity-compr.sh +++ b/lustre/tests/sanity-compr.sh @@ -719,6 +719,77 @@ test_1005() { } run_test 1005 "test for write updating with partial chunks" +test_1006() { + local tf=$DIR/$tfile + local tf2=$DIR2/$tfile + local hdf=$LUSTRE/tests/AMSR_E_L3_DailyOcean_V05_20111003.hdf + local tmp_hdf=$TMP/$tfile.hdf + local source=$tmp_hdf + # Larger than arm page size + local chunksize=128 + local cs_bytes=$((chunksize * 1024)) + + # Larger than arm page size + local chunksize=128 + + if [[ -f $hdf.bz2 ]] && type -p bzcat >/dev/null; then + bzcat $hdf.bz2 > $tmp_hdf + elif [[ -f $hdf.bz2 ]] && type -p bunzip2 >/dev/null; then + cp $hdf.bz2 $tmp_hdf.bz2 || error "cp $tmp_hdf.bz2" + bunzip2 $tmp_hdf.bz2 || error "bunzip2 $tmp_hdf.bz2" + else + echo "bunzip2 is not installed, skip it" + return 0 + fi + + mount_client $MOUNT2 + stack_trap "umount_client $MOUNT2" EXIT + + # Fail test if source size changes so we catch this + # Source should be a few MiB in size + $CHECKSTAT -s 14625450 $source || error "checkstat wrong size" + + stack_trap "rm -f $tf; disable_compression" + enable_compression + + $LFS setstripe -E -1 -Z lz4:0 --compress-chunk=$chunksize $tf.source || + error "set a compress component in $tf.source failed" + + # Copy the source file to Lustre so we also read from Lustre + dd if=$source of=$tf.source bs=1M || error "dd to create $tf.source failed" + flush_and_compare $source $tf.source "(0) failed compare of source" + + for bs in $((PAGE_SIZE - 1024)) $PAGE_SIZE $((PAGE_SIZE * 3/2)) \ + $(((cs_bytes - 1024))) $cs_bytes $((cs_bytes * 3/2)); do + + # Simple compressed layout + $LFS setstripe -E -1 -Z lz4:0 --compress-chunk=$chunksize $tf || + error "set a compress component in $tf failed" + + echo "bs: $bs" + dd if=$tf.source bs=$bs of=$tf conv=notrunc & + pid1=$! + # Second mount with similar but not the same block size + dd if=$tf.source bs=$((bs * 2)) of=$tf2 conv=notrunc & + pid2=$! + wait $pid1 + rc1=$? + wait $pid2 + rc2=$? + if (( rc1 != 0 )); then + error "copy 1 w/bsize $bs failed: $rc1" + fi + if (( rc2 != 0 )); then + error "copy 2 w/bsize $bs failed: $rc2" + fi + + flush_and_compare $source $tf "(1) failed compare with size $bs" + flush_and_compare $tf $tf2 "(2) failed compare with size $bs" + rm -f $tf $tf2 + done +} +run_test 1006 "racing writes with compressed layout" + complete_test $SECONDS check_and_cleanup_lustre declare -a logs=($ONLY) -- 1.8.3.1