summaryrefslogtreecommitdiffstats
path: root/tools/misc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/misc')
-rw-r--r--tools/misc/Makefile.am18
-rw-r--r--tools/misc/Makefile.in88
-rw-r--r--tools/misc/h5repart.c23
-rw-r--r--tools/misc/h5repart_gentest.c99
-rw-r--r--tools/misc/repart_test.c123
-rw-r--r--tools/misc/testh5repart.sh.in101
6 files changed, 422 insertions, 30 deletions
diff --git a/tools/misc/Makefile.am b/tools/misc/Makefile.am
index 914650c..fd1a866 100644
--- a/tools/misc/Makefile.am
+++ b/tools/misc/Makefile.am
@@ -22,20 +22,32 @@ include $(top_srcdir)/config/commence.am
# Include src directory
INCLUDES=-I$(top_srcdir)/src
+#test script and program
+TEST_PROG=h5repart_gentest
+TEST_SCRIPT=testh5repart.sh
+
+check_PROGRAMS=$(TEST_PROG)
+check_SCRIPTS=$(TEST_SCRIPT)
+
# Build pdb2hdf5 if LLNL's PDB is present (checked in configure)
if BUILD_PDB2HDF_CONDITIONAL
PDB2HDF=pdb2hdf5
endif
# These are our main targets, the tools
-bin_PROGRAMS=h5debug h5repart $(PDB2HDF)
+bin_PROGRAMS=h5debug h5repart $(PDB2HDF) repart_test
bin_SCRIPTS=h5redeploy
# Tell automake to clean h5redeploy script
CLEANFILES=h5redeploy
-# h5cc is generated by configure. Remove it only when distclean.
-DISTCLEANFILES=h5cc
+# Temporary files. *.h5 are generated by h5repart_gentest. They should
+# copied to the testfiles/ directory if update is required. fst_family*.h5
+# and scd_family*.h5 were created by setting the HDF5_NOCLEANUP variable.
+MOSTLYCLEANFILES=*.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES=h5cc testh5repart.sh
# All programs rely on hdf5 library and h5tools library
LDADD=$(LIBHDF5) $(LIBH5TOOLS)
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index db7c190..5fe79be 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -31,7 +31,7 @@
#
-SOURCES = h5debug.c h5repart.c pdb2hdf5.c
+SOURCES = h5debug.c h5repart.c h5repart_gentest.c pdb2hdf5.c repart_test.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -56,9 +56,12 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/h5cc.in $(top_srcdir)/config/commence.am \
+ $(srcdir)/h5cc.in $(srcdir)/testh5repart.sh.in \
+ $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
-bin_PROGRAMS = h5debug$(EXEEXT) h5repart$(EXEEXT) $(am__EXEEXT_1)
+check_PROGRAMS = $(am__EXEEXT_2)
+bin_PROGRAMS = h5debug$(EXEEXT) h5repart$(EXEEXT) $(am__EXEEXT_1) \
+ repart_test$(EXEEXT)
subdir = tools/misc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
@@ -66,10 +69,11 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
-CONFIG_CLEAN_FILES = h5cc
+CONFIG_CLEAN_FILES = h5cc testh5repart.sh
@BUILD_PDB2HDF_CONDITIONAL_TRUE@am__EXEEXT_1 = pdb2hdf5$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+am__EXEEXT_2 = h5repart_gentest$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
h5debug_SOURCES = h5debug.c
h5debug_OBJECTS = h5debug.$(OBJEXT)
@@ -81,10 +85,19 @@ h5repart_SOURCES = h5repart.c
h5repart_OBJECTS = h5repart.$(OBJEXT)
h5repart_LDADD = $(LDADD)
h5repart_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+h5repart_gentest_SOURCES = h5repart_gentest.c
+h5repart_gentest_OBJECTS = h5repart_gentest.$(OBJEXT)
+h5repart_gentest_LDADD = $(LDADD)
+h5repart_gentest_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_2)
pdb2hdf5_SOURCES = pdb2hdf5.c
pdb2hdf5_OBJECTS = pdb2hdf5.$(OBJEXT)
pdb2hdf5_LDADD = $(LDADD)
pdb2hdf5_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+repart_test_SOURCES = repart_test.c
+repart_test_OBJECTS = repart_test.$(OBJEXT)
+repart_test_LDADD = $(LDADD)
+repart_test_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
@@ -98,8 +111,10 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = h5debug.c h5repart.c pdb2hdf5.c
-DIST_SOURCES = h5debug.c h5repart.c pdb2hdf5.c
+SOURCES = h5debug.c h5repart.c h5repart_gentest.c pdb2hdf5.c \
+ repart_test.c
+DIST_SOURCES = h5debug.c h5repart.c h5repart_gentest.c pdb2hdf5.c \
+ repart_test.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -313,6 +328,11 @@ H5FC_PP = $(bindir)/h5pfc
# Include src directory
INCLUDES = -I$(top_srcdir)/src
+#test script and program
+TEST_PROG = h5repart_gentest
+TEST_SCRIPT = testh5repart.sh
+check_SCRIPTS = $(TEST_SCRIPT)
+
# Build pdb2hdf5 if LLNL's PDB is present (checked in configure)
@BUILD_PDB2HDF_CONDITIONAL_TRUE@PDB2HDF = pdb2hdf5
bin_SCRIPTS = h5redeploy
@@ -320,8 +340,13 @@ bin_SCRIPTS = h5redeploy
# Tell automake to clean h5redeploy script
CLEANFILES = h5redeploy
-# h5cc is generated by configure. Remove it only when distclean.
-DISTCLEANFILES = h5cc
+# Temporary files. *.h5 are generated by h5repart_gentest. They should
+# copied to the testfiles/ directory if update is required. fst_family*.h5
+# and scd_family*.h5 were created by setting the HDF5_NOCLEANUP variable.
+MOSTLYCLEANFILES = *.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES = h5cc testh5repart.sh
# All programs rely on hdf5 library and h5tools library
LDADD = $(LIBHDF5) $(LIBH5TOOLS)
@@ -378,6 +403,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
h5cc: $(top_builddir)/config.status $(srcdir)/h5cc.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+testh5repart.sh: $(top_builddir)/config.status $(srcdir)/testh5repart.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@@ -406,15 +433,28 @@ clean-binPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
h5debug$(EXEEXT): $(h5debug_OBJECTS) $(h5debug_DEPENDENCIES)
@rm -f h5debug$(EXEEXT)
$(LINK) $(h5debug_LDFLAGS) $(h5debug_OBJECTS) $(h5debug_LDADD) $(LIBS)
h5repart$(EXEEXT): $(h5repart_OBJECTS) $(h5repart_DEPENDENCIES)
@rm -f h5repart$(EXEEXT)
$(LINK) $(h5repart_LDFLAGS) $(h5repart_OBJECTS) $(h5repart_LDADD) $(LIBS)
+h5repart_gentest$(EXEEXT): $(h5repart_gentest_OBJECTS) $(h5repart_gentest_DEPENDENCIES)
+ @rm -f h5repart_gentest$(EXEEXT)
+ $(LINK) $(h5repart_gentest_LDFLAGS) $(h5repart_gentest_OBJECTS) $(h5repart_gentest_LDADD) $(LIBS)
pdb2hdf5$(EXEEXT): $(pdb2hdf5_OBJECTS) $(pdb2hdf5_DEPENDENCIES)
@rm -f pdb2hdf5$(EXEEXT)
$(LINK) $(pdb2hdf5_LDFLAGS) $(pdb2hdf5_OBJECTS) $(pdb2hdf5_LDADD) $(LIBS)
+repart_test$(EXEEXT): $(repart_test_OBJECTS) $(repart_test_DEPENDENCIES)
+ @rm -f repart_test$(EXEEXT)
+ $(LINK) $(repart_test_LDFLAGS) $(repart_test_OBJECTS) $(repart_test_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@@ -443,7 +483,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5debug.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repart.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repart_gentest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdb2hdf5.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repart_test.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -553,6 +595,7 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(PROGRAMS) $(SCRIPTS) all-local
@@ -575,6 +618,7 @@ install-strip:
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
@@ -588,7 +632,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -639,18 +684,19 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-info-am uninstall-local
.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
- clean clean-binPROGRAMS clean-generic clean-libtool ctags \
- distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
- install-binSCRIPTS install-data install-data-am install-exec \
- install-exec-am install-exec-local install-info \
- install-info-am install-man install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-binPROGRAMS \
- uninstall-binSCRIPTS uninstall-info-am uninstall-local
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-binSCRIPTS install-data \
+ install-data-am install-exec install-exec-am \
+ install-exec-local install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-info-am \
+ uninstall-local
install-exec-local:
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index 0bd2dd8..6803aae 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -65,6 +65,10 @@
# define MIN3(X,Y,Z) MIN(MIN(X,Y),Z)
#endif
+/*Make this private property(defined in H5Fprivate.h) available to h5repart,
+ *to update the member file size in the superblock.*/
+#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
+
/*-------------------------------------------------------------------------
* Function: usage
@@ -223,7 +227,7 @@ main (int argc, char *argv[])
off_t src_act_size; /*source actual member size */
off_t dst_size=1 GB; /*destination logical memb size */
#endif
- hid_t fapl;
+ hid_t fapl; /*file access property list */
hid_t file;
/*
@@ -444,19 +448,26 @@ main (int argc, char *argv[])
}
close (dst);
- /* modify family size saved in superblock. Member size 1 signals library to
- * save the new size(actual member file size) in superblock. It's for this
- * tool only. */
+ /* Modify family size saved in superblock through private property. It signals
+ * library to save the new member size(specified in command line) in superblock.
+ * This private property is for this tool only. */
if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) {
perror ("H5Pcreate");
exit (1);
}
-
- if(H5Pset_fapl_family(fapl, 1, H5P_DEFAULT)<0) {
+
+ if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
perror ("H5Pset_fapl_family");
exit (1);
}
+
+ if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &dst_size) < 0) {
+ perror ("H5Pset_family_newsize");
+ exit (1);
+ }
+ /* Open file for "read and write" to flush metadata. Flushing metadata
+ * will update the superblock to the new member size. */
if((file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl))<0) {
perror ("H5Fopen");
exit (1);
diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c
new file mode 100644
index 0000000..22243b1
--- /dev/null
+++ b/tools/misc/h5repart_gentest.c
@@ -0,0 +1,99 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu<slu@ncsa.uiuc.edu>
+ * June 1, 2005
+ *
+ * Purpose: Generate a family file of 1024 bytes for each member
+ * for h5repart test.
+ */
+#include "hdf5.h"
+
+#define KB 1024
+#define FAMILY_NUMBER 4
+#define FAMILY_SIZE 1024
+#define FILENAME "family_file%05d.h5"
+
+int main(void)
+{
+ hid_t file=(-1), fapl, fapl2=(-1), space=(-1), dset=(-1);
+ char dname[]="dataset";
+ int i, j;
+ int buf[FAMILY_NUMBER][FAMILY_SIZE];
+ hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
+
+ /* Set property list and file name for FAMILY driver */
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) {
+ perror ("H5Pcreate");
+ exit (1);
+ }
+
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0) {
+ perror ("H5Pset_fapl_family");
+ exit (1);
+ }
+
+ if((file=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) {
+ perror ("H5Fcreate");
+ exit (1);
+ }
+
+ /* Create and write dataset */
+ if((space=H5Screate_simple(2, dims, NULL))<0) {
+ perror ("H5Screate_simple");
+ exit (1);
+ }
+
+
+ if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0) {
+ perror ("H5Dcreate");
+ exit (1);
+ }
+
+
+ for(i=0; i<FAMILY_NUMBER; i++)
+ for(j=0; j<FAMILY_SIZE; j++)
+ buf[i][j] = i*10000+j;
+
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0) {
+ perror ("H5Dwrite");
+ exit (1);
+ }
+
+
+ if(H5Sclose(space)<0) {
+ perror ("H5Sclose");
+ exit (1);
+ }
+
+ if(H5Dclose(dset)<0) {
+ perror ("H5Dclose");
+ exit (1);
+ }
+
+ if(H5Pclose(fapl)<0) {
+ perror ("H5Pclose");
+ exit (1);
+ }
+
+ if(H5Fclose(file)<0) {
+ perror ("H5Fclose");
+ exit (1);
+ }
+
+ puts(" PASSED"); fflush(stdout);
+
+ return 0;
+}
diff --git a/tools/misc/repart_test.c b/tools/misc/repart_test.c
new file mode 100644
index 0000000..042c858
--- /dev/null
+++ b/tools/misc/repart_test.c
@@ -0,0 +1,123 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * June 1, 2005
+ *
+ * Purpose: This program tests family files after being repartitioned
+ * by h5repart. It simply tries to reopen the files with
+ * correct family driver and member size.
+ */
+#include "hdf5.h"
+
+#define KB 1024
+#define FAMILY_H5REPART_SIZE1 20000
+#define FAMILY_H5REPART_SIZE2 (5*KB)
+#define MAX(a,b) (a>b ? a:b)
+
+const char *FILENAME[] = {
+ "fst_family%05d.h5",
+ "scd_family%05d.h5",
+ NULL
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_family_h5repart_opens
+ *
+ * Purpose: Tries to reopen family files.
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * June 1, 2005
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_family_h5repart_opens(void)
+{
+ hid_t file=(-1), fapl=(-1);
+ char filename[1024];
+
+ /* open 1st file(single member file) with correct family size(20000 byte) */
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
+ goto error;
+
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT)<0)
+ goto error;
+
+ if((file=H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl))<0)
+ goto error;
+
+ if(H5Fclose(file)<0)
+ goto error;
+
+ /* open 2nd file(multiple member files) with correct family size(5KB) */
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE2, H5P_DEFAULT)<0)
+ goto error;
+
+ if((file=H5Fopen(FILENAME[1], H5F_ACC_RDWR, fapl))<0)
+ goto error;
+
+ if(H5Fclose(file)<0)
+ goto error;
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests h5repart-ed family files
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * June 1, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ int nerrors=0;
+
+ nerrors += test_family_h5repart_opens()<0 ?1:0;
+
+ if (nerrors) goto error;
+
+ return 0;
+
+error:
+ nerrors = MAX(1, nerrors);
+ printf("***** %d FAMILY FILE TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+ return 1;
+}
diff --git a/tools/misc/testh5repart.sh.in b/tools/misc/testh5repart.sh.in
new file mode 100644
index 0000000..0889c92
--- /dev/null
+++ b/tools/misc/testh5repart.sh.in
@@ -0,0 +1,101 @@
+#! /bin/sh
+#
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
+#
+# Tests for the h5repart tool
+
+REPART=h5repart # The tool name
+REPART_BIN=`pwd`/$REPART # The path of the tool binary
+
+REPARTED_FAM=repart_test # The test name
+REPARTED_FAM_BIN=`pwd`/$REPARTED_FAM # The path of the test binary
+
+nerrors=0
+verbose=yes
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+test -d ../testfiles || mkdir ../testfiles
+
+actual_dir=`pwd`/../testfiles
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Run a test and print PASS or *FAIL*. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display the
+# difference between the actual output and the expected output. The
+# expected output is given as the first argument to this function and
+# the actual output file is calculated by replacing the `.ddl' with
+# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a
+# non-zero value.
+#
+TOOLTEST() {
+ # Run tool test.
+ TESTING $REPART $@
+ (
+ echo
+ cd $srcdir/../testfiles
+ $RUNSERIAL $REPART_BIN $@
+ )
+}
+
+OUTPUTTEST() {
+ # Run test program.
+ TESTING $REPARTED_FAM $@
+ (
+ cd $actual_dir
+ $RUNSERIAL $REPARTED_FAM_BIN $@
+ )
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $REPART $@
+ echo " -SKIP-"
+}
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# repartition family member size to 20,000 bytes.
+TOOLTEST -m 20000 family_file%05d.h5 $actual_dir/fst_family%05d.h5
+# repartition family member size to 5 KB.
+TOOLTEST -m 5k family_file%05d.h5 $actual_dir/scd_family%05d.h5
+
+# test the output files repartitioned above.
+OUTPUTTEST
+echo
+
+if test $nerrors -eq 0 ; then
+ echo "All $REPART tests passed."
+fi
+
+# Clean up output file
+if test -z "$HDF5_NOCLEANUP"; then
+ cd $actual_dir
+ rm -f fst_family*.h5 scd_family*.h5
+fi
+
+exit $nerrors