Whamcloud - gitweb
LU-17777 tests: Exclude Files when comparing dir structure 29/58129/8
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 19 Feb 2025 11:04:37 +0000 (16:34 +0530)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Mar 2025 03:56:26 +0000 (03:56 +0000)
This patch Excludes /etc/yum* and /etc/pki* as corner case
which is updated by RHEL asynchronously breaking the test-case.

Moves search folder from "/etc /bin" to "/etc /usr/bin" as
/bin can be a symlink

Removes arbitrary return code of 18 and 22 with $?. For
diff this should be 1 for mismatch and 2 for files not found

Renames constant error message with unique message when
rebuilding dir structure before and after remount

Test-Parameters: trivial testlist=runtests
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I8f7824b930f6286e7e5744ff403a02cec280075d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58129
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Deiter <adeiter@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/runtests

index 0a0f3ff..e8885eb 100755 (executable)
@@ -7,7 +7,8 @@ LUSTRE=${LUSTRE:-$(dirname $0)/..}
 init_test_env $@
 init_logging
 
-RUNTESTS_SRC=${RUNTESTS_SRC:-"/etc /bin"}
+RUNTESTS_SRC=${RUNTESTS_SRC:-"/etc /usr/bin"}
+RT_SRC_ARR=($RUNTESTS_SRC)
 [ "$COUNT" ] || COUNT=10000
 [ "$SLOW" = "no" ] && COUNT=1000
 
@@ -20,6 +21,11 @@ build_test_filter
 check_and_setup_lustre
 force_new_seq_all
 
+# Files/Folders to exclude when re-building the folder structure.
+# Exclude /etc/yum* and /etc/pki* as corner case which is updated
+# by RHEL asynchronously breaking the test-case.
+EXCLUDE_FL='eval grep -vE "/etc/pki|/etc/yum"'
+
 test_1() {
        sleep 5 # let MDS refresh aggregated statfs
        # Include some extra space for the status file
@@ -80,17 +86,18 @@ test_1() {
        stack_trap "rm -f $findfiles"
        COUNT=$(xargs -0 -n 1 echo < $findfiles | wc -l)
 
-       log "copying $COUNT files from $RUNTESTS_SRC to $dst$RUNTESTS_SRC " \
-           "at $(date)"
+       log "copying $COUNT files from ${RT_SRC_ARR[0]}, ${RT_SRC_ARR[1]} to " \
+       "$dst${RT_SRC_ARR[0]}, $dst${RT_SRC_ARR[1]} at $(date)"
+
        tar cf - --null --files-from $findfiles | \
                tar xvf - -C $dst > /dev/null || error "copying $RUNTESTS_SRC"
 
        log "comparing $COUNT newly copied files at $(date)"
 
-       cat $findfiles | tr "\0" "\n" | ( rc=0; while read -r f; do
-               diff -q "$f" "$dst/$f" || rc=18
+       cat $findfiles | tr "\0" "\n" | $EXCLUDE_FL | ( rc=0; while read -r f; do
+               diff -q "$f" "$dst/$f" || rc=$?
        done
-       [ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" )
+       (( rc == 0 )) || error_exit "Before remount. Files differ: rc=$rc" )
 
        # mkdirmany test (bug 589)
        log "running $MKDIRMANY $dst/d $COUNT"
@@ -100,11 +107,11 @@ test_1() {
        stopall || error "stopall failed"
        setupall || error "setupall failed"
 
-       log "comparing $COUNT previously copied files"
-       cat $findfiles | tr "\0" "\n" | ( rc=0; while read -r f; do
-               diff -q "$f" "$dst/$f" || rc=22
+       log "After first remount. comparing $COUNT previously copied files"
+       cat $findfiles | tr "\0" "\n" | $EXCLUDE_FL | ( rc=0; while read -r f; do
+               diff -q "$f" "$dst/$f" || rc=$?
        done
-       [ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" )
+       (( rc == 0 )) || error_exit "Post remount. Files differ: rc=$rc" )
 
        log "running $STATMANY $dst/d $COUNT $((COUNT * 2))"
        $STATMANY $dst/d $COUNT $((COUNT * 2)) ||
@@ -112,10 +119,11 @@ test_1() {
        echo "usage after creating all files"
        $LFS df
        $LFS df -i
+
        stopall || error "stopall failed (2)"
        setupall || error "setupall failed (2)"
 
-       log "running $RMDIRMANY $dst/d $COUNT"
+       log "After second remount. running $RMDIRMANY $dst/d $COUNT"
        $RMDIRMANY $dst/d $COUNT || error "$RMDIRMANY cleanup failed"
 
        log "removing $dst"