diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 38 | ||||
-rw-r--r-- | test/blocktrack.c | 138 |
3 files changed, 163 insertions, 17 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 9744c54..a7db7d9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -33,7 +33,7 @@ TEST_PROG=testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \ fillval mount flush1 flush2 enum \ set_extent srb_write srb_append srb_read ttsafe stream_test \ getname file_handle ntypes dangle dtransform filename reserved \ - btree2 + btree2 blocktrack # List programs to be built when testing here. error_test and err_compat are # built at the same time as the other tests, but executed by testerror.sh. @@ -88,7 +88,7 @@ MOSTLYCLEANFILES=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5\ family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ - unlink_chunked.h5 btree2.h5 + unlink_chunked.h5 btree2.h5 blocktrack.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tconfig.c tfile.c tgenprop.c \ diff --git a/test/Makefile.in b/test/Makefile.in index c30bac5..74639c8 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -29,7 +29,7 @@ # # HDF5 Library Test Makefile(.in) # -SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c +SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -81,7 +81,7 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \ file_handle$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ dtransform$(EXEEXT) filename$(EXEEXT) reserved$(EXEEXT) \ - btree2$(EXEEXT) + btree2$(EXEEXT) blocktrack$(EXEEXT) big_SOURCES = big.c big_OBJECTS = big.$(OBJEXT) big_LDADD = $(LDADD) @@ -90,6 +90,10 @@ bittests_SOURCES = bittests.c bittests_OBJECTS = bittests.$(OBJEXT) bittests_LDADD = $(LDADD) bittests_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) +blocktrack_SOURCES = blocktrack.c +blocktrack_OBJECTS = blocktrack.$(OBJEXT) +blocktrack_LDADD = $(LDADD) +blocktrack_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) btree2_SOURCES = btree2.c btree2_OBJECTS = btree2.$(OBJEXT) btree2_LDADD = $(LDADD) @@ -261,17 +265,17 @@ 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 = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c \ - cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c \ - err_compat.c error_test.c extend.c external.c file_handle.c \ - filename.c fillval.c flush1.c flush2.c getname.c gheap.c \ - hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c \ - ohdr.c reserved.c set_extent.c srb_append.c srb_read.c \ - srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) \ - testmeta.c $(ttsafe_SOURCES) unlink.c -DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c \ - cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c \ - enum.c err_compat.c error_test.c extend.c external.c \ +SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \ + btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c \ + dtypes.c enum.c err_compat.c error_test.c extend.c external.c \ + file_handle.c filename.c fillval.c flush1.c flush2.c getname.c \ + gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c \ + ntypes.c ohdr.c reserved.c set_extent.c srb_append.c \ + srb_read.c srb_write.c stab.c stream_test.c \ + $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c +DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \ + btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c \ + dtypes.c enum.c err_compat.c error_test.c extend.c external.c \ file_handle.c filename.c fillval.c flush1.c flush2.c getname.c \ gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c \ ntypes.c ohdr.c reserved.c set_extent.c srb_append.c \ @@ -485,7 +489,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \ fillval mount flush1 flush2 enum \ set_extent srb_write srb_append srb_read ttsafe stream_test \ getname file_handle ntypes dangle dtransform filename reserved \ - btree2 + btree2 blocktrack # The libh5test.a library provides common support code for the tests. @@ -524,7 +528,7 @@ MOSTLYCLEANFILES = cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ - unlink_chunked.h5 btree2.h5 + unlink_chunked.h5 btree2.h5 blocktrack.h5 # Sources for testhdf5 executable @@ -602,6 +606,9 @@ big$(EXEEXT): $(big_OBJECTS) $(big_DEPENDENCIES) bittests$(EXEEXT): $(bittests_OBJECTS) $(bittests_DEPENDENCIES) @rm -f bittests$(EXEEXT) $(LINK) $(bittests_LDFLAGS) $(bittests_OBJECTS) $(bittests_LDADD) $(LIBS) +blocktrack$(EXEEXT): $(blocktrack_OBJECTS) $(blocktrack_DEPENDENCIES) + @rm -f blocktrack$(EXEEXT) + $(LINK) $(blocktrack_LDFLAGS) $(blocktrack_OBJECTS) $(blocktrack_LDADD) $(LIBS) btree2$(EXEEXT): $(btree2_OBJECTS) $(btree2_DEPENDENCIES) @rm -f btree2$(EXEEXT) $(LINK) $(btree2_LDFLAGS) $(btree2_OBJECTS) $(btree2_LDADD) $(LIBS) @@ -725,6 +732,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bittests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blocktrack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btree2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@ diff --git a/test/blocktrack.c b/test/blocktrack.c new file mode 100644 index 0000000..992e54d --- /dev/null +++ b/test/blocktrack.c @@ -0,0 +1,138 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Wednesday, March 9, 2005 + */ +#include "h5test.h" + +/* + * This file needs to access private datatypes from the H5BT package. + */ +#define H5BT_PACKAGE +#include "H5BTpkg.h" + +/* Other private headers that this test requires */ +#include "H5Iprivate.h" + +const char *FILENAME[] = { + "blocktrack", + NULL +}; + + +/*------------------------------------------------------------------------- + * Function: test_create + * + * Purpose: Basic tests for the block tracker code + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Quincey Koziol + * Wednesday, March 9, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_create(hid_t fapl) +{ + hid_t file=-1; + char filename[1024]; + H5F_t *f=NULL; + haddr_t bt_addr; /* Address of block tracker created */ + + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + /* Create the file to work on */ + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR; + + /* Get a pointer to the internal file object */ + if (NULL==(f=H5I_object(file))) { + H5Eprint_stack(H5E_DEFAULT, stdout); + TEST_ERROR; + } + + /* + * Test block tracker creation + */ + TESTING("Block tracker creation"); + if (H5BT_create(f, H5P_DATASET_XFER_DEFAULT, &bt_addr/*out*/)<0) { + H5_FAILED(); + H5Eprint_stack(H5E_DEFAULT, stdout); + goto error; + } + PASSED(); + + if (H5Fclose(file)<0) TEST_ERROR; + + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_create() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Test the block tracker code + * + * Return: Success: + * + * Failure: + * + * Programmer: Quincey Koziol + * Wednesday, March 9, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fapl=-1; + int nerrors=0; + + /* Reset library */ + h5_reset(); + fapl = h5_fileaccess(); + + /* Test block tracker creation */ + nerrors += test_create(fapl); + + if (nerrors) goto error; + puts("All block tracker tests passed."); +#ifndef QAK + h5_cleanup(FILENAME, fapl); +#else /* QAK */ +HDfprintf(stderr,"Uncomment cleanup!\n"); +#endif /* QAK */ + return 0; + +error: + puts("*** TESTS FAILED ***"); + H5E_BEGIN_TRY { + H5Pclose(fapl); + } H5E_END_TRY; + return 1; +} + |