From d633172a38519aba2585c2a1fdcdd821cb19010c Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Sat, 31 Oct 2020 12:03:33 +0300 Subject: [PATCH] LU-10810 test: test lseek support in tools Check that SEEK_HOLE/SEEK_DATA are preforming in external tools as expected. Need 'cp' version 8.33+ and 'tar' version 1.29+, so check tools version and measure runtime of sparse file handling if applicable Signed-off-by: Mikhail Pershin Change-Id: I1424bf57c88f69d054c1646be66e10dd7fde8a1a Reviewed-on: https://review.whamcloud.com/40502 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: James Nunez Tested-by: Maloo --- lustre/tests/sanity.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 7b7f513..01229b1 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -23789,6 +23789,34 @@ test_430b() { } run_test 430b "lseek: SEEK_DATA/SEEK_HOLE special cases" +test_430c() { + $LCTL get_param osc.*.import | grep -q 'connect_flags:.*seek' || + skip "OST does not support SEEK_HOLE" + + local file=$DIR/$tdir/$tfile + local start + + mkdir -p $DIR/$tdir + dd if=/dev/urandom of=$file bs=1k count=1 seek=5M + + # cp version 8.33+ prefers lseek over fiemap + if [[ $(cp --version | head -n1 | sed "s/[^0-9]//g") -ge 833 ]]; then + start=$SECONDS + time cp $file /dev/null + (( SECONDS - start < 5 )) || + error "cp: too long runtime $((SECONDS - start))" + + fi + # tar version 1.29+ supports SEEK_HOLE/DATA + if [[ $(tar --version | head -n1 | sed "s/[^0-9]//g") -ge 129 ]]; then + start=$SECONDS + time tar cS $file - | cat > /dev/null + (( SECONDS - start < 5 )) || + error "tar: too long runtime $((SECONDS - start))" + fi +} +run_test 430c "lseek: external tools check" + prep_801() { [[ $MDS1_VERSION -lt $(version_code 2.9.55) ]] || [[ $OST1_VERSION -lt $(version_code 2.9.55) ]] && -- 1.8.3.1