summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/ohdr.c299
-rw-r--r--test/set_extent.c366
-rw-r--r--test/tarray.c576
-rw-r--r--test/tfile.c6
5 files changed, 574 insertions, 675 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8793fa8..338b906 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -74,7 +74,7 @@ endif (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2")
#-----------------------------------------------------------------------------
- # Define Test Library Sources
+ # Define Plugin Test Sources
#-----------------------------------------------------------------------------
set (TEST_PLUGIN_LIBS
dynlib1
diff --git a/test/ohdr.c b/test/ohdr.c
index 3b11539..8dbe05e 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -72,13 +72,15 @@ test_cont(char *filename, hid_t fapl)
HDmemset(&oh_locB, 0, sizeof(oh_locB));
/* Create the file to operate on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
if (H5AC_ignore_tags(f) < 0) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
- }
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
+ } /* end if */
if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0)
FAIL_STACK_ERROR
@@ -89,58 +91,58 @@ test_cont(char *filename, hid_t fapl)
time_new = 11111111;
if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
FAIL_STACK_ERROR
if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(1 != H5O_link(&oh_locA, 1, H5AC_ind_read_dxpl_id))
FAIL_STACK_ERROR
if(1 != H5O_link(&oh_locB, 1, H5AC_ind_read_dxpl_id))
FAIL_STACK_ERROR
if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_expunge_chunks_test(&oh_locA, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_get_hdr_info(&oh_locA, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
nchunks = hdr_info.nchunks;
/* remove the 1st H5O_NAME_ID message */
if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5AC_ind_read_dxpl_id) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_get_hdr_info(&oh_locA, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(hdr_info.nchunks >= nchunks)
- TEST_ERROR
+ TEST_ERROR
if(H5O_close(&oh_locA) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5O_close(&oh_locB) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -149,8 +151,8 @@ error:
H5Fclose(file);
} H5E_END_TRY;
- return -1;
-} /* test_cont() */
+ return FAIL;
+} /* end test_cont() */
/*
* Verify that object headers are held in the cache until they are linked
@@ -199,7 +201,7 @@ test_ohdr_cache(char *filename, hid_t fapl)
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
FAIL_STACK_ERROR
if(H5Pclose(my_fapl) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
if(H5AC_ignore_tags(f) < 0)
@@ -279,20 +281,20 @@ test_ohdr_cache(char *filename, hid_t fapl)
FAIL_STACK_ERROR
if(H5Pclose(my_dxpl) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* test_ohdr_cache() */
/*
@@ -326,34 +328,34 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
/* Open filename */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Open FILE_BOGUS */
if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
if(bogus_id == H5O_BOGUS_INVALID_ID) {
- /* Open "group" in FILE_BOGUS */
- if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- loc_bogus = gid_bogus;
+ /* Open "group" in FILE_BOGUS */
+ if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc_bogus = gid_bogus;
- /* Create "group" in filename */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- loc = gid;
+ /* Create "group" in filename */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
} else { /* H5O_BOGUS_VALID_ID */
- loc_bogus = fid_bogus;
- loc = fid;
- }
+ loc_bogus = fid_bogus;
+ loc = fid;
+ } /* end else */
/* Open the dataset with the unknown header message, but no extra flags */
if((did = H5Dopen2(loc_bogus, "Dataset1", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
if(H5Dclose(did) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
PASSED();
@@ -361,9 +363,9 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
/* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
if((did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
if(H5Dclose(did) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
PASSED();
@@ -371,11 +373,11 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
/* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */
H5E_BEGIN_TRY {
- did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT);
+ did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT);
} H5E_END_TRY;
if(did >= 0) {
- H5Dclose(did);
- TEST_ERROR
+ H5Dclose(did);
+ TEST_ERROR
} /* end if */
PASSED();
@@ -384,163 +386,158 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
/* Copy object with "mark if unknown" flag on message into file (FILENAME[0]) that can be modified */
if(H5Ocopy(loc_bogus, "Dataset4", loc, "Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Closing: filename */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
- if(H5Gclose(gid) < 0)
- FAIL_STACK_ERROR
- }
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(fid) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Re-open filename, with read-only permissions */
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
if(bogus_id == H5O_BOGUS_INVALID_ID) {
- /* Open "group" in filename */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- loc = gid;
+ /* Open "group" in filename */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
} else
- loc = fid;
+ loc = fid;
/* Open the dataset with the "mark if unknown" message */
if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Check that the "unknown" message was _NOT_ marked */
if(H5O_check_msg_marked_test(did, FALSE) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close the dataset */
if(H5Dclose(did) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Close "group" in filename depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
- if(H5Gclose(gid) < 0)
- FAIL_STACK_ERROR
- }
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close filename (to flush change to object header) */
if(H5Fclose(fid) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Re-open filename */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
if(bogus_id == H5O_BOGUS_INVALID_ID) {
- /* Open "group" in filename */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- loc = gid;
+ /* Open "group" in filename */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
} else
- loc = fid;
+ loc = fid;
/* Open the dataset with the "mark if unknown" message */
if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Create data space */
if((sid = H5Screate(H5S_SCALAR)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Create an attribute, to get the object header into write access */
if((aid = H5Acreate2(did, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close dataspace */
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close attribute */
if(H5Aclose(aid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close the dataset */
if(H5Dclose(did) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Close "group" in filename depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
- if(H5Gclose(gid) < 0)
- FAIL_STACK_ERROR
- }
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close filename (to flush change to object header) */
if(H5Fclose(fid) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Re-open filename */
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
if(bogus_id == H5O_BOGUS_INVALID_ID) {
- /* Open "group" in filename */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- loc = gid;
+ /* Open "group" in filename */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
} else
- loc = fid;
+ loc = fid;
/* Re-open the dataset with the "mark if unknown" message */
if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Check that the "unknown" message was marked */
if(H5O_check_msg_marked_test(did, TRUE) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close the dataset */
if(H5Dclose(did) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Closing: filename */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
- if(H5Gclose(gid) < 0)
- TEST_ERROR
- }
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(fid) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
PASSED();
/* Closing: FILE_BOGUS */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
- if(H5Gclose(gid_bogus) < 0)
- TEST_ERROR
- }
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid_bogus) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(fid_bogus) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
TESTING("object in r/w file with unknown header message & 'fail if unknown and open for write' flag set");
/* Open FILE_BOGUS with RW intent this time */
if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
/* Set up location ID */
if(bogus_id == H5O_BOGUS_INVALID_ID) {
- /* Open "group" in FILE_BOGUS */
- if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- loc_bogus = gid_bogus;
+ /* Open "group" in FILE_BOGUS */
+ if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc_bogus = gid_bogus;
} else
- loc_bogus = fid_bogus;
+ loc_bogus = fid_bogus;
/* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
H5E_BEGIN_TRY {
- did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT);
+ did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT);
} H5E_END_TRY;
if(did >= 0) {
- H5Dclose(did);
- TEST_ERROR
+ H5Dclose(did);
+ TEST_ERROR
} /* end if */
PASSED();
@@ -549,38 +546,36 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
/* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */
H5E_BEGIN_TRY {
- did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT);
+ did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT);
} H5E_END_TRY;
if(did >= 0) {
- H5Dclose(did);
+ H5Dclose(did);
TEST_ERROR
} /* end if */
/* Closing: FILE_BOGUS */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
- if(H5Gclose(gid_bogus) < 0)
- TEST_ERROR
- }
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid_bogus) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(fid_bogus) < 0)
- TEST_ERROR
-
+ FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Fclose(fid);
- H5Gclose(gid);
+ H5Gclose(gid);
H5Fclose(fid_bogus);
- H5Gclose(gid_bogus);
- H5Dclose(did);
- H5Sclose(sid);
- H5Aclose(aid);
+ H5Gclose(gid_bogus);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Aclose(aid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* test_unknown() */
@@ -629,21 +624,20 @@ main(void)
if(H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
- /* test on object continuation block */
- if(test_cont(filename, fapl) < 0)
- FAIL_STACK_ERROR
+ /* test on object continuation block */
+ if(test_cont(filename, fapl) < 0)
+ TEST_ERROR
/* Create the file to operate on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- if (H5AC_ignore_tags(f) < 0) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
- }
-
+ if(H5AC_ignore_tags(f) < 0) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
+ } /* end if */
/*
* Test object header creation
@@ -655,7 +649,6 @@ main(void)
FAIL_STACK_ERROR
PASSED();
-
/* create a new message */
TESTING("message creation");
time_new = 11111111;
@@ -673,7 +666,6 @@ main(void)
TEST_ERROR
PASSED();
-
/*
* Test modification of an existing message.
*/
@@ -959,27 +951,22 @@ main(void)
/* Test reading datasets with undefined object header messages
* and the various "fail/mark if unknown" object header message flags
*/
- HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID");
- {
- if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0)
- TEST_ERROR
- }
-
+ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID");
+ if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0)
+ TEST_ERROR
HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID");
- {
- if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0)
- TEST_ERROR
- }
-
- /* Test object header creation metadata cache issues */
- if(test_ohdr_cache(filename, fapl) < 0)
- TEST_ERROR
+ if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test object header creation metadata cache issues */
+ if(test_ohdr_cache(filename, fapl) < 0)
+ TEST_ERROR
} /* end for */
/* Verify symbol table messages are cached */
if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
- puts("All object header tests passed.");
+ HDputs("All object header tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
diff --git a/test/set_extent.c b/test/set_extent.c
index ae83ba2..acfdc5b 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -20,9 +20,6 @@
* Purpose: Tests the H5Dset_extent call
*/
-#include <time.h>
-#include <stdlib.h>
-#include "hdf5.h"
#include "h5test.h"
/*-------------------------------------------------------------------------
@@ -401,468 +398,299 @@ static int test_rank1( hid_t fapl,
int comp_value;
char filename[NAME_BUF_SIZE];
- if ( do_fill_value )
- {
+ if(do_fill_value)
comp_value = FILL_VALUE;
- }
else
- {
comp_value = 0;
- }
-
-
- for( i = 0; i < DIM0; i++ )
- {
+ for(i = 0; i < DIM0; i++ )
buf_o[i] = 2;
- }
/* create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- {
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
- }
- if ( set_istore_k )
- {
- /* set non-default indexed storage B-tree internal 'K' value */
- if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
- {
+ /* set non-default indexed storage B-tree internal 'K' value */
+ if(set_istore_k)
+ if(H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
TEST_ERROR
- }
- }
/* create a new file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- {
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
TEST_ERROR
- }
/* close property list */
if(H5Pclose(fcpl) < 0)
- {
TEST_ERROR
- }
/* create the data space with unlimited dimensions. */
- if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
- {
+ if((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
TEST_ERROR
- }
/* modify dataset creation properties, i.e. enable chunking. */
- if ((my_dcpl = H5Pcopy (dcpl)) < 0)
- {
+ if((my_dcpl = H5Pcopy (dcpl)) < 0)
TEST_ERROR
- }
- if (H5Pset_chunk(my_dcpl, RANK1, dims_c) < 0)
- {
+ if(H5Pset_chunk(my_dcpl, RANK1, dims_c) < 0)
TEST_ERROR
- }
/*-------------------------------------------------------------------------
- * create, write dataset
- *-------------------------------------------------------------------------
- */
+ * create, write dataset
+ *-------------------------------------------------------------------------
+ */
/* create a dataset */
- if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
- {
+ if((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- }
/* write */
- if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
- {
+ if(H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
TEST_ERROR
- }
-
#if defined (H5_SET_EXTENT_DEBUG)
- printf("\n");
+ printf("\n buf_o: ");
for (i = 0; i < (int)dims_o[0]; i++ )
- {
-
printf("%d ", buf_o[i]);
-
- }
printf("\n");
#endif
-
-
- if (H5Sclose(sid) < 0)
- {
+ if(H5Sclose(sid) < 0)
TEST_ERROR
- }
/*-------------------------------------------------------------------------
- * set new dimensions for the array; expand it
- *-------------------------------------------------------------------------
- */
+ * set new dimensions for the array; expand it
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array. */
- if (H5Dset_extent(did , dims_e) < 0)
- {
+ if(H5Dset_extent(did , dims_e) < 0)
TEST_ERROR
- }
/* get the space */
- if ((sid = H5Dget_space(did)) < 0)
- {
+ if((sid = H5Dget_space(did)) < 0)
TEST_ERROR
- }
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
- {
+ if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- }
- if (H5Sclose(sid) < 0)
- {
+ if(H5Sclose(sid) < 0)
TEST_ERROR
- }
-
/* check dimensions */
for( i = 0; i < RANK1; i++ )
- {
if (dims_r[i] != dims_e[i])
TEST_ERROR
- }
/* read */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
TEST_ERROR
-
#if defined (H5_SET_EXTENT_DEBUG)
- printf("\n");
+ printf("\n buf_e: ");
for (i = 0; i < (int)dims_r[0]; i++ )
- {
-
printf("%d ", buf_e[i]);
-
- }
printf("\n");
#endif
-
-
-
/* compare the read array with the expanded array */
for (i = 0; i < (int)dims_r[0]; i++ )
- {
-
- if ( i >= DIM0 )
- {
- if(buf_e[i] != comp_value)
- {
+ if(i >= DIM0) {
+ if(buf_e[i] != comp_value) {
printf("buf_e[%d] = %d\n", i, buf_e[i]);
- printf("value = %d\n", comp_value);
+ printf("expected = %d\n", comp_value);
TEST_ERROR
- }
- }
- else
- {
+ } /* end if */
+ } /* end if */
+ else {
if(buf_e[i] != buf_o[i])
TEST_ERROR
- }
- }
-
+ } /* end else */
/*-------------------------------------------------------------------------
- * shrink
- *
- *-------------------------------------------------------------------------
- */
+ * shrink
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array. */
- if (H5Dset_extent(did , dims_s) < 0)
- {
+ if(H5Dset_extent(did , dims_s) < 0)
TEST_ERROR
- }
/* get the space */
- if ((sid = H5Dget_space(did)) < 0)
- {
+ if((sid = H5Dget_space(did)) < 0)
TEST_ERROR
- }
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
- {
+ if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- }
- if (H5Sclose(sid) < 0)
- {
+ if(H5Sclose(sid) < 0)
TEST_ERROR
- }
/* check dimensions */
for( i = 0; i < RANK1; i++ )
- {
if (dims_r[i] != dims_s[i])
TEST_ERROR
- }
-
-
/* for this case we close and reopen file */
- if ( set_istore_k )
- {
-
- if (H5Dclose(did) < 0)
- {
+ if(set_istore_k) {
+ if(H5Dclose(did) < 0)
TEST_ERROR
- }
- if (H5Fclose(fid) < 0)
- {
+ if(H5Fclose(fid) < 0)
TEST_ERROR
- }
- if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
- {
+ if((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
TEST_ERROR
- }
- if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
- {
+ if((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
TEST_ERROR
- }
-
-
-
- }
+ } /* end if */
/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ * read
+ *-------------------------------------------------------------------------
+ */
/* read */
- if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
- {
+ if(H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
TEST_ERROR
- }
#if defined (H5_SET_EXTENT_DEBUG)
- printf("\n");
+ printf("\n dims_r: ");
for (i = 0; i < (int)dims_r[0]; i++ )
- {
-
printf("%d ", buf_s[i]);
- }
printf("\n");
-
#endif
-
-
-
/* compare the read array with the shrinked array */
for( i = 0; i < (int)dims_r[0]; i++ )
- {
-
- if ( buf_s[i] != buf_o[i] )
- {
+ if(buf_s[i] != buf_o[i]) {
printf("buf_s[%d] = %d\n", i, buf_s[i]);
printf("buf_o[%d] = %d\n", i, buf_o[i]);
TEST_ERROR
- }
- }
-
+ } /* end if */
/*-------------------------------------------------------------------------
- * expand it back to original size
- *-------------------------------------------------------------------------
- */
+ * expand it back to original size
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array */
- if (H5Dset_extent(did, dims_o) < 0)
- {
+ if(H5Dset_extent(did, dims_o) < 0)
TEST_ERROR
- }
/* get the space */
- if ((sid = H5Dget_space(did)) < 0)
- {
+ if((sid = H5Dget_space(did)) < 0)
TEST_ERROR
- }
/* get dimensions. */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
- {
+ if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- }
- if (H5Sclose(sid) < 0)
- {
+ if(H5Sclose(sid) < 0)
TEST_ERROR
- }
-
/* check dimensions */
for( i = 0; i < RANK1; i++ )
- {
if (dims_r[i] != dims_o[i])
TEST_ERROR
- }
-
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
TEST_ERROR
#if defined (H5_SET_EXTENT_DEBUG)
- printf("\n");
+ printf("\n dims_r: ");
for (i = 0; i < (int)dims_r[0]; i++ )
- {
-
printf("%d ", buf_r[i]);
-
- }
printf("\n");
#endif
-
-
/* compare the read array with the original array */
- for (i = 0; i < (int)dims_r[0]; i++ )
- {
-
- if (i >= DIMS0 )
- {
- if(buf_r[i] != comp_value)
- {
+ for(i = 0; i < (int)dims_r[0]; i++ )
+ if(i >= DIMS0 ) {
+ if(buf_r[i] != comp_value) {
printf("buf_r[%d] = %d\n", i, buf_r[i] );
- printf("value = %d\n", comp_value);
+ printf("expected = %d\n", comp_value);
TEST_ERROR
- }
- }
- else
- {
+ } /* end if */
+ } /* end if */
+ else {
if(buf_r[i] != buf_o[i])
TEST_ERROR
- }
- }
+ } /* end else */
/*-------------------------------------------------------------------------
- * shrink to 0
- *
- *-------------------------------------------------------------------------
- */
+ * shrink to 0
+ *-------------------------------------------------------------------------
+ */
dims_s[0] = 0;
/* set new dimensions for the array. */
- if (H5Dset_extent(did , dims_s) < 0)
- {
+ if(H5Dset_extent(did , dims_s) < 0)
TEST_ERROR
- }
/* get the space */
- if ((sid = H5Dget_space(did)) < 0)
- {
+ if((sid = H5Dget_space(did)) < 0)
TEST_ERROR
- }
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
- {
+ if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- }
-
- if (H5Sclose(sid) < 0)
- {
+ if(H5Sclose(sid) < 0)
TEST_ERROR
- }
/* check dimensions */
for( i = 0; i < RANK1; i++ )
- {
- if (dims_r[i] != dims_s[i])
+ if(dims_r[i] != dims_s[i])
TEST_ERROR
- }
/*-------------------------------------------------------------------------
- * close dataset
- *-------------------------------------------------------------------------
- */
+ * close dataset
+ *-------------------------------------------------------------------------
+ */
- if (H5Dclose(did) < 0)
- {
+ if(H5Dclose(did) < 0)
TEST_ERROR
- }
-
+ /*-------------------------------------------------------------------------
+ * test a dataset with non initialized chunks
+ *-------------------------------------------------------------------------
+ */
-
- /*-------------------------------------------------------------------------
- * test a dataset with non initialized chunks
- *-------------------------------------------------------------------------
- */
-
-
- if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
- {
+ if((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
TEST_ERROR
- }
- if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
- {
+ if((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- }
+
/* set new dimensions for the array */
dims_o[ 0 ] = 0;
- if (H5Dset_extent( did , dims_o ) < 0)
- {
+ if(H5Dset_extent( did , dims_o ) < 0)
TEST_ERROR
- }
-
-
- if (H5Dclose(did) < 0)
- {
+ if(H5Dclose(did) < 0)
TEST_ERROR
- }
- if (H5Sclose(sid) < 0)
- {
+ if(H5Sclose(sid) < 0)
TEST_ERROR
- }
-
-
-
/*-------------------------------------------------------------------------
- * close property list
- *-------------------------------------------------------------------------
- */
-
-
- if (H5Pclose(my_dcpl) < 0)
- {
+ * close property list
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pclose(my_dcpl) < 0)
TEST_ERROR
- }
-
- if (H5Fclose( fid ) < 0)
- {
+ if(H5Fclose(fid) < 0)
TEST_ERROR
- }
-
return 0;
-
-
error:
H5E_BEGIN_TRY
@@ -875,7 +703,7 @@ error:
} H5E_END_TRY;
return -1;
-}
+} /* end test_rank1() */
/*-------------------------------------------------------------------------
* test usage with a 2D rank
diff --git a/test/tarray.c b/test/tarray.c
index cb5fef9..c6e9c0d 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -34,41 +34,67 @@
#define ARRAY1_DIM1 4
/* 3-D array datatype */
-#define ARRAY2_RANK 3
-#define ARRAY2_DIM1 3
-#define ARRAY2_DIM2 4
-#define ARRAY2_DIM3 5
+#define ARRAY2_RANK 3
+#define ARRAY2_DIM1 3
+#define ARRAY2_DIM2 4
+#define ARRAY2_DIM3 5
/* 2-D array datatype */
-#define ARRAY3_RANK 2
-#define ARRAY3_DIM1 6
-#define ARRAY3_DIM2 3
+#define ARRAY3_RANK 2
+#define ARRAY3_DIM1 6
+#define ARRAY3_DIM2 3
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
-/****************************************************************
-**
-** test_array_atomic_1d(): Test basic array datatype code.
-** Tests 1-D array of atomic datatypes
-**
-****************************************************************/
+/* Parameters used with the test_array_bkg() test */
+#define FIELDNAME "ArrayofStructures"
+#define LENGTH 5
+#define ALEN 10
+#define RANK 1
+#define NMAX 100
+
+/* Struct used with test_array_bkg() test */
+typedef struct
+{
+ int nsubfields;
+ char *name[NMAX];
+ size_t offset[NMAX];
+ hid_t datatype[NMAX];
+
+} CmpDTSinfo;
+
+/* Forward declarations for custom vlen memory manager functions */
+void *test_array_alloc_custom(size_t size, void *info);
+void test_array_free_custom(void *mem, void *info);
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_atomic_1d
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_atomic_1d(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n"));
@@ -167,23 +193,28 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_atomic_1d() */
-/****************************************************************
-**
-** test_array_funcs(): Test some type functions that are and
-** aren't supposed to work with array type.
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_funcs
+ *
+ * Purpose: Test some type functions that are and aren't supposed to
+ * work with array type.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_funcs(void)
{
- hid_t type; /* Datatype ID */
- hsize_t tdims1[] = {ARRAY1_DIM1};
- size_t size;
- H5T_pad_t inpad;
- H5T_norm_t norm;
- H5T_cset_t cset;
- H5T_str_t strpad;
- herr_t ret; /* Generic return value */
+ hid_t type; /* Datatype ID */
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_norm_t norm;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ herr_t ret; /* Generic return value */
/* Create a datatype to refer to */
type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1);
@@ -223,29 +254,34 @@ test_array_funcs(void)
/* Close datatype */
ret = H5Tclose(type);
CHECK(ret, FAIL, "H5Tclose");
-} /* end test_array_funcs */
+} /* end test_array_funcs() */
-/****************************************************************
-**
-** test_array_atomic_3d(): Test basic array datatype code.
-** Tests 3-D array of atomic datatypes
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_atomic_3d
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 3-D array of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_atomic_3d(void)
{
int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
- int ndims; /* Array rank for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i,j,k,l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 3-D Array of Atomic Datatypes Functionality\n"));
@@ -349,31 +385,36 @@ test_array_atomic_3d(void)
} /* end test_array_atomic_3d() */
-/****************************************************************
-**
-** test_array_array_atomic(): Test basic array datatype code.
-** Tests 1-D array 2-D arrays of atomic datatypes
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_array_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array 2-D arrays of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_array_atomic(void)
{
int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid1; /* 1-D array Datatype ID */
- hid_t tid2; /* 2-D array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
- int ndims1; /* Array rank for reading */
- int ndims2; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid1; /* 1-D array Datatype ID */
+ hid_t tid2; /* 2-D array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
+ int ndims1; /* Array rank for reading */
+ int ndims2; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i,j,k,l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array 2-D Arrays of Atomic Datatypes Functionality\n"));
@@ -503,12 +544,17 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_array_atomic() */
-/****************************************************************
-**
-** test_array_compound_atomic(): Test basic array datatype code.
-** Tests 1-D array of compound datatypes (with no array fields)
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_compound_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of compound datatypes (with no array fields).
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_compound_atomic(void)
{
@@ -516,23 +562,24 @@ test_array_compound_atomic(void)
int i;
float f;
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char *mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ int i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Atomic Datatypes Functionality\n"));
@@ -704,12 +751,17 @@ test_array_compound_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_compound_atomic() */
-/****************************************************************
-**
-** test_array_compound_array(): Test basic array datatype code.
-** Tests 1-D array of compound datatypes (with array fields)
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_compound_array
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of compound datatypes (with array fields).
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_compound_array(void)
{
@@ -717,25 +769,26 @@ test_array_compound_array(void)
int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- H5T_class_t mclass; /* Datatype class for field */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char *mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ H5T_class_t mclass; /* Datatype class for field */
+ int i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Array Datatypes Functionality\n"));
@@ -949,9 +1002,6 @@ test_array_compound_array(void)
} /* end test_array_compound_array() */
-void *test_array_alloc_custom(size_t size, void *info);
-void test_array_free_custom(void *mem, void *info);
-
/****************************************************************
**
** test_array_alloc_custom(): Test VL datatype custom memory
@@ -960,11 +1010,29 @@ void test_array_free_custom(void *mem, void *info);
** allocated.
**
****************************************************************/
-void *test_array_alloc_custom(size_t size, void *info)
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_alloc_custom
+ *
+ * Purpose: Memory allocator for testing VL datatype custom memory
+ * allocation routines.
+ *
+ * This routine just uses malloc to allocate the memory and
+ * increments the amount of memory allocated.
+ *
+ * Return:
+ *
+ * Success: A memory buffer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+test_array_alloc_custom(size_t size, void *info)
{
- void *ret_value = NULL; /* Pointer to return */
- size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ void *ret_value = NULL; /* Pointer to return */
+ size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -976,23 +1044,31 @@ void *test_array_alloc_custom(size_t size, void *info)
*(size_t *)ret_value = size;
*mem_used += size;
} /* end if */
+
ret_value = ((unsigned char *)ret_value) + extra;
return ret_value;
-}
+} /* end test_array_alloc_custom() */
-/****************************************************************
-**
-** test_array_free_custom(): Test VL datatype custom memory
-** allocation routines. This routine just uses free to
-** release the memory and decrements the amount of memory
-** allocated.
-**
-****************************************************************/
-void test_array_free_custom(void *_mem, void *info)
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_free_custom
+ *
+ * Purpose: Memory free function for testing VL datatype custom memory
+ * allocation routines.
+ *
+ * This routine just uses free to free the memory and
+ * decrements the amount of memory allocated.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+test_array_free_custom(void *_mem, void *info)
{
- unsigned char *mem = NULL;
- size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ unsigned char *mem = NULL; /* Pointer to mem to be freed */
+ size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -1005,35 +1081,42 @@ void test_array_free_custom(void *_mem, void *info)
*mem_used -= *(size_t *)mem;
HDfree(mem);
} /* end if */
-}
-/****************************************************************
-**
-** test_array_vlen_atomic(): Test basic array datatype code.
-** Tests 1-D array of atomic VL datatypes
-**
-****************************************************************/
+ return;
+} /* end test_array_free_custom() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_vlen_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of atomic VL datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Atomic Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- size_t mem_used=0; /* Memory used during allocation */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Atomic Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used=0; /* Memory used during allocation */
+ int i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Variable-Length Datatypes Functionality\n"));
@@ -1217,34 +1300,39 @@ test_array_vlen_atomic(void)
} /* end test_array_vlen_atomic() */
-/****************************************************************
-**
-** test_array_vlen_array(): Test basic array datatype code.
-** Tests 1-D array of 1-D array VL datatypes
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_vlen_array
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of 1-D array VL datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_vlen_array(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hid_t tid4; /* Atomic Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- size_t mem_used=0; /* Memory used during allocation */
- int i,j,k,l; /* Index variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hid_t tid4; /* Atomic Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used=0; /* Memory used during allocation */
+ int i,j,k,l; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of 1-D Array Variable-Length Datatypes Functionality\n"));
@@ -1467,28 +1555,18 @@ test_array_vlen_array(void)
} /* end test_array_vlen_array() */
-#define FIELDNAME "ArrayofStructures"
-#define LENGTH 5
-#define ALEN 10
-#define RANK 1
-#define NMAX 100
-
-typedef struct
-{
- int nsubfields;
- char *name[NMAX];
- size_t offset[NMAX];
- hid_t datatype[NMAX];
-
-} CmpDTSinfo;
-
-/****************************************************************
-**
-** test_array_bkg(): Test basic array datatype code.
-** Tests reading compound datatype with array fields and
-** writing partial fields.
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_bkg
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests reading compound datatype with array fields and
+ * writing partial fields.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_bkg(void)
{
@@ -1531,10 +1609,10 @@ test_array_bkg(void)
CHECK(dtsinfo, NULL, "HDmalloc");
HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo));
for (i = 0; i < LENGTH; i++) {
- for (j = 0; j < ALEN; j++) {
- cf[i].a[j] = 100 * (i + 1) + j;
- cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j;
- cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j);
+ for (j = 0; j < ALEN; j++) {
+ cf[i].a[j] = 100 * (i + 1) + j;
+ cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j;
+ cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j);
} /* end for */
} /* end for */
@@ -1745,7 +1823,7 @@ test_array_bkg(void)
/* Reset the data to read in */
/* ------------------------- */
- memset(cfr, 0, sizeof(CmpField)*LENGTH);
+ HDmemset(cfr, 0, sizeof(CmpField)*LENGTH);
status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfr);
CHECK(status, FAIL, "H5Dread");
@@ -2064,17 +2142,22 @@ test_compat(void)
/* Close the file */
ret = H5Fclose(fid1);
CHECK_I(ret, "H5Fclose");
- }
+ } /* end if */
else
printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile);
} /* end test_compat() */
-/****************************************************************
-**
-** test_array(): Main array datatype testing routine.
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array
+ *
+ * Purpose: Main array datatype testing routine.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
void
test_array(void)
{
@@ -2082,39 +2165,38 @@ test_array(void)
MESSAGE(5, ("Testing Array Datatypes\n"));
/* These tests use the same file... */
- test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
- test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
- test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
- test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
- test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
- test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
- test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
- test_array_funcs(); /* Test type functions with array types */
+ test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
+ test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
+ test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
+ test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
+ test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
+ test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
+ test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
+ test_array_funcs(); /* Test type functions with array types */
- test_array_bkg(); /* Read compound datatype with array fields and background fields read */
+ test_array_bkg(); /* Read compound datatype with array fields and background fields read */
/* This test uses a custom file */
- test_compat(); /* Test compatibility changes for compound datatype fields */
-} /* test_array() */
+ test_compat(); /* Test compatibility changes for compound datatype fields */
+
+} /* end test_array() */
/*-------------------------------------------------------------------------
- * Function: cleanup_array
+ * Function: cleanup_array
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* June 8, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
cleanup_array(void)
{
remove(FILENAME);
-}
+} /* end cleanup_array() */
diff --git a/test/tfile.c b/test/tfile.c
index dff4128..7444698 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -3261,8 +3261,10 @@ test_filespace_compatible(void)
CHECK(fd_new, FAIL, "HDopen");
/* Copy data */
- while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0)
- HDwrite(fd_new, buf, (size_t)nread);
+ while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) {
+ ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread);
+ CHECK(write_err, -1, "HDwrite");
+ } /* end while */
/* Close the files */
ret = HDclose(fd_old);