Whamcloud - gitweb
LU-16904 test: Add sanity-compr.sh to run sanity and sanityn with PFL layout 71/51371/6
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 20 Jun 2023 18:57:56 +0000 (12:57 -0600)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Jul 2023 03:07:49 +0000 (03:07 +0000)
Add sanity-compr.sh to run sanity and sanityn with PFL layout
Also fix sanity subtests problem of 56ba,57b,65e,65g,65n,204e

Test-Parameters: trivial testlist=sanity-compr

Signed-off-by: Wei Liu <sarah@whamcloud.com>
Change-Id: Iefdc7757697629eb5c57d7694456249d62a2049e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51371
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/Makefile.am
lustre/tests/sanity-compr.sh [new file with mode: 0644]
lustre/tests/sanity.sh

index 83229ab..20e2559 100644 (file)
@@ -16,7 +16,7 @@ noinst_DATA += zfs_ost1_2_11.tar.bz2 zfs_ost2_2_11.tar.bz2
 noinst_SCRIPTS = leak_finder.pl llmount.sh llmountcleanup.sh functions.sh
 noinst_SCRIPTS += test-framework.sh runvmstat runiozone runtests sanity.sh
 noinst_SCRIPTS += rundbench acceptance-small.sh compile.sh conf-sanity.sh
-noinst_SCRIPTS += insanity.sh oos.sh oos2.sh dne_sanity.sh
+noinst_SCRIPTS += insanity.sh oos.sh oos2.sh dne_sanity.sh sanity-compr.sh
 noinst_SCRIPTS += recovery-small.sh replay-dual.sh sanity-quota.sh
 noinst_SCRIPTS += replay-ost-single.sh replay-single.sh run-llog.sh sanityn.sh
 noinst_SCRIPTS += large-scale.sh racer.sh replay-vbr.sh
diff --git a/lustre/tests/sanity-compr.sh b/lustre/tests/sanity-compr.sh
new file mode 100644 (file)
index 0000000..4164df4
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/bash
+#
+# Run select tests by setting ONLY, or as arguments to the script.
+# Skip specific tests by setting EXCEPT.
+#
+
+set -e
+
+ONLY=${ONLY:-"$*"}
+
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
+. $LUSTRE/tests/test-framework.sh
+init_test_env "$@"
+init_logging
+
+# bug number for skipped test:
+ALWAYS_EXCEPT="$SANITY_COMPR_EXCEPT"
+
+build_test_filter
+
+FAIL_ON_ERROR=false
+
+check_and_setup_lustre
+
+# $RUNAS_ID may get set incorrectly somewhere else
+if [[ $UID -eq 0 && $RUNAS_ID -eq 0 ]]; then
+       skip_env "\$RUNAS_ID set to 0, but \$UID is also 0!" && exit
+fi
+check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
+
+save_layout_restore_at_exit $MOUNT
+# Set file system with different layout
+COMPR_EXTRA_LAYOUT=${COMPR_EXTRA_LAYOUT:-"-E EOF -c 1"}
+$LFS setstripe $COMPR_EXTRA_LAYOUT $MOUNT
+
+test_sanity()
+{
+       always_except LU-16928 56wb
+       local rc=0
+
+       SANITY_EXCEPT=$ALWAYS_EXCEPT bash sanity.sh
+       rc=$?
+       return $rc
+}
+run_test sanity "Run sanity with PFL layout"
+
+test_sanityn()
+{
+       local rc=0
+
+       bash sanityn.sh
+       rc=$?
+       return $rc
+}
+run_test sanityn "Run sanityn with PFL layout"
+
+complete_test $SECONDS
+check_and_cleanup_lustre
+declare -a logs=($ONLY)
+logs=("${logs[@]/#/$TMP/}")
+exit_status "$(echo "${logs[@]/%/.log}")"
index f76a5fa..53f14f1 100755 (executable)
@@ -8510,8 +8510,8 @@ test_56ba() {
        setup_56 $dir/1Mfiles 5 1 "-S 1M --component-end 1M"
        # Create composite files with three components
        setup_56 $dir/2Mfiles 5 2 "-E 2M -S 1M -E 4M -E 6M"
-       # Create non-composite files
-       createmany -o $dir/${tfile}- 10
+       # LU-16904 Create plain layout files
+       lfs setstripe -c 1 $dir/$tfile-{1..10}
 
        local nfiles=$($LFS find --component-end 1M --type f $dir | wc -l)
 
@@ -8874,8 +8874,10 @@ test_57b() {
        done
 
        # verify that files have EAs now
-       $LFS getstripe $file1 | grep -q "obdidx" || error "$file1 missing EA"
-       $LFS getstripe $fileN | grep -q "obdidx" || error "$fileN missing EA"
+       $LFS getstripe -y $file1 | grep -q "l_ost_idx" ||
+               error "$file1 missing EA"
+       $LFS getstripe -y $fileN | grep -q "l_ost_idx" ||
+               error "$fileN missing EA"
 
        sleep 1  #make sure we get new statfs data
        df $dir
@@ -9764,6 +9766,10 @@ run_test 65d "directory setstripe -S stripe_size -c stripe_count"
 test_65e() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run"
 
+       # LU-16904 delete layout when root is set as PFL layout
+       save_layout_restore_at_exit $MOUNT
+       $LFS setstripe -d $MOUNT || error "setstripe failed"
+
        test_mkdir $DIR/$tdir
 
        $LFS setstripe $DIR/$tdir || error "setstripe"
@@ -9786,6 +9792,10 @@ run_test 65f "dir setstripe permission (should return error) ==="
 test_65g() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run"
 
+       # LU-16904 delete layout when root is set as PFL layout
+       save_layout_restore_at_exit $MOUNT
+       $LFS setstripe -d $MOUNT || error "setstripe failed"
+
        test_mkdir $DIR/$tdir
        local STRIPESIZE=$($LFS getstripe -S $DIR/$tdir)
 
@@ -9955,10 +9965,15 @@ test_65n() {
 
        # new subdirectory under root directory should not inherit
        # the default layout from root
-       local dir1=$MOUNT/$tdir-1
-       mkdir $dir1 || error "mkdir $dir1 failed"
-       ! getfattr -n trusted.lov $dir1 &> /dev/null ||
-               error "$dir1 shouldn't have LOV EA"
+       # LU-16904 check if the root is set as PFL layout
+       local numcomp=$($LFS getstripe --component-count $MOUNT)
+
+       if [[ $numcomp -eq 0 ]]; then
+               local dir1=$MOUNT/$tdir-1
+               mkdir $dir1 || error "mkdir $dir1 failed"
+               ! getfattr -n trusted.lov $dir1 &> /dev/null ||
+                       error "$dir1 shouldn't have LOV EA"
+       fi
 
        # delete the default layout on root directory
        $LFS setstripe -d $MOUNT || error "delete root default layout failed"
@@ -19475,7 +19490,14 @@ test_204e() {
        test_mkdir $DIR/$tdir
        $LFS setstripe -d $DIR/$tdir
 
-       check_default_stripe_attr --stripe-count --raw
+       # LU-16904 check if root is set as PFL layout
+       local numcomp=$($LFS getstripe --component-count $MOUNT)
+
+       if [[ $numcomp -gt 0 ]]; then
+               check_default_stripe_attr --stripe-count
+       else
+               check_default_stripe_attr --stripe-count --raw
+       fi
        check_default_stripe_attr --stripe-size --raw
        check_default_stripe_attr --stripe-index --raw
 }