From a51eed486121f5fd96735afc0542eec234df1784 Mon Sep 17 00:00:00 2001 From: yury <yury> Date: Sun, 13 Mar 2005 11:30:13 +0000 Subject: [PATCH] - more checks and verbosity in test_16 of conf-sanity.sh to see what happens when it does not pass. --- lustre/tests/conf-sanity.sh | 43 +++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 586e87003e..88514cadf0 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -613,6 +613,12 @@ test_15() { } run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)" +is_digit() { + local value=$1 + echo $value | grep -q "^[[:digit:]]*$" + return $? +} + test_16() { TMPMTPT="/mnt/conf16" @@ -645,24 +651,49 @@ test_16() { EXPECTEDLOGSMODE=`debugfs -R "stat LOGS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'` EXPECTEDPENDINGMODE=`debugfs -R "stat PENDING" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'` - if [ $EXPECTEDOBJECTSMODE = "0777" ]; then - echo "Success:Lustre change the mode of OBJECTS correctly" + # check if values are empty + test "$EXPECTEDOBJECTSMODE" = "x" && EXPECTEDOBJECTSMODE="<empty>" + test "$EXPECTEDLOGSMODE" = "x" && EXPECTEDLOGSMODE="<empty>" + test "$EXPECTEDPENDINGMODE" = "x" && EXPECTEDPENDINGMODE="<empty>" + + # check if values are valid digits + is_digit $EXPECTEDOBJECTSMODE || { + echo "Invalid OBJECTS mode obtained from debugfs: $EXPECTEDOBJECTSMODE" + return 42 + } + + is_digit $EXPECTEDLOGSMODE || { + echo "Invalid LOGS mode obtained from debugfs: $EXPECTEDLOGSMODE" + return 42 + } + + is_digit $EXPECTEDPENDINGMODE || { + echo "Invalid PINDING mode obtained from debugfs: $EXPECTEDPENDINGMODE" + return 42 + } + + # check if values are those we expected + if [ "x$EXPECTEDOBJECTSMODE" = "x0777" ]; then + echo "Success: Lustre change the mode of OBJECTS correctly" else echo "Error: Lustre does not change the mode of OBJECTS properly" + echo "Expected value: 0777, actual one: $EXPECTEDOBJECTSMODE" return 1 fi - if [ $EXPECTEDLOGSMODE = "0777" ]; then - echo "Success:Lustre change the mode of LOGS correctly" + if [ "x$EXPECTEDLOGSMODE" = "x0777" ]; then + echo "Success: Lustre change the mode of LOGS correctly" else echo "Error: Lustre does not change the mode of LOGS properly" + echo "Expected value: 0777, actual one: $EXPECTEDLOGSMODE" return 1 fi - if [ $EXPECTEDPENDINGMODE = "0777" ]; then - echo "Success:Lustre change the mode of PENDING correctly" + if [ "x$EXPECTEDPENDINGMODE" = "x0777" ]; then + echo "Success: Lustre change the mode of PENDING correctly" else echo "Error: Lustre does not change the mode of PENDING properly" + echo "Expected value: 0777, actual one: $EXPECTEDPENDINGMODE" return 1 fi } -- GitLab