From dcb4810983391165eb17af1a83105b968557f993 Mon Sep 17 00:00:00 2001 From: Henri Doreau Date: Tue, 16 Jul 2013 11:33:16 +0200 Subject: [PATCH] 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 --- lustre/tests/sanity.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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}") -- 1.8.3.1