From: Feng Lei Date: Thu, 20 Feb 2025 02:21:44 +0000 (+0800) Subject: LU-17679 tests: enable sanity/851 X-Git-Tag: 2.16.56~49 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=58acb22072a917cbc16cccffae1de5e3f2962d52;p=fs%2Flustre-release.git LU-17679 tests: enable sanity/851 Print start message in monitor_lustrefs just before it is ready to read events. In test script, wait for the start message to confirm that monitor_lustrefs process is scheduled and executed. In test script, assign monitor_lustrefs process a higher priority. Test-Parameters: trivial Test-Parameters: testlist=sanity env="ONLY=851,ONLY_REPEAT=1000" Signed-off-by: Lei Feng Change-Id: Ibc5dd2450e7a8b795dba355118ea4a95f4cd52af Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58141 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/monitor_lustrefs.c b/lustre/tests/monitor_lustrefs.c index 2ab0db8..0886e4a 100644 --- a/lustre/tests/monitor_lustrefs.c +++ b/lustre/tests/monitor_lustrefs.c @@ -138,12 +138,14 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + printf("Started...\n"); + fflush(stdout); + while (1) { len = read(fd, (void *)&buf[0], sizeof(buf)); if (len < 0 && errno != EAGAIN) { fprintf(stderr, - "failed to read from fanotify file descriptor." - " %d:%s", + "failed to read from fanotify file descriptor. %d:%s\n", errno, strerror(errno)); exit(EXIT_FAILURE); } @@ -154,8 +156,7 @@ int main(int argc, char *argv[]) while (FAN_EVENT_OK(metadata, len)) { /* Check run-time and compile-time structures match */ if (metadata->vers != FANOTIFY_METADATA_VERSION) { - fprintf(stderr, "Mismatch of fanotify " - "metadata version.\n"); + fprintf(stderr, "Mismatch of fanotify metadata version.\n"); exit(EXIT_FAILURE); } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 6a2e277..d62afb5 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -42,7 +42,6 @@ always_except LU-6493 42b always_except LU-16515 118c 118d always_except LU-8411 407 always_except LU-18032 119i -always_except LU-17679 851 if $SHARED_KEY; then always_except LU-14181 64e 64f @@ -34693,23 +34692,31 @@ test_851() { local report=/tmp/report_test_851_$$ local fanotify_prog=monitor_lustrefs local pid + local i test_mkdir $dir || error "failed to create dir $dir" - stdbuf -o0 $fanotify_prog $DIR > $report & - pid=$! - - sleep 1 - if ! kill -0 $pid; then - error "failed to start $fanoify_prog" - fi - + nice -n -10 $fanotify_prog $DIR > $report & pid=$! + kill -0 $pid || error "failed to run $fanotify_prog" + ps -q $pid -eo pid,ni,comm stack_trap "kill $pid" stack_trap "rm -f $report" + for i in {1..30}; do + if grep Started $report; then + break + else + echo "$fanotify_prog did not start working, wait 1 second for $i times..." + sleep 1 + fi + done + ((i == 30)) && error "$fanotify_prog did not start working in 30 seconds" + + > $report + echo "1234567890" > $file - wait_update_cond localhost "stat -c %s $report" "-gt" "0" 60 || - error "fanotify did not report anything after 60 seconds" + wait_update_cond localhost "stat -c %s $report" "-gt" "0" 30 || + error "fanotify did not report anything after 30 seconds when file is created" grep -a -E "open.*:$file:" $report || error "no open event for writing $file" grep -a -E "write.*:$file:" $report || @@ -34719,8 +34726,8 @@ test_851() { > $report cat $file - wait_update_cond localhost "stat -c %s $report" "-gt" "0" 60 || - error "fanotify did not report anything after 60 seconds" + wait_update_cond localhost "stat -c %s $report" "-gt" "0" 30 || + error "fanotify did not report anything after 30 seconds when file is read" grep -a -E "open.*:$file:" $report || error "no open event for reading $file" grep -a -E "read.*:$file:" $report ||