From bb14b40c647906cb277b502836e016ea976ef25e Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sat, 1 Jul 2023 17:57:26 -0600 Subject: [PATCH] EX-6127 tests: test compression without bzip2/HDF5 Run as much of sanity test_460a compression tests as possible, even if bunzip2 or HDF5 file are unavailable. Print a clear message in test_84 if bunzip2 unavailable. Fixes: f43b9ce9af ("EX-6127 osc: osc brw request compression") Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I36251834f636600eb9b0194ccd14c8b203da32e5 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51532 Tested-by: jenkins Tested-by: Maloo --- lustre/tests/sanity.sh | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2de8fb9..15da355 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -10195,15 +10195,18 @@ test_84() # Third launch with downloaded HDF file # HDF file AMSR_E_L3_DailyOcean_V05_20111003.hdf taken from # https://nsidc.org/data/ae_dyocn/versions/2 - if ! [ -e $hdf.bz2 ]; then - echo "HDF file not present" - exit 0 + if ! [ -f $hdf.bz2 ]; then + echo "HDF file not present, skip rest of test" + return 0 fi - if [ $(which bzcat) ]; then + if type -p bzcat >/dev/null; then bzcat $hdf.bz2 > $tmpfile - else + elif type -p bunzip2 >/dev/null; then cp $hdf.bz2 $tmpfile.bz2 bunzip2 $tmpfile.bz2 + else + echo "missing bunzip2, skip reat of test" + return 0 fi echo "Compress/decompress $hdf" insmod $LUSTRE/tests/kernel/kcompr.ko run_id=$run_id \ @@ -27635,18 +27638,13 @@ test_460a() { local tmp_rand=$TMP/$tfile.rand local hdf=$LUSTRE/tests/AMSR_E_L3_DailyOcean_V05_20111003.hdf - if ! [ -e $hdf.bz2 ]; then - echo "HDF file not present" - exit 0 - fi - - if type -p bzcat >/dev/null; then + if [[ -f $hdf.bz2 ]] && type -p bzcat >/dev/null; then bzcat $hdf.bz2 > $tmp_hdf - elif type -p bunzip2 >/dev/null; then + 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 - skip_env "bunzip2 is not installed" + echo "bunzip2 is not installed, skip it" fi stack_trap "rm -Rf $DIR/$tdir; rm -Rf $TMP/$tdir; disable_compression" @@ -27657,7 +27655,7 @@ test_460a() { compress_content $0 false # hdf file - mix of text and binary data - compress_content $tmp_hdf false + [[ -f "$tmp_hdf" ]] && compress_content $tmp_hdf false dd if=/dev/zero of=$tmp_zero bs=2M count=2 conv=fsync &>/dev/null || error "dd to $tmp_zero failed" @@ -27672,7 +27670,7 @@ test_460a() { compress_content $tmp_rand true # let's compress bz2 file - compress_content $hdf.bz2 true + [[ -f "$hdf.bz2" ]] && compress_content $hdf.bz2 true echo "md5sum:" find $DIR/$tdir -type f -exec md5sum {} + | LC_ALL=C sort -- 1.8.3.1