diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/Makefile.in | 78 | ||||
-rw-r--r-- | test/btree2.c | 139 |
3 files changed, 58 insertions, 162 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index bfd7b30..06dc69e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -32,7 +32,8 @@ TEST_PROG=testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \ dtypes dsets cmpd_dset extend external links unlink big mtime \ fillval mount flush1 flush2 enum gass_write gass_read gass_append \ set_extent srb_write srb_append srb_read ttsafe stream_test \ - getname file_handle ntypes dangle dtransform filename reserved + getname file_handle ntypes dangle dtransform filename reserved \ + btree2 # 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. diff --git a/test/Makefile.in b/test/Makefile.in index 4debd14..243ed00 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -212,7 +212,8 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \ dtypes dsets cmpd_dset extend external links unlink big mtime \ fillval mount flush1 flush2 enum gass_write gass_read gass_append \ set_extent srb_write srb_append srb_read ttsafe stream_test \ - getname file_handle ntypes dangle dtransform filename reserved + getname file_handle ntypes dangle dtransform filename reserved \ + btree2 # List programs to be built when testing here. error_test and err_compat are @@ -298,7 +299,8 @@ check_PROGRAMS = 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) \ - error_test$(EXEEXT) err_compat$(EXEEXT) testmeta$(EXEEXT) + btree2$(EXEEXT) error_test$(EXEEXT) err_compat$(EXEEXT) \ + testmeta$(EXEEXT) big_SOURCES = big.c big_OBJECTS = big.$(OBJEXT) big_LDADD = $(LDADD) @@ -309,6 +311,11 @@ bittests_OBJECTS = bittests.$(OBJEXT) bittests_LDADD = $(LDADD) bittests_DEPENDENCIES = libh5test.la $(top_builddir)/src/libhdf5.la bittests_LDFLAGS = +btree2_SOURCES = btree2.c +btree2_OBJECTS = btree2.$(OBJEXT) +btree2_LDADD = $(LDADD) +btree2_DEPENDENCIES = libh5test.la $(top_builddir)/src/libhdf5.la +btree2_LDFLAGS = cache_SOURCES = cache.c cache_OBJECTS = cache.$(OBJEXT) cache_LDADD = $(LDADD) @@ -525,35 +532,36 @@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/bin/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/big.Po ./$(DEPDIR)/bittests.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/cache.Po ./$(DEPDIR)/cmpd_dset.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/dangle.Po ./$(DEPDIR)/dsets.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/dtransform.Po ./$(DEPDIR)/dtypes.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/enum.Po ./$(DEPDIR)/err_compat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/error_test.Po ./$(DEPDIR)/extend.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/external.Po ./$(DEPDIR)/file_handle.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/filename.Po ./$(DEPDIR)/fillval.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/flush1.Po ./$(DEPDIR)/flush2.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/gass_append.Po ./$(DEPDIR)/gass_read.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/gass_write.Po ./$(DEPDIR)/getname.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/gheap.Po ./$(DEPDIR)/h5test.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/hyperslab.Po ./$(DEPDIR)/istore.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/lheap.Po ./$(DEPDIR)/links.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/mount.Po ./$(DEPDIR)/mtime.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntypes.Po ./$(DEPDIR)/ohdr.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reserved.Po ./$(DEPDIR)/set_extent.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/srb_append.Po ./$(DEPDIR)/srb_read.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/srb_write.Po ./$(DEPDIR)/stab.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/stream_test.Po ./$(DEPDIR)/tarray.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tattr.Po ./$(DEPDIR)/tconfig.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/testframe.Plo ./$(DEPDIR)/testhdf5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/testmeta.Po ./$(DEPDIR)/tfile.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tgenprop.Po ./$(DEPDIR)/th5s.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/theap.Po ./$(DEPDIR)/tid.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/titerate.Po ./$(DEPDIR)/tmeta.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tmisc.Po ./$(DEPDIR)/trefer.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/trefstr.Po ./$(DEPDIR)/tselect.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tskiplist.Po ./$(DEPDIR)/ttime.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe.Po ./$(DEPDIR)/ttsafe_acreate.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/btree2.Po ./$(DEPDIR)/cache.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/cmpd_dset.Po ./$(DEPDIR)/dangle.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dsets.Po ./$(DEPDIR)/dtransform.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dtypes.Po ./$(DEPDIR)/enum.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/err_compat.Po ./$(DEPDIR)/error_test.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/extend.Po ./$(DEPDIR)/external.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/file_handle.Po ./$(DEPDIR)/filename.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/fillval.Po ./$(DEPDIR)/flush1.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/flush2.Po ./$(DEPDIR)/gass_append.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gass_read.Po ./$(DEPDIR)/gass_write.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/getname.Po ./$(DEPDIR)/gheap.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/h5test.Plo ./$(DEPDIR)/hyperslab.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/istore.Po ./$(DEPDIR)/lheap.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/links.Po ./$(DEPDIR)/mount.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/mtime.Po ./$(DEPDIR)/ntypes.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ohdr.Po ./$(DEPDIR)/reserved.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/set_extent.Po ./$(DEPDIR)/srb_append.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/srb_read.Po ./$(DEPDIR)/srb_write.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/stab.Po ./$(DEPDIR)/stream_test.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tarray.Po ./$(DEPDIR)/tattr.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tconfig.Po ./$(DEPDIR)/testframe.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/testhdf5.Po ./$(DEPDIR)/testmeta.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tfile.Po ./$(DEPDIR)/tgenprop.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/th5s.Po ./$(DEPDIR)/theap.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tid.Po ./$(DEPDIR)/titerate.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tmeta.Po ./$(DEPDIR)/tmisc.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/trefer.Po ./$(DEPDIR)/trefstr.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tselect.Po ./$(DEPDIR)/tskiplist.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ttime.Po ./$(DEPDIR)/ttsafe.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_acreate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_cancel.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_dcreate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_error.Po ./$(DEPDIR)/ttst.Po \ @@ -567,7 +575,7 @@ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ -DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.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 file_handle.c \ filename.c fillval.c flush1.c flush2.c gass_append.c \ @@ -577,7 +585,7 @@ DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.c \ stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) \ unlink.c DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(libh5test_la_SOURCES) big.c bittests.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 gass_append.c gass_read.c gass_write.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 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 gass_append.c gass_read.c gass_write.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 all: all-am @@ -612,6 +620,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) +btree2$(EXEEXT): $(btree2_OBJECTS) $(btree2_DEPENDENCIES) + @rm -f btree2$(EXEEXT) + $(LINK) $(btree2_LDFLAGS) $(btree2_OBJECTS) $(btree2_LDADD) $(LIBS) cache$(EXEEXT): $(cache_OBJECTS) $(cache_DEPENDENCIES) @rm -f cache$(EXEEXT) $(LINK) $(cache_LDFLAGS) $(cache_OBJECTS) $(cache_LDADD) $(LIBS) @@ -741,6 +752,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)/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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@ diff --git a/test/btree2.c b/test/btree2.c index 312f149..f0d13b1 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -19,8 +19,10 @@ /* * This file needs to access private datatypes from the H5B2 package. + * This file also needs to access the v2 B-tree testing code. */ #define H5B2_PACKAGE +#define H5B2_TESTING #include "H5B2pkg.h" /* Other private headers that this test requires */ @@ -35,125 +37,6 @@ const char *FILENAME[] = { /*------------------------------------------------------------------------- - * Function: store - * - * Purpose: Store native information into record for B-tree - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, February 3, 2005 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -store(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *udata, void *nrecord) -{ - *(hsize_t *)nrecord=*(const hsize_t *)udata; - -#ifdef QAK -HDfprintf(stderr,"store: udata=%Hu\n",*(const hsize_t *)udata); -#endif /* QAK */ - return(SUCCEED); -} - - -/*------------------------------------------------------------------------- - * Function: compare - * - * Purpose: Compare two native information records, according to some key - * - * Return: <0 if rec1 < rec2 - * =0 if rec1 == rec2 - * >0 if rec1 > rec2 - * - * Programmer: Quincey Koziol - * Thursday, February 3, 2005 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -compare(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *rec1, const void *rec2) -{ -#ifdef QAK -HDfprintf(stderr,"compare: *rec1=%Hu, *rec2=%Hu\n",*(const hsize_t *)rec1,*(const hsize_t *)rec2); -#endif /* QAK */ - return(*(const hssize_t *)rec1-*(const hssize_t *)rec2); -} - - -/*------------------------------------------------------------------------- - * Function: encode - * - * Purpose: Encode native information into raw form for storing on disk - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, February 3, 2005 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -encode(const H5F_t *f, uint8_t *raw, const void *nrecord) -{ - H5F_ENCODE_LENGTH(f, raw, *(const hsize_t *)nrecord); - -#ifdef QAK -HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord); -#endif /* QAK */ - return(SUCCEED); -} - - -/*------------------------------------------------------------------------- - * Function: decode - * - * Purpose: Decode raw disk form of record into native form - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Friday, February 4, 2005 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -decode(const H5F_t *f, const uint8_t *raw, void *nrecord) -{ - H5F_DECODE_LENGTH(f, raw, *(hsize_t *)nrecord); - -#ifdef QAK -HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord); -#endif /* QAK */ - return(SUCCEED); -} - -H5B2_class_t type={ /* B-tree class information */ - 0, /* Type of B-tree */ - sizeof(hsize_t), /* Size of native key */ - store, /* Record storage callback */ - compare, /* Record comparison callback */ - encode, /* Record encoding callback */ - decode /* Record decoding callback */ -}; - - -/*------------------------------------------------------------------------- * Function: test_insert_basic * * Purpose: Basic tests for the B-tree v2 code @@ -193,7 +76,7 @@ test_insert_basic(hid_t fapl) * Test v2 B-tree creation */ TESTING("B-tree creation"); - if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &type, 512, 8, 100, 40, &bt2_addr/*out*/)<0) { + if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -205,7 +88,7 @@ test_insert_basic(hid_t fapl) */ TESTING("B-tree insert"); record=42; - if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) { + if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -215,7 +98,7 @@ test_insert_basic(hid_t fapl) * Test inserting second record into v2 B-tree, before all other records */ record=34; - if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) { + if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -225,7 +108,7 @@ test_insert_basic(hid_t fapl) * Test inserting third record into v2 B-tree, after all other records */ record=56; - if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) { + if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -235,7 +118,7 @@ test_insert_basic(hid_t fapl) * Test inserting fourth record into v2 B-tree, in the middle of other records */ record=38; - if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) { + if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -297,7 +180,7 @@ test_insert_split_root(hid_t fapl) /* * Test v2 B-tree creation */ - if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &type, 512, 8, 100, 40, &bt2_addr/*out*/)<0) { + if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -310,20 +193,20 @@ test_insert_split_root(hid_t fapl) for(u=0; u<INSERT_SPLIT_ROOT_NREC; u++) { record=u+10; - if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) { + if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } } record=0; - if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) { + if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } record=1; - if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) { + if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; |