summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-10-19 19:11:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-10-19 19:11:23 (GMT)
commit63ebb100e4aa4d2cc1117ca7ebc67a2f071119d1 (patch)
tree1a4395f0c53513b3b824b861ca4b27ac74d5db16 /tools
parent3c470c9db63424d8a07c1fb789ee8e8c513dd2a6 (diff)
downloadhdf5-63ebb100e4aa4d2cc1117ca7ebc67a2f071119d1.zip
hdf5-63ebb100e4aa4d2cc1117ca7ebc67a2f071119d1.tar.gz
hdf5-63ebb100e4aa4d2cc1117ca7ebc67a2f071119d1.tar.bz2
[svn-r19641] Description:
Bring r19542:19639 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/CMakeLists.txt3
-rw-r--r--tools/h5copy/h5copy.c605
-rw-r--r--tools/h5copy/testfiles/h5copy_misc1.out3
-rw-r--r--tools/h5copy/testh5copy.sh110
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.ddl8
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.h5bin3887 -> 3850 bytes
-rw-r--r--tools/h5stat/testh5stat.sh.in2
-rw-r--r--tools/testfiles/file_space.h5bin792 -> 792 bytes
8 files changed, 407 insertions, 324 deletions
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
index 17dd7a5..ccb1466 100644
--- a/tools/h5copy/CMakeLists.txt
+++ b/tools/h5copy/CMakeLists.txt
@@ -137,15 +137,12 @@ IF (BUILD_TESTING)
COMMAND ${CMAKE_COMMAND}
-E remove
./testfiles/${HDF_FILE1}.out.h5
- ./testfiles/${HDF_FILE1}.out.ls
./testfiles/${HDF_FILE1}.out.out
./testfiles/${HDF_FILE1}.out.out.err
./testfiles/${HDF_FILE2}.out.h5
- ./testfiles/${HDF_FILE2}.out.ls
./testfiles/${HDF_FILE2}.out.out
./testfiles/${HDF_FILE2}.out.out.err
./testfiles/${HDF_EXT_SRC_FILE}.out.h5
- ./testfiles/${HDF_EXT_SRC_FILE}.out.ls
./testfiles/${HDF_EXT_SRC_FILE}.out.out
./testfiles/${HDF_EXT_SRC_FILE}.out.out.err
)
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index eb16754..3760d6f 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -13,7 +13,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+#include "H5private.h"
#include "h5tools.h"
#include "h5tools_utils.h"
#include <string.h>
@@ -54,9 +54,8 @@ static struct long_options l_opts[] = {
static void
leave(int ret)
{
- h5tools_close();
-
- exit(ret);
+ h5tools_close();
+ exit(ret);
}
@@ -76,7 +75,7 @@ leave(int ret)
static void
usage (void)
{
- fprintf(stdout, "\
+ fprintf(stdout, "\
usage: h5copy [OPTIONS] [OBJECTS...]\n\
OBJECTS\n\
-i, --input input file name\n\
@@ -144,45 +143,45 @@ usage: h5copy [OPTIONS] [OBJECTS...]\n\
static int parse_flag(const char* str_flag, unsigned *flag)
{
- unsigned fla=0;
-
- if (strcmp(str_flag,"shallow")==0)
- {
- fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG;
- }
- else if (strcmp(str_flag,"soft")==0)
- {
- fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG;
- }
- else if (strcmp(str_flag,"ext")==0)
- {
- fla = H5O_COPY_EXPAND_EXT_LINK_FLAG;
- }
- else if (strcmp(str_flag,"ref")==0)
- {
- fla = H5O_COPY_EXPAND_REFERENCE_FLAG;
- }
- else if (strcmp(str_flag,"noattr")==0)
- {
- fla = H5O_COPY_WITHOUT_ATTR_FLAG;
- }
- else if (strcmp(str_flag,"allflags")==0)
- {
- fla = H5O_COPY_ALL;
- }
- else if (strcmp(str_flag,"nullmsg")==0)
- {
- fla = H5O_COPY_PRESERVE_NULL_FLAG;
- }
- else
- {
- error_msg("Error in input flag\n");
- return -1;
- }
-
- *flag = (*flag) | fla;
-
- return 0;
+ unsigned fla=0;
+
+ if (HDstrcmp(str_flag,"shallow")==0)
+ {
+ fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG;
+ }
+ else if (HDstrcmp(str_flag,"soft")==0)
+ {
+ fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG;
+ }
+ else if (HDstrcmp(str_flag,"ext")==0)
+ {
+ fla = H5O_COPY_EXPAND_EXT_LINK_FLAG;
+ }
+ else if (HDstrcmp(str_flag,"ref")==0)
+ {
+ fla = H5O_COPY_EXPAND_REFERENCE_FLAG;
+ }
+ else if (HDstrcmp(str_flag,"noattr")==0)
+ {
+ fla = H5O_COPY_WITHOUT_ATTR_FLAG;
+ }
+ else if (HDstrcmp(str_flag,"allflags")==0)
+ {
+ fla = H5O_COPY_ALL;
+ }
+ else if (HDstrcmp(str_flag,"nullmsg")==0)
+ {
+ fla = H5O_COPY_PRESERVE_NULL_FLAG;
+ }
+ else
+ {
+ error_msg("Error in input flag\n");
+ return -1;
+ }
+
+ *flag = (*flag) | fla;
+
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -200,141 +199,147 @@ static int parse_flag(const char* str_flag, unsigned *flag)
int
main (int argc, const char *argv[])
{
- hid_t fid_src=-1;
- hid_t fid_dst=-1;
- char *fname_src=NULL;
- char *fname_dst=NULL;
- char *oname_src=NULL;
- char *oname_dst=NULL;
- unsigned flag=0;
- unsigned verbose=0;
- unsigned parents=0;
- hid_t ocpl_id = (-1); /* Object copy property list */
- hid_t lcpl_id = (-1); /* Link creation property list */
- char str_flag[20];
- int opt;
- int li_ret;
- h5tool_link_info_t linkinfo;
-
- h5tools_setprogname(PROGRAMNAME);
- h5tools_setstatus(EXIT_SUCCESS);
-/* initialize h5tools lib */
- h5tools_init();
-
- /* Check for no command line parameters */
- if(argc == 1) {
- usage();
- leave(EXIT_FAILURE);
- } /* end if */
-
- /* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
- {
- switch ((char)opt)
- {
- case 'd':
- oname_dst = strdup(opt_arg);
- break;
-
- case 'f':
- /* validate flag */
- if (parse_flag(opt_arg,&flag)<0)
- {
- usage();
- leave(EXIT_FAILURE);
- }
- strcpy(str_flag,opt_arg);
- break;
-
- case 'h':
- usage();
- leave(EXIT_SUCCESS);
- break;
-
- case 'i':
- fname_src = strdup(opt_arg);
- break;
-
- case 'o':
- fname_dst = strdup(opt_arg);
- break;
-
- case 'p':
- parents = 1;
- break;
-
- case 's':
- oname_src = strdup(opt_arg);
- break;
-
- case 'V':
- print_version(h5tools_getprogname());
- leave(EXIT_SUCCESS);
- break;
-
- case 'v':
- verbose = 1;
- break;
-
- default:
- usage();
- leave(EXIT_FAILURE);
- }
- }
-
-/*-------------------------------------------------------------------------
- * check for missing file/object names
- *-------------------------------------------------------------------------*/
-
- if (fname_src==NULL)
- {
- error_msg("Input file name missing\n");
- usage();
- leave(EXIT_FAILURE);
- }
-
- if (fname_dst==NULL)
- {
- error_msg("Output file name missing\n");
- usage();
- leave(EXIT_FAILURE);
- }
-
- if (oname_src==NULL)
- {
- error_msg("Source object name missing\n");
- usage();
- leave(EXIT_FAILURE);
- }
-
- if (oname_dst==NULL)
- {
- error_msg("Destination object name missing\n");
- usage();
- leave(EXIT_FAILURE);
- }
-
-
-/*-------------------------------------------------------------------------
- * open input file
- *-------------------------------------------------------------------------*/
+ hid_t fid_src=-1;
+ hid_t fid_dst=-1;
+ char *fname_src=NULL;
+ char *fname_dst=NULL;
+ char *oname_src=NULL;
+ char *oname_dst=NULL;
+ unsigned flag=0;
+ unsigned verbose=0;
+ unsigned parents=0;
+ hid_t ocpl_id = (-1); /* Object copy property list */
+ hid_t lcpl_id = (-1); /* Link creation property list */
+ char str_flag[20];
+ int opt;
+ int li_ret;
+ h5tool_link_info_t linkinfo;
+ int i, len;
+ char *str_ptr=NULL;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+ /* initialize h5tools lib */
+ h5tools_init();
+
+ /* init linkinfo struct */
+ HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
+
+ /* Check for no command line parameters */
+ if(argc == 1)
+ {
+ usage();
+ leave(EXIT_FAILURE);
+ } /* end if */
- fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0);
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
+ {
+ switch ((char)opt)
+ {
+ case 'd':
+ oname_dst = HDstrdup(opt_arg);
+ break;
+
+ case 'f':
+ /* validate flag */
+ if (parse_flag(opt_arg,&flag)<0)
+ {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ HDstrcpy(str_flag,opt_arg);
+ break;
+
+ case 'h':
+ usage();
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ fname_src = HDstrdup(opt_arg);
+ break;
+
+ case 'o':
+ fname_dst = HDstrdup(opt_arg);
+ break;
+
+ case 'p':
+ parents = 1;
+ break;
+
+ case 's':
+ oname_src = HDstrdup(opt_arg);
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ verbose = 1;
+ break;
+
+ default:
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ } /* end of while */
/*-------------------------------------------------------------------------
- * test for error in opening input file
+ * check for missing file/object names
*-------------------------------------------------------------------------*/
- if (fid_src==-1)
- {
- error_msg("Could not open input file <%s>...Exiting\n", fname_src);
- if (fname_src)
- free(fname_src);
- leave(EXIT_FAILURE);
- }
-/*-------------------------------------------------------------------------
- * open output file
- *-------------------------------------------------------------------------*/
+ if (fname_src==NULL)
+ {
+ error_msg("Input file name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ if (fname_dst==NULL)
+ {
+ error_msg("Output file name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ if (oname_src==NULL)
+ {
+ error_msg("Source object name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ if (oname_dst==NULL)
+ {
+ error_msg("Destination object name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * open input file
+ *-------------------------------------------------------------------------*/
+
+ fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0);
+
+ /*-------------------------------------------------------------------------
+ * test for error in opening input file
+ *-------------------------------------------------------------------------*/
+ if (fid_src==-1)
+ {
+ error_msg("Could not open input file <%s>...Exiting\n", fname_src);
+ if (fname_src)
+ HDfree(fname_src);
+ leave(EXIT_FAILURE);
+ }
+
+ /*-------------------------------------------------------------------------
+ * open output file
+ *-------------------------------------------------------------------------*/
/* Attempt to open an existing HDF5 file first */
fid_dst = h5tools_fopen(fname_dst, H5F_ACC_RDWR, H5P_DEFAULT, NULL, NULL, 0);
@@ -344,49 +349,46 @@ main (int argc, const char *argv[])
if(fid_dst < 0)
fid_dst = H5Fcreate(fname_dst, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
-/*-------------------------------------------------------------------------
- * test for error in opening output file
- *-------------------------------------------------------------------------*/
- if (fid_dst==-1)
- {
- error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
- if (fname_src)
- free(fname_src);
- if (fname_dst)
- free(fname_dst);
- leave(EXIT_FAILURE);
- }
-
-/*-------------------------------------------------------------------------
- * print some info
- *-------------------------------------------------------------------------*/
-
- if (verbose)
- {
- printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n",
- fname_src,
- oname_src,
- fname_dst,
- oname_dst);
- if (flag)
- printf("Using %s flag\n", str_flag);
- }
-
-
-/*-------------------------------------------------------------------------
- * create property lists for copy
- *-------------------------------------------------------------------------*/
-
- /* create property to pass copy options */
- if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- goto error;
+ /*-------------------------------------------------------------------------
+ * test for error in opening output file
+ *-------------------------------------------------------------------------*/
+ if (fid_dst==-1)
+ {
+ error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
+ if (fname_src)
+ HDfree(fname_src);
+ if (fname_dst)
+ HDfree(fname_dst);
+ leave(EXIT_FAILURE);
+ }
+
+ /*-------------------------------------------------------------------------
+ * print some info
+ *-------------------------------------------------------------------------*/
+
+ if (verbose)
+ {
+ printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n",
+ fname_src, oname_src, fname_dst, oname_dst);
+ if (flag)
+ printf("Using %s flag\n", str_flag);
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * create property lists for copy
+ *-------------------------------------------------------------------------*/
+
+ /* create property to pass copy options */
+ if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ goto error;
- /* set options for object copy */
- if (flag)
- {
- if ( H5Pset_copy_object(ocpl_id, flag) < 0)
- goto error;
- }
+ /* set options for object copy */
+ if (flag)
+ {
+ if ( H5Pset_copy_object(ocpl_id, flag) < 0)
+ goto error;
+ }
/* Create link creation property list */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
@@ -406,88 +408,107 @@ main (int argc, const char *argv[])
if(verbose)
printf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
-
-/*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------*/
- /* init linkinfo struct */
- memset(&linkinfo, 0, sizeof(h5tool_link_info_t));
+ else /* error, if parent groups doesn't already exist in destination file */
+ {
+ len = HDstrlen(oname_dst);
+ /* check if all the parents groups exist. skip root group */
+ for (i = 1; i < len; i++)
+ {
+ if ('/'==oname_dst[i])
+ {
+ str_ptr = (char*)HDcalloc((size_t)i+1, sizeof(char));
+ HDstrncpy (str_ptr, oname_dst, (size_t)i);
+ str_ptr[i]='\0';
+ if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0)
+ {
+ error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr);
+ HDfree(str_ptr);
+ goto error;
+ }
+ HDfree(str_ptr);
+ }
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------*/
- if(verbose)
- linkinfo.opt.msg_mode = 1;
+ if(verbose)
+ linkinfo.opt.msg_mode = 1;
- li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1);
- if (li_ret == 0) /* dangling link */
- {
- if(H5Lcopy(fid_src, oname_src,
- fid_dst, oname_dst,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- goto error;
- }
- else /* valid link */
- {
- if (H5Ocopy(fid_src, /* Source file or group identifier */
- oname_src, /* Name of the source object to be copied */
- fid_dst, /* Destination file or group identifier */
- oname_dst, /* Name of the destination object */
- ocpl_id, /* Object copy property list */
- lcpl_id)<0) /* Link creation property list */
- goto error;
- }
-
- /* free link info path */
- if (linkinfo.trg_path)
- free(linkinfo.trg_path);
-
- /* close propertis */
- if(H5Pclose(ocpl_id)<0)
- goto error;
- if(H5Pclose(lcpl_id)<0)
- goto error;
-
- /* close files */
- if (H5Fclose(fid_src)<0)
- goto error;
- if (H5Fclose(fid_dst)<0)
- goto error;
-
- if (fname_src)
- free(fname_src);
- if (fname_dst)
- free(fname_dst);
- if (oname_dst)
- free(oname_dst);
- if (oname_src)
- free(oname_src);
-
- h5tools_close();
-
- return EXIT_SUCCESS;
+ li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1);
+ if (li_ret == 0) /* dangling link */
+ {
+ if(H5Lcopy(fid_src, oname_src,
+ fid_dst, oname_dst,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto error;
+ }
+ else /* valid link */
+ {
+ if (H5Ocopy(fid_src, /* Source file or group identifier */
+ oname_src, /* Name of the source object to be copied */
+ fid_dst, /* Destination file or group identifier */
+ oname_dst, /* Name of the destination object */
+ ocpl_id, /* Object copy property list */
+ lcpl_id)<0) /* Link creation property list */
+ goto error;
+ }
+
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
+
+ /* close propertis */
+ if(H5Pclose(ocpl_id)<0)
+ goto error;
+ if(H5Pclose(lcpl_id)<0)
+ goto error;
+
+ /* close files */
+ if (H5Fclose(fid_src)<0)
+ goto error;
+ if (H5Fclose(fid_dst)<0)
+ goto error;
+
+ if (fname_src)
+ HDfree(fname_src);
+ if (fname_dst)
+ HDfree(fname_dst);
+ if (oname_dst)
+ HDfree(oname_dst);
+ if (oname_src)
+ HDfree(oname_src);
+
+ h5tools_close();
+
+ return EXIT_SUCCESS;
error:
- printf("Error in copy...Exiting\n");
+ printf("Error in copy...Exiting\n");
- /* free link info path */
- if (linkinfo.trg_path)
- free(linkinfo.trg_path);
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
H5E_BEGIN_TRY {
- H5Pclose(ocpl_id);
- H5Pclose(lcpl_id);
- H5Fclose(fid_src);
- H5Fclose(fid_dst);
- } H5E_END_TRY;
- if (fname_src)
- free(fname_src);
- if (fname_dst)
- free(fname_dst);
- if (oname_dst)
- free(oname_dst);
- if (oname_src)
- free(oname_src);
-
- h5tools_close();
-
- return EXIT_FAILURE;
+ H5Pclose(ocpl_id);
+ H5Pclose(lcpl_id);
+ H5Fclose(fid_src);
+ H5Fclose(fid_dst);
+ } H5E_END_TRY;
+ if (fname_src)
+ HDfree(fname_src);
+ if (fname_dst)
+ HDfree(fname_dst);
+ if (oname_dst)
+ HDfree(oname_dst);
+ if (oname_src)
+ HDfree(oname_src);
+
+ h5tools_close();
+
+ return EXIT_FAILURE;
}
diff --git a/tools/h5copy/testfiles/h5copy_misc1.out b/tools/h5copy/testfiles/h5copy_misc1.out
new file mode 100644
index 0000000..370b1a5
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copy_misc1.out
@@ -0,0 +1,3 @@
+Copying file <h5copytst.h5> and object </simple> to file <./testfiles/h5copytst.out.h5> and object </g1/g2/simple>
+Error in copy...Exiting
+h5copy error: group </g1> doesn't exist. Use -p to create parent groups.
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index 5ddb83e..1ce6a31 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -91,6 +91,15 @@ 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.
@@ -143,44 +152,74 @@ 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()
+{
+ expect=$1
+ actual=$2
+
+ VERIFY_OUTPUT $@
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected output differs from actual output"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+}
+
TOOLTEST_FAIL()
{
- runh5diff=yes
- if [ "$1" = -i ]; then
+ expectout="$INDIR/$1"
+ actualout="$OUTDIR/$1.out"
+ actualerr="$OUTDIR/$1.err"
+ shift
+ if [ "$1" = -i ]; then
inputfile=$2
- else
- runh5diff=no
- fi
- if [ "$3" = -o ]; then
+ fi
+ if [ "$3" = -o ]; then
outputfile=$4
- else
- runh5diff=no
- fi
-
+ fi
+
TESTING $H5COPY $5 $6 $7 $8 $9
(
- echo "#############################"
- echo " output for '$H5COPY $@'"
- echo "#############################"
+ #echo "#############################"
+ #echo " output for '$H5COPY $@'"
+ #echo "#############################"
$RUNSERIAL $H5COPY_BIN $@
- ) > output.out
+ ) > $actualout 2> $actualerr
RET=$?
if [ $RET != 0 ]; then
+ echo " PASSED"
+ # Verifying output text from h5copy
+ if [ "$expectout" != "SKIP" ]; then
+ # combine stderr to stdout to compare the output at once.
+ # We may seperate stdout and stderr later.
+ cat $actualerr >> $actualout
+ CMP_OUTPUT $expectout $actualout
+ fi
+ else
echo "*FAILED*"
echo "failed result is:"
- cat output.out
+ cat $actualout
nerrors="`expr $nerrors + 1`"
- else
- echo " PASSED"
-
- # Clean up output file
- if test -z "$HDF5_NOCLEANUP"; then
- rm -f output.out
- fi
fi
- if [ $runh5diff != no ]; then
- H5DIFFTEST_FAIL $inputfile $outputfile $7 $9
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr
fi
}
@@ -389,6 +428,28 @@ COPY_EXT_LINKS()
fi
}
+# Test misc.
+#
+# Assumed arguments:
+# <none>
+TEST_MISC()
+{
+ TESTFILE="$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 -v -i $TESTFILE -o $FILEOUT -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 ###
##############################################################################
@@ -396,6 +457,7 @@ COPY_EXT_LINKS()
COPY_OBJECTS
COPY_REFERENCES
COPY_EXT_LINKS
+TEST_MISC
# Add newline for nicer formatting
echo " "
diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl
index c7ed5f4..6ee8aa8 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.ddl
+++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl
@@ -31,7 +31,7 @@ File space information for file metadata (in bytes):
Shared Messages:
Header: 38
B-tree/List: 550
- Heap: 1316
+ Heap: 1279
Free-space managers:
Header: 0
Amount of free space: 0
@@ -71,7 +71,7 @@ Dataset datatype information:
# of unique datatypes used by datasets: 1
Dataset datatype #0:
Count (total/named) = (3/0)
- Size (desc./elmt) = (14/4)
+ Size (desc./elmt) = (14/8)
Total dataset datatype count: 3
Small # of attributes:
Total # of objects with small # of attributes: 0
@@ -85,8 +85,8 @@ Free-space section bins:
Total # of sections: 0
File space management strategy: H5F_FILE_SPACE_ALL
Summary of file space information:
- File metadata: 3887 bytes
+ File metadata: 3850 bytes
Raw data: 0 bytes
Amount/Percent of tracked free space: 0 bytes/0.0%
Unaccounted space: 0 bytes
-Total space: 3887 bytes
+Total space: 3850 bytes
diff --git a/tools/h5stat/testfiles/h5stat_tsohm.h5 b/tools/h5stat/testfiles/h5stat_tsohm.h5
index 193c34f..e6c89f6 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.h5
+++ b/tools/h5stat/testfiles/h5stat_tsohm.h5
Binary files differ
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index 2a09f9f..c6c377e 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -127,7 +127,7 @@ TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5
TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5
#
# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
-# as of release 1.8.0-alpha4
+# as of release 1.8.7-snap0 (on a 64-bit machine)
TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5
# h5stat_newgrat.h5 is generated by h5stat_gentest.c
TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5
diff --git a/tools/testfiles/file_space.h5 b/tools/testfiles/file_space.h5
index de5837a..425d0c2 100644
--- a/tools/testfiles/file_space.h5
+++ b/tools/testfiles/file_space.h5
Binary files differ