Whamcloud - gitweb
LU-4016 tests: use user and group names in metadata-updates 52/8052/3
authorJames Nunez <james.a.nunez@intel.com>
Thu, 31 Oct 2013 19:43:25 +0000 (13:43 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 5 Nov 2013 18:48:47 +0000 (18:48 +0000)
pdsh eats %u passed to stat executed on remote nodes.  Avoid this
problem by using the user and group names instead of numerical
identifiers in metadata-updates ownership checks.

Test-Parameters: testlist=metadata-updates
Signed-off-by: James Nunez <james.a.nunez@intel.com>
Signed-off-by: Stephen Champion <schamp@sgi.com>
Change-Id: Id0a283d58873bb64772f28cbc28c5a6abad9a48e
Reviewed-on: http://review.whamcloud.com/8052
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/metadata-updates.sh

index 41a1849..cad4473 100755 (executable)
@@ -32,8 +32,8 @@ NEW_MODE=0222
 NEW_ATIME="2001-01-01 GMT"
 NEW_MTIME="2005-05-05 GMT"
 
-test_UID=$(id -u)
-test_GID=$(id -g)
+test_USER=$(id -u -n)
+test_GROUP=$(id -g -n)
 
 SUMFILE=$TESTDIR/mdsum
 
@@ -99,21 +99,21 @@ $TRUNCATE \\\$TESTFILE 0" || return ${PIPESTATUS[0]}
 
 # check st_uid, st_gid, st_size, st_mode
 get_stat () {
-    local attr="$test_UID $test_GID $FILE_SIZE $CURRENT_MODE"
+       local attr="$test_USER $test_GROUP $FILE_SIZE $CURRENT_MODE"
 
-    echo "Checking file(s) attributes ... "
+       echo "Checking file(s) attributes ... "
 
     do_nodesv $NODES_TO_USE "set $TRACE;
 for HOST in ${HOSTS//,/ } ; do
     TESTFILE=$TESTDIR/\\\$HOST/$FILE;
-    tmp=\\\$(stat -c \\\"%u %g %s 0%a\\\" \\\$TESTFILE);
+    tmp=\\\$(stat -c \\\"%U %G %s 0%a\\\" \\\$TESTFILE);
     echo \\\"\\\$TESTFILE [ uid gid size mode ] expected : $attr ;  got : \\\$tmp \\\";
     if [ x\\\"\\\$tmp\\\" != x\\\"$attr\\\" ] ; then
         echo \\\"Wrong file attributes\\\";
         exit 56;
     fi;
 done " || return ${PIPESTATUS[0]}
-    return 0 
+       return 0
 }
 
 do_chmod () {