From b468a3f4da3232d17040972e33f55a2647273131 Mon Sep 17 00:00:00 2001 From: James Nunez Date: Thu, 3 Aug 2017 13:47:27 -0600 Subject: [PATCH] LU-8998 test: Test 'lfs find' composite file options The Progressive File Layout feature expanded the options to find files using the 'lfs find' utility. Files can be searched for with the component start, end, count and flags options. These 'lfs find' options need to be exercised. Test-Parameters: trivial Signed-off-by: James Nunez Change-Id: I36a6e774fa77b4089642ff5f2f8d482b3196aa62 Reviewed-on: https://review.whamcloud.com/26926 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Steve Guminski --- lustre/tests/sanity.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 881a3d7..c9101d4 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5366,6 +5366,68 @@ test_56aa() { # LU-5937 } run_test 56aa "lfs find --size under striped dir" +test_56ba() { + # Create composite files with one component + TDIR=$DIR/$tdir/1Mfiles + setup_56 5 1 "--component-end 1M" + # Create composite files with three components + TDIR=$DIR/$tdir/2Mfiles + setup_56 5 2 "-E 2M -E 4M -E 6M" + TDIR=$DIR/$tdir + # Create non-composite files + createmany -o $TDIR/${tfile}- 10 + + local nfiles=$($LFIND --component-end 1M --type f $TDIR | wc -l) + [[ $nfiles == 10 ]] || + error "lfs find -E 1M found $nfiles != 10 files" + + nfiles=$($LFIND ! -E 1M --type f $TDIR | wc -l) + [[ $nfiles == 25 ]] || + error "lfs find ! -E 1M found $nfiles != 25 files" + + # All files have a component that starts at 0 + local nfiles=$($LFIND --component-start 0 --type f $TDIR | wc -l) + [[ $nfiles == 35 ]] || + error "lfs find --component-start 0 found $nfiles != 35 files" + + nfiles=$($LFIND --component-start 2M --type f $TDIR | wc -l) + [[ $nfiles == 15 ]] || + error "$LFIND --component-start 2M found $nfiles != 15 files" + + # All files created here have a componenet that does not starts at 2M + nfiles=$($LFIND ! --component-start 2M --type f $TDIR | wc -l) + [[ $nfiles == 35 ]] || + error "$LFIND ! --component-start 2M found $nfiles != 35 files" + + # Find files with a specified number of components + local nfiles=$($LFIND --component-count 3 --type f $TDIR | wc -l) + [[ $nfiles == 15 ]] || + error "lfs find --component-count 3 found $nfiles != 15 files" + + # Remember non-composite files have a component count of zero + local nfiles=$($LFIND --component-count 0 --type f $TDIR | wc -l) + [[ $nfiles == 10 ]] || + error "lfs find --component-count 0 found $nfiles != 10 files" + + nfiles=$($LFIND ! --component-count 3 --type f $TDIR | wc -l) + [[ $nfiles == 20 ]] || + error "$LFIND ! --component-count 3 found $nfiles != 20 files" + + # All files have a flag called "init" + local nfiles=$($LFIND --component-flags init --type f $TDIR | wc -l) + [[ $nfiles == 35 ]] || + error "$LFIND --component-flags init found $nfiles != 35 files" + + # Multi-component files will have a component not initialized + local nfiles=$($LFIND ! --component-flags init --type f $TDIR | wc -l) + [[ $nfiles == 15 ]] || + error "$LFIND !--component-flags init found $nfiles != 15 files" + + rm -rf $TDIR + +} +run_test 56ba "test lfs find --component-end, -start, -count, and -flags" + test_57a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return # note test will not do anything if MDS is not local -- 1.8.3.1