[Ocfs2-test-devel] [PATCH 1/1] Tunefs-test: Improve tunefs-test.sh a little bit.

Marcos E. Matsunaga Marcos.Matsunaga at oracle.com
Mon Mar 8 05:20:06 PST 2010


Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>

Regards,

Marcos Eduardo Matsunaga

Oracle USA
Linux Engineering

“The statements and opinions expressed here are my own and do not
necessarily represent those of Oracle Corporation.”


On 03/08/2010 06:04 AM, Tristan Ye wrote:
> Currently, we'll definitely fail at check_executes() using
>  default tools binaries(without specifying PROGRAMs).
>
> This patch tries to check tools binary in path instead of a full
> executing command(like '/usr/bin/sudo -u root /sbin/mkfs.ocfs),
> some trivial changes for improvement also included.
>
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> ---
>  programs/tunefs-test/tunefs-test.sh |   36 +++++++++++++++++++++++-----------
>  1 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/programs/tunefs-test/tunefs-test.sh b/programs/tunefs-test/tunefs-test.sh
> index 19acdb1..f198601 100755
> --- a/programs/tunefs-test/tunefs-test.sh
> +++ b/programs/tunefs-test/tunefs-test.sh
> @@ -25,13 +25,16 @@
>  
>  . `dirname ${0}`/config.sh
>  
> -MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
> -FSCK_BIN="`which sudo` -u root `which fsck.ocfs2`"
> -DEBUGFS_BIN="`which sudo` -u root `which debugfs.ocfs2`"
> -TUNEFS_BIN="`which sudo` -u root `which tunefs.ocfs2`"
> -MOUNTED_BIN="`which sudo` -u root `which mounted.ocfs2`"
> -MOUNT_BIN="`which sudo` -u root `which mount.ocfs2`"
> -UMOUNT_BIN="`which sudo` -u root `which umount`"
> +MKFS_PATH=`which mkfs.ocfs2`
> +FSCK_PATH=`which fsck.ocfs2`
> +DEBUGFS_PATH=`which debugfs.ocfs2`
> +TUNEFS_PATH=`which tunefs.ocfs2`
> +MOUNTED_PATH=`which mounted.ocfs2`
> +MOUNT_PATH=`which mount.ocfs2`
> +UMOUNT_PATH=`which umount`
> +
> +MOUNT_BIN="`which sudo` -u root ${MOUNT_PATH}"
> +UMOUNT_BIN="`which sudo` -u root ${UMOUNT_PATH}"
>  TEE_BIN=`which tee`
>  MKDIR_BIN=`which mkdir`
>  RM_BIN=`which rm`
> @@ -95,7 +98,7 @@ EOF
>  function check_executes()
>  {
>  	LogMsg "checking the programs we need in the test...";
> -	for PROGRAM in ${MKFS_BIN} ${FSCK_BIN} ${DEBUGFS_BIN} ${TUNEFS_BIN} $MOUNTED_BIN
> +	for PROGRAM in ${MKFS_PATH} ${FSCK_PATH} ${DEBUGFS_PATH} ${TUNEFS_PATH} ${MOUNTED_PATH} ${MOUNT_PATH} ${UMOUNT_PATH}
>  	do
>  		which ${PROGRAM} 2>&1 >> ${LOGFILE}
>  		if [ "$?" != "0" ]; then
> @@ -680,16 +683,19 @@ do
>  		LOG_DIR="${1#--log-dir=}"
>  		;;
>  	"--with-fsck="*)
> -		FSCK_BIN="${1#--with-fsck=}"
> +		FSCK_PATH="${1#--with-fsck=}"
>  		;;
>  	"--with-mkfs="*)
> -		MKFS_BIN="${1#--with-mkfs=}"
> +		MKFS_PATH="${1#--with-mkfs=}"
>  		;;
>  	"--with-debugfs="*)
> -		DEBUGFS_BIN="${1#--with-debugfs=}"
> +		DEBUGFS_PATH="${1#--with-debugfs=}"
>  		;;
>  	"--with-tunefs="*)
> -		TUNEFS_BIN="${1#--with-tunefs=}"
> +		TUNEFS_PATH="${1#--with-tunefs=}"
> +		;;
> +	"--with-mounted="*)
> +		MOUNTED_PATH="${1#--with-mounted=}"
>  		;;
>  	*)
>  		DEVICE="$1"
> @@ -698,6 +704,12 @@ do
>  	shift
>  done
>  
> +MKFS_BIN="`which sudo` -u root ${MKFS_PATH}"
> +FSCK_BIN="`which sudo` -u root ${FSCK_PATH}"
> +DEBUGFS_BIN="`which sudo` -u root ${DEBUGFS_PATH}"
> +TUNEFS_BIN="`which sudo` -u root ${TUNEFS_PATH}"
> +MOUNTED_BIN="`which sudo` -u root ${MOUNTED_PATH}"
> +
>  MKFSLOG=${LOG_DIR}/$$_mkfs.log
>  FSCKLOG=${LOG_DIR}/$$_fsck.log
>  TUNEFSLOG=${LOG_DIR}/$$_tunefs.log
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-test-devel/attachments/20100308/fe7beeb4/attachment.html 


More information about the Ocfs2-test-devel mailing list