Whamcloud - gitweb
LU-13709 tests: test lfs mkdir -c without -i 01/40801/3
authorOlaf Faaland <faaland1@llnl.gov>
Thu, 16 Jul 2020 22:50:29 +0000 (15:50 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 4 Mar 2021 08:35:17 +0000 (08:35 +0000)
Almost every test with lfs mkdir -c in the test suite also
uses option -i, so lfs mkdir -c (same as -i -1, where lustre
chooses the MDTs) is poorly tested.  Add a test for that
case, sanity test_300s.

Lustre-change: https://review.whamcloud.com/39457
Lustre-commit: 2c89cc6c25549cb6748c7c9f5a209c7e38387eb4

Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Change-Id: Iede537d52cf445c9c9a6353338670e55a11364da
Reviewed-on: https://review.whamcloud.com/40801
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Gian-Carlo DeFazio <defazio1@llnl.gov>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/sanity.sh

index 71c3454..dd83e11 100755 (executable)
@@ -19416,6 +19416,56 @@ test_300r() {
 }
 run_test 300r "test -1 striped directory"
 
+test_300s_helper() {
+       local count=$1
+
+       local stripe_dir=$DIR/$tdir/striped_dir.$count
+
+       $LFS mkdir -c $count $stripe_dir ||
+               error "lfs mkdir -c error"
+
+       $LFS getdirstripe $stripe_dir ||
+               error "lfs getdirstripe fails"
+
+       local stripe_count
+       stripe_count=$($LFS getdirstripe $stripe_dir |
+                     awk '/lmv_stripe_count:/ { print $2 }')
+
+       [ $count -ne $stripe_count ] &&
+               error_noexit "bad stripe count $stripe_count expected $count"
+
+       local dupe_stripes
+       dupe_stripes=$($LFS getdirstripe $stripe_dir |
+               awk '/0x/ {count[$1] += 1}; END {
+                       for (idx in count) {
+                               if (count[idx]>1) {
+                                       print "index " idx " count " count[idx]
+                               }
+                       }
+               }')
+
+       if [[ -n "$dupe_stripes" ]] ; then
+               lfs getdirstripe $stripe_dir
+               error_noexit "Dupe MDT above: $dupe_stripes "
+       fi
+
+       rm -rf $stripe_dir ||
+               error_noexit "unlink $stripe_dir fails"
+}
+
+test_300s() {
+       [ $MDS1_VERSION -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       mkdir $DIR/$tdir
+       for count in $(seq 2 $MDSCOUNT); do
+               test_300s_helper $count
+       done
+}
+run_test 300s "test lfs mkdir -c without -i"
+
+
 prepare_remote_file() {
        mkdir $DIR/$tdir/src_dir ||
                error "create remote source failed"