summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-02-25 22:06:18 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-02-25 22:06:18 (GMT)
commit952d00e7f0f49c0895d937a3fed9abed4b25b7e1 (patch)
treefc5172f5729c61ba15c092d6c0e8f177c1d992a6 /test
parent99a3f4d8d4ee1ec3f61a377c1a96a3fe35e9990a (diff)
parentc4044e0c85778e6bd3eda61b7bfdf6bb0fd0a8e9 (diff)
downloadhdf5-952d00e7f0f49c0895d937a3fed9abed4b25b7e1.zip
hdf5-952d00e7f0f49c0895d937a3fed9abed4b25b7e1.tar.gz
hdf5-952d00e7f0f49c0895d937a3fed9abed4b25b7e1.tar.bz2
[svn-r26306] Merge r26296 through 26304 from trunk to vds branch.
It should no longer be necessary to use --enable-using-memchecker make check fails due to an issue with h5ls apparently unrelated to the merge Tested: ummon
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in6
-rw-r--r--test/th5s.c92
-rw-r--r--test/tselect.c164
3 files changed, 259 insertions, 3 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index f5a25ce..539bea4 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1072,15 +1072,15 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chkexe files are used to mark tests that have run successfully.
# .chklog files are output from those tests.
-# *.clog are from the MPE option.
+# *.clog and *.clog2 are from the MPE option.
# Temporary files. These files are the ones created by setting the
# HDF5_NOCLEANUP environment variable and running `make test' without
# specifying a file prefix or low-level driver. Changing the file
# prefix or low-level driver with environment variables will influence
# the temporary file name in ways that the makefile is not aware of.
-CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \
- compact_dataset.h5 dataset.h5 dset_offset.h5 \
+CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 accum.h5 \
+ cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \
max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \
huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \
copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 \
diff --git a/test/th5s.c b/test/th5s.c
index 43ad1bb..d3a651c 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -2207,6 +2207,97 @@ test_h5s_extent_equal(void)
/****************************************************************
**
+** test_h5s_extent_copy(): Exercise extent copy code
+**
+****************************************************************/
+static void
+test_h5s_extent_copy(void)
+{
+ hid_t spaces[14] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; /* Array of all dataspaces */
+ hid_t tmp_space = -1;
+ hsize_t d1_dims1[1] = {10}, /* 1-D dimensions */
+ d1_dims2[1] = {20},
+ d1_dims3[1] = {H5S_UNLIMITED};
+ hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */
+ d2_dims2[2] = {20, 20},
+ d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */
+ d3_dims2[3] = {20, 20, 20},
+ d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
+ htri_t ext_equal; /* Whether two dataspace extents are equal */
+ const unsigned num_spaces = sizeof(spaces) / sizeof(spaces[0]);
+ unsigned i, j;
+ herr_t ret; /* Generic error return */
+
+ /* Create dataspaces */
+ spaces[0] = H5Screate(H5S_NULL);
+ CHECK(spaces[0], FAIL, "H5Screate");
+
+ spaces[1] = H5Screate(H5S_SCALAR);
+ CHECK(spaces[1], FAIL, "H5Screate");
+
+ spaces[2] = H5Screate_simple(1, d1_dims1, NULL);
+ CHECK(spaces[2], FAIL, "H5Screate");
+ spaces[3] = H5Screate_simple(1, d1_dims2, NULL);
+ CHECK(spaces[3], FAIL, "H5Screate");
+ spaces[4] = H5Screate_simple(1, d1_dims1, d1_dims2);
+ CHECK(spaces[4], FAIL, "H5Screate");
+ spaces[5] = H5Screate_simple(1, d1_dims1, d1_dims3);
+ CHECK(spaces[5], FAIL, "H5Screate");
+
+ spaces[6] = H5Screate_simple(2, d2_dims1, NULL);
+ CHECK(spaces[6], FAIL, "H5Screate");
+ spaces[7] = H5Screate_simple(2, d2_dims2, NULL);
+ CHECK(spaces[7], FAIL, "H5Screate");
+ spaces[8] = H5Screate_simple(2, d2_dims1, d2_dims2);
+ CHECK(spaces[8], FAIL, "H5Screate");
+ spaces[9] = H5Screate_simple(2, d2_dims1, d2_dims3);
+ CHECK(spaces[9], FAIL, "H5Screate");
+
+ spaces[10] = H5Screate_simple(3, d3_dims1, NULL);
+ CHECK(spaces[10], FAIL, "H5Screate");
+ spaces[11] = H5Screate_simple(3, d3_dims2, NULL);
+ CHECK(spaces[11], FAIL, "H5Screate");
+ spaces[12] = H5Screate_simple(3, d3_dims1, d3_dims2);
+ CHECK(spaces[12], FAIL, "H5Screate");
+ spaces[13] = H5Screate_simple(3, d3_dims1, d3_dims3);
+ CHECK(spaces[13], FAIL, "H5Screate");
+
+ tmp_space = H5Screate(H5S_NULL);
+ CHECK(tmp_space, FAIL, "H5Screate");
+
+ /* Copy between all dataspace combinations. Note there are a few
+ * duplicates. */
+ for(i = 0; i < num_spaces; i++)
+ for(j = i; j < num_spaces; j++) {
+ /* Copy from i to j, unless the inner loop just restarted, in which
+ * case i and j are the same, so the second call to H5Sextent_copy()
+ * will test copying from i/j to i/j */
+ ret = H5Sextent_copy(tmp_space, spaces[j]);
+ CHECK(ret, FAIL, "H5Sextent_copy");
+ ext_equal = H5Sextent_equal(tmp_space, spaces[j]);
+ VERIFY(ext_equal, TRUE, "H5Sextent_equal");
+
+ /* Copy from j to i */
+ ret = H5Sextent_copy(tmp_space, spaces[i]);
+ CHECK(ret, FAIL, "H5Sextent_copy");
+ ext_equal = H5Sextent_equal(tmp_space, spaces[i]);
+ VERIFY(ext_equal, TRUE, "H5Sextent_equal");
+ } /* end for */
+
+ /* Close dataspaces */
+ for(i = 0; i < num_spaces; i++) {
+ ret = H5Sclose(spaces[i]);
+ CHECK(ret, FAIL, "H5Sclose");
+ spaces[i] = -1;
+ } /* end for */
+
+ ret = H5Sclose(tmp_space);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_h5s_extent_copy() */
+
+/****************************************************************
+**
** test_h5s(): Main H5S (dataspace) testing routine.
**
****************************************************************/
@@ -2230,6 +2321,7 @@ test_h5s(void)
test_h5s_chunk(); /* Exercise bug fix for chunked I/O */
test_h5s_extent_equal(); /* Test extent comparison code */
+ test_h5s_extent_copy(); /* Test extent copy code */
} /* test_h5s() */
diff --git a/test/tselect.c b/test/tselect.c
index d5a1f4c..b34d095 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -162,6 +162,12 @@
/* #defines for shape same / different rank tests */
#define SS_DR_MAX_RANK 5
+/* Information for regular hyperslab query test */
+#define SPACE13_RANK 3
+#define SPACE13_DIM1 50
+#define SPACE13_DIM2 50
+#define SPACE13_DIM3 50
+#define SPACE13_NPOINTS 4
/* Location comparison function */
@@ -13069,6 +13075,161 @@ test_select_bounds(void)
/****************************************************************
**
+** test_hyper_regular(): Tests query operations on regular hyperslabs
+**
+****************************************************************/
+static void
+test_hyper_regular(void)
+{
+ hid_t sid; /* Dataspace ID */
+ const hsize_t dims[SPACE13_RANK] = {SPACE13_DIM1, SPACE13_DIM2, SPACE13_DIM3}; /* Dataspace dimensions */
+ hsize_t coord[SPACE13_NPOINTS][SPACE13_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE13_RANK]; /* The start of the hyperslab */
+ hsize_t stride[SPACE13_RANK]; /* The stride between block starts for the hyperslab */
+ hsize_t count[SPACE13_RANK]; /* The number of blocks for the hyperslab */
+ hsize_t block[SPACE13_RANK]; /* The size of each block for the hyperslab */
+ hsize_t t_start[SPACE13_RANK]; /* Temporary start of the hyperslab */
+ hsize_t t_count[SPACE13_RANK]; /* Temporary number of blocks for the hyperslab */
+ hsize_t q_start[SPACE13_RANK]; /* The queried start of the hyperslab */
+ hsize_t q_stride[SPACE13_RANK]; /* The queried stride between block starts for the hyperslab */
+ hsize_t q_count[SPACE13_RANK]; /* The queried number of blocks for the hyperslab */
+ hsize_t q_block[SPACE13_RANK]; /* The queried size of each block for the hyperslab */
+ htri_t is_regular; /* Whether a hyperslab selection is regular */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing queries on regular hyperslabs\n"));
+
+ /* Create dataspace */
+ sid = H5Screate_simple(SPACE13_RANK, dims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Query if 'all' selection is regular hyperslab (should fail) */
+ H5E_BEGIN_TRY {
+ is_regular = H5Sis_regular_hyperslab(sid);
+ } H5E_END_TRY;
+ VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
+
+ /* Query regular hyperslab selection info (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+
+ /* Set 'none' selection */
+ ret = H5Sselect_none(sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
+
+ /* Query if 'none' selection is regular hyperslab (should fail) */
+ H5E_BEGIN_TRY {
+ is_regular = H5Sis_regular_hyperslab(sid);
+ } H5E_END_TRY;
+ VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
+
+ /* Query regular hyperslab selection info (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+
+ /* Set point selection */
+ coord[0][0] = 3; coord[0][1] = 3; coord[0][2] = 3;
+ coord[1][0] = 3; coord[1][1] = 48; coord[1][2] = 48;
+ coord[2][0] = 48; coord[2][1] = 3; coord[2][2] = 3;
+ coord[3][0] = 48; coord[3][1] = 48; coord[3][2] = 48;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE13_NPOINTS, (const hsize_t *)coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Query if 'point' selection is regular hyperslab (should fail) */
+ H5E_BEGIN_TRY {
+ is_regular = H5Sis_regular_hyperslab(sid);
+ } H5E_END_TRY;
+ VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
+
+ /* Query regular hyperslab selection info (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+
+ /* Set "regular" hyperslab selection */
+ start[0] = 2; start[1] = 2; start[2] = 2;
+ stride[0] = 5; stride[1] = 5; stride[2] = 5;
+ count[0] = 3; count[1] = 3; count[2] = 3;
+ block[0] = 4; block[1] = 4; block[2] = 4;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */
+ is_regular = H5Sis_regular_hyperslab(sid);
+ VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab");
+
+ /* Retrieve the hyperslab parameters */
+ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
+ CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
+
+ /* Verify the hyperslab parameters */
+ for(u = 0; u < SPACE13_RANK; u++) {
+ if(start[u] != q_start[u])
+ ERROR("H5Sget_regular_hyperslab, start");
+ if(stride[u] != q_stride[u])
+ ERROR("H5Sget_regular_hyperslab, stride");
+ if(count[u] != q_count[u])
+ ERROR("H5Sget_regular_hyperslab, count");
+ if(block[u] != q_block[u])
+ ERROR("H5Sget_regular_hyperslab, block");
+ } /* end for */
+
+ /* 'OR' in another point */
+ t_start[0] = 0; t_start[1] = 0; t_start[2] = 0;
+ t_count[0] = 1; t_count[1] = 1; t_count[2] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, t_start, NULL, t_count, NULL);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Query if 'hyperslab' selection is regular hyperslab (should be FALSE) */
+ is_regular = H5Sis_regular_hyperslab(sid);
+ VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab");
+
+ /* Query regular hyperslab selection info (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
+
+ /* 'XOR' in the point again, to remove it, which should make it regular again */
+ t_start[0] = 0; t_start[1] = 0; t_start[2] = 0;
+ t_count[0] = 1; t_count[1] = 1; t_count[2] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_XOR, t_start, NULL, t_count, NULL);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */
+ is_regular = H5Sis_regular_hyperslab(sid);
+ VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab");
+
+ /* Retrieve the hyperslab parameters */
+ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
+ CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
+
+ /* Verify the hyperslab parameters */
+ for(u = 0; u < SPACE13_RANK; u++) {
+ if(start[u] != q_start[u])
+ ERROR("H5Sget_regular_hyperslab, start");
+ if(stride[u] != q_stride[u])
+ ERROR("H5Sget_regular_hyperslab, stride");
+ if(count[u] != q_count[u])
+ ERROR("H5Sget_regular_hyperslab, count");
+ if(block[u] != q_block[u])
+ ERROR("H5Sget_regular_hyperslab, block");
+ } /* end for */
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_hyper_regular() */
+
+/****************************************************************
+**
** test_select(): Main H5S selection testing routine.
**
****************************************************************/
@@ -13228,6 +13389,9 @@ test_select(void)
/* Test selection bounds with & without offsets */
test_select_bounds();
+ /* Test 'regular' hyperslab query routines */
+ test_hyper_regular();
+
} /* test_select() */