Whamcloud - gitweb
LU-10810 test: test lseek support in tools 02/40502/10
authorMikhail Pershin <mpershin@whamcloud.com>
Sat, 31 Oct 2020 09:03:33 +0000 (12:03 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Nov 2020 08:12:57 +0000 (08:12 +0000)
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 <mpershin@whamcloud.com>
Change-Id: I1424bf57c88f69d054c1646be66e10dd7fde8a1a
Reviewed-on: https://review.whamcloud.com/40502
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanity.sh

index 7b7f513..01229b1 100755 (executable)
@@ -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) ]] &&