summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt110
-rw-r--r--test/Makefile.in20
-rw-r--r--test/dsets.c4
-rw-r--r--test/dt_arith.c2
-rw-r--r--test/filter_fail.c89
-rw-r--r--test/testlibinfo.sh.in5
-rw-r--r--test/th5s.c4
-rw-r--r--test/tselect.c218
8 files changed, 302 insertions, 150 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0bec69f..7e12026 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -168,6 +168,78 @@ MACRO (ADD_H5_TEST file)
ADD_TEST (NAME ${file} COMMAND $<TARGET_FILE:${file}>)
ENDMACRO (ADD_H5_TEST file)
+# Remove any output file left over from previous test run
+ADD_TEST (
+ NAME h5test-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ cache_test.h5
+ coord.h5
+ dt_arith1.h5
+ dt_arith2.h5
+ dtransform.h5
+ dtypes4.h5
+ dtypes5.h5
+ extlinks16A00000.h5
+ extlinks16A00001.h5
+ extlinks16A00002.h5
+ extlinks16B-b.h5
+ extlinks16B-g.h5
+ extlinks16B-l.h5
+ extlinks16B-r.h5
+ extlinks16B-s.h5
+ extlinks19B00000.h5
+ extlinks19B00001.h5
+ extlinks19B00002.h5
+ extlinks19B00003.h5
+ extlinks19B00004.h5
+ extlinks19B00005.h5
+ extlinks19B00006.h5
+ extlinks19B00007.h5
+ extlinks19B00008.h5
+ extlinks19B00009.h5
+ extlinks19B00010.h5
+ extlinks19B00011.h5
+ extlinks19B00012.h5
+ extlinks19B00013.h5
+ extlinks19B00014.h5
+ extlinks19B00015.h5
+ extlinks19B00016.h5
+ extlinks19B00017.h5
+ extlinks19B00018.h5
+ extlinks19B00019.h5
+ extlinks19B00020.h5
+ extlinks19B00021.h5
+ extlinks19B00022.h5
+ extlinks19B00023.h5
+ extlinks19B00024.h5
+ extlinks19B00025.h5
+ extlinks19B00026.h5
+ extlinks19B00027.h5
+ extlinks19B00028.h5
+ fheap.h5
+ objcopy_ext.h5
+ sys_file1
+ tattr.h5
+ testmeta.h5
+ tfile1.h5
+ tfile2.h5
+ tfile3.h5
+ tfile4.h5
+ tfile5.h5
+ th5o_file
+ th5s1.h5
+ th5s2.h5
+ th5s3.h5
+ tnullspace.h5
+ tselect.h5
+ tsohm.h5
+ tsohm_dst.h5
+ tsohm_src.h5
+ tstint1.h5
+ tstint2.h5
+)
+
SET (H5_TESTS
lheap
ohdr
@@ -183,6 +255,7 @@ SET (H5_TESTS
dt_arith
dtypes
cmpd_dset
+ filter_fail
extend
external
objcopy
@@ -270,6 +343,43 @@ TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>)
+IF (HDF5_TEST_VFD)
+
+ SET (VFD_LIST
+ sec2
+ stdio
+ core
+ split
+ multi
+ family
+ )
+
+ IF (DIRECT_VFD)
+ SET (VFD_LIST ${VFD_LIST} direct)
+ ENDIF (DIRECT_VFD)
+
+ MACRO (ADD_VFD_TEST vfdname resultcode)
+ FOREACH (test ${H5_TESTS})
+ ADD_TEST (
+ NAME VFD-${vfdname}-${test}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${test}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ ENDFOREACH (test ${H5_TESTS})
+ ENDMACRO (ADD_VFD_TEST)
+
+ # Run test with different Virtual File Driver
+ FOREACH (vfd ${VFD_LIST})
+ ADD_VFD_TEST (${vfd} 0)
+ ENDFOREACH (vfd ${VFD_LIST})
+
+ENDIF (HDF5_TEST_VFD)
+
##############################################################################
##############################################################################
### T H E G E N E R A T O R S ###
diff --git a/test/Makefile.in b/test/Makefile.in
index e91de4c..89a2e30 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -682,14 +682,24 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la
LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
+# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
+# has been removed. According to the official description of DESTDIR by Gnu at
+# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
+# prepended to the normal and complete install path that it precedes for the
+# purpose of installing in a temporary directory which is useful for building
+# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
+# '/' at the beginning of the normal install path. When DESTDIR is empty the
+# path then begins with '//', which is incorrect and causes problems at least for
+# Cygwin.
+
# Scripts used to build examples
# If only shared libraries have been installed, have h5cc build examples with
# shared libraries instead of static libraries
-H5CC = $(bindir)/h5cc
-H5CC_PP = $(bindir)/h5pcc
-H5FC = $(bindir)/h5fc
-H5FC_PP = $(bindir)/h5pfc
-H5CPP = $(bindir)/h5c++
+H5CC = ${DESTDIR}$(bindir)/h5cc
+H5CC_PP = ${DESTDIR}$(bindir)/h5pcc
+H5FC = ${DESTDIR}$(bindir)/h5fc
+H5FC_PP = ${DESTDIR}$(bindir)/h5pfc
+H5CPP = ${DESTDIR}$(bindir)/h5c++
ACLOCAL_AMFLAGS = "-I m4"
# The trace script; this is used on source files from the C library to
diff --git a/test/dsets.c b/test/dsets.c
index 88ffe5d..de4443e 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -7854,7 +7854,7 @@ test_chunk_fast(hid_t fapl)
/* Fill existing elements */
for(u = 0; u < npoints; u++) {
/* Compute the coordinate from the linear offset */
- if(H5V_array_calc_pre(u, ndims, dim, down, hs_offset) < 0) FAIL_STACK_ERROR
+ if(H5V_array_calc_pre(u, ndims, down, hs_offset) < 0) FAIL_STACK_ERROR
/* Un-swizzle hyperslab offset in same way as swizzled dimensions */
H5V_unswizzle_coords(hs_offset, unlim_dim);
@@ -7979,7 +7979,7 @@ test_chunk_fast(hid_t fapl)
/* Read elements */
for(u = 0; u < npoints; u++) {
/* Compute the coordinate from the linear offset */
- if(H5V_array_calc_pre(u, ndims, swizzled_dim, down, hs_offset) < 0) FAIL_STACK_ERROR
+ if(H5V_array_calc_pre(u, ndims, down, hs_offset) < 0) FAIL_STACK_ERROR
/* Unswizzle hyperslab offset in same way as swizzled dimensions */
H5V_unswizzle_coords(hs_offset, unlim_dim);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 8d4b65b..413f326 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -5177,8 +5177,8 @@ run_int_fp_conv(const char *name)
static int
run_fp_int_conv(const char *name)
{
-#ifdef H5_FP_TO_INTEGER_OVERFLOW_WORKS
int nerrors = 0;
+#ifdef H5_FP_TO_INTEGER_OVERFLOW_WORKS
int test_values;
#ifdef H5_VMS
diff --git a/test/filter_fail.c b/test/filter_fail.c
index abb25cd..9b46421 100644
--- a/test/filter_fail.c
+++ b/test/filter_fail.c
@@ -25,13 +25,13 @@
#include "H5srcdir.h"
#define DSET_NAME "dset_fail"
-#define ONE_MB 1048576
#define H5Z_FILTER_FAIL_TEST 312
#define DIM 10
#define FILTER_CHUNK_DIM 2
const char *FILENAME[] = {
- "filter_fail",
+ "filter_fail_with_cache",
+ "filter_fail_without_cache",
NULL
};
@@ -70,9 +70,6 @@ filter_fail(unsigned int flags, size_t cd_nelmts,
size_t *buf_size, void **buf)
{
int *dst = (int*)(*buf);
- unsigned int offset;
- unsigned int length;
- unsigned int value;
size_t ret_value = 0;
if(flags & H5Z_FLAG_REVERSE) { /* do nothing during read */
@@ -89,7 +86,6 @@ filter_fail(unsigned int flags, size_t cd_nelmts,
}
} /* end else */
-error:
return ret_value;
} /* end filter_fail() */
@@ -112,27 +108,30 @@ error:
* 25 August 2010
*
* Modifications:
- *
+ * Raymond Lu
+ * 5 Oct 2010
+ * Test when the chunk cache is enable and disabled to make
+ * sure the library behaves properly.
*-------------------------------------------------------------------------
*/
static herr_t
-test_filter_write(char *file_name, hid_t my_fapl)
+test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled)
{
- char filename[1024];
hid_t file = -1;
hid_t dataset=-1; /* dataset ID */
hid_t sid=-1; /* dataspace ID */
hid_t dcpl=-1; /* dataset creation property list ID */
hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/
hsize_t chunk_dims[1]={FILTER_CHUNK_DIM}; /* chunk dimension - 2*/
- int nfilters; /* number of filters in DCPL */
- unsigned flags; /* flags for filter */
int points[DIM]; /* Data */
- int rbuf[DIM]; /* Data */
herr_t ret; /* generic return value */
int i;
- TESTING("data writing when a mandatory filter fails");
+ if(cache_enabled) {
+ TESTING("data writing when a mandatory filter fails and chunk cache is enabled");
+ } else {
+ TESTING("data writing when a mandatory filter fails and chunk cache is disabled");
+ }
/* Create file */
if((file = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
@@ -161,24 +160,44 @@ test_filter_write(char *file_name, hid_t my_fapl)
for(i = 0; i < DIM; i++)
points[i] = i;
- /* Write data */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points) < 0) TEST_ERROR
+ /* Write data. If the chunk cache is enabled, H5Dwrite should succeed. If it is
+ * diabled, H5Dwrite should fail. */
+ if(cache_enabled) {
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points) < 0)
+ TEST_ERROR
+ } else {
+ /* Data writing should fail */
+ H5E_BEGIN_TRY {
+ ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points);
+ } H5E_END_TRY;
+ if(ret >= 0) {
+ H5_FAILED();
+ puts(" Data writing is supposed to fail because the chunk can't be written to file.");
+ TEST_ERROR
+ }
+ }
/* clean up objects used for this test */
if(H5Pclose (dcpl) < 0) TEST_ERROR
if(H5Sclose (sid) < 0) TEST_ERROR
- /* Dataset closing should fail */
- H5E_BEGIN_TRY {
- ret = H5Dclose (dataset);
- } H5E_END_TRY;
- if(ret >= 0) {
- H5_FAILED();
- puts(" Dataset is supposed to fail because the chunk can't be flushed to file.");
- TEST_ERROR
+ /* Close dataset. If the chunk cache is enabled, the flushing of chunks should fail
+ * during H5Dclose. If it is diabled, H5Dwrite should fail but H5Dclose should succeed. */
+ if(cache_enabled) {
+ H5E_BEGIN_TRY {
+ ret = H5Dclose (dataset);
+ } H5E_END_TRY;
+ if(ret >= 0) {
+ H5_FAILED();
+ puts(" Dataset is supposed to fail because the chunk can't be flushed to file.");
+ TEST_ERROR
+ }
+ } else {
+ if(H5Dclose (dataset) < 0)
+ TEST_ERROR
}
- /* Even though H5Dclose fails, it should release all resources.
+ /* Even though H5Dclose or H5Dwrite fails, it should release all resources.
* So the file should close successfully. */
if(H5Fclose (file) < 0) TEST_ERROR
@@ -222,7 +241,6 @@ test_filter_read(char *file_name, hid_t my_fapl)
hid_t sid = -1;
hid_t mspace = -1;
hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/
- hsize_t chunk_dims[1]={FILTER_CHUNK_DIM}; /* chunk dimension - 2*/
int rbuf[DIM]; /* Data */
hsize_t dset_size = 0; /* Dataset storage size */
hsize_t hs_offset[H5S_MAX_RANK];
@@ -346,9 +364,9 @@ int main(void)
{
hid_t fapl;
int mdc_nelmts = 0;
- size_t rdcc_nelmts = 521;
- size_t rdcc_nbytes = ONE_MB;
- double rdcc_w0 = 0.75;
+ size_t rdcc_nelmts = 0;
+ size_t rdcc_nbytes = 0;
+ double rdcc_w0 = 0;
char filename[1024];
unsigned nerrors = 0;
@@ -357,12 +375,21 @@ int main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Make sure the chunk cache is used. All values are default. */
+ /* The chunk cache is used so that the flushing of data chunks happens
+ * during H5Dclose. All values are default. */
+ nerrors += (test_filter_write(filename, fapl, TRUE) < 0 ? 1 : 0);
+ nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
+
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+
+ /* Disable the chunk cache so that the writing of data chunks happens
+ * during H5Dwrite. */
if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
TEST_ERROR
- nerrors += (test_filter_write(filename, fapl) < 0 ? 1 : 0);
- nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
+ /* Run the test again. */
+ nerrors += (test_filter_write(filename, fapl, FALSE) < 0 ? 1 : 0);
+ nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
h5_cleanup(FILENAME, fapl);
diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in
index 97fb59d..5bcd300 100644
--- a/test/testlibinfo.sh.in
+++ b/test/testlibinfo.sh.in
@@ -84,6 +84,11 @@ case `uname -s` in
shlibsuffix=.dylib
break
;;
+ AIX) # AIX .a is already a shared lib
+ # this is a temporary patch.
+ shlibsuffix=.a
+ break
+ ;;
*) # default
shlibsuffix=.so
break
diff --git a/test/th5s.c b/test/th5s.c
index ddd61e3..52fbe76 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -1043,9 +1043,9 @@ test_h5s_chunk(void)
dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT);
CHECK(dsetID, FAIL, "H5Dopen2");
- status= H5Dread (dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl);
+ status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl);
CHECK(status, FAIL, "H5Dread");
- status= H5Dread (dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
+ status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
CHECK(status, FAIL, "H5Dread");
status = H5Dclose(dsetID);
diff --git a/test/tselect.c b/test/tselect.c
index 1fa98bf..1041ab3 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -12870,7 +12870,7 @@ static void
test_select_bounds(void)
{
hid_t sid; /* Dataspace ID */
- const hsize_t dims[SPACE11_RANK] = { SPACE11_DIM1, SPACE11_DIM2 }; /* Dataspace dimensions */
+ const hsize_t dims[SPACE11_RANK] = {SPACE11_DIM1, SPACE11_DIM2}; /* Dataspace dimensions */
hsize_t coord[SPACE11_NPOINTS][SPACE11_RANK]; /* Coordinates for point selection */
hsize_t start[SPACE11_RANK]; /* The start of the hyperslab */
hsize_t stride[SPACE11_RANK]; /* The stride between block starts for the hyperslab */
@@ -12889,178 +12889,178 @@ test_select_bounds(void)
CHECK(sid, FAIL, "H5Screate_simple");
/* Get bounds for 'all' selection */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],0,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 0, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 0, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], SPACE11_DIM1 - 1, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], SPACE11_DIM2 - 1, "H5Sget_select_bounds");
/* Set offset for selection */
- offset[0]=1; offset[1]=1;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 1; offset[1] = 1;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for 'all' selection with offset (which should be ignored) */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],0,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 0, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 0, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], SPACE11_DIM1 - 1, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], SPACE11_DIM2 - 1, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0]=0; offset[1]=0;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 0; offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Set 'none' selection */
- ret=H5Sselect_none(sid);
+ ret = H5Sselect_none(sid);
CHECK(ret, FAIL, "H5Sselect_none");
/* Get bounds for 'none' selection */
H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Sget_select_bounds");
-
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_select_bo unds");
+
/* Set point selection */
- coord[0][0]= 3; coord[0][1]= 3;
- coord[1][0]= 3; coord[1][1]= 96;
- coord[2][0]= 96; coord[2][1]= 3;
- coord[3][0]= 96; coord[3][1]= 96;
+ coord[0][0] = 3; coord[0][1] = 3;
+ coord[1][0] = 3; coord[1][1] = 96;
+ coord[2][0] = 96; coord[2][1] = 3;
+ coord[3][0] = 96; coord[3][1] = 96;
ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE11_NPOINTS, (const hsize_t *)coord);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Get bounds for point selection */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],3,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],3,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],SPACE11_DIM1-4,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],SPACE11_DIM2-4,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 3, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 3, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], SPACE11_DIM1 - 4, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], SPACE11_DIM2 - 4, "H5Sget_select_bounds");
/* Set bad offset for selection */
- offset[0]=5; offset[1]=-5;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 5; offset[1] = -5;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with negative offset */
H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_select_bounds");
/* Set valid offset for selection */
- offset[0]=2; offset[1]=-2;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 2; offset[1] = -2;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for point selection with offset */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],5,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],1,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],SPACE11_DIM1-2,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],SPACE11_DIM2-6,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 5, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 1, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], SPACE11_DIM1 - 2, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], SPACE11_DIM2 - 6, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0]=0; offset[1]=0;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 0; offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Set "regular" hyperslab selection */
- start[0]= 2; start[1]= 2;
- stride[0]= 10; stride[1]= 10;
- count[0]= 4; count[1]= 4;
- block[0]= 5; block[1]= 5;
- ret = H5Sselect_hyperslab(sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2; start[1] = 2;
+ stride[0] = 10; stride[1] = 10;
+ count[0] = 4; count[1] = 4;
+ block[0] = 5; block[1] = 5;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Get bounds for hyperslab selection */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],2,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],2,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],36,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],36,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 2, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 2, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], 36, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], 36, "H5Sget_select_bounds");
/* Set bad offset for selection */
- offset[0]=5; offset[1]=-5;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 5; offset[1] = -5;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with negative offset */
H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_select_bounds");
/* Set valid offset for selection */
- offset[0]=5; offset[1]=-2;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 5; offset[1] = -2;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with offset */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],7,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],41,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],34,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 7, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 0, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], 41, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], 34, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0]=0; offset[1]=0;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 0; offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Make "irregular" hyperslab selection */
- start[0]= 20; start[1]= 20;
- stride[0]= 20; stride[1]= 20;
- count[0]= 2; count[1]= 2;
- block[0]= 10; block[1]= 10;
- ret = H5Sselect_hyperslab(sid,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 20; start[1] = 20;
+ stride[0] = 20; stride[1] = 20;
+ count[0] = 2; count[1] = 2;
+ block[0] = 10; block[1] = 10;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Get bounds for hyperslab selection */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],2,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],2,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],49,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],49,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 2, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 2, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], 49, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], 49, "H5Sget_select_bounds");
/* Set bad offset for selection */
- offset[0]=5; offset[1]=-5;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 5; offset[1] = -5;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with negative offset */
H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_select_bounds");
/* Set valid offset for selection */
- offset[0]=5; offset[1]=-2;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 5; offset[1] = -2;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with offset */
- ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low_bounds[0],7,"H5Sget_select_bounds");
- VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
- VERIFY(high_bounds[0],54,"H5Sget_select_bounds");
- VERIFY(high_bounds[1],47,"H5Sget_select_bounds");
+ VERIFY(low_bounds[0], 7, "H5Sget_select_bounds");
+ VERIFY(low_bounds[1], 0, "H5Sget_select_bounds");
+ VERIFY(high_bounds[0], 54, "H5Sget_select_bounds");
+ VERIFY(high_bounds[1], 47, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0]=0; offset[1]=0;
- ret=H5Soffset_simple(sid, offset);
+ offset[0] = 0; offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Close the dataspace */
- ret=H5Sclose (sid);
+ ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
} /* test_select_bounds() */
@@ -13078,18 +13078,18 @@ test_select(void)
size_t rdcc_nelmts; /* Raw data number of elements */
size_t rdcc_nbytes; /* Raw data number of bytes */
double rdcc_w0; /* Raw data write percentage */
- hssize_t offset[SPACE7_RANK]={1,1}; /* Offset for testing selection offsets */
+ hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Selections\n"));
/* Create a dataset transfer property list */
- plist_id=H5Pcreate(H5P_DATASET_XFER);
+ plist_id = H5Pcreate(H5P_DATASET_XFER);
CHECK(plist_id, FAIL, "H5Pcreate");
/* test I/O with a very small buffer for reads */
- ret=H5Pset_buffer(plist_id,(size_t)59,NULL,NULL);
+ ret = H5Pset_buffer(plist_id, (size_t)59, NULL, NULL);
CHECK(ret, FAIL, "H5Pset_buffer");
/* These next tests use the same file */
@@ -13106,18 +13106,18 @@ test_select(void)
test_select_combo(); /* Test combined hyperslab & element selection code */
test_select_hyper_stride(H5P_DEFAULT); /* Test strided hyperslab selection code */
test_select_hyper_stride(plist_id); /* Test strided hyperslab selection code */
- test_select_hyper_contig(H5T_STD_U16LE,H5P_DEFAULT); /* Test contiguous hyperslab selection code */
- test_select_hyper_contig(H5T_STD_U16LE,plist_id); /* Test contiguous hyperslab selection code */
- test_select_hyper_contig(H5T_STD_U16BE,H5P_DEFAULT); /* Test contiguous hyperslab selection code */
- test_select_hyper_contig(H5T_STD_U16BE,plist_id); /* Test contiguous hyperslab selection code */
- test_select_hyper_contig2(H5T_STD_U16LE,H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
- test_select_hyper_contig2(H5T_STD_U16LE,plist_id); /* Test more contiguous hyperslab selection cases */
- test_select_hyper_contig2(H5T_STD_U16BE,H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
- test_select_hyper_contig2(H5T_STD_U16BE,plist_id); /* Test more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16LE,H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16LE,plist_id); /* Test yet more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16BE,H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16BE,plist_id); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig(H5T_STD_U16LE, H5P_DEFAULT); /* Test contiguous hyperslab selection code */
+ test_select_hyper_contig(H5T_STD_U16LE, plist_id); /* Test contiguous hyperslab selection code */
+ test_select_hyper_contig(H5T_STD_U16BE, H5P_DEFAULT); /* Test contiguous hyperslab selection code */
+ test_select_hyper_contig(H5T_STD_U16BE, plist_id); /* Test contiguous hyperslab selection code */
+ test_select_hyper_contig2(H5T_STD_U16LE, H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
+ test_select_hyper_contig2(H5T_STD_U16LE, plist_id); /* Test more contiguous hyperslab selection cases */
+ test_select_hyper_contig2(H5T_STD_U16BE, H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
+ test_select_hyper_contig2(H5T_STD_U16BE, plist_id); /* Test more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16LE, H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16LE, plist_id); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16BE, H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16BE, plist_id); /* Test yet more contiguous hyperslab selection cases */
test_select_hyper_contig_dr(H5T_STD_U16LE, H5P_DEFAULT);
test_select_hyper_contig_dr(H5T_STD_U16LE, plist_id);
test_select_hyper_contig_dr(H5T_STD_U16BE, H5P_DEFAULT);
@@ -13148,32 +13148,32 @@ test_select(void)
test_select_hyper_union_random_5d(plist_id); /* Test hyperslab union code for random 5-D hyperslabs */
/* Create a dataset transfer property list */
- fapl=H5Pcreate(H5P_FILE_ACCESS);
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(fapl, FAIL, "H5Pcreate");
/* Get the default file access properties for caching */
- ret=H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0);
+ ret = H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0);
CHECK(ret, FAIL, "H5Pget_cache");
/* Increase the size of the raw data cache */
- rdcc_nbytes=10*1024*1024;
+ rdcc_nbytes = 10 * 1024 * 1024;
/* Set the file access properties for caching */
- ret=H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
+ ret = H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
CHECK(ret, FAIL, "H5Pset_cache");
/* Test reading in a large hyperslab with a chunked dataset */
- test_select_hyper_chunk(fapl,H5P_DEFAULT);
+ test_select_hyper_chunk(fapl, H5P_DEFAULT);
/* Test reading in a large hyperslab with a chunked dataset a small amount at a time */
- test_select_hyper_chunk(fapl,plist_id);
+ test_select_hyper_chunk(fapl, plist_id);
/* Close file access property list */
- ret=H5Pclose(fapl);
+ ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
/* Close dataset transfer property list */
- ret=H5Pclose(plist_id);
+ ret = H5Pclose(plist_id);
CHECK(ret, FAIL, "H5Pclose");
/* More tests for checking validity of selections */