From 48c78f609fb3dd8f20f8a49a22a16dbb956b3f04 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 4 Mar 2013 09:25:25 -0500 Subject: [PATCH] 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 --- lustre/tests/lfsck.sh | 2 ++ lustre/tests/test-framework.sh | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) 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() { -- 1.8.3.1