summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am5
-rw-r--r--test/Makefile.in61
-rw-r--r--test/b+tree.c209
-rw-r--r--test/h5test.h3
4 files changed, 248 insertions, 30 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index c200e3c..55e6537 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -29,8 +29,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
-# JAMES debug: removed btree2 and cache tests since they take so long.
-TEST_PROG=testhdf5 lheap ohdr stab gheap cache btree2 blocktrack sheap \
+TEST_PROG=testhdf5 lheap ohdr stab gheap cache b+tree btree2 blocktrack sheap \
pool hyperslab istore bittests dt_arith \
dtypes dsets cmpd_dset extend external links unlink big mtime \
fillval mount flush1 flush2 enum \
@@ -91,7 +90,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 blocktrack.h5 sheap.h5
+ unlink_chunked.h5 btree2.h5 blocktrack.h5 sheap.h5 b+tree.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 94c8887..3e42d63 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 blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.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 pool.c reserved.c set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
+SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.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 pool.c reserved.c set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -71,17 +71,21 @@ libh5test_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libh5test_la_OBJECTS = h5test.lo testframe.lo
libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS)
am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
- stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) btree2$(EXEEXT) \
- blocktrack$(EXEEXT) sheap$(EXEEXT) pool$(EXEEXT) \
- hyperslab$(EXEEXT) istore$(EXEEXT) bittests$(EXEEXT) \
- dt_arith$(EXEEXT) dtypes$(EXEEXT) dsets$(EXEEXT) \
- cmpd_dset$(EXEEXT) extend$(EXEEXT) external$(EXEEXT) \
- links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) \
- fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \
+ stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) b+tree$(EXEEXT) \
+ btree2$(EXEEXT) blocktrack$(EXEEXT) sheap$(EXEEXT) \
+ pool$(EXEEXT) hyperslab$(EXEEXT) istore$(EXEEXT) \
+ bittests$(EXEEXT) dt_arith$(EXEEXT) dtypes$(EXEEXT) \
+ dsets$(EXEEXT) cmpd_dset$(EXEEXT) extend$(EXEEXT) \
+ external$(EXEEXT) links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) \
+ mtime$(EXEEXT) fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \
flush2$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \
ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \
vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
dtransform$(EXEEXT) filename$(EXEEXT) reserved$(EXEEXT)
+b_tree_SOURCES = b+tree.c
+b_tree_OBJECTS = b+tree.$(OBJEXT)
+b_tree_LDADD = $(LDADD)
+b_tree_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
big_SOURCES = big.c
big_OBJECTS = big.$(OBJEXT)
big_LDADD = $(LDADD)
@@ -266,22 +270,22 @@ 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 blocktrack.c \
- btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c \
- dtransform.c dtypes.c enum.c err_compat.c error_test.c \
- extend.c external.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 pool.c reserved.c set_extent.c sheap.c \
- stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c \
- $(ttsafe_SOURCES) unlink.c vfd.c
-DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \
- btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c \
- dtransform.c dtypes.c enum.c err_compat.c error_test.c \
- extend.c external.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 pool.c reserved.c set_extent.c sheap.c \
- stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c \
- $(ttsafe_SOURCES) unlink.c vfd.c
+SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \
+ blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c \
+ dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \
+ error_test.c extend.c external.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 pool.c reserved.c \
+ set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) \
+ testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
+DIST_SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \
+ blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c \
+ dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \
+ error_test.c extend.c external.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 pool.c reserved.c \
+ set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) \
+ testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -514,7 +518,7 @@ MOSTLYCLEANFILES = *.chkexe *.chksh cmpd_dset.h5 compact_dataset.h5 \
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 blocktrack.h5 \
- sheap.h5
+ sheap.h5 b+tree.h5
INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
# Test script for error_test and err_compat
@@ -523,8 +527,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
-# JAMES debug: removed btree2 and cache tests since they take so long.
-TEST_PROG = testhdf5 lheap ohdr stab gheap cache btree2 blocktrack sheap \
+TEST_PROG = testhdf5 lheap ohdr stab gheap cache b+tree btree2 blocktrack sheap \
pool hyperslab istore bittests dt_arith \
dtypes dsets cmpd_dset extend external links unlink big mtime \
fillval mount flush1 flush2 enum \
@@ -623,6 +626,9 @@ clean-checkPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
+b+tree$(EXEEXT): $(b_tree_OBJECTS) $(b_tree_DEPENDENCIES)
+ @rm -f b+tree$(EXEEXT)
+ $(LINK) $(b_tree_LDFLAGS) $(b_tree_OBJECTS) $(b_tree_LDADD) $(LIBS)
big$(EXEEXT): $(big_OBJECTS) $(big_DEPENDENCIES)
@rm -f big$(EXEEXT)
$(LINK) $(big_LDFLAGS) $(big_OBJECTS) $(big_LDADD) $(LIBS)
@@ -753,6 +759,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/b+tree.Po@am__quote@
@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@
diff --git a/test/b+tree.c b/test/b+tree.c
new file mode 100644
index 0000000..39b174b
--- /dev/null
+++ b/test/b+tree.c
@@ -0,0 +1,209 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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>
+ * Tuesday, April 19, 2005
+ */
+#include "h5test.h"
+
+/*
+ * This file needs to access private datatypes from the H5BP package.
+ * This file also needs to access the B+ tree testing code.
+ */
+#define H5BP_PACKAGE
+#define H5BP_TESTING
+#include "H5BPpkg.h"
+
+/* Other private headers that this test requires */
+#include "H5Iprivate.h"
+
+const char *FILENAME[] = {
+ "b+tree",
+ NULL
+};
+
+#define NODE_SIZE 512
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_create
+ *
+ * Purpose: Basic tests for the B+ tree code
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, April 19, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_create(hid_t fapl)
+{
+ hid_t file=-1;
+ char filename[1024];
+ H5F_t *f=NULL;
+ haddr_t bpt_addr; /* Address of B+ tree 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)
+ STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if (NULL==(f=H5I_object(file)))
+ STACK_ERROR
+
+ /*
+ * Test B+ tree creation
+ */
+ TESTING("B+ tree creation");
+ if (H5BP_create(f, H5P_DATASET_XFER_DEFAULT, H5BP_TEST, NODE_SIZE, 100, 40, &bpt_addr/*out*/)<0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ if (H5Fclose(file)<0)
+ STACK_ERROR
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_insert_basic
+ *
+ * Purpose: Basic tests for the B+ tree code
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, April 19, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_insert_basic(hid_t fapl)
+{
+ hid_t file=-1;
+ char filename[1024];
+ H5F_t *f=NULL;
+ char *record; /* Record to insert into tree */
+ haddr_t bpt_addr; /* Address of B+ tree created */
+ herr_t ret; /* Generic error return value */
+
+ 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)
+ STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if (NULL==(f=H5I_object(file)))
+ STACK_ERROR
+
+ /* Create B+ tree */
+ if (H5BP_create(f, H5P_DATASET_XFER_DEFAULT, H5BP_TEST, NODE_SIZE, 100, 40, &bpt_addr/*out*/)<0)
+ FAIL_STACK_ERROR
+
+ /*
+ * Test B+ tree creation
+ */
+ TESTING("B+ tree single record insert");
+ record="Foo!";
+ if (H5BP_insert(f, H5P_DATASET_XFER_DEFAULT, H5BP_TEST, bpt_addr, &record)<0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ if (H5Fclose(file)<0)
+ STACK_ERROR
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_insert_basic() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Test the B+ tree code
+ *
+ * Return: Success:
+ *
+ * Failure:
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, April 19, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl=-1;
+ int nerrors=0;
+
+ /* Reset library */
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ /* Test B+ tree creation */
+ nerrors += test_create(fapl);
+
+ /* Test B+ tree record insertion */
+ /* Iteration, find & index routines tested in these routines as well */
+#ifdef QAK
+ nerrors += test_insert_basic(fapl);
+#endif /* QAK */
+
+ if (nerrors) goto error;
+ puts("All B+ tree 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;
+}
+
diff --git a/test/h5test.h b/test/h5test.h
index f261876..2d08ab7 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -103,6 +103,9 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define H5_WARNING() {puts("*WARNING*");fflush(stdout);}
#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
+#define STACK_ERROR {H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
+#define FAIL_STACK_ERROR {H5_FAILED(); AT(); \
+ H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
#ifdef __cplusplus
extern "C" {