Whamcloud - gitweb
LU-9968 tests: correct stripe index sanity 300g
[fs/lustre-release.git] / lustre / tests / sanity.sh
index a2a82bc..c80bdab 100755 (executable)
@@ -1712,10 +1712,10 @@ test_27w() { # bug 10997
        $LFS setstripe -S 65536 $DIR/$tdir/f0 || error "setstripe failed"
        [ $($LFS getstripe -S $DIR/$tdir/f0) -ne 65536 ] &&
                error "stripe size $size != 65536" || true
-       [ $($LFS getstripe -d $DIR/$tdir | grep -c "stripe_count") -ne 1 ] &&
-               error "$LFS getstripe -d $DIR/$tdir failed" || true
+       [ $($LFS getstripe -d $DIR/$tdir | grep -c "stripe_count") -eq 0 ] &&
+               error "$LFS getstripe -d $DIR/$tdir no 'stripe_count'" || true
 }
-run_test 27w "check $LFS setstripe -S option"
+run_test 27w "check $LFS setstripe -S and getstrip -d options"
 
 test_27wa() {
        [[ $OSTCOUNT -lt 2 ]] &&
@@ -6932,7 +6932,7 @@ setup_test102() {
        done
 
        cd $DIR
-       $1 $TAR cf $TMP/f102.tar $tdir --xattrs
+       $1 tar cf $TMP/f102.tar $tdir --xattrs
 }
 
 cleanup_test102() {
@@ -7091,20 +7091,17 @@ compare_stripe_info1() {
        return 0
 }
 
-find_lustre_tar() {
-       [ -n "$(which tar 2>/dev/null)" ] &&
-               strings $(which tar) | grep -q "lustre" && echo tar
+have_xattrs_include() {
+       tar --help | grep -q xattrs-include &&
+               echo --xattrs-include="lustre.*"
 }
 
 test_102d() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
-       # b10930: tar test for trusted.lov xattr
-       TAR=$(find_lustre_tar)
-       [ -z "$TAR" ] && skip_env "lustre-aware tar is not installed" && return
        [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs" && return
+       XINC=$(have_xattrs_include)
        setup_test102
-       test_mkdir $DIR/$tdir
-       $TAR xf $TMP/$tfile.tar -C $DIR/$tdir --xattrs
+       tar xf $TMP/f102.tar -C $DIR/$tdir --xattrs $XINC
        cd $DIR/$tdir/$tdir
        compare_stripe_info1
 }
@@ -7112,14 +7109,13 @@ run_test 102d "tar restore stripe info from tarfile,not keep osts"
 
 test_102f() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
-       # b10930: tar test for trusted.lov xattr
-       TAR=$(find_lustre_tar)
-       [ -z "$TAR" ] && skip_env "lustre-aware tar is not installed" && return
        [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs" && return
+       XINC=$(have_xattrs_include)
        setup_test102
        test_mkdir $DIR/$tdir.restore
        cd $DIR
-       $TAR cf - --xattrs $tdir | $TAR xf - --xattrs -C $DIR/$tdir.restore
+       tar cf - --xattrs $tdir | tar xf - \
+               -C $DIR/$tdir.restore --xattrs $XINC
        cd $DIR/$tdir.restore/$tdir
        compare_stripe_info1
 }
@@ -7193,13 +7189,11 @@ run_test 102i "lgetxattr test on symbolic link ============"
 
 test_102j() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
-       TAR=$(find_lustre_tar)
-       [ -z "$TAR" ] && skip_env "lustre-aware tar is not installed" && return
        [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs" && return
+       XINC=$(have_xattrs_include)
        setup_test102 "$RUNAS"
-       test_mkdir $DIR/$tdir
        chown $RUNAS_ID $DIR/$tdir
-       $RUNAS $TAR xf $TMP/f102.tar -C $DIR/$tdir --xattrs
+       $RUNAS tar xf $TMP/f102.tar -C $DIR/$tdir --xattrs $XINC
        cd $DIR/$tdir/$tdir
        compare_stripe_info1 "$RUNAS"
 }
@@ -14897,11 +14891,12 @@ test_256() {
 
        #after mount new plainllog is used
        touch $DIR/$tdir/{11..19}
-       local TEMP256FILE=$(mktemp TEMP256XXXXXX)
+       do_facet mds1 sync
+       local TEMP256FILE=$(mktemp -u TEMP256XXXXXX)
        cat_sl=$(do_facet mds1 \
        "$DEBUGFS -R \\\"dump changelog_catalog $TEMP256FILE\\\" $mdt_dev; \
         llog_reader $TEMP256FILE | grep \\\"type=1064553b\\\" | wc -l")
-       rm $TEMP256FILE
+       do_facet mds1 rm $TEMP256FILE
 
        if (( cat_sl != 2 )); then
                do_facet mds1 $LCTL --device $MDT0 changelog_deregister $cl_user
@@ -14910,11 +14905,12 @@ test_256() {
 
        $LFS changelog_clear $MDT0 $cl_user 0
 
-       TEMP256FILE=$(mktemp TEMP256XXXXXX)
+       do_facet mds1 sync
+       TEMP256FILE=$(mktemp -u TEMP256XXXXXX)
        cat_sl=$(do_facet mds1 \
        "$DEBUGFS -R \\\"dump changelog_catalog $TEMP256FILE\\\" $mdt_dev; \
         llog_reader $TEMP256FILE | grep \\\"type=1064553b\\\" | wc -l")
-       rm $TEMP256FILE
+       do_facet mds1 rm $TEMP256FILE
 
        do_facet mds1 $LCTL --device $MDT0 changelog_deregister $cl_user
 
@@ -15315,17 +15311,17 @@ test_300g() {
        $LFS setdirstripe -D -i1 $DIR/$tdir/striped_dir ||
                error "create striped_dir failed"
 
+       $LFS setdirstripe -i0 $DIR/$tdir/striped_dir/dir0 ||
+               error "create dir0 fails"
+       stripe_index=$($LFS getdirstripe -i $DIR/$tdir/striped_dir/dir0)
+       [ $stripe_index -eq 0 ] ||
+               error "dir0 expect index 0 got $stripe_index"
+
        mkdir $DIR/$tdir/striped_dir/dir1 ||
                error "create dir1 fails"
        stripe_index=$($LFS getdirstripe -i $DIR/$tdir/striped_dir/dir1)
        [ $stripe_index -eq 1 ] ||
-               error "dir1 expect 1 got $stripe_index"
-
-       $LFS setdirstripe -i2 $DIR/$tdir/striped_dir/dir2 ||
-               error "create dir2 fails"
-       stripe_index=$($LFS getdirstripe -i $DIR/$tdir/striped_dir/dir2)
-       [ $stripe_index -eq 2 ] ||
-               error "dir2 expect 2 got $stripe_index"
+               error "dir1 expect index 1 got $stripe_index"
 
        #check default stripe count/stripe index
        test_300_check_default_striped_dir normal_dir $MDSCOUNT 1