From: Niu Yawei Date: Mon, 4 Mar 2013 14:25:25 +0000 (-0500) Subject: LU-2694 test: fix is_empty_fs in t-f X-Git-Tag: 2.3.63~84 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=48c78f609fb3dd8f20f8a49a22a16dbb956b3f04;p=fs%2Flustre-release.git LU-2694 test: fix is_empty_fs in t-f The original is_empty_fs is incorrect, which can cause unexpected error when running lfsck.sh, because lfsck sets the max error level based on whether filesystem is empty. Test-Parameters: testlist=lfsck Signed-off-by: Niu Yawei Change-Id: I2269cc41744e3c9fe228898323a1508a03616efe Reviewed-on: http://review.whamcloud.com/5576 Reviewed-by: Emoly Liu Tested-by: Hudson Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/lfsck.sh b/lustre/tests/lfsck.sh index 53ec4ff..8d2ad27 100644 --- a/lustre/tests/lfsck.sh +++ b/lustre/tests/lfsck.sh @@ -265,8 +265,10 @@ fi generate_db # remount filesystem +ORIG_REFORMAT=$REFORMAT REFORMAT="" check_and_setup_lustre +REFORMAT=$ORIG_REFORMAT # run lfsck rc=0 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index c7e03d0..e21f50d 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -3353,17 +3353,17 @@ is_mounted () { } is_empty_dir() { - [ $(find $1 -maxdepth 1 -print | wc -l) = 1 ] && return 0 - return 1 + [ $(find $1 -maxdepth 1 -print | wc -l) = 1 ] && return 0 + return 1 } # empty lustre filesystem may have empty directories lost+found and .lustre is_empty_fs() { - [ $(find $1 -maxdepth 1 -name lost+found -o -name .lustre -prune -o \ - -print | wc -l) = 1 ] || return 1 - [ ! -d $1/lost+found ] || is_empty_dir $1/lost+found && return 0 - [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre && return 0 - return 1 + [ $(find $1 -maxdepth 1 -name lost+found -o -name .lustre -prune -o \ + -print | wc -l) = 1 ] || return 1 + [ ! -d $1/lost+found ] || is_empty_dir $1/lost+found || return 1 + [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre || return 1 + return 0 } check_and_setup_lustre() {