[Ocfs2-test-devel] [PATCH 1/3] fsck-test.sh: Check existence of LOG_DIR and set pipefail.

tristan.ye tristan.ye at oracle.com
Tue Oct 28 20:24:50 PDT 2008


Also looks great to me:)

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>

On Tue, 2008-10-28 at 20:00 -0700, Marcos Matsunaga wrote:
> The script was not testing for the existence of LOG_DIR before creating the
> logfile. It now checks for it and if it does not exist, it will try to create.
> In case of failure, the script will abort.
> 
> Another point was that "| tee -a ${LOGFILE}" is used in many places including
> a diff that determine if the testcase was successful or not. In this case,
> it is being added "set -o pipefail" so that it will carry on if the diff fails
> and not signal a false success.
> 
> Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
> ---
>  programs/fsck-tests/fsck-test.sh |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/programs/fsck-tests/fsck-test.sh b/programs/fsck-tests/fsck-test.sh
> index 12e49af..2edbd7b 100755
> --- a/programs/fsck-tests/fsck-test.sh
> +++ b/programs/fsck-tests/fsck-test.sh
> @@ -495,6 +495,7 @@ function basic_test()
>  #
>  . `dirname ${0}`/config.sh
>  
> +set -o pipefail
>  
>  internal_setup
>  
> @@ -536,6 +537,13 @@ do
>  	shift
>  done
>  
> +if [ ! -d ${LOG_DIR} ]; then
> +	mkdir -p ${LOG_DIR}
> +	if [ $? -ne 0 ]; then
> +		echo -e "Failed to create directory ${LOG_DIR}\n";
> +		exit(1);
> +	fi;
> +fi;
>  LOGFILE=${LOG_DIR}/fsck-test.log
>  if [ -f ${LOGFILE} ]; then
>  	mv ${LOGFILE} `dirname ${LOGFILE}`/`date +%F-%H-%M-%S`-`basename ${LOGFILE}`




More information about the Ocfs2-test-devel mailing list