From: Henri Doreau Date: Tue, 16 Jul 2013 09:33:16 +0000 (+0200) Subject: LU-3589 tests: Access changelog record FIDs by name. X-Git-Tag: 2.4.53~22 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=dcb4810983391165eb17af1a83105b968557f993 LU-3589 tests: Access changelog record FIDs by name. Update sanity test_160 to make it parse changelog records in a more robust way. Access target and parent FIDs by name instead of relying on their position on the line. Signed-off-by: Henri Doreau Change-Id: Ib5836a8e624f04a971b80f9ff9b9e978bbff7bee Reviewed-on: http://review.whamcloud.com/6998 Tested-by: Hudson Reviewed-by: Jian Yu Reviewed-by: James Nunez Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 55bd93a..eae0af9 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9203,6 +9203,17 @@ changelog_chmask() fi } +changelog_extract_field() { + local mdt=$1 + local cltype=$2 + local file=$3 + local identifier=$4 + + $LFS changelog $mdt | gawk "/$cltype.*$file$/ { + print gensub(/^.* "$identifier'(\[[^\]]*\]).*$/,"\\1",1)}' | + tail -1 +} + test_160() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return remote_mds_nodsh && skip "remote MDS with nodsh" && return @@ -9248,14 +9259,14 @@ test_160() { # verify contents echo "verifying target fid" - fidc=$($LFS changelog $MDT0|awk '/CREAT.*timestamp$/{print $6}'|tail -1) + fidc=$(changelog_extract_field $MDT0 "CREAT" "timestamp" "t=") fidf=$($LFS path2fid $DIR/$tdir/pics/zach/timestamp) - [ "$fidc" == "t=$fidf" ] || + [ "$fidc" == "$fidf" ] || err17935 "fid in changelog $fidc != file fid $fidf" echo "verifying parent fid" - fidc=$($LFS changelog $MDT0|awk '/CREAT.*timestamp$/{print $7}'|tail -1) + fidc=$(changelog_extract_field $MDT0 "CREAT" "timestamp" "p=") fidf=$($LFS path2fid $DIR/$tdir/pics/zach) - [ "$fidc" == "p=$fidf" ] || + [ "$fidc" == "$fidf" ] || err17935 "pfid in changelog $fidc != dir fid $fidf" USER_REC1=$($GET_CL_USERS | awk "\$1 == \"$USER\" {print \$2}")