From: Kyrylo Shatskyy Date: Wed, 13 Apr 2016 06:29:32 +0000 (+0530) Subject: LU-7130 test: sanity/162 doesn't handle DIR values properly X-Git-Tag: 2.8.53~68 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7151367afdb04562f016c3002f0c614004552ad6 LU-7130 test: sanity/162 doesn't handle DIR values properly The test fails when path values have trailing slash, e.g. DIR=/mnt/lustre/ The patch adds validation which at the moment processes these parameters-DIR, DIR1, DIR2, MOUNT, MOUNT1, MOUNT2. Change-Id: Ief85e8798911cb67b4dafce985a9e4ef56cc26a4 Signed-off-by: Kyrylo Shatskyy Signed-off-by: Parinay Kondekar Seagate-bug-id: MRP-334 Reviewed-on: http://es-gerrit.xyus.xyratex.com:8080/#/c/269 Tested-by: Jenkins Reviewed-by: Andrew Perepechko Reviewed-by: Alexander Lezhoev Tested-by: Alexander Lezhoev Reviewed-by: Vitaly Fertman Reviewed-on: http://review.whamcloud.com/16358 Reviewed-by: James Nunez Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 6c309d1..7a9cb6b 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -54,16 +54,25 @@ fi [ -z "$MODPROBECONF" -a -f /etc/modprobe.conf ] && MODPROBECONF=/etc/modprobe.conf +sanitize_parameters() { + for i in DIR DIR1 DIR2 MOUNT MOUNT1 MOUNT2 + do + local path=${!i} + if [ -d "$path" ]; then + eval export $i=$(echo $path | sed -E 's/\/+$//g') + fi + done +} assert_DIR () { - local failed="" - [[ $DIR/ = $MOUNT/* ]] || \ - { failed=1 && echo "DIR=$DIR not in $MOUNT. Aborting."; } - [[ $DIR1/ = $MOUNT1/* ]] || \ - { failed=1 && echo "DIR1=$DIR1 not in $MOUNT1. Aborting."; } - [[ $DIR2/ = $MOUNT2/* ]] || \ - { failed=1 && echo "DIR2=$DIR2 not in $MOUNT2. Aborting"; } + local failed="" + [[ $DIR/ = $MOUNT/* ]] || + { failed=1 && echo "DIR=$DIR not in $MOUNT. Aborting."; } + [[ $DIR1/ = $MOUNT1/* ]] || + { failed=1 && echo "DIR1=$DIR1 not in $MOUNT1. Aborting."; } + [[ $DIR2/ = $MOUNT2/* ]] || + { failed=1 && echo "DIR2=$DIR2 not in $MOUNT2. Aborting"; } - [ -n "$failed" ] && exit 99 || true + [ -n "$failed" ] && exit 99 || true } usage() { @@ -3975,12 +3984,13 @@ is_empty_fs() { } check_and_setup_lustre() { - nfs_client_mode && return + sanitize_parameters + nfs_client_mode && return cifs_client_mode && return - local MOUNTED=$(mounted_lustre_filesystems) + local MOUNTED=$(mounted_lustre_filesystems) - local do_check=true + local do_check=true # 1. # both MOUNT and MOUNT2 are not mounted if ! is_mounted $MOUNT && ! is_mounted $MOUNT2; then