From 657ff95e968aa127e3145098a9731332819ac71e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 30 Jul 2001 14:52:34 -0500 Subject: [svn-r4279] Purpose: Additional test Description: Added metadata cache abuser code to the 'timings' target in the tests. Platforms Tested: FreeBSD 4.3 (hawkwind) --- test/Makefile.in | 17 +++-- test/testmeta.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 237 insertions(+), 7 deletions(-) create mode 100644 test/testmeta.c diff --git a/test/Makefile.in b/test/Makefile.in index 4cd2df2..77cd888 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -22,7 +22,7 @@ TEST_PROGS=testhdf5 lheap ohdr stab gheap hyperslab istore bittests dtypes \ flush1 flush2 enum gass_write gass_read gass_append dpss_write \ dpss_read srb_write srb_append srb_read ttsafe stream_test -TIMINGS=iopipe chunk overhead +TIMINGS=iopipe chunk overhead testmeta ## The libh5test.a library provides common support code for the tests. We link ## this library statically because some systems can only link executables to @@ -46,9 +46,9 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \ gheap1.h5 gheap2.h5 gheap3.h5 gheap4.h5 links.h5 chunk.h5 \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 dtypes1.h5 dtypes2.h5 \ tattr.h5 tselect.h5 mtime.h5 unlink.h5 overhead.h5 \ - fillval_[0-9].h5 fillval.raw mount_[0-9].h5 ttime.h5 trefer[12].h5 \ - tvltypes.h5 tvlstr.h5 flush.h5 enum1.h5 titerate.h5 ttsafe.h5 \ - tarray1.h5 tgenprop.h5 + fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 \ + ttime.h5 trefer[12].h5 tvltypes.h5 tvlstr.h5 flush.h5 enum1.h5 \ + titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 CLEAN=$(TIMINGS) ## Source and object files for programs... The TEST_SRC list contains all the @@ -57,9 +57,9 @@ CLEAN=$(TIMINGS) ## overlap with other tests. TEST_SRC=big.c bittests.c chunk.c cmpd_dset.c dsets.c dtypes.c extend.c \ - external.c fillval.c flush1.c flush2.c gheap.c h5test.c hyperslab.c \ - iopipe.c istore.c lheap.c links.c mount.c mtime.c ohdr.c overhead.c \ - stab.c tarray.c tattr.c testhdf5.c tfile.c tgenprop.c th5s.c \ + external.c fillval.c flush1.c flush2.c gheap.c h5test.c hyperslab.c \ + iopipe.c istore.c lheap.c links.c mount.c mtime.c ohdr.c overhead.c \ + stab.c tarray.c tattr.c testhdf5.c testmeta.c tfile.c tgenprop.c th5s.c \ titerate.c tmeta.c trefer.c tselect.c ttime.c ttbbt.c tvltypes.c tvlstr.c \ unlink.c enum.c ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c gass_write.c gass_read.c gass_append.c dpss_read.c \ @@ -195,5 +195,8 @@ srb_append: srb_append.lo stream_test: stream_test.lo @$(LT_LINK_EXE) $(CFLAGS) -o $@ stream_test.lo $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS) +testmeta: testmeta.lo + @$(LT_LINK_EXE) $(CFLAGS) -o $@ testmeta.lo $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS) + @CONCLUDE@ diff --git a/test/testmeta.c b/test/testmeta.c new file mode 100644 index 0000000..0a77c77 --- /dev/null +++ b/test/testmeta.c @@ -0,0 +1,227 @@ +/* + * This program illustrates assertion errors when linked + * to HDF5 1.4.1-post2 or 1.4.2-pre3 debug library. + * + * If the assertion errors are ignored, the program eventially causes + * an error in H5Gcreate when writing object 83381. + * + * When writing in single file mode, the assertion errors still occur + * but the H5Gcreate error does not. + */ + + +#include "hdf5.h" + +#define FILEN "testmeta.h5" + +#define MEMB_SIZE 100000000 +#define CHUNK_SIZE 512 + +#define NDATAARRAYS 3 +/*#define NPOINTS 2048*/ +#define NPOINTS 20 +#define NEXTARRAYS 10 +#define NWATTRS 2 +#define NDATAOBJECTS 100000 + +int main(void) +{ + hid_t file_id, prop_id, memspace_id, type_id; + hid_t group_id, access_plist; + hid_t dataset_id, dataspace_id, s_dataspace_id; + herr_t status; + hsize_t dims[1]; + hsize_t maxdims[1]; + float data[NPOINTS]; + float floatval; + unsigned numdataobj = 0; + unsigned i, j; + char name[80]; + hssize_t start[1] = {0}; + hsize_t stride[1] = {1}; + hsize_t count[1] = {1}; + + /* Create a file */ + file_id = H5Fcreate(FILEN, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create a dataset to hold the number of data objects */ + /* Create the data space */ + dataspace_id = H5Screate(H5S_SCALAR); + + /* Create dataset */ + dataset_id = H5Dcreate(file_id, "/NumDataObj", + H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT); + + /* Write value to NumDataObj dataset */ + status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, + H5S_ALL, H5P_DEFAULT, &numdataobj); + + /* Close the identifiers */ + status = H5Dclose(dataset_id); + status = H5Sclose(dataspace_id); + + /* Create extendible arrays */ + /* Set up for extendible dataset */ + prop_id = H5Pcreate(H5P_DATASET_CREATE); + dims[0] = CHUNK_SIZE; + status = H5Pset_chunk(prop_id, 1, dims); + + /* Create dataspace */ + dims[0]=1; + maxdims[0]=H5S_UNLIMITED; + dataspace_id = H5Screate_simple(1, dims, maxdims); + + for(i=0; i