summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2010-10-15 00:17:51 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2010-10-15 00:17:51 (GMT)
commit07a4684190f592e8a4d29c0910a5f90374056795 (patch)
treea6168d589dd7eae86d6224e0ed1fa8a62f18e51f /tools
parent6a83768826bbe47264798a5ccd4514b3c605ac1b (diff)
downloadhdf5-07a4684190f592e8a4d29c0910a5f90374056795.zip
hdf5-07a4684190f592e8a4d29c0910a5f90374056795.tar.gz
hdf5-07a4684190f592e8a4d29c0910a5f90374056795.tar.bz2
[svn-r19605] Purpose:
Backout the previous changes (r19598): (Fix for bug# 2040 - h5copy should fail gracefully for expected failure copying to non-exist nested group without -p option.) Description: Some failure occurred on talwit, so backout the changes and will put it back after the fix. (Fixed h5copy to fail gracefully when copying object to non-exist group without -p option. This is expected to be failed. Merged from hdf5 trunk r19598.)
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/h5copy.c23
-rw-r--r--tools/h5copy/testfiles/h5copy_misc1.out5
-rw-r--r--tools/h5copy/testh5copy.sh100
3 files changed, 21 insertions, 107 deletions
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index 595864e..eb16754 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -215,8 +215,6 @@ main (int argc, const char *argv[])
int opt;
int li_ret;
h5tool_link_info_t linkinfo;
- int i, len;
- char *str_prt=NULL;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -408,23 +406,6 @@ main (int argc, const char *argv[])
if(verbose)
printf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
- else /* error, if parent groups doesn't already exist in destination file */
- {
- len = strlen(oname_dst);
- /* check if all the parents groups exist. skip root group */
- for (i = 1; i < len-1; i++)
- {
- if ('/'==oname_dst[i])
- {
- str_prt = strndup(oname_dst, (size_t)i);
- if (H5Lexists(fid_dst, str_prt, H5P_DEFAULT) <= 0)
- {
- error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n");
- goto error;
- }
- }
- }
- }
/*-------------------------------------------------------------------------
* do the copy
@@ -478,8 +459,6 @@ main (int argc, const char *argv[])
free(oname_dst);
if (oname_src)
free(oname_src);
- if (str_prt)
- free(str_prt);
h5tools_close();
@@ -506,8 +485,6 @@ error:
free(oname_dst);
if (oname_src)
free(oname_src);
- if (str_prt)
- free(str_prt);
h5tools_close();
diff --git a/tools/h5copy/testfiles/h5copy_misc1.out b/tools/h5copy/testfiles/h5copy_misc1.out
deleted file mode 100644
index ac11605..0000000
--- a/tools/h5copy/testfiles/h5copy_misc1.out
+++ /dev/null
@@ -1,5 +0,0 @@
-#############################
- output for 'h5copy -i ../../../hdf5/tools/h5copy/testfiles/h5copytst.h5 -o ./testfiles/h5copytst.out.h5 -v -s /simple -d /g1/g2/simple'
-#############################
-Copying file <../../../hdf5/tools/h5copy/testfiles/h5copytst.h5> and object </simple> to file <./testfiles/h5copytst.out.h5> and object </g1/g2/simple>
-Error in copy...Exiting
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index 350785d..a54816e 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -91,15 +91,6 @@ VERIFY_H5LS()
echo "Verifying h5ls file structure $* $SPACES" | cut -c1-70 | tr -d '\012'
}
-# Print a line-line message left justified in a field of 70 characters
-# beginning with the word "Verifying".
-#
-VERIFY_OUTPUT()
-{
- SPACES=" "
- echo "Verifying output files $* $SPACES" | cut -c1-70 | tr -d '\012'
-}
-
# Run a test and print PASS or *FAIL*. If h5copy can complete
# with exit status 0, consider it pass. If a test fails then increment
# the `nerrors' global variable.
@@ -152,70 +143,44 @@ TOOLTEST()
}
-# Compare the two text files
-# PASS if same
-# FAIL if different, and show the diff
-#
-# Assumed arguments:
-# $1 is text file1 (expected output)
-# $2 is text file2 (actual output)
-CMP_OUTPUT()
-{
- expectout=$1
- actualout=$2
-
- VERIFY_OUTPUT $@
- if [ ! -f $expectout ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actualout $expectout
- elif $CMP $expectout $actualout; then
- echo " PASSED"
- else
- echo "*FAILED*"
- echo " Expected output differs from actual output"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expectout $actualout |sed 's/^/ /'
- fi
-}
-
TOOLTEST_FAIL()
{
- expectout="$INDIR/$1"
- actualout="$OUTDIR/$1.actual"
- shift
- if [ "$1" = -i ]; then
+ runh5diff=yes
+ if [ "$1" = -i ]; then
inputfile=$2
- fi
- if [ "$3" = -o ]; then
+ else
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
outputfile=$4
- fi
-
+ else
+ runh5diff=no
+ fi
+
TESTING $H5COPY $@
(
echo "#############################"
echo " output for '$H5COPY $@'"
echo "#############################"
$RUNSERIAL $H5COPY_BIN $@
- ) > $actualout 2> /dev/null
+ ) > output.out
RET=$?
if [ $RET != 0 ]; then
- echo " PASSED"
- # Verifying output text from h5copy
- if [ "$expectout" != "SKIP" ]; then
- CMP_OUTPUT $expectout $actualout
- fi
- else
echo "*FAILED*"
echo "failed result is:"
- cat $actualout
+ cat output.out
nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f output.out
+ fi
fi
-
- # Clean up output file
- if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actualout
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST_FAIL $inputfile $outputfile $7 $9
fi
}
@@ -424,28 +389,6 @@ COPY_EXT_LINKS()
fi
}
-# Test misc.
-#
-# Assumed arguments:
-# <none>
-TEST_MISC()
-{
- TESTFILE="$INDIR/$HDF_FILE1"
- FILEOUT="$OUTDIR/`basename $HDF_FILE1 .h5`.out.h5"
-
- # Remove any output file left over from previous test run
- rm -f $FILEOUT
-
- echo "Test copying object into group which doesn't exist, without -p"
- TOOLTEST_FAIL h5copy_misc1.out -i $TESTFILE -o $FILEOUT -v -s /simple -d /g1/g2/simple
-
- # Remove output file created, if the "no cleanup" environment variable is
- # not defined
- if test -z "$HDF5_NOCLEANUP"; then
- rm -f $FILEOUT
- fi
-}
-
##############################################################################
### T H E T E S T S ###
##############################################################################
@@ -453,7 +396,6 @@ TEST_MISC()
COPY_OBJECTS
COPY_REFERENCES
COPY_EXT_LINKS
-TEST_MISC
if test $nerrors -eq 0 ; then