From 847f01442b20cbe7132a1533e493e06975b48bdc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 14 Feb 2007 09:44:42 -0500 Subject: [svn-r13299] Description: Put paths to testfile input & output directories in one place, making it easier to modify them if we choose to re-arrange our testfile locations in the future (this should probably be carried over to other test scripts). Make h5copy exit more cleanly if no command line parameters are given. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) --- tools/h5copy/h5copy.c | 6 ++++++ tools/h5copy/testh5copy.sh | 22 ++++++++++++---------- tools/misc/testh5mkgrp.sh | 12 +++++++----- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index 926be0f..cbbb738 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -183,6 +183,12 @@ main (int argc, const char *argv[]) /* initialize h5tools lib */ h5tools_init(); + /* Check for no command line parameters */ + if(argc == 1) { + usage(); + leave(EXIT_SUCCESS); + } /* end if */ + /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index 4106fe0..b8fbb79 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -31,6 +31,8 @@ nerrors=0 verbose=yes SRCFILE=h5copytst.h5 +INDIR=$srcdir/../testfiles +OUTDIR=../testfiles CMP='cmp -s' DIFF='diff -c' @@ -38,7 +40,7 @@ DIFF='diff -c' if test -z "$srcdir"; then srcdir=. fi -test -d ../testfiles || mkdir ../testfiles +test -d $OUTDIR || mkdir $OUTDIR # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". @@ -135,8 +137,8 @@ H5DIFFTEST() # H5LSTEST() { - expect="$srcdir/../testfiles/`basename $1 .h5`.ls" - actual="../testfiles/`basename $1 .h5`.out" + expect="$INDIR/`basename $1 .h5`.ls" + actual="$OUTDIR/`basename $1 .h5`.out" # Stderr is included in stdout so that the diff can detect # any unexpected output from that stream too. @@ -172,8 +174,8 @@ H5LSTEST() # $3 is group within destination file COPYOBJECTS() { - TESTFILE=$srcdir/../testfiles/$SRCFILE - FILEOUT="../testfiles/`basename $SRCFILE .h5`.$1.out.h5" + TESTFILE="$INDIR/$SRCFILE" + FILEOUT="$OUTDIR/`basename $SRCFILE .h5`.$1.out.h5" # Remove any output file left over from previous test run rm -f $FILEOUT @@ -202,7 +204,7 @@ COPYOBJECTS() # Remove output file created, if the "no cleanup" environment variable is # not defined - if [ x$HDF5_NOCLEANUP = "x" ]; then + if test -z "$HDF5_NOCLEANUP"; then rm -f $FILEOUT fi } @@ -211,12 +213,12 @@ COPYOBJECTS() ### T H E T E S T S ### ############################################################################## -# Copy objects from root group of source file to root of destination file -# (with implicit root group paths) +echo "Copy objects from root group of source file to root of destination file" +echo "(with implicit root group paths)" COPYOBJECTS a "" "" -# Copy objects from root group of source file to root of destination file -# (with explicit root group paths) +echo "Copy objects from root group of source file to root of destination file" +echo "(with explicit root group paths)" COPYOBJECTS b "/" "/" diff --git a/tools/misc/testh5mkgrp.sh b/tools/misc/testh5mkgrp.sh index e4912bb..b90c288 100644 --- a/tools/misc/testh5mkgrp.sh +++ b/tools/misc/testh5mkgrp.sh @@ -28,6 +28,8 @@ H5LS_BIN=`pwd`/../h5ls/$H5LS # The path of the h5ls tool binary nerrors=0 verbose=yes +INDIR=$srcdir/../testfiles +OUTDIR=../testfiles CMP='cmp -s' DIFF='diff -c' @@ -35,7 +37,7 @@ DIFF='diff -c' if test -z "$srcdir"; then srcdir=. fi -test -d ../testfiles || mkdir ../testfiles +test -d $OUTDIR || mkdir $OUTDIR # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". @@ -84,8 +86,8 @@ TOOLTEST() # H5LSTEST() { - expect="$srcdir/../testfiles/`basename $1 .h5`.ls" - actual="../testfiles/`basename $1 .h5`.out" + expect="$INDIR/`basename $1 .h5`.ls" + actual="$OUTDIR/`basename $1 .h5`.out" # Stderr is included in stdout so that the diff can detect # any unexpected output from that stream too. @@ -120,7 +122,7 @@ H5LSTEST() # $* are groups to create RUNTEST() { - FILEOUT=../testfiles/$1 + FILEOUT=$OUTDIR/$1 shift H5MKGRP_ARGS=$1 shift @@ -136,7 +138,7 @@ RUNTEST() # Remove output file created, if the "no cleanup" environment variable is # not defined - if [ x$HDF5_NOCLEANUP = "x" ]; then + if test -z "$HDF5_NOCLEANUP"; then rm -f $FILEOUT fi } -- cgit v0.12