diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 97 | ||||
-rw-r--r-- | test/cache_api.c | 9 | ||||
-rw-r--r-- | test/cache_common.c | 302 | ||||
-rw-r--r-- | test/cache_common.h | 36 | ||||
-rw-r--r-- | test/earray.c | 8 | ||||
-rw-r--r-- | test/links.c | 32 | ||||
-rw-r--r-- | test/ntypes.c | 84 | ||||
-rw-r--r-- | test/trefer.c | 173 |
8 files changed, 393 insertions, 348 deletions
diff --git a/test/cache.c b/test/cache.c index e02f14a..364ec75 100644 --- a/test/cache.c +++ b/test/cache.c @@ -256,7 +256,7 @@ smoke_check_1(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* file_ptr */ file_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -281,7 +281,7 @@ smoke_check_1(void) /* flush all entries in the cache: */ - flush_cache(/* file_ptr */ file_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -472,7 +472,7 @@ smoke_check_2(void) /* flush all entries in the cache: */ - flush_cache(/* file_ptr */ file_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -963,8 +963,8 @@ smoke_check_5(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1205,8 +1205,8 @@ smoke_check_6(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1444,8 +1444,8 @@ smoke_check_7(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ @@ -1684,8 +1684,8 @@ smoke_check_8(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ @@ -4973,7 +4973,7 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, struct flush_cache_test_spec spec[]) { /* const char * fcn_name = "check_flush_cache__multi_entry_test"; */ - H5C_t * cache_ptr = file_ptr->shared->cache; + H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; int i; @@ -6053,8 +6053,8 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) * which the call back function both resizes and renames the entry * for which it has been called. * - * Again, we run this entry twice, as the first run moves the entry to its - * alternate address, and the second moves it back. + * Again, we run this entry twice, as the first run moves the entry + * to its alternate address, and the second moves it back. */ int test_num = 9; /* and 10 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; @@ -9246,7 +9246,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, struct fo_flush_entry_check check[]) { const char * fcn_name = "check_flush_cache__flush_op_test"; - H5C_t *cache_ptr = file_ptr->shared->cache; + H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; hbool_t show_progress = FALSE; hbool_t verbose = FALSE; @@ -13331,7 +13331,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, hbool_t expected_destroyed) { /* const char *fcn_name = "check_flush_cache__pinned_single_entry_test"; */ - H5C_t *cache_ptr = file_ptr->shared->cache; + H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; hbool_t expected_loaded = TRUE; herr_t result; @@ -13837,10 +13837,10 @@ check_expunge_entry(void) if ( result < 0 ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5C_get_entry_status() reports failure 2."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_get_entry_status() reports failure 2."); + failure_mssg = msg; } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { @@ -13881,10 +13881,10 @@ check_expunge_entry(void) if ( result < 0 ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5C_get_entry_status() reports failure 3."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_get_entry_status() reports failure 3."); + failure_mssg = msg; } else if ( in_cache ) { @@ -13923,10 +13923,10 @@ check_expunge_entry(void) if ( result < 0 ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5C_get_entry_status() reports failure 4."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_get_entry_status() reports failure 4."); + failure_mssg = msg; } else if ( in_cache ) { @@ -14611,7 +14611,7 @@ check_rename_entry__run_test(H5F_t * file_ptr, struct rename_entry_test_spec * spec_ptr) { /* const char * fcn_name = "check_rename_entry__run_test"; */ - H5C_t *cache_ptr = file_ptr->shared->cache; + H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; unsigned int flags = H5C__NO_FLAGS_SET; test_entry_t * base_addr; @@ -15898,7 +15898,7 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* verivy that it is empty */ + /* verify that it is empty */ if ( pass ) { if ( ( cache_ptr->index_len != 0 ) || @@ -15985,7 +15985,7 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* verify that the an entry has been evicted */ + /* verify that an entry has been evicted */ if ( pass ) { if ( ( cache_ptr->index_len != 16 ) || @@ -17320,7 +17320,7 @@ check_double_protect_err(void) if ( pass ) { cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, - &(types[0]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET); + &(types[0]), entry_ptr->addr, NULL, H5C__NO_FLAGS_SET); if ( cache_entry_ptr != NULL ) { @@ -17977,7 +17977,7 @@ check_protect_ro_rw_err(void) if ( pass ) { thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, - &(types[0]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET); + &(types[0]), entry_ptr->addr, NULL, H5C__NO_FLAGS_SET); if ( thing_ptr != NULL ) { @@ -18223,8 +18223,8 @@ check_auto_cache_resize(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -18621,7 +18621,6 @@ check_auto_cache_resize(void) auto_size_ctl.flash_multiple = 2.0; auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__threshold; auto_size_ctl.upper_hr_threshold = 0.995; @@ -18975,7 +18974,6 @@ check_auto_cache_resize(void) auto_size_ctl.flash_multiple = 2.0; auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__threshold; auto_size_ctl.upper_hr_threshold = 0.995; @@ -19439,7 +19437,7 @@ check_auto_cache_resize(void) } } - if ( show_progress ) HDfprintf(stderr, "*check point %d\n", checkpoint++); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); /* now just bang on one entry -- after three epochs, this should * get all entries other than the one evicted, and the cache size @@ -21526,7 +21524,7 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Load a second moster entry. Since the monster entry is larger + /* Load a second monster entry. Since the monster entry is larger * than half the size of the cache yet again, and there is not * sufficient space for the monster entry in the cache, we again * add space to the cache to make space for the entry. @@ -22816,7 +22814,6 @@ check_auto_cache_resize_disable(void) auto_size_ctl.decr_mode = H5C_decr__threshold; auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; @@ -25071,6 +25068,7 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Now test the flash cache size increment code to verify that it * is disabled when it should be. * @@ -25098,7 +25096,6 @@ check_auto_cache_resize_disable(void) * code enabled. */ - if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -25314,8 +25311,8 @@ check_auto_cache_resize_epoch_markers(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -25984,9 +25981,9 @@ check_auto_cache_resize_epoch_markers(void) * Modifications: * * Added code to verify that errors in the flash cache size - * increment related fields are caught as well. + * increment related fields are caught as well. * - * JRM -- 1/17/08 + * JRM -- 1/17/08 * *------------------------------------------------------------------------- */ @@ -26084,8 +26081,8 @@ check_auto_cache_resize_input_errs(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -27418,7 +27415,6 @@ check_auto_cache_resize_input_errs(void) } } - /* test for bad flash_incr_mode rejection */ if ( pass ) { @@ -27790,6 +27786,7 @@ check_auto_cache_resize_input_errs(void) } } + /* test for bad decr_mode rejection */ if ( pass ) { @@ -28501,8 +28498,8 @@ check_auto_cache_resize_aux_fcns(void) /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0, - /* double flash_threshold = */ 0.5, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, diff --git a/test/cache_api.c b/test/cache_api.c index 796e303..e7ba7bd 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -25,6 +25,7 @@ #include "H5ACprivate.h" #include "cache_common.h" + /* global variable declarations: */ /* macro definitions */ @@ -197,8 +198,7 @@ check_fapl_mdc_api_calls(void) H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG; H5AC_cache_config_t mod_config = { - /* int version = */ - H5AC__CURR_CACHE_CONFIG_VERSION, + /* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, /* hbool_t close_trace_file = */ FALSE, @@ -356,9 +356,9 @@ check_fapl_mdc_api_calls(void) pass = FALSE; failure_mssg = "Can't get file_ptr.\n"; - } else { + } else { - cache_ptr = file_ptr->shared->cache; + cache_ptr = file_ptr->shared->cache; } } @@ -2021,6 +2021,7 @@ mdc_api_call_smoke_check(int express_test) } /* mdc_api_call_smoke_check() */ + /* The following array of invalid external MDC cache configurations is * used to test error rejection in the MDC related API calls. */ diff --git a/test/cache_common.c b/test/cache_common.c index 0c94a22..4326616 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -26,7 +26,7 @@ #include "H5MFprivate.h" #include "cache_common.h" - + /* global variable declarations: */ const char *FILENAME[] = { @@ -293,8 +293,7 @@ static herr_t clear(H5F_t * f, void * thing, hbool_t dest); static herr_t destroy(H5F_t * f, void * thing); static herr_t flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing, unsigned UNUSED * flags_ptr); -static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); +static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); static herr_t size(H5F_t * f, void * thing, size_t * size_ptr); static herr_t notify(H5C_notify_action_t action, void *thing); static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, @@ -316,8 +315,6 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -430,8 +427,6 @@ type_and_index_to_addr(int32_t type, #endif -/* Call back functions: */ - /*------------------------------------------------------------------------- * * Function: check_if_write_permitted @@ -449,8 +444,6 @@ type_and_index_to_addr(int32_t type, * * Programmer: John Mainzer, 5/15/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -987,8 +980,7 @@ void * load(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, - const void UNUSED *udata1, - void UNUSED *udata2) + void UNUSED *udata) { int32_t type; int32_t idx; @@ -1033,80 +1025,69 @@ load(H5F_t UNUSED *f, } /* load() */ void * -pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } void * -notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) +notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) { - return(load(f, dxpl_id, addr, udata1, udata2)); + return(load(f, dxpl_id, addr, udata)); } @@ -1316,8 +1297,6 @@ notify_notify(H5C_notify_action_t action, void *thing) * Programmer: John Mainzer * 9/1/06 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -1390,8 +1369,6 @@ add_flush_op(int target_type, * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -1471,10 +1448,6 @@ create_pinned_entry_dependency(H5F_t * file_ptr, * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -1548,10 +1521,6 @@ dirty_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 9/1/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -1665,12 +1634,6 @@ execute_flush_op(H5F_t * file_ptr, * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * - * JRM - 10/12/04 - * Removed references to local_H5C_t, as we now get direct - * access to the definition of H5C_t via H5Cpkg.h. - * *------------------------------------------------------------------------- */ @@ -1719,16 +1682,6 @@ entry_in_cache(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * - * JRM -- 3/31/06 - * Added initialization for new pinned entry test related - * fields. - * - * JRM -- 4/1/07 - * Added initialization for the new is_read_only, and - * ro_ref_count fields. - * *------------------------------------------------------------------------- */ @@ -1883,10 +1836,6 @@ reset_entries(void) * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -1950,23 +1899,19 @@ resize_entry(H5F_t * file_ptr, /*------------------------------------------------------------------------- - * Function: resize_pinned_entry + * Function: resize_pinned_entry * - * Purpose: Given a pointer to a cache, an entry type, an index, and + * Purpose: Given a pointer to a cache, an entry type, an index, and * a new size, change the size of the target pinned entry * to match the supplied new size. * - * Do nothing if pass is false on entry. + * Do nothing if pass is false on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/11/08 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -1974,7 +1919,7 @@ void resize_pinned_entry(H5C_t * cache_ptr, int32_t type, int32_t idx, - size_t new_size) + size_t new_size) { herr_t result; test_entry_t * base_addr; @@ -1990,7 +1935,7 @@ resize_pinned_entry(H5C_t * cache_ptr, if ( ! entry_in_cache(cache_ptr, type, idx) ) { - pass = FALSE; + pass = FALSE; failure_mssg = "entry not in cache."; } else { @@ -2009,23 +1954,23 @@ resize_pinned_entry(H5C_t * cache_ptr, } else { - entry_ptr->size = new_size; + entry_ptr->size = new_size; result = H5C_resize_pinned_entry((void *)entry_ptr, new_size); - if ( result != SUCCEED ) { + if ( result != SUCCEED ) { - pass = FALSE; - failure_mssg = "error(s) in H5C_resize_pinned_entry()."; + pass = FALSE; + failure_mssg = "error(s) in H5C_resize_pinned_entry()."; - } else { + } else { - HDassert( entry_ptr->size = (entry_ptr->header).size ); + HDassert( entry_ptr->size = (entry_ptr->header).size ); } - } - } + } + } } return; @@ -2046,8 +1991,6 @@ resize_pinned_entry(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -2106,8 +2049,6 @@ verify_clean(void) * Programmer: John Mainzer * 10/8/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -2134,7 +2075,7 @@ verify_entry_status(H5C_t * cache_ptr, ( expected[i].is_pinned ) ) ) { pass = FALSE; - sprintf(msg, "Contradictory data in expected[%d].\n", i); + sprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i); failure_mssg = msg; } @@ -2467,8 +2408,6 @@ verify_entry_status(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/10/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -2541,10 +2480,10 @@ setup_cache(size_t max_cache_size, hbool_t verbose = TRUE; int mile_stone = 1; hid_t fid = -1; - haddr_t actual_base_addr; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5F_t * ret_val = NULL; + haddr_t actual_base_addr; hid_t fapl_id = H5P_DEFAULT; if ( show_progress ) /* 1 */ @@ -2892,17 +2831,12 @@ takedown_cache(H5F_t * file_ptr, * * Purpose: Expunge the entry indicated by the type and index. * - * Do nothing if pass is FALSE on entry. * * Return: void * * Programmer: John Mainzer * 7/6/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -2965,8 +2899,6 @@ expunge_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 6/23/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -3052,24 +2984,6 @@ flush_cache(H5F_t * file_ptr, * Programmer: John Mainzer * 6/16/04 * - * Modifications: - * - * JRM -- 1/13/05 - * Updated function for the flags parameter in - * H5C_insert_entry(), and to allow access to this parameter. - * - * JRM -- 6/17/05 - * The interface no longer permits clean inserts. - * Accordingly, the dirty parameter is no longer meaningfull. - * - * JRM -- 4/5/06 - * Added code to initialize the new cache_ptr field of the - * test_entry_t structure. - * - * JRM -- 8/10/06 - * Updated to reflect the fact that entries can now be - * inserted pinned. - * *------------------------------------------------------------------------- */ @@ -3171,10 +3085,6 @@ insert_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 3/28/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -3206,11 +3116,11 @@ mark_pinned_entry_dirty(int32_t type, entry_ptr->is_dirty = TRUE; - if ( size_changed ) { + if ( size_changed ) { - /* update entry size now to keep the sanity checks happy */ - entry_ptr->size = new_size; - } + /* update entry size now to keep the sanity checks happy */ + entry_ptr->size = new_size; + } result = H5C_mark_pinned_entry_dirty((void *)entry_ptr, size_changed, @@ -3224,20 +3134,20 @@ mark_pinned_entry_dirty(int32_t type, ( entry_ptr->addr != entry_ptr->header.addr ) ) { #if 0 /* This is useful debugging code -- keep it around */ - HDfprintf(stdout, "result = %ld.\n", (long)result); - HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n", - (int)(entry_ptr->header.is_dirty)); - HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n", - (int)(entry_ptr->header.is_pinned)); - HDfprintf(stdout, - "(entry_ptr->header.type != &(types[type])) = %d.\n", - (int)(entry_ptr->header.type != &(types[type]))); - HDfprintf(stdout, - "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n", - (long)(entry_ptr->size), (long)(entry_ptr->header.size)); - HDfprintf(stdout, - "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n", - (long)(entry_ptr->addr), (long)(entry_ptr->header.addr)); + HDfprintf(stdout, "result = %ld.\n", (long)result); + HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n", + (int)(entry_ptr->header.is_dirty)); + HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n", + (int)(entry_ptr->header.is_pinned)); + HDfprintf(stdout, + "(entry_ptr->header.type != &(types[type])) = %d.\n", + (int)(entry_ptr->header.type != &(types[type]))); + HDfprintf(stdout, + "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n", + (long)(entry_ptr->size), (long)(entry_ptr->header.size)); + HDfprintf(stdout, + "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n", + (long)(entry_ptr->addr), (long)(entry_ptr->header.addr)); #endif pass = FALSE; failure_mssg = "error in H5C_mark_pinned_entry_dirty()."; @@ -3265,10 +3175,6 @@ mark_pinned_entry_dirty(int32_t type, * Programmer: John Mainzer * 5/17/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -3349,12 +3255,6 @@ mark_pinned_or_protected_entry_dirty(int32_t type, * Programmer: John Mainzer * 6/21/04 * - * Modifications: - * - * JRM -- 6/17/05 - * Updated code to reflect the fact that renames automatically - * dirty entries. - * *------------------------------------------------------------------------- */ @@ -3453,12 +3353,6 @@ rename_entry(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/11/04 * - * Modifications: - * - * - Modified call to H5C_protect to pass H5C__NO_FLAGS_SET in the - * new flags parameter. - * JRM -- 3/28/07 - * *------------------------------------------------------------------------- */ @@ -3490,7 +3384,7 @@ protect_entry(H5F_t * file_ptr, HDassert( !(entry_ptr->is_protected) ); cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, - &(types[type]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET); + &(types[type]), entry_ptr->addr, NULL, H5C__NO_FLAGS_SET); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || @@ -3554,10 +3448,6 @@ protect_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 4/1/07 * - * Modifications: - * - * - None. - * *------------------------------------------------------------------------- */ @@ -3591,7 +3481,7 @@ protect_entry_ro(H5F_t * file_ptr, ( entry_ptr->ro_ref_count > 0 ) ) ); cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, - &(types[type]), entry_ptr->addr, NULL, NULL, H5C__READ_ONLY_FLAG); + &(types[type]), entry_ptr->addr, NULL, H5C__READ_ONLY_FLAG); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || @@ -3696,10 +3586,6 @@ pin_entry(int32_t type, * Programmer: John Mainzer * 3/28/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -3767,26 +3653,6 @@ unpin_entry(int32_t type, * Programmer: John Mainzer * 6/12/04 * - * Modifications: - * - * JRM -- 1/7/05 - * Updated for the replacement of the deleted parameter in - * H5C_unprotect() with the new flags parameter. - * - * JRM - 6/17/05 - * Modified function to use the new dirtied parameter of - * H5C_unprotect(). - * - * JRM -- 9/8/05 - * Update for new entry size parameter in H5C_unprotect(). - * We don't use them here for now. - * - * JRM -- 3/31/06 - * Update for pinned entries. - * - * JRM -- 4/1/07 - * Updated for new multiple read protects. - * *------------------------------------------------------------------------- */ @@ -3942,10 +3808,6 @@ unprotect_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 8/31/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -3957,7 +3819,6 @@ unprotect_entry_with_size_change(H5F_t * file_ptr, size_t new_size) { const char * fcn_name = "unprotect_entry_with_size_change()"; - H5C_t *cache_ptr; herr_t result; hbool_t dirty_flag_set; hbool_t pin_flag_set; @@ -3967,10 +3828,13 @@ unprotect_entry_with_size_change(H5F_t * file_ptr, test_entry_t * entry_ptr; if ( pass ) { +#ifndef NDEBUG + H5C_t * cache_ptr; cache_ptr = file_ptr->shared->cache; HDassert( cache_ptr ); +#endif /* NDEBUG */ HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); HDassert( new_size <= entry_sizes[type] ); @@ -4084,12 +3948,6 @@ unprotect_entry_with_size_change(H5F_t * file_ptr, * Programmer: John Mainzer * 6/12/04 * - * Modifications: - * - * JRM -- 4/4/07 - * Added code supporting multiple read only protects. - * Note that this increased the minimum lag to 10. - * *------------------------------------------------------------------------- */ @@ -4401,13 +4259,6 @@ row_major_scan_forward(H5F_t * file_ptr, * Programmer: John Mainzer * 10/21/04 * - * Modifications: - * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * *------------------------------------------------------------------------- */ @@ -4822,13 +4673,6 @@ row_major_scan_backward(H5F_t * file_ptr, * Programmer: John Mainzer * 10/21/04 * - * Modifications: - * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * *------------------------------------------------------------------------- */ @@ -5043,13 +4887,6 @@ col_major_scan_forward(H5F_t * file_ptr, * Programmer: John Mainzer * 19/25/04 * - * Modifications: - * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * *------------------------------------------------------------------------- */ @@ -5169,8 +5006,6 @@ hl_col_major_scan_forward(H5F_t * file_ptr, * Programmer: John Mainzer * 6/23/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -5287,13 +5122,6 @@ col_major_scan_backward(H5F_t * file_ptr, * Programmer: John Mainzer * 10/25/04 * - * Modifications: - * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * *------------------------------------------------------------------------- */ diff --git a/test/cache_common.h b/test/cache_common.h index 9a7ac9f..3714f6e 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -37,7 +37,7 @@ /* Macro to make error reporting easier */ #define CACHE_ERROR(s) {failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s ; pass = FALSE; goto done;} -#define NO_CHANGE -1 +#define NO_CHANGE -1 /* with apologies for the abuse of terminology... */ @@ -81,6 +81,7 @@ #define MAX_ENTRIES (10 * 1024) + /* The choice of the BASE_ADDR below is arbitrary -- it just has to be * larger than the superblock. */ @@ -598,28 +599,17 @@ herr_t notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing, unsigned * flags_ptr); -void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); +void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +void * notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); herr_t pico_size(H5F_t * f, void * thing, size_t * size_ptr); diff --git a/test/earray.c b/test/earray.c index c1584f9..fe9e9c1 100644 --- a/test/earray.c +++ b/test/earray.c @@ -1532,7 +1532,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED TEST_ERROR /* Protect the base entry */ - if(NULL == (base_entry = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (base_entry = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, NULL, H5AC_WRITE))) TEST_ERROR /* Unprotect & unpin the base entry */ @@ -1544,7 +1544,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED TEST_ERROR /* Protect the test entry */ - if(NULL == (entry1 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, NULL, NULL, H5AC_WRITE))) + if(NULL == (entry1 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, NULL, H5AC_WRITE))) TEST_ERROR /* Unprotect & unpin the test entry */ @@ -1556,7 +1556,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED TEST_ERROR /* Protect the test entry */ - if(NULL == (entry2 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, NULL, NULL, H5AC_WRITE))) + if(NULL == (entry2 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, NULL, H5AC_WRITE))) TEST_ERROR /* Unprotect & unpin the test entry */ @@ -1568,7 +1568,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED TEST_ERROR /* Protect the test entry */ - if(NULL == (entry3 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, NULL, NULL, H5AC_WRITE))) + if(NULL == (entry3 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, NULL, H5AC_WRITE))) TEST_ERROR /* Unprotect & unpin the test entry */ diff --git a/test/links.c b/test/links.c index afd5872..f23a566 100644 --- a/test/links.c +++ b/test/links.c @@ -1140,11 +1140,13 @@ test_move(hid_t fapl, hbool_t new_format) if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create hard and soft links. */ + /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR /* Move a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ @@ -1159,6 +1161,18 @@ test_move(hid_t fapl, hbool_t new_format) !=FAIL) TEST_ERROR } H5E_END_TRY; + /* Move a soft link across files. Should succeed. */ + if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + + /* Move an external link across files. Should succeed. */ + if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + /* Move a group across groups in the same file while renaming it. */ if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1286,11 +1300,13 @@ test_copy(hid_t fapl, hbool_t new_format) if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create hard and soft links. */ + /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR /* Copy a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ @@ -1305,6 +1321,18 @@ test_copy(hid_t fapl, hbool_t new_format) !=FAIL) TEST_ERROR } H5E_END_TRY; + /* Copy a soft link across files. Should succeed. */ + if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + + /* Copy an external link across files. Should succeed. */ + if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + /* Move a group across groups in the same file while renaming it. */ if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR diff --git a/test/ntypes.c b/test/ntypes.c index 781dfef..fa208e3 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -298,6 +298,7 @@ test_compound_dtype2(hid_t file) typedef struct s2 { short c2; long l2; + long long ll2; } s2; typedef struct s1 { char c; @@ -329,7 +330,8 @@ test_compound_dtype2(hid_t file) temp_point->i = n++; temp_point->st.c2 = (short)(i + j); temp_point->st.l2 = (i * 5 + j * 50) * n; - temp_point->l = (unsigned long long)((i * 10 + j * 100) * n); + temp_point->st.ll2 = (i * 10 + j * 100) * n; + temp_point->l = (unsigned long long)((i * 100 + j * 1000) * n); } /* end for */ } /* end for */ @@ -339,37 +341,40 @@ test_compound_dtype2(hid_t file) if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ -#if H5_SIZEOF_LONG==4 - if((tid2=H5Tcreate(H5T_COMPOUND, 6)) < 0) TEST_ERROR; - if((tid=H5Tcreate(H5T_COMPOUND, 19)) < 0) TEST_ERROR; -#elif H5_SIZEOF_LONG==8 - if((tid2=H5Tcreate(H5T_COMPOUND, 10)) < 0) TEST_ERROR; - if((tid=H5Tcreate(H5T_COMPOUND, 23)) < 0) TEST_ERROR; -#else -#error "Unknown 'long' size" -#endif + if((tid2=H5Tcreate(H5T_COMPOUND, sizeof(s2))) < 0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; /* Insert and pack members */ - if(H5Tinsert(tid2, "c2", 0, H5T_STD_I16BE) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "c2", HOFFSET(s2, c2), H5T_STD_I16BE) < 0) TEST_ERROR; #if H5_SIZEOF_LONG == 4 - if(H5Tinsert(tid2, "l2", 2, H5T_STD_I32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "l2", HOFFSET(s2, l2), H5T_STD_I32LE) < 0) TEST_ERROR; #elif H5_SIZEOF_LONG == 8 - if(H5Tinsert(tid2, "l2", 2, H5T_STD_I64LE) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "l2", HOFFSET(s2, l2), H5T_STD_I64LE) < 0) TEST_ERROR; #else #error "Unknown 'long' size" #endif +#if H5_SIZEOF_LONG_LONG == 4 + if(H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I32BE) < 0) TEST_ERROR; +#elif H5_SIZEOF_LONG_LONG == 8 + if(H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I64BE) < 0) TEST_ERROR; +#else +#error "Unknown 'long long' size" +#endif - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; - if(H5Tinsert(tid, "i", 1, H5T_STD_I32LE) < 0) TEST_ERROR; - if(H5Tinsert(tid, "st", 5, tid2) < 0) TEST_ERROR; -#if H5_SIZEOF_LONG == 4 - if(H5Tinsert(tid, "l", 11, H5T_STD_U64BE) < 0) TEST_ERROR; -#elif H5_SIZEOF_LONG == 8 - if(H5Tinsert(tid, "l", 15, H5T_STD_U64BE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "c", HOFFSET(s1, c), H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "i", HOFFSET(s1, i), H5T_STD_I32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "st", HOFFSET(s1, st), tid2) < 0) TEST_ERROR; +#if H5_SIZEOF_LONG_LONG == 4 + if(H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U32BE) < 0) TEST_ERROR; +#elif H5_SIZEOF_LONG_LONG == 8 + if(H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U64BE) < 0) TEST_ERROR; #else -#error "Unknown 'long' size" +#error "Unknown 'long long' size" #endif + /* Take away the paddings */ + if(H5Tpack(tid) < 0) TEST_ERROR; + /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_COMPOUND_NAME_2, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -382,6 +387,7 @@ test_compound_dtype2(hid_t file) /* Insert members */ if(H5Tinsert(tid_m2, "c2", HOFFSET(s2, c2), H5T_NATIVE_SHORT) < 0) TEST_ERROR; if(H5Tinsert(tid_m2, "l2", HOFFSET(s2, l2), H5T_NATIVE_LONG) < 0) TEST_ERROR; + if(H5Tinsert(tid_m2, "ll2", HOFFSET(s2, ll2), H5T_NATIVE_LLONG) < 0) TEST_ERROR; if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; if(H5Tinsert(tid_m, "i", HOFFSET(s1, i), H5T_NATIVE_INT) < 0) TEST_ERROR; if(H5Tinsert(tid_m, "st", HOFFSET(s1, st), tid_m2) < 0) TEST_ERROR; @@ -406,13 +412,16 @@ test_compound_dtype2(hid_t file) if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; + if(H5Tequal(native_type, tid_m) != TRUE) + TEST_ERROR; + /* Verify the datatype of each field retrieved and converted */ /* check the char member */ if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; - if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) + if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_SCHAR)) TEST_ERROR; - if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE)) + if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I8LE)) TEST_ERROR; if(H5T_INTEGER != H5Tget_class(mem_id)) TEST_ERROR; @@ -429,7 +438,7 @@ test_compound_dtype2(hid_t file) TEST_ERROR; H5Tclose(mem_id); - /* check the long long member */ + /* check the unsigned long long member */ if((mem_id = H5Tget_member_type(native_type, 3)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_ULLONG)) @@ -469,6 +478,21 @@ test_compound_dtype2(hid_t file) TEST_ERROR; H5Tclose(mem_id); + if((mem_id = H5Tget_member_type(nest_mem_id, 2)) < 0) + TEST_ERROR; + if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG)) + TEST_ERROR; +#if H5_SIZEOF_LONG_LONG==4 + if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE)) TEST_ERROR; +#elif H5_SIZEOF_LONG_LONG==8 + if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64LE)) TEST_ERROR; +#else +#error "Unknown 'long long' size" +#endif + if(H5T_INTEGER!=H5Tget_class(mem_id)) + TEST_ERROR; + H5Tclose(mem_id); + /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)))) @@ -496,6 +520,7 @@ test_compound_dtype2(hid_t file) temp_point->i != temp_check->i || temp_point->st.c2 != temp_check->st.c2 || temp_point->st.l2 != temp_check->st.l2 || + temp_point->st.ll2 != temp_check->st.ll2 || temp_point->l != temp_check->l ) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -644,6 +669,9 @@ test_compound_dtype(hid_t file) if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; + if(H5Tequal(native_type, tid2) != TRUE) + TEST_ERROR; + /* Verify the datatype of each field retrieved and converted */ if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; @@ -2550,7 +2578,7 @@ test_bitfield_dtype(hid_t file) H5P_DEFAULT)) < 0) TEST_ERROR; for(i = 0; i < BITFIELD_ENUMB*sizeof(int); i++) - wbuf[i] = (unsigned int)0xff ^ (unsigned int)i; + wbuf[i] = (unsigned char)((unsigned int)0xff ^ (unsigned int)i); if(H5Dwrite(dset1, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; @@ -2581,12 +2609,12 @@ test_bitfield_dtype(hid_t file) /* Read the data and compare them */ if(H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; - p = (unsigned int*)rbuf; + p = (unsigned char *)rbuf; for(i = 0; i < BITFIELD_ENUMB*4; i++) { if(*p != wbuf[i]) { H5_FAILED(); printf(" Read different values than written.\n"); - printf(" At index %d\n", i); + printf(" At index %zu\n", i); TEST_ERROR; } p++; @@ -2611,7 +2639,7 @@ test_bitfield_dtype(hid_t file) if(intr[i] != intw[i]) { H5_FAILED(); printf(" Read different values than written.\n"); - printf(" At index %d\n", i); + printf(" At index %zu\n", i); TEST_ERROR; } } diff --git a/test/trefer.c b/test/trefer.c index dbf12bc..6ee298f 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -62,6 +62,178 @@ typedef struct s1_t { /**************************************************************** ** +** test_reference_params(): Test basic H5R (reference) parameters +** for correct processing +** +****************************************************************/ +static void +test_reference_params(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hobj_ref_t *wbuf, /* buffer to write to disk */ + *rbuf, /* buffer read from disk */ + *tbuf; /* temp. buffer read from disk */ + hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */ + unsigned *tu32; /* Temporary pointer to uint32 data */ + int i, j; /* counting variables */ + const char *write_comment="Foo!"; /* Comments for group */ + char read_comment[10]; + H5O_type_t obj_type; /* Object type */ + herr_t ret; /* Generic return value */ + char *ref_name; /* Buffer for ref name */ + size_t name_size; /* Size of reference name */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Reference Parameters\n")); + + /* Allocate write & read buffers */ + wbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + rbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + tbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + + /* Create file */ + fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + + /* Create a group */ + group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(group, FAIL, "H5Gcreate2"); + + /* Set group's comment */ + ret = H5Oset_comment(group, write_comment); + CHECK(ret, FAIL, "H5Oset_comment"); + + /* Create a dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate2"); + + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++=i*3; + + /* Write selection to disk */ + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create another dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate2"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create a datatype to refer to */ + tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); + CHECK(tid1, FAIL, "H5Tcreate"); + + /* Insert fields */ + ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT); + CHECK(ret, FAIL, "H5Tinsert"); + + /* Save datatype for later */ + ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Create a dataset */ + dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dcreate2"); + + /* Test parameters to H5Rcreate */ + ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + VERIFY(ret, FAIL, "H5Rcreate ref"); + ret = H5Rcreate(&wbuf[0], -1, "/Group1/Dataset1", H5R_OBJECT, -1); + VERIFY(ret, FAIL, "H5Rcreate loc_id"); + ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, -1); + VERIFY(ret, FAIL, "H5Rcreate name"); + ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, -1); + VERIFY(ret, FAIL, "H5Rcreate null name"); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, -1); + VERIFY(ret, FAIL, "H5Rcreate type"); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, -1); + VERIFY(ret, FAIL, "H5Rcreate region space"); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, 0); + VERIFY(ret, FAIL, "H5Rcreate space"); + + /* Test parameters to H5Rdereference */ + dset2 = H5Rdereference(-1, H5R_OBJECT, &rbuf[0]); + VERIFY(dset2, FAIL, "H5Rdereference loc_id"); + dset2 = H5Rdereference(dataset, H5R_OBJECT, NULL); + VERIFY(dset2, FAIL, "H5Rdereference ref"); + dset2 = H5Rdereference(dataset, H5R_MAXTYPE, &rbuf[0]); + VERIFY(dset2, FAIL, "H5Rdereference type"); + + /* Test parameters to H5Rget_obj_type2 */ + ret = H5Rget_obj_type2(-1, H5R_OBJECT, &rbuf[0], NULL); + VERIFY(ret, FAIL, "H5Rget_obj_type2 loc_id"); + ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL); + VERIFY(ret, FAIL, "H5Rget_obj_type2 ref"); + ret = H5Rget_obj_type2(fid1, H5R_MAXTYPE, &rbuf[0], NULL); + VERIFY(ret, FAIL, "H5Rget_obj_type2 type"); + + /* Test parameters to H5Rget_name */ + name_size = H5Rget_name(-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0); + VERIFY(name_size, FAIL, "H5Rget_name loc_id"); + name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0); + VERIFY(ret, FAIL, "H5Rget_name ref"); + name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0); + VERIFY(ret, FAIL, "H5Rget_name type"); + + /* Test parameters to H5Rget_region */ + ret = H5Rget_region(-1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret, FAIL, "H5Rget_region loc_id"); + ret = H5Rget_region(fid1, H5R_OBJECT, NULL); + VERIFY(ret, FAIL, "H5Rget_region ref"); + ret = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret, FAIL, "H5Rget_region type"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Free memory buffers */ + free(wbuf); + free(rbuf); + free(tbuf); +} /* test_reference_obj() */ + +/**************************************************************** +** ** test_reference_obj(): Test basic H5R (reference) object reference code. ** Tests references to various kinds of objects ** @@ -1373,6 +1545,7 @@ test_reference(void) /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); + test_reference_params(); /* Test for correct parameter checking */ test_reference_obj(); /* Test basic H5R object reference code */ test_reference_region(); /* Test basic H5R dataset region reference code */ test_reference_region_1D(); /* Test H5R dataset region reference code for 1-D datasets */ |