From 1c54733894f81e854363fbd2d49c141842f73ae4 Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Mon, 11 May 2020 15:36:26 +0800 Subject: [PATCH] LU-10401 tests: add -F so list_param prints entry type In sanity.sh test_133g add "-F" so that the list_param command prints '=' for entries that can be written. Otherwise, the grep will not find any entries to modify and the test does not really work. Also change 113f to use lctl rather than hardcode proc and sysfs paths. Test-Parameters: trivial testlist=sanity Fixes: 83b6c6608e94 ("LU-11644 ptlrpc: show target name in req_history") Signed-off-by: Yang Sheng Change-Id: I3c94bb13f3345161580ef1b7944945b871ea2c60 Reviewed-on: https://review.whamcloud.com/38567 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Wei Liu --- lustre/tests/sanity.sh | 70 ++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 45 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 56cc51d..2106360 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -12903,38 +12903,21 @@ test_133e() { } run_test 133e "Verifying OST {read,write}_bytes nid stats =================" -proc_regexp="/{proc,sys}/{fs,sys,kernel/debug}/{lustre,lnet}/" - -# Some versions of find (4.5.11, 4.5.14) included in CentOS 7.3-7.5 do -# not honor the -ignore_readdir_race option correctly. So we call -# error_ignore() rather than error() in these cases. See LU-11152. -error_133() { - if (find --version; do_facet mds1 find --version) | - grep -q '\b4\.5\.1[1-4]\b'; then - error_ignore LU-11152 "$@" - else - error "$@" - fi -} - test_133f() { - # First without trusting modes. - local proc_dirs=$(eval \ls -d $proc_regexp 2>/dev/null) - echo "proc_dirs='$proc_dirs'" - [ -n "$proc_dirs" ] || error "no proc_dirs on $HOSTNAME" - find $proc_dirs -exec cat '{}' \; &> /dev/null + [[ $(lustre_version_code $facet) -ge $(version_code 2.7.65) ]] || + skip "too old lustre for get_param -R ($facet_ver)" - # Second verifying readability. + # verifying readability. $LCTL get_param -R '*' &> /dev/null # Verifing writability with badarea_io. - find $proc_dirs \ - -ignore_readdir_race \ - -type f \ - -not -name force_lbug \ - -not -name changelog_mask \ - -exec badarea_io '{}' \; || - error_133 "find $proc_dirs failed" + $LCTL list_param -FR '*' | grep '=' | tr -d = | + egrep -v 'force_lbug|changelog_mask' | xargs badarea_io || + error "client badarea_io failed" + + # remount the FS in case writes/reads /proc break the FS + cleanup || error "failed to unmount" + setup || error "failed to setup" } run_test 133f "Check reads/writes of client lustre proc files with bad area io" @@ -12951,10 +12934,10 @@ test_133g() { log "$facet: too old lustre for get_param -R" fi if [ $facet_ver -ge $(version_code 2.5.54) ]; then - do_facet $facet "$LCTL list_param -R '*' | grep '=' | + do_facet $facet "$LCTL list_param -FR '*' | grep '=' | tr -d = | egrep -v 'force_lbug|changelog_mask' | xargs badarea_io" || - error_133 "$facet badarea_io failed" + error "$facet badarea_io failed" else skip_noexit "$facet: too old lustre for get_param -R" fi @@ -12963,7 +12946,6 @@ test_133g() { # remount the FS in case writes/reads /proc break the FS cleanup || error "failed to unmount" setup || error "failed to setup" - true } run_test 133g "Check reads/writes of server lustre proc files with bad area io" @@ -12976,22 +12958,19 @@ test_133h() { local facet for facet in client mds1 ost1; do - local facet_proc_dirs=$(do_facet $facet \ - \\\ls -d $proc_regexp 2> /dev/null) - [ -z "$facet_proc_dirs" ] && error "no proc_dirs on $facet" - echo "${facet}_proc_dirs='$facet_proc_dirs'" # Get the list of files that are missing the terminating newline - local missing=($(do_facet $facet \ - find ${facet_proc_dirs} -type f \| \ - while read F\; do \ - awk -v FS='\v' -v RS='\v\v' \ - "'END { if(NR>0 && \ - \\\$NF !~ /.*\\\n\$/) \ - print FILENAME}'" \ - '\$F'\; \ - done 2>/dev/null)) - [ ${#missing[*]} -eq 0 ] || - error "files do not end with newline: ${missing[*]}" + #local missing=($(do_facet $facet \ + local plist=$(do_facet $facet + $LCTL list_param -FR '*' | grep '=' | tr -d =) + local ent + for ent in $plist; do + local missing=$(do_facet $facet $LCTL get_param $ent \|\ + awk -v FS='\v' -v RS='\v\v' \ + "'END { if(NR>0 && \\\$NF !~ /.*\\\n\$/) \ + print FILENAME}'" 2>/dev/null) + [ -z $missing ] || + error "files do not end with newline: $missing" + done done } run_test 133h "Proc files should end with newlines" @@ -21679,6 +21658,7 @@ test_401a() { #LU-7437 #count the number of parameters by "list_param -R" local params=$($LCTL list_param -R '*' 2>/dev/null | wc -l) #count the number of parameters by listing proc files + local proc_regexp="/{proc,sys}/{fs,sys,kernel/debug}/{lustre,lnet}/" local proc_dirs=$(eval \ls -d $proc_regexp 2>/dev/null) echo "proc_dirs='$proc_dirs'" [ -n "$proc_dirs" ] || error "no proc_dirs on $HOSTNAME" -- 1.8.3.1