Whamcloud - gitweb
LU-2188 tests: Fix assumptions in test 133d
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Thu, 1 Nov 2012 17:51:13 +0000 (13:51 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 10 Nov 2012 04:42:46 +0000 (23:42 -0500)
The test assumed that with 512 files in a directory, the inode sizes
would be different in the two test directories.  This is not the case
on zfs which caused the get_rename_size() function to return multiple
values.  This change adds a argument to specify which stat is pulled
from rename_stats, and doesn't rely on the sizes being different.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I568ec95bd7f0613caf96101055a392ea5762cd2d
Reviewed-on: http://review.whamcloud.com/4438
Reviewed-by: wangdi <di.wang@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh

index 7f9a65f..d015a4c 100644 (file)
@@ -1,4 +1,5 @@
 #!/bin/bash
 #!/bin/bash
+# -*- tab-width: 4; indent-tabs-mode: t; -*-
 #
 # Run select tests by setting ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
 #
 # Run select tests by setting ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
@@ -7731,8 +7732,10 @@ size_in_KMGT() {
 
 get_rename_size() {
     local size=$1
 
 get_rename_size() {
     local size=$1
+    local context=${2:-.}
     local sample=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats |
     local sample=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats |
-                   awk '/ '${size}'/ {print $4}' | sed -e "s/,//g")
+               grep -A1 $context |
+               awk '/ '${size}'/ {print $4}' | sed -e "s/,//g")
     echo $sample
 }
 
     echo $sample
 }
 
@@ -7798,8 +7801,8 @@ test_133d() {
 
     eval $cmd || error "$cmd failed"
     local crossdir=$($cmd | grep 'crossdir')
 
     eval $cmd || error "$cmd failed"
     local crossdir=$($cmd | grep 'crossdir')
-    local src_sample=$(get_rename_size $testdir1_size)
-    local tgt_sample=$(get_rename_size $testdir2_size)
+    local src_sample=$(get_rename_size $testdir1_size crossdir_src)
+    local tgt_sample=$(get_rename_size $testdir2_size crossdir_tgt)
     [ -z "$crossdir" ] && error "crossdir_rename_size count error"
     [ "$src_sample" -eq 1 ] || error "crossdir_rename_size error $src_sample"
     [ "$tgt_sample" -eq 1 ] || error "crossdir_rename_size error $tgt_sample"
     [ -z "$crossdir" ] && error "crossdir_rename_size count error"
     [ "$src_sample" -eq 1 ] || error "crossdir_rename_size error $src_sample"
     [ "$tgt_sample" -eq 1 ] || error "crossdir_rename_size error $tgt_sample"