diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2016-03-24 03:58:43 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2016-03-24 03:58:43 (GMT) |
commit | 9333a2e39c9a496f2a21a97d772493932c3f66d4 (patch) | |
tree | 45875ff8c9f35c0020dc5ef5abd6cb8733002d15 /test | |
parent | 32f21214bb0215e77c4819be9462e254c4532b85 (diff) | |
download | hdf5-9333a2e39c9a496f2a21a97d772493932c3f66d4.zip hdf5-9333a2e39c9a496f2a21a97d772493932c3f66d4.tar.gz hdf5-9333a2e39c9a496f2a21a97d772493932c3f66d4.tar.bz2 |
[svn-r29548] Minor normalization w/ trunk in preparation for big merge.
Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1
autotools serial
autotools parallel (MPICH 3.1.4)
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 39 | ||||
-rw-r--r-- | test/earray.c | 297 | ||||
-rw-r--r-- | test/gen_plist.c | 2 | ||||
-rw-r--r-- | test/h5test.c | 14 |
4 files changed, 29 insertions, 323 deletions
diff --git a/test/dsets.c b/test/dsets.c index a9cda93..2cb51d3 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -20,37 +20,34 @@ * Purpose: Tests the dataset interface (H5D) */ -#include <stdlib.h> -#include <time.h> - -/* - * This file needs to access private information from the H5Z package. - */ -#define H5Z_FRIEND +#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_TESTING +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ #include "h5test.h" #include "H5srcdir.h" +#include "H5Dpkg.h" #include "H5Zpkg.h" #ifdef H5_HAVE_SZLIB_H # include "szlib.h" #endif const char *FILENAME[] = { - "dataset", - "compact_dataset", - "dset_offset", - "max_compact_dataset", - "simple", - "set_local", - "random_chunks", - "huge_chunks", - "chunk_cache", - "big_chunk", - "chunk_expand", - "copy_dcpl_newfile", - "layout_extend", - "zero_chunk", + "dataset", /* 0 */ + "compact_dataset", /* 1 */ + "dset_offset", /* 2 */ + "max_compact_dataset", /* 3 */ + "simple", /* 4 */ + "set_local", /* 5 */ + "random_chunks", /* 6 */ + "huge_chunks", /* 7 */ + "chunk_cache", /* 8 */ + "big_chunk", /* 9 */ + "chunk_expand", /* 10 */ + "copy_dcpl_newfile",/* 11 */ + "layout_extend", /* 12 */ + "zero_chunk", /* 13 */ NULL }; #define FILENAME_BUF_SIZE 1024 diff --git a/test/earray.c b/test/earray.c index 46f2712..c3c7d3d 100644 --- a/test/earray.c +++ b/test/earray.c @@ -1529,296 +1529,6 @@ error: return 1; } /* test_delete_open() */ - -/*------------------------------------------------------------------------- - * Function: test_flush_depend_cb - * - * Purpose: Callback for flush dependency 'depend'/'undepend' and - * 'support'/'unsupport' routines - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Quincey Koziol - * Tuesday, May 26, 2009 - * - *------------------------------------------------------------------------- - */ -static herr_t -test_flush_depend_cb(const void *_elmt, size_t nelmts, void *udata) -{ - earray_flush_depend_ctx_t *ctx = (earray_flush_depend_ctx_t *)udata; - const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ - - /* Check for out of order flush */ - if(ctx->base_obj) - return(FAIL); - - /* Look for magic values */ - while(nelmts > 0) { - /* Check for elements of interest */ - if((uint64_t)0 == *elmt) { - /* Check for out-of-order flush */ - if(!ctx->idx0_obj) - return(FAIL); - - /* Indicate that the element was flushed */ - ctx->idx0_elem = TRUE; - } /* end if */ - else if((uint64_t)1 == *elmt) { - /* Check for out-of-order flush */ - if(!ctx->idx1_obj) - return(FAIL); - - /* Indicate that the element was flushed */ - ctx->idx1_elem = TRUE; - } /* end if */ - else if((uint64_t)10000 == *elmt) { - /* Check for out-of-order flush */ - if(!ctx->idx10000_obj) - return(FAIL); - - /* Indicate that the element was flushed */ - ctx->idx10000_elem = TRUE; - } /* end if */ - - /* Decrement elements left to inspect */ - nelmts--; - elmt++; - } /* end while */ - - return(SUCCEED); -} /* end test_flush_depend_cb() */ - - -/*------------------------------------------------------------------------- - * Function: test_flush_depend - * - * Purpose: Exercise flush dependency 'depend'/'undepend' routines - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Quincey Koziol - * Thursday, May 21, 2009 - * - *------------------------------------------------------------------------- - */ -static unsigned -test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSED *tparam) -{ - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5EA_t *ea = NULL; /* Extensible array wrapper */ - haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ - H5EA__ctx_cb_t cb; /* Extensible array context action info */ - earray_flush_depend_ctx_t fd_info; /* Context information for flush depend test */ - haddr_t base_addr; /* Base test entry address */ - earray_test_t *base_entry; /* Pointer to base test entry */ - haddr_t addr1; /* Test entry #1 address */ - earray_test_t *entry1; /* Pointer to test entry #1 */ - haddr_t addr2; /* Test entry #2 address */ - earray_test_t *entry2; /* Pointer to test entry #2 */ - haddr_t addr3; /* Test entry #3 address */ - earray_test_t *entry3; /* Pointer to test entry #3 */ - uint64_t welmt; /* Element to write */ - hsize_t idx; /* Index value of element */ - - /* Create file & retrieve pointer to internal file object */ - if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0) - TEST_ERROR - - /* - * Display testing message - */ - TESTING("flush dependencies on array metadata"); - - /* Create array */ - cb.encode = test_flush_depend_cb; - HDmemset(&fd_info, 0, sizeof(earray_flush_depend_ctx_t)); - cb.udata = &fd_info; - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &ea, &ea_addr, &cb) < 0) - TEST_ERROR - - /* Verify the creation parameters */ - if(verify_cparam(ea, cparam) < 0) - TEST_ERROR - - /* Create base entry to insert */ - if(NULL == (base_entry = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(base_entry, 0, sizeof(earray_test_t)); - base_entry->idx = (uint64_t)-1; - base_entry->fd_info = &fd_info; - - /* Insert test entry into cache */ - base_addr = HADDR_MAX; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the base entry as a flush dependency for the array */ - if(H5EA_depend((H5AC_info_t *)base_entry, ea) < 0) - TEST_ERROR - - /* Create entry #1 to insert */ - if(NULL == (entry1 = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(entry1, 0, sizeof(earray_test_t)); - entry1->fd_info = &fd_info; - - /* Insert test entry into cache */ - addr1 = HADDR_MAX - 1; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the test entry as a flush dependency for 0th index in the array */ - if(H5EA_support(ea, H5AC_ind_read_dxpl_id, (hsize_t)0, (H5AC_info_t *)entry1) < 0) - TEST_ERROR - - /* Set element of array */ - welmt = (uint64_t)0; - idx = 0; - if(H5EA_set(ea, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) - FAIL_STACK_ERROR - - /* Create entry #2 to insert */ - if(NULL == (entry2 = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(entry2, 0, sizeof(earray_test_t)); - entry2->idx = (uint64_t)1; - entry2->fd_info = &fd_info; - - /* Insert test entry into cache */ - addr2 = HADDR_MAX - 2; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the test entry as a flush dependency for 1st index in the array */ - if(H5EA_support(ea, H5AC_ind_read_dxpl_id, (hsize_t)1, (H5AC_info_t *)entry2) < 0) - TEST_ERROR - - /* Set element of array */ - welmt = (uint64_t)1; - idx = 1; - if(H5EA_set(ea, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) - FAIL_STACK_ERROR - - /* Create entry #3 to insert */ - if(NULL == (entry3 = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(entry3, 0, sizeof(earray_test_t)); - entry3->idx = (uint64_t)10000; - entry3->fd_info = &fd_info; - - /* Insert test entry into cache */ - addr3 = HADDR_MAX - 3; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the test entry as a flush dependency for 10,000th index in the array */ - if(H5EA_support(ea, H5AC_ind_read_dxpl_id, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) - TEST_ERROR - - /* Set element of array */ - welmt = (uint64_t)10000; - idx = 10000; - if(H5EA_set(ea, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) - FAIL_STACK_ERROR - - - /* Flush the cache */ - if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) - TEST_ERROR - - /* Check that all callback flags have been set */ - if(!fd_info.base_obj) - TEST_ERROR - if(!fd_info.idx0_obj) - TEST_ERROR - if(!fd_info.idx0_elem) - TEST_ERROR - if(!fd_info.idx1_obj) - TEST_ERROR - if(!fd_info.idx1_elem) - TEST_ERROR - if(!fd_info.idx10000_obj) - TEST_ERROR - if(!fd_info.idx10000_elem) - TEST_ERROR - - - /* Remove the base entry as a flush dependency for the array */ - if(H5EA_undepend((H5AC_info_t *)base_entry, ea) < 0) - TEST_ERROR - - /* Protect the base entry */ - if(NULL == (base_entry = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, base_addr, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the base entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, base_addr, base_entry, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Remove the test entry as a flush dependency for 0th index in the array */ - if(H5EA_unsupport(ea, H5AC_ind_read_dxpl_id, (hsize_t)0, (H5AC_info_t *)entry1) < 0) - TEST_ERROR - - /* Protect the test entry */ - if(NULL == (entry1 = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr1, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr1, entry1, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Remove the test entry as a flush dependency for 1st index in the array */ - if(H5EA_unsupport(ea, H5AC_ind_read_dxpl_id, (hsize_t)1, (H5AC_info_t *)entry2) < 0) - TEST_ERROR - - /* Protect the test entry */ - if(NULL == (entry2 = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr2, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr2, entry2, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Remove the test entry as a flush dependency for 10,000th index in the array */ - if(H5EA_unsupport(ea, H5AC_ind_read_dxpl_id, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) - TEST_ERROR - - /* Protect the test entry */ - if(NULL == (entry3 = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr3, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr3, entry3, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Close the extensible array */ - if(H5EA_close(ea, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR - ea = NULL; - - /* Close the file */ - if(H5Fclose(file) < 0) - FAIL_STACK_ERROR - - /* All tests passed */ - PASSED() - - return 0; - -error: - H5E_BEGIN_TRY { - if(ea) - H5EA_close(ea, H5AC_ind_read_dxpl_id); - H5Fclose(file); - } H5E_END_TRY; - - return 1; -} /* test_flush_depend() */ - /* Extensible array iterator info for forward iteration */ typedef struct eiter_fw_t { hsize_t idx; /* Index of next array location */ @@ -3066,7 +2776,6 @@ main(void) nerrors += test_open_twice(fapl, &cparam, &tparam); nerrors += test_open_twice_diff(fapl, &cparam, &tparam); nerrors += test_delete_open(fapl, &cparam, &tparam); - nerrors += test_flush_depend(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; H5_INC_ENUM(earray_iter_type_t, curr_iter)) { @@ -3160,7 +2869,7 @@ main(void) if(nerrors) goto error; - puts("All extensible array tests passed."); + HDputs("All extensible array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); @@ -3168,10 +2877,10 @@ main(void) return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Pclose(fapl); + H5Pclose(fapl); } H5E_END_TRY; return 1; diff --git a/test/gen_plist.c b/test/gen_plist.c index f071733..b45eeeb 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -34,7 +34,7 @@ main(void) hid_t dapl1; /* dataset access prop. list */ hid_t dxpl1; /* dataset xfer prop. list */ hid_t gcpl1; /* group create prop. list */ - hid_t ocpypl1; /* object copy prop. list */ + hid_t ocpypl1; /* object copy prop. list */ hid_t ocpl1; /* object create prop. list */ hid_t lcpl1; /* link create prop. list */ hid_t lapl1; /* link access prop. list */ diff --git a/test/h5test.c b/test/h5test.c index c010adc..8285043 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1557,8 +1557,6 @@ getenv_all(MPI_Comm comm, int root, const char* name) * Programmer: Larry Knox * Monday, October 13, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -1570,20 +1568,22 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) const char *filename = H5_get_srcdir_filename(origfilename);; /* Get the test file name to copy */ /* Copy old file into temporary file */ - if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1; - if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) - < 0) return -1; + if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) + return -1; + if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + return -1; /* Copy data */ while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0) - HDwrite(fd_new, buf, (size_t)nread); + if(HDwrite(fd_new, buf, (size_t)nread) < 0) + return -1; /* Close files */ if(HDclose(fd_old) < 0) return -1; if(HDclose(fd_new) < 0) return -1; return 0; -} +} /* end h5_make_local_copy() */ /*------------------------------------------------------------------------- |