diff options
Diffstat (limited to 'tools/h5copy')
-rw-r--r-- | tools/h5copy/Makefile.am | 5 | ||||
-rw-r--r-- | tools/h5copy/Makefile.in | 55 | ||||
-rw-r--r-- | tools/h5copy/h5copygentest.c | 105 | ||||
-rw-r--r-- | tools/h5copy/testh5copy.sh | 6 |
4 files changed, 154 insertions, 17 deletions
diff --git a/tools/h5copy/Makefile.am b/tools/h5copy/Makefile.am index 9632c1b..17f650c 100644 --- a/tools/h5copy/Makefile.am +++ b/tools/h5copy/Makefile.am @@ -23,12 +23,17 @@ include $(top_srcdir)/config/commence.am INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts +TEST_PROG=h5copygentest TEST_SCRIPT=$(srcdir)/testh5copy.sh check_SCRIPTS=$(TEST_SCRIPT) SCRIPT_DEPEND=h5copy$(EXEEXT) # This is our main target, the h5copy tool bin_PROGRAMS=h5copy +check_PROGRAMS=$(TEST_PROG) + +# source file for the test file generator +h5copygentest_SOURCES=h5copygentest.c # All programs depend on the hdf5 and h5tools libraries LDADD=$(LIBH5TOOLS) $(LIBHDF5) diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index 9dd1d15..0f1e365 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -30,7 +30,7 @@ # HDF5 Library Makefile(.in) # -SOURCES = h5copy.c +SOURCES = h5copy.c $(h5copygentest_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -58,6 +58,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am bin_PROGRAMS = h5copy$(EXEEXT) +check_PROGRAMS = $(am__EXEEXT_1) subdir = tools/h5copy ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in @@ -68,6 +69,7 @@ CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +am__EXEEXT_1 = h5copygentest$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) h5copy_SOURCES = h5copy.c h5copy_OBJECTS = h5copy.$(OBJEXT) @@ -75,6 +77,11 @@ h5copy_LDADD = $(LDADD) am__DEPENDENCIES_1 = $(top_builddir)/tools/lib/libh5tools.la am__DEPENDENCIES_2 = $(top_builddir)/src/libhdf5.la h5copy_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +am_h5copygentest_OBJECTS = h5copygentest.$(OBJEXT) +h5copygentest_OBJECTS = $(am_h5copygentest_OBJECTS) +h5copygentest_LDADD = $(LDADD) +h5copygentest_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/bin/depcomp am__depfiles_maybe = depfiles @@ -86,8 +93,8 @@ 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 = h5copy.c -DIST_SOURCES = h5copy.c +SOURCES = h5copy.c $(h5copygentest_SOURCES) +DIST_SOURCES = h5copy.c $(h5copygentest_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -326,10 +333,14 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts +TEST_PROG = h5copygentest TEST_SCRIPT = $(srcdir)/testh5copy.sh check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5copy$(EXEEXT) +# source file for the test file generator +h5copygentest_SOURCES = h5copygentest.c + # All programs depend on the hdf5 and h5tools libraries LDADD = $(LIBH5TOOLS) $(LIBHDF5) @@ -410,9 +421,19 @@ 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 h5copy$(EXEEXT): $(h5copy_OBJECTS) $(h5copy_DEPENDENCIES) @rm -f h5copy$(EXEEXT) $(LINK) $(h5copy_LDFLAGS) $(h5copy_OBJECTS) $(h5copy_LDADD) $(LIBS) +h5copygentest$(EXEEXT): $(h5copygentest_OBJECTS) $(h5copygentest_DEPENDENCIES) + @rm -f h5copygentest$(EXEEXT) + $(LINK) $(h5copygentest_LDFLAGS) $(h5copygentest_OBJECTS) $(h5copygentest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -421,6 +442,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5copy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5copygentest.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -530,7 +552,7 @@ distdir: $(DISTFILES) fi; \ done check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) all-local @@ -564,7 +586,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) @@ -613,17 +636,17 @@ ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am .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-data install-data-am install-exec install-exec-am \ - 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 mostlyclean-local pdf \ - pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am + 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-data install-data-am install-exec \ + install-exec-am 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 \ + mostlyclean-local pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c new file mode 100644 index 0000000..f4695fd --- /dev/null +++ b/tools/h5copy/h5copygentest.c @@ -0,0 +1,105 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Generate the binary hdf5 file for the h5copy tests + */ + +#include "hdf5.h" +#define FILENAME "h5copytst.h5" +#define DATASET_SIMPLE "simple" +#define DATASET_CHUNK "chunk" + + +/*------------------------------------------------------------------------- + * Function: gent_simple_dataset + * + * Purpose: Generate a simple dataset in FID + * + *------------------------------------------------------------------------- + */ +static void gent_simple_dataset(hid_t fid) +{ + hid_t sid, did; + hsize_t dims[1] = {6}; + int buf[6] = {1,2,3,4,5,6}; + + /* create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + + /* create dataset */ + did = H5Dcreate(fid, DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT); + + /* write */ + H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + + /* close */ + H5Sclose(sid); + H5Dclose(did); +} + +/*------------------------------------------------------------------------- + * Function: gent_chunked_dataset + * + * Purpose: Generate a chunked dataset in FID + * + *------------------------------------------------------------------------- + */ +static void gent_chunked_dataset(hid_t fid) +{ + hid_t sid, did, pid; + hsize_t dims[1] = {6}; + hsize_t chunk_dims[1] = {2}; + int buf[6] = {1,2,3,4,5,6}; + + /* create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + + /* create property plist for chunk*/ + pid = H5Pcreate(H5P_DATASET_CREATE); + H5Pset_chunk(pid, 1, chunk_dims); + + /* create dataset */ + did = H5Dcreate(fid, DATASET_CHUNK, H5T_NATIVE_INT, sid, pid); + + /* write */ + H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + + /* close */ + H5Sclose(sid); + H5Dclose(did); + H5Pclose(pid); +} + + +/*------------------------------------------------------------------------- + * Function: main + * + *------------------------------------------------------------------------- + */ + +int main(void) +{ + hid_t fid; + + + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + gent_simple_dataset(fid); + gent_chunked_dataset(fid); + + H5Fclose(fid); + return 0; +} + diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index ec8412a..eef1834 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -23,6 +23,9 @@ H5COPY_BIN=`pwd`/$H5COPY # The path of the tool binary H5DIFF=../h5diff/h5diff # The h5diff tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary +TESTFILE=$srcdir/../testfiles/h5copytst.h5 +FILEOUT=h5copytst.out.h5 + nerrors=0 # The build (current) directory might be different than the source directory. @@ -117,7 +120,8 @@ H5DIFFTEST() ### T H E T E S T S ### ############################################################################## -TOOLTEST -i $srcdir/../testfiles/test1.h5 -o test1.out.h5 -v -s array -d array +TOOLTEST -i $TESTFILE -o $FILEOUT -v -s simple -d simple +TOOLTEST -i $TESTFILE -o $FILEOUT -v -s chunk -d chunk |