diff options
Diffstat (limited to 'test')
64 files changed, 3963 insertions, 3745 deletions
diff --git a/test/btree2.c b/test/btree2.c index fa56f24..8e2aa04 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -7576,7 +7576,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Initialize v2 B-tree creation parameters */ init_cparam(&cparam); @@ -7585,11 +7585,11 @@ main(void) /* Loop over re-opening B-tree during tests */ for(reopen = FALSE; reopen <= TRUE; reopen++) { if(reopen) { - fprintf(stdout, "Testing with reopening B-tree:\n"); + HDfprintf(stdout, "Testing with reopening B-tree:\n"); tparam.reopen_btree = TRUE; } /* end if */ else { - fprintf(stdout, "Testing without reopening B-tree:\n"); + HDfprintf(stdout, "Testing without reopening B-tree:\n"); tparam.reopen_btree = FALSE; } /* end else */ @@ -7609,7 +7609,7 @@ main(void) nerrors += test_insert_level2_3internal_redistrib(fapl, &cparam, &tparam); nerrors += test_insert_level2_3internal_split(fapl, &cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. test_insert_lots skipped\n"); + HDprintf("***Express test mode on. test_insert_lots skipped\n"); else nerrors += test_insert_lots(fapl, &cparam, &tparam); @@ -7636,7 +7636,7 @@ main(void) nerrors += test_remove_level2_3internal_merge(fapl, &cparam, &tparam); nerrors += test_remove_level2_collapse_right(fapl, &cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. test_remove_lots skipped\n"); + HDprintf("***Express test mode on. test_remove_lots skipped\n"); else nerrors += test_remove_lots(envval, fapl, &cparam); diff --git a/test/cache_api.c b/test/cache_api.c index 9b791cf..cd1176f 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -14,8 +14,8 @@ /* Programmer: John Mainzer * 11/10/05 * - * This file contains tests for the API calls associated - * with the cache implemented in H5C.c + * This file contains tests for the API calls associated + * with the cache implemented in H5C.c */ #include "cache_common.h" @@ -38,7 +38,7 @@ static void check_fapl_mdc_api_errs(void); static void check_file_mdc_api_errs(void); - + /**************************************************************************/ /**************************************************************************/ /********************************* tests: *********************************/ @@ -56,7 +56,7 @@ static void check_file_mdc_api_errs(void); * be sufficient to verify that the desired configuration * data is getting to the cache. * - * Return: void + * Return: void * * Programmer: John Mainzer * 4/12/04 @@ -107,8 +107,8 @@ check_fapl_mdc_api_calls(void) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t scratch; H5C_auto_size_ctl_t default_auto_size_ctl; @@ -485,7 +485,7 @@ check_fapl_mdc_api_calls(void) } /* check_fapl_mdc_api_calls() */ - + /*------------------------------------------------------------------------- * Function: check_file_mdc_api_calls() * @@ -500,7 +500,7 @@ check_fapl_mdc_api_calls(void) * We shouldn't need to verify data correctness beyond that * point. * - * Return: void + * Return: void * * Programmer: John Mainzer * 4/14/04 @@ -552,8 +552,8 @@ check_file_mdc_api_calls(void) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_2 = { @@ -587,8 +587,8 @@ check_file_mdc_api_calls(void) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_3 = { @@ -622,8 +622,8 @@ check_file_mdc_api_calls(void) /* hbool_t apply_empty_reserve = */ FALSE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_4 = { @@ -658,8 +658,8 @@ check_file_mdc_api_calls(void) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; TESTING("MDC/FILE related API calls"); @@ -802,9 +802,9 @@ check_file_mdc_api_calls(void) else { HDfprintf(stdout, "H5Fget_mdc_size() reports:\n"); - HDfprintf(stdout, " max_size: %ld, min_clean_size: %ld\n", + HDfprintf(stdout, " max_size: %ld, min_clean_size: %ld\n", (long)max_size, (long)min_clean_size); - HDfprintf(stdout, " cur_size: %ld, cur_num_entries: %d\n", + HDfprintf(stdout, " cur_size: %ld, cur_num_entries: %d\n", (long)cur_size, cur_num_entries); } #endif @@ -833,14 +833,14 @@ check_file_mdc_api_calls(void) } /* check_file_mdc_api_calls() */ - + /*------------------------------------------------------------------------- - * Function: mdc_api_call_smoke_check() + * Function: mdc_api_call_smoke_check() * * Purpose: Initial basic functional test to see if there are problems * with the cache API calls. * - * NOTE: This test takes some time to run and checks the + * NOTE: This test takes some time to run and checks the * HDF5TestExpress environment variable. * * Return: void @@ -913,8 +913,8 @@ mdc_api_call_smoke_check(int express_test) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_2 = { @@ -948,8 +948,8 @@ mdc_api_call_smoke_check(int express_test) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_3 = { @@ -983,8 +983,8 @@ mdc_api_call_smoke_check(int express_test) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; TESTING("MDC API smoke check"); @@ -1094,9 +1094,9 @@ mdc_api_call_smoke_check(int express_test) /* create the dataset */ if ( pass ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, - dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); + dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -1304,7 +1304,7 @@ mdc_api_call_smoke_check(int express_test) pass = FALSE; failure_mssg = "slab validation failed."; #else /* as above */ - fprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); #endif } @@ -1425,7 +1425,7 @@ mdc_api_call_smoke_check(int express_test) pass = FALSE; failure_mssg = "slab validation failed."; #if 0 /* as above */ - fprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); #endif } @@ -1513,7 +1513,7 @@ mdc_api_call_smoke_check(int express_test) * used to test error rejection in the MDC related API calls. */ -#define NUM_INVALID_CONFIGS 42 +#define NUM_INVALID_CONFIGS 42 H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = { @@ -1549,8 +1549,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 1 -- bad rpt_fcn_enabled */ @@ -1584,8 +1584,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 2 -- bad open_trace_file */ @@ -1619,8 +1619,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 3 -- bad close_trace_file */ @@ -1654,8 +1654,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 4 -- open_trace_file == TRUE and empty trace_file_name */ @@ -1689,8 +1689,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 5 -- bad set_initial_size */ @@ -1724,8 +1724,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 6 -- max_size too big */ @@ -1759,8 +1759,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 7 -- min_size too small */ @@ -1794,8 +1794,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 8 -- min_size > max_size */ @@ -1829,8 +1829,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 9 -- initial size out of range (too big) */ @@ -1864,8 +1864,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 10 -- initial_size out of range (too small) */ @@ -1899,8 +1899,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 11 -- min_clean_fraction too big */ @@ -1934,8 +1934,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 12 -- min_clean_fraction too small */ @@ -1969,8 +1969,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 13 -- epoch_length too small */ @@ -2004,8 +2004,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 14 -- epoch_length too big */ @@ -2039,8 +2039,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 15 -- invalid incr_mode */ @@ -2074,8 +2074,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 16 -- lower_hr_threshold too small */ @@ -2109,8 +2109,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 17 -- lower_hr_threshold too big */ @@ -2144,8 +2144,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 18 -- increment too small */ @@ -2179,8 +2179,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 19 -- bad apply_max_increment */ @@ -2214,8 +2214,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 20 -- invalid flash_incr_mode */ @@ -2249,8 +2249,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 21 -- flash_multiple too small */ @@ -2284,8 +2284,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 22 -- flash_multiple too big */ @@ -2319,8 +2319,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 23 -- flash_threshold too small */ @@ -2354,8 +2354,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 24 -- flash_threshold too big */ @@ -2389,8 +2389,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 25 -- bad decr_mode */ @@ -2424,8 +2424,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 26 -- upper_hr_threshold too big */ @@ -2459,8 +2459,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 27 -- decrement too small */ @@ -2494,8 +2494,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 28 -- decrement too big */ @@ -2529,8 +2529,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 29 -- epochs_before_eviction too small */ @@ -2564,8 +2564,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 30 -- epochs_before_eviction too big */ @@ -2599,8 +2599,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 31 -- invalid apply_empty_reserve */ @@ -2634,8 +2634,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ 2, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 32 -- empty_reserve too small */ @@ -2669,8 +2669,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ -0.0000000001f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 33 -- empty_reserve too big */ @@ -2704,8 +2704,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ H5_DOUBLE(1.00000000001), /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 34 -- upper_hr_threshold too small */ @@ -2739,8 +2739,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 35 -- upper_hr_threshold too big */ @@ -2774,8 +2774,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 36 -- upper_hr_threshold <= lower_hr_threshold */ @@ -2809,8 +2809,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 37 -- dirty_bytes_threshold too small */ @@ -2844,8 +2844,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (H5C__MIN_MAX_CACHE_SIZE / 2) - 1, - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 38 -- dirty_bytes_threshold too big */ @@ -2879,8 +2879,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (H5C__MAX_MAX_CACHE_SIZE / 4) + 1, - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 39 -- attempt to disable evictions when auto incr enabled */ @@ -2914,8 +2914,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 40 -- attempt to disable evictions when auto decr enabled */ @@ -2949,8 +2949,8 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { /* 41 -- unknown metadata write strategy */ @@ -2984,18 +2984,18 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ -1 + /* int metadata_write_strategy = */ -1 } }; - + /*------------------------------------------------------------------------- * Function: check_fapl_mdc_api_errs() * * Purpose: Verify that the FAPL related MDC API calls reject input * errors gracefully. * - * Return: void + * Return: void * * Programmer: John Mainzer * 4/19/04 @@ -3156,14 +3156,14 @@ check_fapl_mdc_api_errs(void) } /* check_fapl_mdc_api_errs() */ - + /*------------------------------------------------------------------------- * Function: check_file_mdc_api_errs() * * Purpose: Verify that the file related MDC API calls reject input * errors gracefully. * - * Return: void + * Return: void * * Programmer: John Mainzer * 4/19/04 @@ -3202,8 +3202,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: calling h5_fixname().\n", fcn_name); - } + HDfprintf(stdout, "%s: calling h5_fixname().\n", fcn_name); + } if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -3217,8 +3217,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: calling H5Fcreate().\n", fcn_name); - } + HDfprintf(stdout, "%s: calling H5Fcreate().\n", fcn_name); + } file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -3239,8 +3239,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", fcn_name); + } H5E_BEGIN_TRY { result = H5Fget_mdc_config((hid_t)-1, &scratch); @@ -3257,8 +3257,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", fcn_name); + } H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, NULL); @@ -3276,8 +3276,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", fcn_name); + } H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, &scratch); @@ -3298,8 +3298,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", fcn_name); + } H5E_BEGIN_TRY { result = H5Fset_mdc_config((hid_t)-1, &default_config); @@ -3316,8 +3316,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", fcn_name); + } H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, NULL); @@ -3335,10 +3335,10 @@ check_file_mdc_api_errs(void) { if ( show_progress ) { - HDfprintf(stdout, - "%s: testing H5Fset_mdc_config() with invalid config %d.\n", - fcn_name, i); - } + HDfprintf(stdout, + "%s: testing H5Fset_mdc_config() with invalid config %d.\n", + fcn_name, i); + } H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, &(invalid_configs[i])); @@ -3365,9 +3365,9 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", - fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", + fcn_name); + } H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate); @@ -3384,9 +3384,9 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", - fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", + fcn_name); + } H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate(file_id, NULL); @@ -3405,9 +3405,9 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", - fcn_name); - } + HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", + fcn_name); + } H5E_BEGIN_TRY { result = H5Freset_mdc_hit_rate_stats((hid_t)-1); @@ -3427,8 +3427,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", fcn_name); + } H5E_BEGIN_TRY { result = H5Fget_mdc_size((hid_t)-1, &max_size, &min_clean_size, @@ -3446,8 +3446,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", fcn_name); - } + HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", fcn_name); + } if ( ( H5Fget_mdc_size(file_id, &max_size, NULL, NULL, NULL) < 0 ) || ( H5Fget_mdc_size(file_id, NULL, &min_clean_size, @@ -3468,8 +3468,8 @@ check_file_mdc_api_errs(void) if ( show_progress ) { - HDfprintf(stdout, "%s: cleaning up from tests.\n", fcn_name); - } + HDfprintf(stdout, "%s: cleaning up from tests.\n", fcn_name); + } if ( H5Fclose(file_id) < 0 ) { @@ -3491,13 +3491,13 @@ check_file_mdc_api_errs(void) } /* check_file_mdc_api_errs() */ - + /*------------------------------------------------------------------------- * Function: main * * Purpose: Run tests on the cache code contained in H5C.c * - * Return: Success: + * Return: Success: * * Programmer: John Mainzer * 6/24/04 diff --git a/test/cache_common.c b/test/cache_common.c index a5dd485..c4ecb6d 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1891,7 +1891,7 @@ verify_entry_status(H5C_t * cache_ptr, ( expected[i].is_pinned ) ) ) { pass = FALSE; - sprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i); + HDsprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i); failure_mssg = msg; } @@ -1903,7 +1903,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( in_cache != expected[i].in_cache ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) in cache actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -1919,7 +1919,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->size != expected[i].size ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) size actualexpected = %ld/%ld.\n", tag, (int)expected[i].entry_type, @@ -1935,7 +1935,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->header.size != expected[i].size ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) header size actual/expected = %ld/%ld.\n", tag, (int)expected[i].entry_type, @@ -1951,7 +1951,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->at_main_addr != expected[i].at_main_addr ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) at main addr actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -1967,7 +1967,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->is_dirty != expected[i].is_dirty ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -1983,7 +1983,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->header.is_dirty != expected[i].is_dirty ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -1999,7 +1999,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->is_protected != expected[i].is_protected ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) is_protected actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -2015,7 +2015,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->header.is_protected != expected[i].is_protected ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) header is_protected actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -2031,7 +2031,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->is_pinned != expected[i].is_pinned ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -2047,7 +2047,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( entry_ptr->header.is_pinned != expected[i].is_pinned ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n", tag, (int)expected[i].entry_type, @@ -2066,7 +2066,7 @@ verify_entry_status(H5C_t * cache_ptr, ( entry_ptr->destroyed != expected[i].destroyed ) ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d,%d) loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n", tag, (int)expected[i].entry_type, diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index fd3bb30..37ee076 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -214,13 +214,13 @@ test_compound (char *filename, hid_t fapl) /* Also verify H5Pset_preserve is initially 0 and then is set to 1. */ if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto error; if ((ret_code=H5Pget_preserve (PRESERVE)) != 0){ - printf("Preserve status of dataset transfer property list should be" + HDprintf("Preserve status of dataset transfer property list should be" " 0 (FALSE), got %d\n", ret_code); goto error; } if (H5Pset_preserve (PRESERVE, 1)<0) goto error; if ((ret_code=H5Pget_preserve (PRESERVE)) != 1){ - printf("Preserve status of dataset transfer property list should be" + HDprintf("Preserve status of dataset transfer property list should be" " 1 (TRUE), got %d\n", ret_code); goto error; } @@ -550,11 +550,11 @@ test_compound (char *filename, hid_t fapl) s1[i].d != 8*i+6 || s1[i].e != 8*i+7) { H5_FAILED(); - printf(" i==%u, row=%u, col=%u\n", i, i/NY, i%NY); - printf(" got: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n", + HDprintf(" i==%u, row=%u, col=%u\n", i, i/NY, i%NY); + HDprintf(" got: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n", s1[i].a, s1[i].b, s1[i].c[0], s1[i].c[1], s1[i].c[2], s1[i].c[3], s1[i].d, s1[i].e); - printf(" ans: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n", + HDprintf(" ans: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n", 8*i+0, 8*i+1, 8*i+2, 8*i+3, 8*i+4, 8*i+5, 8*i+6, 8*i+7); goto error; } @@ -1298,15 +1298,15 @@ compare_data(void *src_data, void *dst_data, hbool_t src_subset) !DBL_ABS_EQUAL(s_ptr->n, d_ptr->n) ) { H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->c[4], s_ptr->c[5], s_ptr->c[6], s_ptr->c[7], s_ptr->d, s_ptr->e, s_ptr->f, s_ptr->g,s_ptr->h[0],s_ptr->h[1],s_ptr->h[2], s_ptr->h[3],s_ptr->h[4],s_ptr->h[5],s_ptr->h[6],s_ptr->h[7],s_ptr->h[8], s_ptr->h[9],s_ptr->h[10],s_ptr->h[11],s_ptr->h[12],s_ptr->h[13],s_ptr->h[14], s_ptr->h[15], s_ptr->i,s_ptr->j,s_ptr->k,s_ptr->l,s_ptr->m,s_ptr->n); - printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], d_ptr->c[3], d_ptr->c[4], d_ptr->c[5], d_ptr->c[6], d_ptr->c[7], d_ptr->d, d_ptr->e, d_ptr->f, d_ptr->g,d_ptr->h[0],d_ptr->h[1],d_ptr->h[2], @@ -1738,10 +1738,10 @@ error: { \ int _i; \ H5_FAILED(); AT(); \ - printf(" Insertion order ="); \ + HDprintf(" Insertion order ="); \ for(_i=0; _i<PACK_NMEMBS; _i++) \ - printf(" %d", order[_i]); \ - printf("\n Inner compound order = %d, location = %d\n", sub_cmpd_order, order[sub_cmpd_order]); \ + HDprintf(" %d", order[_i]); \ + HDprintf("\n Inner compound order = %d, location = %d\n", sub_cmpd_order, order[sub_cmpd_order]); \ fflush(stdout); \ goto error; \ } @@ -1819,7 +1819,7 @@ test_pack_ooo(void) /* Insert the compound members in the random order previously generated */ for(i=0; i<PACK_NMEMBS; i++) { - sprintf(name, "%05d", i); + HDsprintf(name, "%05d", i); if(i == sub_cmpd_order) { if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR } else @@ -1845,7 +1845,7 @@ test_pack_ooo(void) /* Insert the compound members in the random order previously generated */ for(i=0; i<PACK_NMEMBS; i++) { - sprintf(name, "%05d", i); + HDsprintf(name, "%05d", i); if(i == sub_cmpd_order) { if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR } else @@ -1872,7 +1872,7 @@ test_pack_ooo(void) /* Insert the compound members in reverse order, with compound last */ for(i=0; i<PACK_NMEMBS; i++) { - sprintf(name, "%05d", i); + HDsprintf(name, "%05d", i); if(i == PACK_NMEMBS - 1) { if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR } else @@ -1898,7 +1898,7 @@ test_pack_ooo(void) /* Insert the compound members in reverse order, with compound last */ for(i=0; i<PACK_NMEMBS; i++) { - sprintf(name, "%05d", i); + HDsprintf(name, "%05d", i); if(i == PACK_NMEMBS - 1) { if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR } else @@ -1925,7 +1925,7 @@ test_pack_ooo(void) /* Insert the compound members in forward order, with compound first */ for(i=0; i<PACK_NMEMBS; i++) { - sprintf(name, "%05d", i); + HDsprintf(name, "%05d", i); if(i == 0) { if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR } else @@ -1951,7 +1951,7 @@ test_pack_ooo(void) /* Insert the compound members in forward order */ for(i=0; i<PACK_NMEMBS; i++) { - sprintf(name, "%05d", i); + HDsprintf(name, "%05d", i); if(i == 0) { if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR } else @@ -2181,7 +2181,7 @@ main (int argc, char *argv[]) /* Turn off optimized compound converter? */ if (argc>1) { if (argc>2 || strcmp("--noopt", argv[1])) { - fprintf(stderr, "usage: %s [--noopt]\n", argv[0]); + HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]); exit(1); } H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, H5T__conv_struct_opt); @@ -2213,7 +2213,7 @@ main (int argc, char *argv[]) nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); if (nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(1); } diff --git a/test/cross_read.c b/test/cross_read.c index 503cd28..1b08c3a 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -127,7 +127,7 @@ static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number) if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001F)) { if (!nerrors++) { H5_FAILED(); - printf("element [%d][%d] is %g but should have been %g\n", + HDprintf("element [%d][%d] is %g but should have been %g\n", j, i, data_out[j][i], data_in[j][i]); } } @@ -144,7 +144,7 @@ static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number) if (int_data_out[j][i] != int_data_in[j][i]) { if (!nerrors++) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been %d\n", + HDprintf("element [%d][%d] is %d but should have been %d\n", j, i, (int)int_data_out[j][i], (int)int_data_in[j][i]); } @@ -161,7 +161,7 @@ static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number) /* Failure */ if (nerrors) { - printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + HDprintf("total of %d errors out of %d elements\n", nerrors, NX*NY); return 1; } @@ -337,11 +337,11 @@ int main(void) nerrors += open_dataset(filename); if (nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(1); } - printf("All data type tests passed.\n"); + HDprintf("All data type tests passed.\n"); return 0; } diff --git a/test/dtransform.c b/test/dtransform.c index f022699..2882c8f 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -72,7 +72,7 @@ const int transformData[ROWS][COLS] = if(!( (((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || ( ((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) \ { \ H5_FAILED(); \ - fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ + HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ goto error; \ } \ } \ @@ -89,7 +89,7 @@ const int transformData[ROWS][COLS] = if( !(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL))) ) \ { \ H5_FAILED(); \ - fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ + HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ goto error; \ } \ } \ @@ -106,7 +106,7 @@ const int transformData[ROWS][COLS] = if( (VAR1)[i][j] != (VAR2)[i][j] ) \ { \ H5_FAILED(); \ - fprintf(stderr, " ERROR: data failed to match computed data\n"); \ + HDfprintf(stderr, " ERROR: data failed to match computed data\n"); \ goto error; \ } \ } \ @@ -248,7 +248,7 @@ const int transformData[ROWS][COLS] = else \ { \ H5_FAILED(); \ - fprintf(stderr, " ERROR: Data transform allowed invalid TRANSFORM transform to be set\n"); \ + HDfprintf(stderr, " ERROR: Data transform allowed invalid TRANSFORM transform to be set\n"); \ goto error; \ } \ } diff --git a/test/dtypes.c b/test/dtypes.c index 25cc890..9747af7 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -61,7 +61,7 @@ FAIL_STACK_ERROR \ if((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \ H5_FAILED(); \ - printf(" #dtype ids expected: %lld; found: %lld\n", \ + HDprintf(" #dtype ids expected: %lld; found: %lld\n", \ (long long)NMEMBS, (long long)H5I_nmembers(H5I_DATATYPE)); \ goto error; \ } @@ -747,11 +747,11 @@ test_compound_2(void) s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) { H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->d, s_ptr->e); - printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], d_ptr->c[3], d_ptr->d, d_ptr->e); goto error; @@ -875,11 +875,11 @@ test_compound_3(void) s_ptr->c[3] != d_ptr->c[3] || s_ptr->e != d_ptr->e) { H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->d, s_ptr->e); - printf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", + HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], d_ptr->c[3], d_ptr->e); goto error; @@ -1010,11 +1010,11 @@ test_compound_4(void) s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) { H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->d, s_ptr->e); - printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], d_ptr->c[3], d_ptr->d, d_ptr->e); goto error; @@ -1231,10 +1231,10 @@ test_compound_6(void) if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) { H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={b=%d, d=%d\n", + HDprintf(" i=%d\n", i); + HDprintf(" src={b=%d, d=%d\n", (int)s_ptr->b, (int)s_ptr->d); - printf(" dst={b=%ld, d=%ld\n", + HDprintf(" dst={b=%ld, d=%ld\n", d_ptr->b, d_ptr->d); goto error; } @@ -1307,43 +1307,43 @@ test_compound_7(void) if((tid1= H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_INT) < 0) { H5_FAILED(); - printf("Can't insert field 'a'\n"); + HDprintf("Can't insert field 'a'\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); - printf("Can't insert field 'b'\n"); + HDprintf("Can't insert field 'b'\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"c",HOFFSET(struct s1,c),H5T_NATIVE_LONG) < 0) { H5_FAILED(); - printf("Can't insert field 'c'\n"); + HDprintf("Can't insert field 'c'\n"); goto error; } /* end if */ if(H5Tget_size(tid1)!=sizeof(struct s1)) { H5_FAILED(); - printf("Incorrect size for struct 1\n"); + HDprintf("Incorrect size for struct 1\n"); goto error; } /* end if */ if((tid2= H5Tcopy(tid1)) < 0) { H5_FAILED(); - printf("Can't copy datatype\n"); + HDprintf("Can't copy datatype\n"); goto error; } /* end if */ if(H5Tget_size(tid2)==sizeof(struct s2)) { H5_FAILED(); - printf("Incorrect size for struct 2\n"); + HDprintf("Incorrect size for struct 2\n"); goto error; } /* end if */ @@ -1353,7 +1353,7 @@ test_compound_7(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf("Inserted field 'd'?\n"); + HDprintf("Inserted field 'd'?\n"); goto error; } /* end if */ @@ -1363,33 +1363,33 @@ test_compound_7(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf("Shrunk compound type?\n"); + HDprintf("Shrunk compound type?\n"); goto error; } /* end if */ /* Increase compound type size and try inserting field again */ if(H5Tset_size(tid2, sizeof(struct s2)) < 0) { H5_FAILED(); - printf("Can't increase size for compound type\n"); + HDprintf("Can't increase size for compound type\n"); goto error; } /* end if */ if( H5Tinsert(tid2,"d",HOFFSET(struct s2,d),H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); - printf("Can't expand compound datatype\n"); + HDprintf("Can't expand compound datatype\n"); goto error; } /* end if */ if(H5Tget_size(tid2)!=sizeof(struct s2)) { H5_FAILED(); - printf("Incorrect size for struct 2\n"); + HDprintf("Incorrect size for struct 2\n"); goto error; } /* end if */ /* Release resources */ if (H5Tclose(tid1) < 0 || H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatypes\n"); + HDprintf("Can't close datatypes\n"); goto error; } /* end if */ @@ -1455,59 +1455,59 @@ test_compound_8(void) /* Create first compound datatype */ if((tid1 = H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'a'\n"); + HDprintf("Can't insert field 'a'\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'b'\n"); + HDprintf("Can't insert field 'b'\n"); goto error; } /* end if */ /* Make a copy of the type for later use */ if((tid1_copy = H5Tcopy(tid1)) < 0) { H5_FAILED(); AT(); - printf("Can't copy type #1\n"); + HDprintf("Can't copy type #1\n"); goto error; } /* end if */ /* Test H5Tpack for the first compound type */ if(H5Tpack(tid1) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype\n"); + HDprintf("Can't pack the compound datatype\n"); goto error; } /* end if */ if(H5Tlock(tid1) < 0) { H5_FAILED(); AT(); - printf("Can't lock the compound datatype\n"); + HDprintf("Can't lock the compound datatype\n"); goto error; } /* end if */ /* If the type is already packed, packing a locked type is OK */ if(H5Tpack(tid1) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype for second time\n"); + HDprintf("Can't pack the compound datatype for second time\n"); goto error; } /* end if */ /* Verify the size of packed compound type */ if((tsize = H5Tget_size(tid1)) == 0) { H5_FAILED(); AT(); - printf("Can't get size of the compound datatype\n"); + HDprintf("Can't get size of the compound datatype\n"); goto error; } /* end if */ if(tsize != (sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed compound datatype is incorrect\n"); + HDprintf("The size of the packed compound datatype is incorrect\n"); goto error; } /* end if */ @@ -1517,61 +1517,61 @@ test_compound_8(void) /* Create second compound datatype */ if((tid2 = H5Tcreate( H5T_COMPOUND, sizeof(struct s2))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid2,"c",HOFFSET(struct s2,c),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c'\n"); + HDprintf("Can't insert field 'c'\n"); goto error; } /* end if */ /* Insert the member of unpacked compound type */ if(H5Tinsert(tid2,"d",HOFFSET(struct s2,d),tid1_copy) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'd'\n"); + HDprintf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Make a copy of the type for later */ if((tid3=H5Tcopy(tid2)) < 0) { H5_FAILED(); AT(); - printf("Can't copy type #2\n"); + HDprintf("Can't copy type #2\n"); goto error; } /* end if */ /* Make a copy of the type for later */ if((tid2_copy = H5Tcopy(tid2)) < 0) { H5_FAILED(); AT(); - printf("Can't copy type #2\n"); + HDprintf("Can't copy type #2\n"); goto error; } /* end if */ /* Test H5Tpack for the second compound type */ if(H5Tpack(tid2) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype\n"); + HDprintf("Can't pack the compound datatype\n"); goto error; } /* end if */ if(H5Tlock(tid2) < 0) { H5_FAILED(); AT(); - printf("Can't lock the compound datatype\n"); + HDprintf("Can't lock the compound datatype\n"); goto error; } /* end if */ /* If the type is already packed, packing a locked type is OK */ if(H5Tpack(tid2) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype for second time\n"); + HDprintf("Can't pack the compound datatype for second time\n"); goto error; } /* end if */ /* Lock unpacked type */ if(H5Tlock(tid3) < 0) { H5_FAILED(); AT(); - printf("Can't lock the compound datatype\n"); + HDprintf("Can't lock the compound datatype\n"); goto error; } /* end if */ @@ -1581,20 +1581,20 @@ test_compound_8(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); AT(); - printf("Packing locked datatype worked?\n"); + HDprintf("Packing locked datatype worked?\n"); goto error; } /* end if */ /* Verify the size of packed compound type */ if((tsize = H5Tget_size(tid2)) == 0) { H5_FAILED(); AT(); - printf("Can't get size of the compound datatype\n"); + HDprintf("Can't get size of the compound datatype\n"); goto error; } /* end if */ if(tsize != (sizeof(char) + sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed compound datatype is incorrect: tsize = %zu\n", tsize); + HDprintf("The size of the packed compound datatype is incorrect: tsize = %zu\n", tsize); goto error; } /* end if */ @@ -1604,46 +1604,46 @@ test_compound_8(void) /* Create an array type of compound type */ if((arr_tid = H5Tarray_create2(tid2_copy, 1, dims)) < 0) { H5_FAILED(); AT(); - printf("Can't create an array datatype\n"); + HDprintf("Can't create an array datatype\n"); goto error; } /* end if */ /* Test H5Tpack for the array type */ if(H5Tpack(arr_tid) < 0) { H5_FAILED(); AT(); - printf("Can't pack the array datatype\n"); + HDprintf("Can't pack the array datatype\n"); goto error; } /* end if */ /* Verify the size of packed compound type */ if((tsize = H5Tget_size(arr_tid)) == 0) { H5_FAILED(); AT(); - printf("Can't get size of the array datatype\n"); + HDprintf("Can't get size of the array datatype\n"); goto error; } /* end if */ if(tsize != ARRAY_DIM * (sizeof(char) + sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed array datatype is incorrect\n"); + HDprintf("The size of the packed array datatype is incorrect\n"); goto error; } /* end if */ if(H5Tclose(tid1_copy) < 0) { H5_FAILED(); AT(); - printf("Can't close the compound datatype\n"); + HDprintf("Can't close the compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2_copy) < 0) { H5_FAILED(); AT(); - printf("Can't close the compound datatype\n"); + HDprintf("Can't close the compound datatype\n"); goto error; } /* end if */ if(H5Tclose(arr_tid) < 0) { H5_FAILED(); AT(); - printf("Can't close the array datatype\n"); + HDprintf("Can't close the array datatype\n"); goto error; } /* end if */ @@ -1697,51 +1697,51 @@ test_compound_9(void) h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create file!\n"); + HDprintf("Can't create file!\n"); goto error; } /* end if */ /* Create first compound datatype */ if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ str_id = H5Tcopy(H5T_C_S1); if(H5Tset_size(str_id,H5T_VARIABLE) < 0) { H5_FAILED(); AT(); - printf("Can't set size for VL string\n"); + HDprintf("Can't set size for VL string\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, str), str_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i2'\n"); + HDprintf("Can't insert field 'i2'\n"); goto error; } /* end if */ if(H5Tcommit2(file, "compound", cmpd_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); AT(); - printf("Can't commit datatype\n"); + HDprintf("Can't commit datatype\n"); goto error; } /* end if */ if(H5Tclose(cmpd_tid) < 0) { H5_FAILED(); AT(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ @@ -1750,44 +1750,44 @@ test_compound_9(void) if((dup_tid = H5Tcopy(cmpd_tid)) < 0) { H5_FAILED(); AT(); - printf("Can't copy datatype\n"); + HDprintf("Can't copy datatype\n"); goto error; } /* end if */ dim1[0] = 1; if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ if((dset_id = H5Dcreate2(file, "Dataset", dup_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create dataset\n"); + HDprintf("Can't create dataset\n"); goto error; } /* end if */ if(H5Dwrite(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ rdata.str = NULL; @@ -1808,31 +1808,31 @@ test_compound_9(void) if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("cannot open file\n"); + HDprintf("cannot open file\n"); goto error; } /* end if */ if((dset_id = H5Dopen2(file, "Dataset", H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("cannot open dataset\n"); + HDprintf("cannot open dataset\n"); goto error; } /* end if */ if((space_id = H5Dget_space(dset_id)) < 0) { H5_FAILED(); AT(); - printf("Can't get space\n"); + HDprintf("Can't get space\n"); goto error; } /* end if */ if((cmpd_tid = H5Dget_type(dset_id)) < 0) { H5_FAILED(); AT(); - printf("cannot open dataset\n"); + HDprintf("cannot open dataset\n"); goto error; } /* end if */ if((dup_tid = H5Tcopy(cmpd_tid)) < 0) { H5_FAILED(); AT(); - printf("Can't copy datatype\n"); + HDprintf("Can't copy datatype\n"); goto error; } /* end if */ @@ -1841,19 +1841,19 @@ test_compound_9(void) if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ rdata.str = NULL; @@ -1936,84 +1936,84 @@ test_compound_10(void) h5_fixname(FILENAME[4], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create file!\n"); + HDprintf("Can't create file!\n"); goto error; } /* end if */ /* Create first compound datatype */ if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ cstr_id = H5Tcopy(H5T_C_S1); if(H5Tset_size(cstr_id,H5T_VARIABLE) < 0) { H5_FAILED(); AT(); - printf("Can't set size for C string\n"); + HDprintf("Can't set size for C string\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid,"c_string",HOFFSET(cmpd_struct,str),cstr_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'str'\n"); + HDprintf("Can't insert field 'str'\n"); goto error; } /* end if */ /* Create vl-string datatype */ if((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) { H5_FAILED(); AT(); - printf("Can't create VL string\n"); + HDprintf("Can't create VL string\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid, "vl_string",HOFFSET(cmpd_struct, text), vlstr_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'text'\n"); + HDprintf("Can't insert field 'text'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid,"i2",HOFFSET(struct cmpd_struct,i2),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i2'\n"); + HDprintf("Can't insert field 'i2'\n"); goto error; } /* end if */ /* Create the array datatype for c_string data */ if((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) { H5_FAILED(); AT(); - printf("Can't create array type\n"); + HDprintf("Can't create array type\n"); goto error; } /* end if */ dim1[0] = 1; if((space_id = H5Screate_simple(1,dim1,NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ if((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create dataset\n"); + HDprintf("Can't create dataset\n"); goto error; } /* end if */ if(H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ if(H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ @@ -2021,13 +2021,13 @@ test_compound_10(void) if(rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 || HDstrcmp(rdata[i].str, wdata[i].str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(rdata[i].text.len!=wdata[i].text.len) { H5_FAILED(); AT(); - printf("incorrect VL length\n"); + HDprintf("incorrect VL length\n"); goto error; } /* end if */ @@ -2035,18 +2035,18 @@ test_compound_10(void) t2 = wdata[i].text.p; if(strcmp((char*)t1, (char*)t2)) { H5_FAILED(); AT(); - printf("incorrect VL read data\n"); + HDprintf("incorrect VL read data\n"); goto error; } } /* end for */ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ @@ -2157,7 +2157,7 @@ test_compound_11(void) ((big_t *)buf)[u].i1 = (int)(u * 3); ((big_t *)buf)[u].i2 = (int)(u * 5); ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32); - sprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u); + HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u); } /* end for */ /* Make copy of buffer before conversion */ @@ -2166,7 +2166,7 @@ test_compound_11(void) dim[0] = NTESTELEM; if((space_id = H5Screate_simple(1, dim, NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ @@ -2182,29 +2182,29 @@ test_compound_11(void) /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) { - printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1); TEST_ERROR } /* end if */ if(((big_t *)buf_orig)[u].i1!=((little_t *)buf)[u].i1) { - printf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].i1,(unsigned)u,((little_t *)buf)[u].i1); TEST_ERROR } /* end if */ if(((big_t *)buf_orig)[u].s1==NULL || ((little_t *)buf)[u].s1==NULL) { - printf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ else if(HDstrcmp(((big_t *)buf_orig)[u].s1,((little_t *)buf)[u].s1)) { - printf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ } /* end for */ if(H5Dvlen_reclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim data\n"); + HDprintf("Can't reclaim data\n"); goto error; } /* end if */ @@ -2226,29 +2226,29 @@ test_compound_11(void) /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) { - printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1); TEST_ERROR } /* end if */ if(((big_t *)buf_orig)[u].i1!=((little_t *)buf)[u].i1) { - printf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].i1,(unsigned)u,((little_t *)buf)[u].i1); TEST_ERROR } /* end if */ if(((big_t *)buf_orig)[u].s1==NULL || ((little_t *)buf)[u].s1==NULL) { - printf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ else if(HDstrcmp(((big_t *)buf_orig)[u].s1,((little_t *)buf)[u].s1)) { - printf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ } /* end for */ if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim data\n"); + HDprintf("Can't reclaim data\n"); goto error; } /* end if */ @@ -2264,29 +2264,29 @@ test_compound_11(void) /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) { - printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1); TEST_ERROR } /* end if */ if(((big_t *)buf_orig)[u].i1!=((little_t *)buf)[u].i1) { - printf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].i1,(unsigned)u,((little_t *)buf)[u].i1); TEST_ERROR } /* end if */ if(((big_t *)buf_orig)[u].s1==NULL || ((little_t *)buf)[u].s1==NULL) { - printf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ else if(HDstrcmp(((big_t *)buf_orig)[u].s1,((little_t *)buf)[u].s1)) { - printf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__, + HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ } /* end for */ if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim data\n"); + HDprintf("Can't reclaim data\n"); goto error; } /* end if */ @@ -2557,230 +2557,230 @@ test_compound_14(void) h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create file!\n"); + HDprintf("Can't create file!\n"); goto error; } /* end if */ /* Create memory compound datatype 1 */ if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1,c1),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c1'\n"); + HDprintf("Can't insert field 'c1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1,c2),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c2'\n"); + HDprintf("Can't insert field 'c2'\n"); goto error; } /* end if */ str_id = H5Tcopy(H5T_C_S1); if(H5Tset_size(str_id,H5T_VARIABLE) < 0) { H5_FAILED(); AT(); - printf("Can't set size for VL string\n"); + HDprintf("Can't set size for VL string\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1, str), str_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'vl_string'\n"); + HDprintf("Can't insert field 'vl_string'\n"); goto error; } /* end if */ /* Create file compound datatype 1 */ if((cmpd_f1_tid = H5Tcreate( H5T_COMPOUND, 8 + 1 + sizeof(hvl_t))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f1_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c1'\n"); + HDprintf("Can't insert field 'c1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f1_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c2'\n"); + HDprintf("Can't insert field 'c2'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f1_tid, "vl_string",(size_t)(8 + 1), str_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'vl_string'\n"); + HDprintf("Can't insert field 'vl_string'\n"); goto error; } /* end if */ /* Create memory compound datatype 2 */ if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2,c1),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c1'\n"); + HDprintf("Can't insert field 'c1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2,c2),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c2'\n"); + HDprintf("Can't insert field 'c2'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2, str), str_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'vl_string'\n"); + HDprintf("Can't insert field 'vl_string'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2,l1),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l1'\n"); + HDprintf("Can't insert field 'l1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2,l2),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l2'\n"); + HDprintf("Can't insert field 'l2'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2,l3),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l3'\n"); + HDprintf("Can't insert field 'l3'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2,l4),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l4'\n"); + HDprintf("Can't insert field 'l4'\n"); goto error; } /* end if */ /* Create file compound datatype 2 */ if((cmpd_f2_tid = H5Tcreate( H5T_COMPOUND, 8 + 1 + sizeof(hvl_t) + 4*sizeof(long))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f2_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c1'\n"); + HDprintf("Can't insert field 'c1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f2_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c2'\n"); + HDprintf("Can't insert field 'c2'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f2_tid, "vl_string", (size_t)(8 + 1), str_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'vl_string'\n"); + HDprintf("Can't insert field 'vl_string'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f2_tid,"l1",8 + 1 + sizeof(hvl_t),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l1'\n"); + HDprintf("Can't insert field 'l1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f2_tid,"l2",8 + 1 + sizeof(hvl_t) + sizeof(long),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l2'\n"); + HDprintf("Can't insert field 'l2'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f2_tid,"l3",8 + 1 + sizeof(hvl_t) + 2*sizeof(long),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l3'\n"); + HDprintf("Can't insert field 'l3'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f2_tid,"l4",8 + 1 + sizeof(hvl_t) + 3*sizeof(long),H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'l4'\n"); + HDprintf("Can't insert field 'l4'\n"); goto error; } /* end if */ dim1[0] = 1; if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ if((dset1_id = H5Dcreate2(file, "Dataset1", cmpd_f1_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create dataset\n"); + HDprintf("Can't create dataset\n"); goto error; } /* end if */ if((dset2_id = H5Dcreate2(file, "Dataset2", cmpd_f2_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create dataset\n"); + HDprintf("Can't create dataset\n"); goto error; } /* end if */ if(H5Dwrite(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ if(H5Dwrite(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata2) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ if(H5Dread(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata1) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(H5Dread(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata2) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) || rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 || rdata2.l4 != wdata2.l4) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ rdata1.str = NULL; if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ rdata2.str = NULL; @@ -2802,25 +2802,25 @@ test_compound_14(void) if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("cannot open file\n"); + HDprintf("cannot open file\n"); goto error; } /* end if */ if((dset1_id = H5Dopen2(file, "Dataset1", H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("cannot open dataset\n"); + HDprintf("cannot open dataset\n"); goto error; } /* end if */ if((dset2_id = H5Dopen2(file, "Dataset2", H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("cannot open dataset\n"); + HDprintf("cannot open dataset\n"); goto error; } /* end if */ if((space_id = H5Dget_space(dset2_id)) < 0) { H5_FAILED(); AT(); - printf("Can't get space\n"); + HDprintf("Can't get space\n"); goto error; } /* end if */ @@ -2836,38 +2836,38 @@ test_compound_14(void) if(H5Dread(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata1) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(H5Dread(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata2) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata1.c1!=wdata1.c1 || rdata1.c2!=wdata1.c2 || strcmp(rdata1.str, wdata1.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) || rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 || rdata2.l4 != wdata2.l4) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ rdata1.str = NULL; if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ rdata2.str = NULL; @@ -2935,39 +2935,39 @@ test_compound_15(void) h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create file!\n"); + HDprintf("Can't create file!\n"); goto error; } /* end if */ /* Create file compound datatype */ if((cmpd_f_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_f_tid,"i2",HOFFSET(struct cmpd_struct,i2),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i2'\n"); + HDprintf("Can't insert field 'i2'\n"); goto error; } /* end if */ /* Create memory compound datatype */ if((cmpd_m_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_m_tid,"i1",(size_t)0,H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ @@ -2975,19 +2975,19 @@ test_compound_15(void) dim1[0] = 1; if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ if((dset_id = H5Dcreate2(file, "Dataset", cmpd_f_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create dataset\n"); + HDprintf("Can't create dataset\n"); goto error; } /* end if */ if(H5Dwrite(dset_id, cmpd_f_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ @@ -2995,21 +2995,21 @@ test_compound_15(void) * element of wdata2 to be written. */ if(H5Dwrite(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata2) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ /* Read data */ if(H5Dread(dset_id, cmpd_f_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ /* Check for correctness of read data */ if(rdata.i1 != wdata2[0] || rdata.i2 != wdata1.i2) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ @@ -3021,14 +3021,14 @@ test_compound_15(void) /* Read data */ if(H5Dread(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ /* Check for correctness of read data */ if(rdata.i1 != wdata2[0] || rdata.i2 != wdata2[1]) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ @@ -3116,7 +3116,7 @@ test_compound_16(void) /* Check behavior of H5Fget_obj_count */ if((obj_count = H5Fget_obj_count(file, H5F_OBJ_DATATYPE)) != 1) { H5_FAILED(); AT(); - printf(" H5Fget_obj_count returned: %zd; expected: 1\n", obj_count); + HDprintf(" H5Fget_obj_count returned: %zd; expected: 1\n", obj_count); goto error; } @@ -3124,7 +3124,7 @@ test_compound_16(void) if(H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, (size_t)2, open_dtypes) < 0) TEST_ERROR if(open_dtypes[1]) { H5_FAILED(); AT(); - printf(" H5Fget_obj_ids returned as second id: %lld; expected: 0\n", (long long)open_dtypes[1]); + HDprintf(" H5Fget_obj_ids returned as second id: %lld; expected: 0\n", (long long)open_dtypes[1]); goto error; } @@ -3195,7 +3195,7 @@ test_compound_17(void) if(H5Tpack(tmp_dt) < 0) TEST_ERROR if(2 != H5Tget_size(tmp_dt)) { H5_FAILED(); AT(); - printf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt)); + HDprintf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt)); goto error; } if(H5Tclose(tmp_dt) < 0) TEST_ERROR @@ -3205,7 +3205,7 @@ test_compound_17(void) if(H5Tpack(tmp_dt) < 0) TEST_ERROR if(4 != H5Tget_size(tmp_dt)) { H5_FAILED(); AT(); - printf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt)); + HDprintf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt)); goto error; } if(H5Tclose(tmp_dt) < 0) TEST_ERROR @@ -3239,7 +3239,7 @@ test_compound_17(void) if(H5Tpack(tmp_dt) < 0) TEST_ERROR if(2 != H5Tget_size(tmp_dt)) { H5_FAILED(); AT(); - printf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt)); + HDprintf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt)); goto error; } if(H5Tclose(tmp_dt) < 0) TEST_ERROR @@ -3249,7 +3249,7 @@ test_compound_17(void) if(H5Tpack(tmp_dt) < 0) TEST_ERROR if(4 != H5Tget_size(tmp_dt)) { H5_FAILED(); AT(); - printf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt)); + HDprintf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt)); goto error; } if(H5Tclose(tmp_dt) < 0) TEST_ERROR @@ -3437,107 +3437,107 @@ test_query(void) /* Create a compound datatype */ if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) { H5_FAILED(); - printf("Can't insert field 'a'\n"); + HDprintf("Can't insert field 'a'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); - printf("Can't insert field 'b'\n"); + HDprintf("Can't insert field 'b'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) { H5_FAILED(); - printf("Can't insert field 'c'\n"); + HDprintf("Can't insert field 'c'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); - printf("Can't insert field 'd'\n"); + HDprintf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Create a enumerate datatype */ if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) { H5_FAILED(); - printf("Can't create enumerate type\n"); + HDprintf("Can't create enumerate type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "RED", (enum_val=10,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "GREEN", (enum_val=11,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "BLUE", (enum_val=12,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "ORANGE", (enum_val=13,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "YELLOW", (enum_val=14,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ /* Query member number and member index by name, for compound type. */ if(H5Tget_nmembers(tid1)!=4) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(tid1, "c")!=2) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Query member number and member index by member name, for enumeration type. */ if(H5Tget_nmembers(tid2) != 5) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(tid2, "ORANGE") != 3) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Commit compound datatype and close it */ if(H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit compound datatype\n"); + HDprintf("Can't commit compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ /* Commit enumeration datatype and close it */ if(H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit compound datatype\n"); + HDprintf("Can't commit compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ @@ -3550,48 +3550,48 @@ test_query(void) /* Query member number and member index by name, for compound type */ if(H5Tget_nmembers(tid1) != 4) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(tid1, "c") != 2) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Query member number and member index by member name, for enumeration type */ if(H5Tget_nmembers(tid2)!=5) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(tid2, "ORANGE")!=3) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Query member value by member name, for enumeration type */ if(H5Tenum_valueof (tid2, "ORANGE", &enum_val) < 0) { H5_FAILED(); - printf("Can't get value for enumerate member\n"); + HDprintf("Can't get value for enumerate member\n"); goto error; } /* end if */ if(enum_val!=13) { H5_FAILED(); - printf("Incorrect value for enum member\n"); + HDprintf("Incorrect value for enum member\n"); goto error; } /* end if */ /* Query member value by member index, for enumeration type */ if(H5Tget_member_value (tid2, 2, &enum_val) < 0) { H5_FAILED(); - printf("Can't get value for enum member\n"); + HDprintf("Can't get value for enum member\n"); goto error; } /* end if */ if(enum_val!=12) { H5_FAILED(); - printf("Incorrect value for enum member\n"); + HDprintf("Incorrect value for enum member\n"); goto error; } /* end if */ @@ -3599,30 +3599,30 @@ test_query(void) enum_val = 14; if(H5Tenum_nameof(tid2, &enum_val, enum_name, (size_t)16) < 0) { H5_FAILED(); - printf("Can't get name for enum member\n"); + HDprintf("Can't get name for enum member\n"); goto error; } /* end if */ if(strcmp("YELLOW", enum_name)) { H5_FAILED(); - printf("Incorrect name for enum member\n"); + HDprintf("Incorrect name for enum member\n"); goto error; } /* end if */ /* Close datatype and file */ if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -4408,8 +4408,8 @@ test_conv_str_2(void) } /* end for */ /* Do the conversions */ - sprintf(s, "Testing random string conversion speed"); - printf("%-70s", s); + HDsprintf(s, "Testing random string conversion speed"); + HDprintf("%-70s", s); HDfflush(stdout); if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; @@ -4599,14 +4599,14 @@ test_conv_enum_1(void) buf[u] = HDrand() % 26; /* Conversions */ - sprintf(s, "Testing random enum conversion O(N)"); - printf("%-70s", s); + HDsprintf(s, "Testing random enum conversion O(N)"); + HDprintf("%-70s", s); HDfflush(stdout); if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); - sprintf(s, "Testing random enum conversion O(N log N)"); - printf("%-70s", s); + HDsprintf(s, "Testing random enum conversion O(N log N)"); + HDprintf("%-70s", s); HDfflush(stdout); if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); @@ -4692,7 +4692,7 @@ test_conv_enum_2(void) if (data[i] != i%8) { if (!nerrors++) { H5_FAILED(); - printf("element %d is %d but should have been %d\n", + HDprintf("element %d is %d but should have been %d\n", i, data[i], i%8); } } @@ -4706,7 +4706,7 @@ test_conv_enum_2(void) /* Failure */ if (nerrors) { - printf("total of %d conversion errors out of %d elements for enums\n", + HDprintf("total of %d conversion errors out of %d elements for enums\n", nerrors, NTESTELEM); return 1; } @@ -4752,7 +4752,7 @@ test_conv_bitfield(void) if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) { H5_FAILED(); - printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", + HDprintf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -4771,7 +4771,7 @@ test_conv_bitfield(void) if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) { H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -4785,7 +4785,7 @@ test_conv_bitfield(void) if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) { H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -4866,7 +4866,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (size>0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4875,7 +4875,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (inpad>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4884,7 +4884,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (cset>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4893,7 +4893,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (strpad>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4902,7 +4902,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4911,7 +4911,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (tag) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4920,7 +4920,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (super>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -5053,7 +5053,7 @@ opaque_check(int tag_it) } H5E_END_TRY; if (status>=0) { H5_FAILED(); - printf(" opaque conversion should have failed but succeeded\n"); + HDprintf(" opaque conversion should have failed but succeeded\n"); goto error; } @@ -5065,7 +5065,7 @@ opaque_check(int tag_it) if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error; if (saved+1 != num_opaque_conversions_g) { H5_FAILED(); - printf(" unexpected number of opaque conversions\n"); + HDprintf(" unexpected number of opaque conversions\n"); goto error; } @@ -5175,7 +5175,7 @@ opaque_funcs(void) ret=H5Tset_precision(type, (size_t)32); } H5E_END_TRY; if (ret>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5183,7 +5183,7 @@ opaque_funcs(void) ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); } H5E_END_TRY; if (ret>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5191,7 +5191,7 @@ opaque_funcs(void) size=H5Tget_ebias(type); } H5E_END_TRY; if (size>0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5199,7 +5199,7 @@ opaque_funcs(void) inpad=H5Tget_inpad(type); } H5E_END_TRY; if (inpad>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5207,7 +5207,7 @@ opaque_funcs(void) cset=H5Tget_cset(type); } H5E_END_TRY; if (cset>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5215,7 +5215,7 @@ opaque_funcs(void) strpad=H5Tget_strpad(type); } H5E_END_TRY; if (strpad>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5223,7 +5223,7 @@ opaque_funcs(void) ret=H5Tset_offset(type, (size_t)16); } H5E_END_TRY; if (ret>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5231,7 +5231,7 @@ opaque_funcs(void) sign = H5Tget_sign(type); } H5E_END_TRY; if (sign>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5239,7 +5239,7 @@ opaque_funcs(void) super = H5Tget_super(type); } H5E_END_TRY; if (super>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5310,71 +5310,71 @@ test_encode(void) /* Create a compound datatype */ if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) { H5_FAILED(); - printf("Can't insert field 'a'\n"); + HDprintf("Can't insert field 'a'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); - printf("Can't insert field 'b'\n"); + HDprintf("Can't insert field 'b'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) { H5_FAILED(); - printf("Can't insert field 'c'\n"); + HDprintf("Can't insert field 'c'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); - printf("Can't insert field 'd'\n"); + HDprintf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Create a enumerate datatype */ if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) { H5_FAILED(); - printf("Can't create enumerate type\n"); + HDprintf("Can't create enumerate type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ /* Create a variable-length string type */ if((tid3 = H5Tcopy(H5T_C_S1)) < 0) { H5_FAILED(); - printf("Can't copy a string type\n"); + HDprintf("Can't copy a string type\n"); goto error; } /* end if */ if(H5Tset_size(tid3, H5T_VARIABLE) < 0) { H5_FAILED(); - printf("Can't the string type to be variable-length\n"); + HDprintf("Can't the string type to be variable-length\n"); goto error; } /* end if */ @@ -5385,7 +5385,7 @@ test_encode(void) /* Encode compound type in a buffer */ if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5398,13 +5398,13 @@ test_encode(void) } H5E_END_TRY; if(ret_id!=FAIL) { H5_FAILED(); - printf("Decoded bogus buffer!\n"); + HDprintf("Decoded bogus buffer!\n"); goto error; } if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5415,19 +5415,19 @@ test_encode(void) /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid1, tid1)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for compound type. */ if(H5Tget_nmembers(decoded_tid1)!=4) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid1, "c")!=2) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ @@ -5435,7 +5435,7 @@ test_encode(void) /* Encode enumerate type in a buffer */ if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ @@ -5444,33 +5444,33 @@ test_encode(void) if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); - printf("Can't decode enumerate type\n"); + HDprintf("Can't decode enumerate type\n"); goto error; } /* end if */ /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid2, tid2)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for enumeration type. */ if(H5Tget_nmembers(decoded_tid2)!=5) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid2, "ORANGE") != 3) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ @@ -5478,7 +5478,7 @@ test_encode(void) /* Encode VL string type in a buffer */ if(H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ @@ -5487,26 +5487,26 @@ test_encode(void) if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ /* Decode from the VL string buffer and return an object handle */ if((decoded_tid3=H5Tdecode(vlstr_buf)) < 0) { H5_FAILED(); - printf("Can't decode VL string type\n"); + HDprintf("Can't decode VL string type\n"); goto error; } /* end if */ /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid3, tid3)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ if(!H5Tis_variable_str(decoded_tid3)) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ @@ -5517,17 +5517,17 @@ test_encode(void) /* Commit compound datatype and close it */ if(H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit compound datatype\n"); + HDprintf("Can't commit compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(decoded_tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ HDfree(cmpd_buf); @@ -5536,17 +5536,17 @@ test_encode(void) /* Commit enumeration datatype and close it */ if(H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit compound datatype\n"); + HDprintf("Can't commit compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(decoded_tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ HDfree(enum_buf); @@ -5555,17 +5555,17 @@ test_encode(void) /* Commit enumeration datatype and close it */ if(H5Tcommit2(file, vlstr_type, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit vl string datatype\n"); + HDprintf("Can't commit vl string datatype\n"); goto error; } /* end if */ if(H5Tclose(tid3) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(decoded_tid3) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ HDfree(vlstr_buf); @@ -5586,7 +5586,7 @@ test_encode(void) /* Encode compound type in a buffer */ if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5595,7 +5595,7 @@ test_encode(void) if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5606,26 +5606,26 @@ test_encode(void) /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid1, tid1)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for compound type. */ if(H5Tget_nmembers(decoded_tid1)!=4) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid1, "c")!=2) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Encode enumerate type in a buffer */ if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ @@ -5634,40 +5634,40 @@ test_encode(void) if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); - printf("Can't decode enumerate type\n"); + HDprintf("Can't decode enumerate type\n"); goto error; } /* end if */ /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid2, tid2)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for enumeration type. */ if(H5Tget_nmembers(decoded_tid2)!=5) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Encode VL string type in a buffer */ if(H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ @@ -5676,14 +5676,14 @@ test_encode(void) if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ /* Decode from the VL string buffer and return an object handle */ if((decoded_tid3=H5Tdecode(vlstr_buf)) < 0) { H5_FAILED(); - printf("Can't decode VL string type\n"); + HDprintf("Can't decode VL string type\n"); goto error; } /* end if */ HDfree(vlstr_buf); @@ -5691,12 +5691,12 @@ test_encode(void) /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid3, tid3)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ if(!H5Tis_variable_str(decoded_tid3)) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ @@ -5708,19 +5708,19 @@ test_encode(void) /* Make sure the reference counts for the decoded datatypes are one. */ if(H5Iget_ref(decoded_tid1) != 1) { H5_FAILED(); - printf("Decoded datatype has incorrect reference count\n"); + HDprintf("Decoded datatype has incorrect reference count\n"); goto error; } /* end if */ if(H5Iget_ref(decoded_tid2) != 1) { H5_FAILED(); - printf("Decoded datatype has incorrect reference count\n"); + HDprintf("Decoded datatype has incorrect reference count\n"); goto error; } /* end if */ if(H5Iget_ref(decoded_tid3) != 1) { H5_FAILED(); - printf("Decoded datatype has incorrect reference count\n"); + HDprintf("Decoded datatype has incorrect reference count\n"); goto error; } /* end if */ @@ -5728,19 +5728,19 @@ test_encode(void) * decremented and the datatypes are closed. */ if(H5Idec_ref(decoded_tid1) != 0) { H5_FAILED(); - printf("Decoded datatype can't close\n"); + HDprintf("Decoded datatype can't close\n"); goto error; } /* end if */ if(H5Idec_ref(decoded_tid2) != 0) { H5_FAILED(); - printf("Decoded datatype can't close\n"); + HDprintf("Decoded datatype can't close\n"); goto error; } /* end if */ if(H5Idec_ref(decoded_tid3) != 0) { H5_FAILED(); - printf("Decoded datatype can't close\n"); + HDprintf("Decoded datatype can't close\n"); goto error; } /* end if */ @@ -5750,7 +5750,7 @@ test_encode(void) } H5E_END_TRY; if(ret!=FAIL) { H5_FAILED(); - printf("Decoded datatype should have been closed\n"); + HDprintf("Decoded datatype should have been closed\n"); goto error; } @@ -5759,7 +5759,7 @@ test_encode(void) } H5E_END_TRY; if(ret!=FAIL) { H5_FAILED(); - printf("Decoded datatype should have been closed\n"); + HDprintf("Decoded datatype should have been closed\n"); goto error; } @@ -5768,7 +5768,7 @@ test_encode(void) } H5E_END_TRY; if(ret!=FAIL) { H5_FAILED(); - printf("Decoded datatype should have been closed\n"); + HDprintf("Decoded datatype should have been closed\n"); goto error; } @@ -5779,23 +5779,23 @@ test_encode(void) /* Close datatype and file */ if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(tid3) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -7549,7 +7549,7 @@ main(void) fapl = h5_fileaccess(); if(ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ nerrors += test_classes(); @@ -7604,12 +7604,12 @@ main(void) nerrors += test_utf_ascii_conv(); if(nerrors) { - printf("***** %lu FAILURE%s! *****\n", + HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } - printf("All datatype tests passed.\n"); + HDprintf("All datatype tests passed.\n"); return 0; } diff --git a/test/enum.c b/test/enum.c index 588e9b3..26e64fd 100644 --- a/test/enum.c +++ b/test/enum.c @@ -166,7 +166,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if(data1[i] != data2[i]) { H5_FAILED(); - printf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + HDprintf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; @@ -178,7 +178,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((short)data1[i] != data_short[i]) { H5_FAILED(); - printf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n", + HDprintf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_short[i])); goto error; @@ -190,7 +190,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((int)data1[i] != (int)data_double[i]) { H5_FAILED(); - printf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", + HDprintf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_double[i])); goto error; @@ -212,7 +212,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((int)data1[i] != data_int[i]) { H5_FAILED(); - printf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n", + HDprintf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_int[i])); goto error; @@ -234,7 +234,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((int)data1[i] != (int)data_double[i]) { H5_FAILED(); - printf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", + HDprintf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_double[i])); goto error; @@ -318,7 +318,7 @@ test_tr1(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if(data1[i] != data2[i]) { H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; @@ -400,7 +400,7 @@ test_tr2(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if(data1[i] != data2[i]) { H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; @@ -559,7 +559,7 @@ test_funcs(void) } H5E_END_TRY; if (ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -568,7 +568,7 @@ test_funcs(void) } H5E_END_TRY; if (size>0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -577,7 +577,7 @@ test_funcs(void) } H5E_END_TRY; if (inpad>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -586,7 +586,7 @@ test_funcs(void) } H5E_END_TRY; if (cset>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -596,7 +596,7 @@ test_funcs(void) } H5E_END_TRY; if (ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -605,7 +605,7 @@ test_funcs(void) } H5E_END_TRY; if (ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ diff --git a/test/err_compat.c b/test/err_compat.c index ed85524..7e0bc4e 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -22,7 +22,7 @@ #ifdef H5_NO_DEPRECATED_SYMBOLS int main(void) { - printf("Test skipped because backward compatibility with v1.6 is NOT configured in\n"); + HDprintf("Test skipped because backward compatibility with v1.6 is NOT configured in\n"); return 0; } #else /* H5_NO_DEPRECATED_SYMBOLS */ @@ -62,7 +62,7 @@ static herr_t user_print1(FILE *stream) { /* Customized way to print errors */ - fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + HDfprintf(stderr, "\n********* Print error stack in customized way *********\n"); if(H5Ewalk1(H5E_WALK_UPWARD, (H5E_walk1_t)custom_print_cb1, stream) < 0) TEST_ERROR; @@ -92,7 +92,7 @@ static herr_t user_print2(hid_t err_stack, FILE *stream) { /* Customized way to print errors */ - fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + HDfprintf(stderr, "\n********* Print error stack in customized way *********\n"); if(H5Ewalk2(err_stack, H5E_WALK_UPWARD, (H5E_walk2_t)custom_print_cb2, stream) < 0) TEST_ERROR; @@ -135,12 +135,12 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) if(NULL == (maj = H5Eget_major(err_desc->maj_num))) TEST_ERROR; - fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", + HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name, err_desc->func_name, err_desc->line); - fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); - fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); + HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); + HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); H5free_memory(maj); H5free_memory(min); @@ -188,12 +188,12 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) if(NULL == (maj = H5Eget_major(err_desc->maj_num))) TEST_ERROR; - fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", + HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name, err_desc->func_name, err_desc->line); - fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); - fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); + HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); + HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); H5free_memory(maj); H5free_memory(min); @@ -238,7 +238,7 @@ test_error1(void) herr_t ret; TESTING("error API H5Eset/get_auto"); - fprintf(stderr, "\n"); + HDfprintf(stderr, "\n"); /* Create the data space */ dims[0] = DIM0; @@ -367,7 +367,7 @@ test_error2(hid_t file) const char *FUNC_test_error="test_error2"; TESTING("error API based on data I/O"); - fprintf(stderr, "\n"); + HDfprintf(stderr, "\n"); /* Create the data space */ dims[0] = DIM0; @@ -433,12 +433,12 @@ static herr_t dump_error(void) { /* Print errors in library default way */ - fprintf(stderr, "********* Print error stack in HDF5 default way *********\n"); + HDfprintf(stderr, "********* Print error stack in HDF5 default way *********\n"); if(H5Eprint1(stderr) < 0) TEST_ERROR; /* Customized way to print errors */ - fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + HDfprintf(stderr, "\n********* Print error stack in customized way *********\n"); if(H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb1, stderr) < 0) TEST_ERROR; @@ -469,7 +469,7 @@ main(void) char filename[1024]; const char *FUNC_main="main"; - fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); + HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -500,11 +500,11 @@ main(void) if(H5Fclose(file) < 0) TEST_ERROR ; h5_clean_files(FILENAME, fapl); - printf("All error API tests passed.\n"); + HDprintf("All error API tests passed.\n"); return 0; error: - printf("***** ERROR TEST FAILED! *****\n"); + HDprintf("***** ERROR TEST FAILED! *****\n"); return 1; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/extend.c b/test/extend.c index e5c3cb3..f8c091b 100644 --- a/test/extend.c +++ b/test/extend.c @@ -105,9 +105,9 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me for(k = 0; k < (NX / 2); k++) for(m = 0; m < (NY / 2); m++) if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - printf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - printf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - printf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); TEST_ERROR; } /* end if */ } /* end for */ @@ -195,9 +195,9 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h for(k = 0; k < (NX / 2); k++) for(m = 0; m < (NY / 2); m++) if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - printf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - printf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - printf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); TEST_ERROR; } /* end if */ } /* end for */ @@ -289,17 +289,17 @@ main (void) nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); if(nerrors) { - printf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); + HDprintf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); exit(EXIT_FAILURE); } /* end if */ - printf("All extend tests passed.\n"); + HDprintf("All extend tests passed.\n"); h5_cleanup(FILENAME, fapl); return 0; error: - printf("*** One or more extend tests failed ***\n"); + HDprintf("*** One or more extend tests failed ***\n"); return 1; } diff --git a/test/external.c b/test/external.c index ff33605..f0c772c 100644 --- a/test/external.c +++ b/test/external.c @@ -262,7 +262,7 @@ test_non_extendible(hid_t file) if(1 != n) { H5_FAILED(); HDputs(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); + HDprintf(" got: %d\n ans: 1\n", n); goto error; } /* end if */ @@ -274,7 +274,7 @@ test_non_extendible(hid_t file) if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } /* end if */ @@ -282,7 +282,7 @@ test_non_extendible(hid_t file) if(file_size != (max_size[0] * sizeof(int))) { H5_FAILED(); HDputs(" Wrong file size."); - printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); + HDprintf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); goto error; } /* end if */ @@ -523,7 +523,7 @@ test_unlimited(hid_t file) if(1 != n) { H5_FAILED(); HDputs(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); + HDprintf(" got: %d\n ans: 1\n", n); goto error; } /* end if */ @@ -533,14 +533,14 @@ test_unlimited(hid_t file) if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } /* end if */ if(H5F_UNLIMITED != file_size) { H5_FAILED(); HDputs(" Wrong file size."); - printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); + HDprintf(" got: %lu\n ans: INF\n", (unsigned long)file_size); goto error; } /* end if */ diff --git a/test/fheap.c b/test/fheap.c index b326248..bd9a5de 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16147,7 +16147,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); */ #ifndef QAK if(ExpressMode > 1) - printf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n"); + HDprintf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n"); else nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam); #else /* QAK */ @@ -16210,7 +16210,7 @@ tparam.drain_half = FHEAP_DEL_DRAIN_ALL; nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam); nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. Some tests skipped\n"); + HDprintf("***Express test mode on. Some tests skipped\n"); else { nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam); nerrors += test_man_remove_2nd_indirect(fapl, &small_cparam, &tparam); @@ -16244,7 +16244,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); nerrors += test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); nerrors += test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. Some tests skipped\n"); + HDprintf("***Express test mode on. Some tests skipped\n"); else { nerrors += test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam); nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam); @@ -16394,7 +16394,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); #ifndef QAK /* Random object insertion & deletion */ if(ExpressMode > 1) - printf("***Express test mode on. Some tests skipped\n"); + HDprintf("***Express test mode on. Some tests skipped\n"); else { #ifndef QAK /* Random tests using "small" heap creation parameters */ diff --git a/test/fillval.c b/test/fillval.c index 5b95de9..dac0e09 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -542,8 +542,8 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s) < 0) goto error; if(rd_s != fill_s) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %d, set %d\n", rd_s, fill_s); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %d, set %d\n", rd_s, fill_s); goto error; } #endif @@ -557,8 +557,8 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; if(rd_l!=fill_l) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", rd_l, fill_l); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } #endif @@ -572,8 +572,8 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; if(rd_l != fill_l) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", rd_l, fill_l); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } #endif @@ -582,12 +582,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); - printf(" Got %d\n", alloc_time); + HDprintf(" Got %d\n", alloc_time); } if(fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); - printf(" Got %d\n", fill_time); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset3) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -598,7 +598,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { H5_FAILED(); puts(" Got allocated space instead of unallocated."); - printf(" Got %d\n", allocation); + HDprintf(" Got %d\n", allocation); goto error; } if((dcpl = H5Dget_create_plist(dset4)) < 0) goto error; @@ -607,12 +607,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); - printf(" Got %d\n", alloc_time); + HDprintf(" Got %d\n", alloc_time); } if(fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); - printf(" Got %d\n", fill_time); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset4) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -624,7 +624,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); - printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", + HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } if(H5Dclose(dset9) < 0) goto error; @@ -639,21 +639,21 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Dget_space_status(dset5, &allocation) < 0) goto error; if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); - printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); - printf(" Got %d\n", allocation); + HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__); + HDprintf(" Got %d\n", allocation); goto error; } if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); - printf(" Got %d\n", alloc_time); + HDprintf(" Got %d\n", alloc_time); } if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); - printf(" Got %d\n", fill_time); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset5) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -664,28 +664,28 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Dget_space_status(dset6, &allocation) < 0) goto error; if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); - printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); - printf(" Got %d\n", allocation); + HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__); + HDprintf(" Got %d\n", allocation); goto error; } if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; if(rd_l != fill_l) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", rd_l, fill_l); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); - printf(" Got %d\n", alloc_time); + HDprintf(" Got %d\n", alloc_time); } if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); - printf(" Got %d\n", fill_time); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset6) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -697,7 +697,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); - printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", + HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } if(H5Dclose(dset8) < 0) goto error; @@ -926,8 +926,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); - printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); - printf(" Got %d\n", allocation); + HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__); + HDprintf(" Got %d\n", allocation); goto error; } HDfree(buf); @@ -954,7 +954,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, if(val_rd!=should_be) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " "should be: %u\n", (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3], @@ -967,7 +967,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, if(val_rd!=should_be) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " "should be: %u\n", (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3], @@ -998,7 +998,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " "should be: %f,%d,%f,%c\n", (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3], @@ -1017,7 +1017,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " "should be: %f,%d,%f,%c\n", (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3], @@ -1992,7 +1992,7 @@ test_compatible(void) TESTING("contiguous dataset compatibility with v. 1.4"); if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { - printf(" Could not open file %s. Try set $srcdir to point at the " + HDprintf(" Could not open file %s. Try set $srcdir to point at the " "source directory of test\n", testfile); goto error; } @@ -2002,8 +2002,8 @@ test_compatible(void) if(H5Pfill_value_defined(dcpl1, &status) < 0) goto error; if(status != H5D_FILL_VALUE_UNDEFINED) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n", + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n", (long)status); goto error; } @@ -2012,7 +2012,7 @@ test_compatible(void) if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); - printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); + HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } if((mspace = H5Screate_simple(2, one, NULL)) < 0) goto error; @@ -2023,7 +2023,7 @@ test_compatible(void) if(val_rd != 0) { H5_FAILED(); puts(" Got a different value than what was set."); - printf(" Got %ld, set 0\n", (long)val_rd); + HDprintf(" Got %ld, set 0\n", (long)val_rd); goto error; } if(H5Pclose(dcpl1) < 0) goto error; @@ -2037,16 +2037,16 @@ test_compatible(void) if(H5Pfill_value_defined(dcpl2, &status) < 0) goto error; if(status != H5D_FILL_VALUE_USER_DEFINED) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got status=%ld, suppose to be H5D_FILL_VALUE_USER_DEFINED\n", + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_USER_DEFINED\n", (long)status); goto error; } if(H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill) < 0) goto error; if(rd_fill != fill_val) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val); goto error; } fspace = -1; @@ -2056,7 +2056,7 @@ test_compatible(void) if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); - printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); + HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } if((mspace=H5Screate_simple(2, one, NULL)) < 0) goto error; @@ -2067,7 +2067,7 @@ test_compatible(void) if(val_rd != fill_val) { H5_FAILED(); puts(" Got a different value than what was set."); - printf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); + HDprintf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); goto error; } if(H5Pclose(dcpl2) < 0) goto error; @@ -2185,7 +2185,7 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t (r_values[3] != fillval)) { H5_FAILED(); HDfprintf(stdout, "%u: Allocated chunk value read was not correct.\n", (unsigned)__LINE__); - printf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", + HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)r_values[0], (long)r_values[1], (long)r_values[2], (long)r_values[3], (long)w_values[0], (long)fillval, @@ -2199,7 +2199,7 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t (f_values[3] != fillval)) { H5_FAILED(); HDfprintf(stdout, "%u: Unallocated chunk value read was not correct.\n", (unsigned)__LINE__); - printf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", + HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)f_values[0], (long)f_values[1], (long)f_values[2], (long)f_values[3], (long)fillval, (long)fillval, @@ -2262,81 +2262,81 @@ test_partalloc(hid_t fapl, const char *base_name) /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error; #ifdef DEBUG - fprintf( stdout, "\nALLOC_TIME_LATE\n" ); + HDfprintf( stdout, "\nALLOC_TIME_LATE\n" ); #endif /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_ALLOC\n" ); + HDfprintf( stdout, " FILL_TIME_ALLOC\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset1", H5D_FILL_TIME_ALLOC); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_NEVER\n" ); + HDfprintf( stdout, " FILL_TIME_NEVER\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset2", H5D_FILL_TIME_NEVER ); /* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_IFSET\n" ); + HDfprintf( stdout, " FILL_TIME_IFSET\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset3", H5D_FILL_TIME_IFSET ); /* II. Test H5D_ALLOC_TIME_INCR space allocation cases */ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0) goto error; #ifdef DEBUG - fprintf( stdout, "\nALLOC_TIME_INCR\n" ); + HDfprintf( stdout, "\nALLOC_TIME_INCR\n" ); #endif /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_ALLOC\n" ); + HDfprintf( stdout, " FILL_TIME_ALLOC\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset4", H5D_FILL_TIME_ALLOC ); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_NEVER\n" ); + HDfprintf( stdout, " FILL_TIME_NEVER\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset5", H5D_FILL_TIME_NEVER ); /* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_IFSET\n" ); + HDfprintf( stdout, " FILL_TIME_IFSET\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset6", H5D_FILL_TIME_IFSET ); /* III. Test H5D_ALLOC_TIME_EARLY space allocation cases */ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error; #ifdef DEBUG - fprintf( stdout, "\nALLOC_TIME_EARLY\n" ); + HDfprintf( stdout, "\nALLOC_TIME_EARLY\n" ); #endif /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_ALLOC\n" ); + HDfprintf( stdout, " FILL_TIME_ALLOC\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset7", H5D_FILL_TIME_ALLOC ); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_NEVER\n" ); + HDfprintf( stdout, " FILL_TIME_NEVER\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset8", H5D_FILL_TIME_NEVER ); /* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_IFSET\n" ); + HDfprintf( stdout, " FILL_TIME_IFSET\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset9", H5D_FILL_TIME_IFSET ); diff --git a/test/filter_fail.c b/test/filter_fail.c index d47705f..1d0d676 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -271,15 +271,15 @@ test_filter_read(char *file_name, hid_t my_fapl) for(i = 0; i < DIM; i++) { if(i < DIM-2 && rbuf[i] != i) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } else if(i >= DIM-2 && rbuf[i] != 0) { H5_FAILED(); - printf(" No value should be read.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" No value should be read.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } } @@ -311,15 +311,15 @@ test_filter_read(char *file_name, hid_t my_fapl) for(i = 0; i < DIM; i+=2) { if(i < DIM-2 && rbuf[i] != i) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } else if(i >= DIM-2 && rbuf[i] != 0) { H5_FAILED(); - printf(" No value should be read.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" No value should be read.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } } @@ -403,7 +403,7 @@ int main(void) error: if (nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } diff --git a/test/flush1.c b/test/flush1.c index d910d14..1e759d0 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -75,7 +75,7 @@ create_file(char* name, hid_t fapl) /* Create some groups */ if((groups = H5Gcreate2(file, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR for(i = 0; i < 100; i++) { - sprintf(name, "grp%02u", (unsigned)i); + HDsprintf(name, "grp%02u", (unsigned)i); if((grp = H5Gcreate2(groups, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(grp) < 0) FAIL_STACK_ERROR } /* end for */ diff --git a/test/flush2.c b/test/flush2.c index e80674c..ec0ba5b 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -73,9 +73,9 @@ check_dset(hid_t file, const char* name) error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1)); if(error > 0.0001F) { H5_FAILED(); - printf(" dset[%lu][%lu] = %g\n", + HDprintf(" dset[%lu][%lu] = %g\n", (unsigned long)i, (unsigned long)j, the_data[i][j]); - printf(" should be %g\n", + HDprintf(" should be %g\n", (double)(hssize_t)i/(hssize_t)(j+1)); goto error; } /* end if */ @@ -88,7 +88,7 @@ error: return 1; } - + /*------------------------------------------------------------------------- * Function: check_file * @@ -116,9 +116,9 @@ check_file(char* filename, hid_t fapl, int flag) /* Open some groups */ if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error; for(i = 0; i < 100; i++) { - sprintf(name, "grp%02u", (unsigned)i); - if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error; - if(H5Gclose(grp) < 0) goto error; + HDsprintf(name, "grp%02u", (unsigned)i); + if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error; + if(H5Gclose(grp) < 0) goto error; } /* end for */ /* Check to see if that last added dataset in the third file is accessible @@ -134,7 +134,7 @@ error: return 1; } /* end check_file() */ - + /*------------------------------------------------------------------------- * Function: main * diff --git a/test/h5test.c b/test/h5test.c index e370c6d..6ed14d3 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -102,7 +102,6 @@ static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *suff char *fullname, size_t size); - /*------------------------------------------------------------------------- * Function: h5_errors * @@ -127,7 +126,7 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) return 0; } - + /*------------------------------------------------------------------------- * Function: h5_clean_files * @@ -156,7 +155,7 @@ h5_clean_files(const char *base_name[], hid_t fapl) return; } /* end h5_clean_files() */ - + /*------------------------------------------------------------------------- * Function: h5_delete_test_file * @@ -233,7 +232,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl) } /* end h5_delete_test_file() */ #pragma GCC diagnostic pop - + /*------------------------------------------------------------------------- * Function: h5_delete_all_test_files * @@ -266,7 +265,7 @@ h5_delete_all_test_files(const char *base_name[], hid_t fapl) return; } /* end h5_delete_all_test_files() */ - + /*------------------------------------------------------------------------- * Function: h5_cleanup * @@ -299,7 +298,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) return retval; } /* end h5_cleanup() */ - + /*------------------------------------------------------------------------- * Function: h5_test_shutdown * @@ -328,7 +327,7 @@ h5_test_shutdown(void) return; } /* end h5_test_shutdown() */ - + /*------------------------------------------------------------------------- * Function: h5_restore_err * @@ -350,7 +349,7 @@ h5_restore_err(void) err_func = NULL; } - + /*------------------------------------------------------------------------- * Function: h5_reset * @@ -392,7 +391,7 @@ h5_reset(void) * Cause the library to emit some diagnostics early so they don't * interfere with other formatted output. */ - sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); + HDsprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); H5E_BEGIN_TRY { hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -405,7 +404,7 @@ h5_reset(void) #endif /* OLD_WAY */ } - + /*------------------------------------------------------------------------- * Function: h5_test_init * @@ -438,7 +437,7 @@ h5_test_init(void) return; } /* end h5_test_init() */ - + /*------------------------------------------------------------------------- * Function: h5_fixname * @@ -468,7 +467,6 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) } - /*------------------------------------------------------------------------- * Function: h5_fixname_no_suffix * @@ -489,7 +487,32 @@ h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t s } - +/*------------------------------------------------------------------------- + * Function: h5_fixname_printf + * + * Purpose: Same as h5_fixname but returns a filename that can be passed + * through a printf-style function once before being passed to the file + * driver. Basically, replaces all % characters used by the file + * driver with %%. + * + * Return: Success: The FULLNAME pointer. + * + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. + * + * Programmer: Neil Fortner + * Wednesday, July 15, 2015 + * + *------------------------------------------------------------------------- + */ +char * +h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size) +{ + return (h5_fixname_real(base_name, fapl, ".h5", fullname, size)); +} + + /*------------------------------------------------------------------------- * Function: h5_fixname_real * @@ -585,7 +608,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (mpi_rank == 0) - printf("*** Hint ***\n" + HDprintf("*** Hint ***\n" "You can use environment variable HDF5_PARAPREFIX to " "run parallel test files in a\n" "different directory or to add file type prefix. e.g.,\n" @@ -701,7 +724,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, return fullname; } - + /*------------------------------------------------------------------------- * Function: h5_rmprefix * @@ -732,13 +755,13 @@ h5_rmprefix(const char *filename) return(ret_ptr); } - + /*------------------------------------------------------------------------- * Function: h5_fileaccess * * Purpose: Returns a file access template which is the default template - * but with a file driver set according to the constant or - * environment variable HDF5_DRIVER + * but with a file driver set + * according to a constant or environment variable HDF5_DRIVER * * Return: Success: A file access property list * Failure: H5I_INVALID_HID @@ -760,10 +783,6 @@ h5_fileaccess(void) if(h5_get_vfd_fapl(fapl_id) < 0) goto error; - /* Finally, check for libver bounds */ - if(h5_get_libver_fapl(fapl_id) < 0) - goto error; - return fapl_id; error: @@ -772,7 +791,7 @@ error: return H5I_INVALID_HID; } /* end h5_fileaccess() */ - + /*------------------------------------------------------------------------- * Function: h5_fileaccess_flags * @@ -800,10 +819,6 @@ h5_fileaccess_flags(unsigned flags) if((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) goto error; - /* Finally, check for libver bounds */ - if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) - goto error; - return fapl_id; error: @@ -812,7 +827,7 @@ error: return H5I_INVALID_HID; } /* end h5_fileaccess_flags() */ - + /*------------------------------------------------------------------------- * Function: h5_get_vfd_fapl * @@ -936,12 +951,7 @@ h5_get_vfd_fapl(hid_t fapl) if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) goto error; #endif - } else if(!HDstrcmp(tok, "latest")) { - /* use the latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; - } - else { + } else { /* Unknown driver */ goto error; } /* end if */ @@ -955,69 +965,6 @@ error: /*------------------------------------------------------------------------- - * Function: h5_get_libver_fapl - * - * Purpose: Sets the library version bounds for a FAPL according to the - * value in the constant or environment variable "HDF5_LIBVER_BOUNDS". - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Quincey Koziol - * November 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -h5_get_libver_fapl(hid_t fapl) -{ - const char *env = NULL; /* HDF5_DRIVER environment variable */ - const char *tok = NULL; /* strtok pointer */ - char *lasts = NULL; /* Context pointer for strtok_r() call */ - char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ - - /* Get the environment variable, if it exists */ - env = HDgetenv("HDF5_LIBVER_BOUNDS"); -#ifdef HDF5_LIBVER_BOUNDS - /* Use the environment variable, then the compile-time constant */ - if(!env) - env = HDF5_LIBVER_BOUNDS; -#endif - - /* If the environment variable was not set, just return - * without modifying the FAPL. - */ - if(!env || !*env) - goto done; - - /* Get the first 'word' of the environment variable. - * If it's nothing (environment variable was whitespace) - * just return the default fapl. - */ - HDstrncpy(buf, env, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; - if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) - goto done; - - if(!HDstrcmp(tok, "latest")) { - /* use the latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; - } /* end if */ - else { - /* Unknown setting */ - goto error; - } /* end else */ - -done: - return 0; - -error: - return -1; -} /* end h5_get_libver_fapl() */ - - -/*------------------------------------------------------------------------- * Function: h5_no_hwconv * * Purpose: Turn off hardware data type conversions. @@ -1037,7 +984,7 @@ h5_no_hwconv(void) H5Tunregister(H5T_PERS_HARD, NULL, (hid_t)-1, (hid_t)-1, NULL); } - + /*------------------------------------------------------------------------- * Function: h5_show_hostname * @@ -1071,15 +1018,15 @@ h5_show_hostname(void) if(mpi_initialized && !mpi_finalized) { MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); - printf("MPI-process %d.", mpi_rank); + HDprintf("MPI-process %d.", mpi_rank); } else - printf("thread 0."); + HDprintf("thread 0."); } #elif defined(H5_HAVE_THREADSAFE) - printf("thread %lu.", HDpthread_self_ulong()); + HDprintf("thread %lu.", HDpthread_self_ulong()); #else - printf("thread 0."); + HDprintf("thread 0."); #endif #ifdef H5_HAVE_WIN32_API @@ -1105,18 +1052,18 @@ h5_show_hostname(void) #endif #ifdef H5_HAVE_GETHOSTNAME if (gethostname(hostname, (size_t)80) < 0) - printf(" gethostname failed\n"); + HDprintf(" gethostname failed\n"); else - printf(" hostname=%s\n", hostname); + HDprintf(" hostname=%s\n", hostname); #else - printf(" gethostname not supported\n"); + HDprintf(" gethostname not supported\n"); #endif #ifdef H5_HAVE_WIN32_API WSACleanup(); #endif } - + #ifdef H5_HAVE_PARALLEL /* * Function: h5_set_info_object @@ -1215,7 +1162,7 @@ h5_set_info_object(void) return ret_value; } - + /* * Function: h5_dump_info_object * Purpose: Display content of an MPI Info object @@ -1231,25 +1178,25 @@ h5_dump_info_object(MPI_Info info) int flag; int i, nkeys; - printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, + HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, MPI_MAX_INFO_VAL); if (info==MPI_INFO_NULL){ - printf("object is MPI_INFO_NULL\n"); + HDprintf("object is MPI_INFO_NULL\n"); } else { MPI_Info_get_nkeys(info, &nkeys); - printf("object has %d items\n", nkeys); + HDprintf("object has %d items\n", nkeys); for (i=0; i<nkeys; i++){ MPI_Info_get_nthkey(info, i, key); MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); - printf("%s=%s\n", key, value); + HDprintf("%s=%s\n", key, value); } } } #endif /* H5_HAVE_PARALLEL */ - + /*------------------------------------------------------------------------- * Function: h5_get_file_size * @@ -1386,14 +1333,14 @@ print_func(const char *format, ...) int ret_value; HDva_start(arglist, format); - ret_value = vprintf(format, arglist); + ret_value = HDvprintf(format, arglist); HDva_end(arglist); return ret_value; } #ifdef H5_HAVE_FILTER_SZIP - + /*------------------------------------------------------------------------- * Function: h5_szip_can_encode * @@ -1592,7 +1539,7 @@ error: return -1; } /* end h5_make_local_copy() */ - + /*------------------------------------------------------------------------- * Function: h5_verify_cached_stabs_cb * @@ -1615,7 +1562,7 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, return SUCCEED; } /* end h5_verify_cached_stabs_cb() */ - + /*------------------------------------------------------------------------- * Function: h5_verify_cached_stabs * @@ -1676,3 +1623,233 @@ error: return -1; } +/*------------------------------------------------------------------------- + * Function: h5_send_message + * + * Purpose: Sends the specified signal. + * + * In terms of this test framework, a signal consists of a file + * on disk. Since there are multiple processes that need to + * communicate with each other, they do so by writing and + * reading signal files on disk, the names and contents of + * which are used to inform a process about when it can + * proceed and what it should do next. + * + * This function writes a signal file. The first argument is + * the name of the signal file, and the second and third + * arguments are the contents of the first two lines of the + * signal file. The last two arguments may be NULL. + * + * Return: void + * + * Programmer: Mike McGreevy + * August 18, 2010 + * + *------------------------------------------------------------------------- + */ +void +h5_send_message(const char *send, const char *arg1, const char *arg2) +{ + FILE *signalfile = NULL; + + /* Create signal file (which will send signal to some other process) */ + signalfile = HDfopen(TMP_SIGNAL_FILE, "w+"); + + /* Write messages to signal file, if provided */ + if(arg2 != NULL) { + HDassert(arg1); + HDfprintf(signalfile, "%s\n%s\n", arg1, arg2); + } /* end if */ + else if(arg1 != NULL) { + HDassert(arg2 == NULL); + HDfprintf(signalfile, "%s\n", arg1); + } /* end if */ + else { + HDassert(arg1 == NULL); + HDassert(arg2 == NULL); + }/* end else */ + + HDfclose(signalfile); + + HDrename(TMP_SIGNAL_FILE, send); +} /* h5_send_message() */ + +/*------------------------------------------------------------------------- + * Function: h5_wait_message + * + * Purpose: Waits for the specified signal. + * + * In terms of this test framework, a signal consists of a file + * on disk. Since there are multiple processes that need to + * communicate with each other, they do so by writing and + * reading signal files on disk, the names and contents of + * which are used to inform a process about when it can + * proceed and what it should do next. + * + * This function continuously attempts to read the specified + * signal file from disk, and only continues once it has + * successfully done so (i.e., only after another process has + * called the "h5_send_message" function to write the signal file). + * This functon will then immediately remove the file (i.e., + * to indicate that it has been received and can be reused), + * and then exits, allowing the calling function to continue. + * + * Return: void + * + * Programmer: Mike McGreevy + * August 18, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +h5_wait_message(const char *waitfor) +{ + FILE *returnfile; + time_t t0,t1; + + /* Start timer. If this function runs for too long (i.e., + expected signal is never received), it will + return failure */ + HDtime(&t0); + + /* Wait for return signal from some other process */ + while ((returnfile = HDfopen(waitfor, "r")) == NULL) { + + /* make note of current time. */ + HDtime(&t1); + + /* If we've been waiting for a signal for too long, then + it was likely never sent and we should fail rather + than loop infinitely */ + if(HDdifftime(t1, t0) > MESSAGE_TIMEOUT) { + HDfprintf(stdout, "Error communicating between processes. Make sure test script is running.\n"); + TEST_ERROR; + } /* end if */ + } /* end while */ + + HDfclose(returnfile); + HDunlink(waitfor); + + return SUCCEED; + +error: + return FAIL; +} /* h5_wait_message() */ + +/* Functions for the dummy VFD class (see below). + * + * Useful for testing things like ID handling where we shouldn't mess with the + * real VFDs. + */ +static H5FD_t *dummy_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static H5FD_t *dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { return NULL; } + +static herr_t dummy_vfd_close(H5FD_t *_file); +static herr_t dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) { return FAIL; } + +static haddr_t dummy_vfd_get_eoa(const H5FD_t *file, H5FD_mem_t type); +static haddr_t dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; } + +static herr_t dummy_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static herr_t dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) { return FAIL; } + +static haddr_t dummy_vfd_get_eof(const H5FD_t *file, H5FD_mem_t type); +static haddr_t dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; } + +static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); +static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { return FAIL; } + +static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); +static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; } + +/* Dummy VFD with the minimum parameters to make a VFD that can be registered */ +static const H5FD_class_t H5FD_dummy_g = { + "dummy", /* name */ + 1, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + NULL, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + dummy_vfd_open, /* open */ + dummy_vfd_close, /* close */ + NULL, /* cmp */ + NULL, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + dummy_vfd_get_eoa, /* get_eoa */ + dummy_vfd_set_eoa, /* set_eoa */ + dummy_vfd_get_eof, /* get_eof */ + NULL, /* get_handle */ + dummy_vfd_read, /* read */ + dummy_vfd_write, /* write */ + NULL, /* flush */ + NULL, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + + +/*------------------------------------------------------------------------- + * Function: h5_get_dummy_vfd_class() + * + * Purpose: Returns a disposable, generally non-functional, + * VFD class struct. + * + * In some of the test code, we need a disposable VFD but + * we don't want to mess with the real VFDs and we also + * don't have access to the internals of the real VFDs (which + * use static globals and functions) to easily duplicate + * them (e.g.: for testing VFD ID handling). + * + * This API call will return a pointer to a VFD class that + * can be used to construct a test VFD using H5FDregister(). + * + * Return: Success: A pointer to a VFD class struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5FD_class_t * +h5_get_dummy_vfd_class(void) +{ + H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */ + + /* Create the class and initialize everything to zero/NULL */ + if(NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t)))) + TEST_ERROR; + + /* Copy the dummy VFD */ + HDmemcpy(vfd_class, &H5FD_dummy_g, sizeof(H5FD_class_t)); + + return vfd_class; + +error: + if(vfd_class) + HDfree(vfd_class); + return NULL; +} /* h5_get_dummy_vfd_class */ + +/*------------------------------------------------------------------------- + * Function: h5_get_version_string + * + * Purpose: Get the string that corresponds to the libvery version bound. + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +char * +h5_get_version_string(H5F_libver_t libver) +{ + return(LIBVER_NAMES[libver]); +} /* end of h5_get_version_string */ diff --git a/test/h5test.h b/test/h5test.h index a2606dd..9250630 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -78,7 +78,7 @@ #define BEGINTEST 3 /* Skip all tests before this test */ /* - * This contains the filename prefix specificied as command line option for + * This contains the filename prefix specified as command line option for * the parallel test files. */ H5TEST_DLLVAR char *paraprefix; @@ -89,7 +89,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ /* * Print the current location on the standard output stream. */ -#define AT() printf (" at %s:%d in %s()...\n", \ +#define AT() HDprintf (" at %s:%d in %s()...\n", \ __FILE__, __LINE__, FUNC); /* @@ -101,18 +101,18 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * spaces. If the h5_errors() is used for automatic error handling then * the H5_FAILED() macro is invoked automatically when an API function fails. */ -#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} -#define TESTING_2(WHAT) {printf(" Testing %-60s",WHAT); fflush(stdout);} -#define PASSED() {puts(" PASSED");fflush(stdout);} -#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} -#define H5_WARNING() {puts("*WARNING*");fflush(stdout);} -#define SKIPPED() {puts(" -SKIP-");fflush(stdout);} -#define PUTS_ERROR(s) {puts(s); AT(); goto error;} +#define TESTING(WHAT) {HDprintf("Testing %-62s",WHAT); HDfflush(stdout);} +#define TESTING_2(WHAT) {HDprintf(" Testing %-60s",WHAT); HDfflush(stdout);} +#define PASSED() {HDputs(" PASSED");HDfflush(stdout);} +#define H5_FAILED() {HDputs("*FAILED*");HDfflush(stdout);} +#define H5_WARNING() {HDputs("*WARNING*");HDfflush(stdout);} +#define SKIPPED() {HDputs(" -SKIP-");HDfflush(stdout);} +#define PUTS_ERROR(s) {HDputs(s); AT(); goto error;} #define TEST_ERROR {H5_FAILED(); AT(); goto error;} #define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;} #define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \ goto error;} -#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); puts(s); goto error;} +#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); HDputs(s); goto error;} /* * Alarm definitions to wait up (terminate) a test that runs too long. @@ -123,7 +123,6 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ /* Flags for h5_fileaccess_flags() */ #define H5_FILEACCESS_VFD 0x01 -#define H5_FILEACCESS_LIBVER 0x02 /* * The methods to compare the equality of floating-point values: @@ -164,10 +163,11 @@ H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl); H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); +H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); +H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver); /* Functions that will replace components of a FAPL */ H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); -H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id); /* h5_clean_files() replacements */ H5TEST_DLL void h5_delete_test_file(const char *base_name, hid_t fapl); @@ -206,8 +206,6 @@ H5TEST_DLL int TestErrPrintf(const char *format, ...) H5_ATTR_FORMAT(printf, 1, H5TEST_DLL void SetTest(const char *testname, int action); H5TEST_DLL void TestAlarmOn(void); H5TEST_DLL void TestAlarmOff(void); -H5TEST_DLL void PrintErrorStackOn(void); -H5TEST_DLL void PrintErrorStackOff(void); #ifdef H5_HAVE_FILTER_SZIP H5TEST_DLL int h5_szip_can_encode(void); @@ -222,6 +220,9 @@ H5TEST_DLL char* getenv_all(MPI_Comm comm, int root, const char* name); /* Extern global variables */ H5TEST_DLLVAR int TestVerbosity; +H5TEST_DLL void h5_send_message(const char *file, const char *arg1, const char *arg2); +H5TEST_DLL herr_t h5_wait_message(const char *file); + #ifdef __cplusplus } #endif diff --git a/test/hyperslab.c b/test/hyperslab.c index feb96bd..773d573 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -85,19 +85,19 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz) for(i = 0; i < nx; i++) { if(nz > 1) - printf("i=%lu:\n", (unsigned long)i); + HDprintf("i=%lu:\n", (unsigned long)i); else - printf("%03lu:", (unsigned long)i); + HDprintf("%03lu:", (unsigned long)i); for(j = 0; j < ny; j++) { if(nz > 1) - printf("%03lu:", (unsigned long)j); + HDprintf("%03lu:", (unsigned long)j); for(k = 0; k < nz; k++) - printf(" %3d", *array++); + HDprintf(" %3d", *array++); if(nz > 1) - printf("\n"); + HDprintf("\n"); } /* end for */ - printf("\n"); + HDprintf("\n"); } /* end for */ } /* end print_array() */ @@ -122,7 +122,7 @@ print_ref(size_t nx, size_t ny, size_t nz) uint8_t *array; if(NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) { - printf("Reference array:\n"); + HDprintf("Reference array:\n"); init_full(array, nx, ny, nz); print_array(array, nx, ny, nz); HDfree(array); @@ -168,21 +168,21 @@ test_fill(size_t nx, size_t ny, size_t nz, if(0 == ny) { ndims = 1; ny = nz = 1; - sprintf(dim, "%lu", (unsigned long) nx); + HDsprintf(dim, "%lu", (unsigned long) nx); } /* end if */ else { ndims = 2; nz = 1; - sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } /* end else */ } /* end if */ else { ndims = 3; - sprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, + HDsprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } /* end else */ - sprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim); - printf("%-70s", s); + HDsprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim); + HDprintf("%-70s", s); fflush(stdout); /* Allocate array */ @@ -242,8 +242,8 @@ test_fill(size_t nx, size_t ny, size_t nz, * is going directly to a terminal. */ AT(); - printf(" acc != ref_value\n"); - printf(" i=%lu, j=%lu, k=%lu, " + HDprintf(" acc != ref_value\n"); + HDprintf(" i=%lu, j=%lu, k=%lu, " "dx=%lu, dy=%lu, dz=%lu, " "fill=%d\n", (unsigned long)i, (unsigned long)j, @@ -252,7 +252,7 @@ test_fill(size_t nx, size_t ny, size_t nz, (unsigned long)dy, (unsigned long)dz, fill_value); print_ref(nx, ny, nz); - printf("\n Result is:\n"); + HDprintf("\n Result is:\n"); print_array(dst, nx, ny, nz); } /* end if */ goto error; @@ -332,17 +332,17 @@ test_copy(int mode, if(0 == ny) { ndims = 1; ny = nz = 1; - sprintf(dim, "%lu", (unsigned long) nx); + HDsprintf(dim, "%lu", (unsigned long) nx); } /* end if */ else { ndims = 2; nz = 1; - sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } /* end else */ } /* end if */ else { ndims = 3; - sprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, + HDsprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } /* end else */ @@ -376,8 +376,8 @@ test_copy(int mode, HDabort(); } /* end switch */ - sprintf(s, "Testing hyperslab copy %-11s %s", dim, sub); - printf("%-70s", s); + HDsprintf(s, "Testing hyperslab copy %-11s %s", dim, sub); + HDprintf("%-70s", s); fflush(stdout); /* @@ -481,8 +481,8 @@ test_copy(int mode, * going directly to a terminal. */ AT(); - printf(" acc != ref_value\n"); - printf(" i=%lu, j=%lu, k=%lu, " + HDprintf(" acc != ref_value\n"); + HDprintf(" i=%lu, j=%lu, k=%lu, " "dx=%lu, dy=%lu, dz=%lu\n", (unsigned long)i, (unsigned long)j, @@ -491,7 +491,7 @@ test_copy(int mode, (unsigned long)dy, (unsigned long)dz); print_ref(nx, ny, nz); - printf("\n Destination array is:\n"); + HDprintf("\n Destination array is:\n"); print_array(dst, nx, ny, nz); } /* end if */ goto error; @@ -522,9 +522,9 @@ test_copy(int mode, * going directly to a terminal. */ AT(); - printf(" acc != ref_value + nx*ny*nz - " + HDprintf(" acc != ref_value + nx*ny*nz - " "dx*dy*dz\n"); - printf(" i=%lu, j=%lu, k=%lu, " + HDprintf(" i=%lu, j=%lu, k=%lu, " "dx=%lu, dy=%lu, dz=%lu\n", (unsigned long)i, (unsigned long)j, @@ -533,7 +533,7 @@ test_copy(int mode, (unsigned long)dy, (unsigned long)dz); print_ref(nx, ny, nz); - printf("\n Destination array is:\n"); + HDprintf("\n Destination array is:\n"); print_array(dst, nx, ny, nz); } /* end if */ goto error; @@ -594,7 +594,7 @@ test_multifill(size_t nx) } fill, *src = NULL, *dst = NULL; hsize_t i, j; - printf("%-70s", "Testing multi-byte fill value"); + HDprintf("%-70s", "Testing multi-byte fill value"); fflush(stdout); /* Initialize the source and destination */ @@ -639,28 +639,28 @@ test_multifill(size_t nx) s[0] = '\0'; for(i = 0; i < nx; i++) { if(dst[i].left != 3333333) - sprintf(s, "bad dst[%lu].left", (unsigned long)i); + HDsprintf(s, "bad dst[%lu].left", (unsigned long)i); else if(!H5_DBL_ABS_EQUAL(dst[i].mid, fill.mid)) /* Check if two DOUBLE values are equal. If their difference * is smaller than the EPSILON value for double, they are * considered equal. See the definition in h5test.h. */ - sprintf(s, "bad dst[%lu].mid", (unsigned long)i); + HDsprintf(s, "bad dst[%lu].mid", (unsigned long)i); else if(dst[i].right != 4444444) - sprintf(s, "bad dst[%lu].right", (unsigned long)i); + HDsprintf(s, "bad dst[%lu].right", (unsigned long)i); if(s[0]) { H5_FAILED() if(!HDisatty(1)) { AT(); - printf(" fill={%d,%g,%d}\n ", fill.left, fill.mid, + HDprintf(" fill={%d,%g,%d}\n ", fill.left, fill.mid, fill.right); for(j = 0; j < sizeof(fill); j++) - printf(" %02x", ((uint8_t *)&fill)[j]); - printf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i, + HDprintf(" %02x", ((uint8_t *)&fill)[j]); + HDprintf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i, dst[i].left, dst[i].mid, dst[i].right); for(j = 0; j < sizeof(dst[i]); j++) - printf(" %02x", ((uint8_t *)(dst + i))[j]); - printf("\n"); + HDprintf(" %02x", ((uint8_t *)(dst + i))[j]); + HDprintf("\n"); } /* end if */ goto error; } /* end if */ @@ -709,7 +709,7 @@ test_endian(size_t nx) hsize_t size[2]; /*size vector */ hsize_t i, j; - printf("%-70s", "Testing endian conversion by stride"); + HDprintf("%-70s", "Testing endian conversion by stride"); fflush(stdout); /* Initialize arrays */ @@ -742,10 +742,10 @@ test_endian(size_t nx) * to a terminal. */ AT(); - printf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); - printf(" Source array is:\n"); + HDprintf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Source array is:\n"); print_array(src, nx, (size_t)4, (size_t)1); - printf("\n Result is:\n"); + HDprintf("\n Result is:\n"); print_array(dst, nx, (size_t)4, (size_t)1); } /* end if */ goto error; @@ -795,9 +795,9 @@ test_transpose(size_t nx, size_t ny) char s[256]; hsize_t i, j; - sprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, + HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, (unsigned long)ny); - printf("%-70s", s); + HDprintf("%-70s", s); fflush(stdout); /* Initialize */ @@ -833,20 +833,20 @@ test_transpose(size_t nx, size_t ny) H5_FAILED() if(!HDisatty(1)) { AT(); - printf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); - printf(" Source is:\n"); + HDprintf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Source is:\n"); for(i = 0; i < nx; i++) { - printf("%3lu:", (unsigned long)i); + HDprintf("%3lu:", (unsigned long)i); for(j = 0; j < ny; j++) - printf(" %6d", src[i * ny + j]); - printf("\n"); + HDprintf(" %6d", src[i * ny + j]); + HDprintf("\n"); } /* end for */ - printf("\n Destination is:\n"); + HDprintf("\n Destination is:\n"); for (i = 0; i < ny; i++) { - printf("%3lu:", (unsigned long)i); + HDprintf("%3lu:", (unsigned long)i); for(j = 0; j < nx; j++) - printf(" %6d", dst[i * nx + j]); - printf("\n"); + HDprintf(" %6d", dst[i * nx + j]); + HDprintf("\n"); } /* end for */ } /* end if */ goto error; @@ -900,10 +900,10 @@ test_sub_super(size_t nx, size_t ny) hsize_t i, j; char s[256]; - sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", + HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx), (unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny); - printf("%-70s", s); + HDprintf("%-70s", s); fflush(stdout); /* Initialize */ @@ -935,12 +935,12 @@ test_sub_super(size_t nx, size_t ny) H5_FAILED() if(!HDisatty(1)) { AT(); - printf(" full[%lu][%lu] != half[%lu][%lu]\n", + HDprintf(" full[%lu][%lu] != half[%lu][%lu]\n", (unsigned long)i * 2, (unsigned long)j * 2, (unsigned long)i, (unsigned long)j); - printf(" full is:\n"); + HDprintf(" full is:\n"); print_array(full, 2 * nx, 2 * ny, (size_t)1); - printf("\n half is:\n"); + HDprintf("\n half is:\n"); print_array(half, nx, ny, (size_t)1); } /* end if */ goto error; @@ -953,10 +953,10 @@ test_sub_super(size_t nx, size_t ny) * Test replicating pixels to produce an image twice as large in each * dimension. */ - sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", + HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, (unsigned long)ny, (unsigned long)(2 * nx), (unsigned long)(2 * ny)); - printf("%-70s", s); + HDprintf("%-70s", s); fflush(stdout); /* Setup stride */ @@ -982,19 +982,19 @@ test_sub_super(size_t nx, size_t ny) for(i = 0; i < nx; i++) { for(j = 0; j < ny; j++) { if(half[i * ny + j] != twice[4 * i * ny + 2 * j]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2); else if(half[i * ny + j] != twice[4 * i * ny + 2 * j + 1]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2 + 1); else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2); else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j + 1]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1); if(s[0]) { @@ -1055,7 +1055,7 @@ test_array_fill(size_t lo, size_t hi) size_t u, v, w; /* Local index variables */ char s[256]; - sprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi); + HDsprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi); TESTING(s); /* Initialize */ @@ -1120,7 +1120,7 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */ char s[256]; - sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x); + HDsprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x); TESTING(s); /* Initialize */ @@ -1212,18 +1212,18 @@ main(int argc, char *argv[]) else if(!HDstrcmp(argv[i], "medium")) size_of_test |= TEST_MEDIUM; else { - printf("unrecognized argument: %s\n", argv[i]); + HDprintf("unrecognized argument: %s\n", argv[i]); HDexit(EXIT_FAILURE); } /* end else */ } /* end for */ } /* end else */ - printf("Test sizes: "); + HDprintf("Test sizes: "); if(size_of_test & TEST_SMALL) - printf(" SMALL"); + HDprintf(" SMALL"); if(size_of_test & TEST_MEDIUM) - printf(" MEDIUM"); - printf("\n"); + HDprintf(" MEDIUM"); + HDprintf("\n"); /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -1429,14 +1429,14 @@ main(int argc, char *argv[]) /*--- END OF TESTS ---*/ if(nerrors) { - printf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1 + HDprintf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); if(HDisatty(1)) - printf("(Redirect output to a pager or a file to see debug output)\n"); + HDprintf("(Redirect output to a pager or a file to see debug output)\n"); HDexit(EXIT_FAILURE); } /* end if */ - printf("All hyperslab tests passed.\n"); + HDprintf("All hyperslab tests passed.\n"); #ifdef H5_HAVE_THREADSAFE H5close(); diff --git a/test/istore.c b/test/istore.c index e91a59b..f0ddda4 100644 --- a/test/istore.c +++ b/test/istore.c @@ -106,21 +106,21 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz) for (i = 0; i < nx; i++) { if (nz > 1) { - fprintf(stderr,"i=%lu:\n", (unsigned long)i); + HDfprintf(stderr,"i=%lu:\n", (unsigned long)i); } else { - fprintf(stderr,"%03lu:", (unsigned long)i); + HDfprintf(stderr,"%03lu:", (unsigned long)i); } for (j = 0; j < ny; j++) { if (nz > 1) - fprintf(stderr,"%03lu:", (unsigned long)j); + HDfprintf(stderr,"%03lu:", (unsigned long)j); for (k = 0; k < nz; k++) { - fprintf(stderr," %3d", *array++); + HDfprintf(stderr," %3d", *array++); } if (nz > 1) - fprintf(stderr,"\n"); + HDfprintf(stderr,"\n"); } - fprintf(stderr,"\n"); + HDfprintf(stderr,"\n"); } } @@ -268,19 +268,19 @@ test_extend(hid_t f, const char *prefix, if (!ny) { ndims = 1; ny = nz = 1; - sprintf(dims, "%lu", (unsigned long) nx); + HDsprintf(dims, "%lu", (unsigned long) nx); } else { ndims = 2; nz = 1; - sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } } else { ndims = 3; - sprintf(dims, "%lux%lux%lu", + HDsprintf(dims, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } - sprintf(s, "istore extend: %s", dims); + HDsprintf(s, "istore extend: %s", dims); TESTING(s); buf = (uint8_t *)HDmalloc(nx * ny * nz); check = (uint8_t *)HDmalloc(nx * ny * nz); @@ -294,9 +294,9 @@ test_extend(hid_t f, const char *prefix, max_corner[2] = 0; /* Build the new empty object */ - sprintf(name, "%s_%s", prefix, dims); + HDsprintf(name, "%s_%s", prefix, dims); if ((dataset=new_object(f, name, ndims, whole_size, whole_size)) < 0) { - fprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name); + HDfprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name); goto error; } @@ -327,21 +327,21 @@ test_extend(hid_t f, const char *prefix, #if 0 if (0 == ctr) - fprintf(stderr,"\n"); - fprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]); + HDfprintf(stderr,"\n"); + HDfprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]); if (ndims > 1) - fprintf(stderr,",%ld", (long)offset[1]); + HDfprintf(stderr,",%ld", (long)offset[1]); if (ndims > 2) - fprintf(stderr,",%ld", (long)offset[2]); - fprintf(stderr,"), size=(%lu", (unsigned long)size[0]); + HDfprintf(stderr,",%ld", (long)offset[2]); + HDfprintf(stderr,"), size=(%lu", (unsigned long)size[0]); if (ndims > 1) - fprintf(stderr,",%lu", (unsigned long)size[1]); + HDfprintf(stderr,",%lu", (unsigned long)size[1]); if (ndims > 2) - fprintf(stderr,",%lu", (unsigned long)size[2]); - fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); + HDfprintf(stderr,",%lu", (unsigned long)size[2]); + HDfprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); if (0 == nelmts) - fprintf(stderr," *SKIPPED*"); - fprintf(stderr,"\n"); + HDfprintf(stderr," *SKIPPED*"); + HDfprintf(stderr,"\n"); #endif /* Fill the source array */ @@ -357,7 +357,7 @@ test_extend(hid_t f, const char *prefix, /* Write to disk */ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) { H5_FAILED(); - fprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr); + HDfprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr); goto error; } @@ -365,16 +365,16 @@ test_extend(hid_t f, const char *prefix, HDmemset(check, 0xff, (size_t)nelmts); if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) { H5_FAILED(); - fprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr); + HDfprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr); goto error; } if (HDmemcmp(buf, check, (size_t)nelmts)) { H5_FAILED(); - fprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr); - fprintf(stderr," Wrote:\n"); + HDfprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr); + HDfprintf(stderr," Wrote:\n"); print_array(buf, (size_t)size[0], (size_t)size[1], (size_t)size[2]); - fprintf(stderr," Read:\n"); + HDfprintf(stderr," Read:\n"); print_array(check, (size_t)size[0], (size_t)size[1], (size_t)size[2]); goto error; @@ -397,7 +397,7 @@ test_extend(hid_t f, const char *prefix, HDmemset(buf, 0xff, nx * ny * nz); if (H5Dread(dataset, TEST_DATATYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { H5_FAILED(); - fprintf(stderr," Read failed for whole array.\n"); + HDfprintf(stderr," Read failed for whole array.\n"); goto error; } for (i=0; i<nx; i++) { @@ -405,16 +405,16 @@ test_extend(hid_t f, const char *prefix, for (k=0; k<nz; k++) { if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) { H5_FAILED(); - fprintf(stderr," Check failed at i=%lu", (unsigned long)i); + HDfprintf(stderr," Check failed at i=%lu", (unsigned long)i); if (ndims > 1) { - fprintf(stderr,", j=%lu", (unsigned long)j); + HDfprintf(stderr,", j=%lu", (unsigned long)j); } if (ndims > 2) { - fprintf(stderr,", k=%lu", (unsigned long)k); + HDfprintf(stderr,", k=%lu", (unsigned long)k); } - fprintf(stderr,"\n Check array is:\n"); + HDfprintf(stderr,"\n Check array is:\n"); print_array(whole, nx, ny, nz); - fprintf(stderr," Value read is:\n"); + HDfprintf(stderr," Value read is:\n"); print_array(buf, nx, ny, nz); goto error; } @@ -481,19 +481,19 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, if (!ny) { ndims = 1; ny = nz = 1; - sprintf(dims, "%lu", (unsigned long) nx); + HDsprintf(dims, "%lu", (unsigned long) nx); } else { ndims = 2; nz = 1; - sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } } else { ndims = 3; - sprintf(dims, "%lux%lux%lu", + HDsprintf(dims, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } - sprintf(s, "istore sparse: %s", dims); + HDsprintf(s, "istore sparse: %s", dims); TESTING(s); if(skip_test){ SKIPPED() @@ -512,9 +512,9 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size[2] = nz; /* Build the new empty object */ - sprintf(name, "%s_%s", prefix, dims); + HDsprintf(name, "%s_%s", prefix, dims); if ((dataset=new_object(f, name, ndims, whole_size, chunk_dims)) < 0) { - printf(" Cannot create %u-d object `%s'\n", ndims, name); + HDprintf(" Cannot create %u-d object `%s'\n", ndims, name); goto error; } @@ -535,18 +535,18 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, /* write to disk */ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) { H5_FAILED(); - printf(" Write failed: ctr=%lu\n", (unsigned long)ctr); - printf(" offset=(%lu", (unsigned long) (offset[0])); + HDprintf(" Write failed: ctr=%lu\n", (unsigned long)ctr); + HDprintf(" offset=(%lu", (unsigned long) (offset[0])); if (ndims > 1) - printf(",%lu", (unsigned long) (offset[1])); + HDprintf(",%lu", (unsigned long) (offset[1])); if (ndims > 2) - printf(",%lu", (unsigned long) (offset[2])); - printf("), size=(%lu", (unsigned long) (size[0])); + HDprintf(",%lu", (unsigned long) (offset[2])); + HDprintf("), size=(%lu", (unsigned long) (size[0])); if (ndims > 1) - printf(",%lu", (unsigned long) (size[1])); + HDprintf(",%lu", (unsigned long) (size[1])); if (ndims > 2) - printf(",%lu", (unsigned long) (size[2])); - printf(")\n"); + HDprintf(",%lu", (unsigned long) (size[2])); + HDprintf(")\n"); goto error; } total += nx * ny * nz; @@ -617,21 +617,21 @@ main(int argc, char *argv[]) } else if (!strcmp(argv[i], "large")) { size_of_test |= TEST_LARGE; } else { - printf("unrecognized argument: %s\n", argv[i]); + HDprintf("unrecognized argument: %s\n", argv[i]); #if 0 exit(EXIT_FAILURE); #endif } } } - printf("Test sizes: "); + HDprintf("Test sizes: "); if (size_of_test & TEST_SMALL) - printf(" SMALL"); + HDprintf(" SMALL"); if (size_of_test & TEST_MEDIUM) - printf(" MEDIUM"); + HDprintf(" MEDIUM"); if (size_of_test & TEST_LARGE) - printf(" LARGE"); - printf("\n"); + HDprintf(" LARGE"); + HDprintf("\n"); /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -653,7 +653,7 @@ main(int argc, char *argv[]) /* Create the test file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { - printf("Cannot create file %s; test aborted\n", filename); + HDprintf("Cannot create file %s; test aborted\n", filename); exit(EXIT_FAILURE); } @@ -708,7 +708,7 @@ main(int argc, char *argv[]) */ status = test_sparse(file, "sparse", (size_t)800, (size_t)50, (size_t)50, (size_t)50, skip_test); if(skip_test) - printf(" The current VFD does not support sparse files on this platform.\n"); + HDprintf(" The current VFD does not support sparse files on this platform.\n"); nerrors += status < 0 ? 1 : 0; } @@ -720,12 +720,12 @@ main(int argc, char *argv[]) nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); if (nerrors) { - printf("***** %d I-STORE TEST%s FAILED! *****\n", + HDprintf("***** %d I-STORE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); } - printf("All i-store tests passed.\n"); + HDprintf("All i-store tests passed.\n"); h5_cleanup(FILENAME, fapl); diff --git a/test/lheap.c b/test/lheap.c index d3e165e..b692947 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -89,7 +89,7 @@ main(void) goto error; } for(i = 0; i < NOBJS; i++) { - sprintf(buf, "%03d-", i); + HDsprintf(buf, "%03d-", i); for(j = 4; j < i; j++) buf[j] = (char)('0' + j % 10); if(j > 4) @@ -124,7 +124,7 @@ main(void) goto error; } for(i = 0; i < NOBJS; i++) { - sprintf(buf, "%03d-", i); + HDsprintf(buf, "%03d-", i); for(j = 4; j < i; j++) buf[j] = (char)('0' + j % 10); if(j > 4) diff --git a/test/links.c b/test/links.c index 0188758..89e62ab 100644 --- a/test/links.c +++ b/test/links.c @@ -31,8 +31,8 @@ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" -#define TMPDIR "tmp/" -#define TMPDIR2 "tmp2/" +#define TMPDIR "tmp_links/" +#define TMPDIR2 "tmp2_links/" /* Symlinks for external link symlink test */ #define SYMLINK1 TMPDIR "sym1.h5" @@ -98,7 +98,7 @@ const char *FILENAME[] = { #define CORE_INCREMENT 1024 #define NUM40 40 -/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ +/* do not do check_all_closed() for "ext*" files and "tmp_links/ext*" */ #define EXTSTOP 12 #define LINK_BUF_SIZE 1024 @@ -2553,9 +2553,9 @@ error: * * Purpose: 1. target link: "extlinks2" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set + * 3. target file: "tmp_links/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp_links" + * Should be able to access the target file in tmp_links directory via the prefix set * by H5Pset_elink_prefix() * * @@ -2583,11 +2583,11 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* set up name for external linked target file: "extlinks2" */ h5_fixname(FILENAME[16], fapl, filename2, sizeof filename2); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file: "tmp/extlinks2" */ + /* set up name for target file: "tmp_links/extlinks2" */ h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -2617,7 +2617,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -2641,8 +2641,8 @@ error: * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: "<cur drive>:/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" + * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Windows: "<cur drive>:/CWD/tmp_links/extlinks0" + * 3. target file: "tmp_links/extlinks3" * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 @@ -2667,17 +2667,17 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* set up name for external linked target file: "extlinks3" */ h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks3" */ + /* set up name for target file: "tmp_links/extlinks3" */ h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Window: "<cur drive>:/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Window: "<cur drive>:/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -2705,7 +2705,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from absolute path set for main file */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -2729,8 +2729,8 @@ error: * Function: external_link_rel_mainpath: test 4 * * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" + * 2. main file: "tmp_links/extlinks0" + * 3. target file: "tmp_links/extlinks4" * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 @@ -2757,9 +2757,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for main file: "tmp/extlinks0" */ + /* set up name for main file: "tmp_links/extlinks0" */ h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1); - /* set up name for target file: "tmp/extlinks4" */ + /* set up name for target file: "tmp_links/extlinks4" */ h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -2808,7 +2808,7 @@ error: * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0" + * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/extlinks0" * 3. target file: "extlinks5" * Should be able to access the target file in the current working directory * @@ -2840,8 +2840,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: "<cur drive>:/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Windows: "<cur drive>:/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -2892,9 +2892,9 @@ error: /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * - * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:"<cur drive>:/CWD/tmp/extlinks6" + * Purpose: 1. target link: Linux:"/CWD/tmp_links/extlinks6"; Windows:"<cur drive>:/CWD/tmp_links/extlinks6" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" + * 3. target file: "tmp_links/extlinks6" * Should be able to access the target file's absolute path * * Return: Success: 0 @@ -2920,19 +2920,19 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR /* * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks6" - * Windows: "<cur drive>:/CWD/tmp/extlinks6" + * Linux: "/CWD/tmp_links/extlinks6" + * Windows: "<cur drive>:/CWD/tmp_links/extlinks6" */ fix_ext_filename(tmpname, cwdpath, FILENAME[23]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks6" */ + /* set up name for target file: "tmp_links/extlinks6" */ h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -2957,7 +2957,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -2979,7 +2979,7 @@ error: /*------------------------------------------------------------------------- * Function: external_link_abstar_cur: test 7 * - * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: "<cur drive>:/CWD/tmp/extlinks7" + * Purpose: 1. target link: Linux: "/CWD/tmp_links/extlinks7"; Windows: "<cur drive>:/CWD/tmp_links/extlinks7" * 2. main file: "extlinks0" * 3. target file: "extlinks7" * Should be able to access the target file via the main file's CWD. @@ -3010,14 +3010,14 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* set up name for target file name: "extlinks7" */ h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR /* * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks7" - * Windows: "<cur drive>:/CWD/tmp/extlinks7" + * Linux: "/CWD/tmp_links/extlinks7" + * Windows: "<cur drive>:/CWD/tmp_links/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3067,9 +3067,9 @@ error: /*------------------------------------------------------------------------- * Function: external_link_reltar: test 8 * - * Purpose: 1. target link: Linux:"tmp/extlinks8" + * Purpose: 1. target link: Linux:"tmp_links/extlinks8" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" + * 3. target file: "tmp_links/extlinks8" * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 @@ -3092,11 +3092,11 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name: "tmp/extlinks8" */ - /* set up name for external linked target file: "tmp/extlinks8" */ + /* set up name for target file name: "tmp_links/extlinks8" */ + /* set up name for external linked target file: "tmp_links/extlinks8" */ h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2); /* Create the target file */ @@ -3117,7 +3117,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } /* end if */ @@ -3143,8 +3143,8 @@ error: * Purpose: * 1. target link: "extlinks9" * 2. main file: "extlinks0" - * 3. target file" "tmp/extlinks9" - * 3. chdir "tmp" + * 3. target file" "tmp_links/extlinks9" + * 3. chdir "tmp_links" * Should be able to access the target file in current working directory * * Return: Success: 0 @@ -3170,10 +3170,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format) /* set up name for external linked target file ("extlinks9") */ h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2); - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name ("tmp/extlinks9") */ + /* set up name for target file name ("tmp_links/extlinks9") */ h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -3206,7 +3206,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format) */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -3234,7 +3234,7 @@ error: * * 1. target link: "extlinks16" * 2. target file: "extlinks16" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0" + * 3. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/extlinks0" * 4. Create target file A to be a "family" file: extlinks16A * 4. Create target file B to be a "multi" file: extlinks16B * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A @@ -3276,8 +3276,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: "<cur drive>:/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Windows: "<cur drive>:/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -3426,7 +3426,7 @@ error: * * 1. target link: "extlinks17" * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0" + * 3. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/extlinks0" * 4. Create target file to be a "core" file:/A/Dataset * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset * 6. Set the file access property list of the link access to use "core" file without @@ -3465,8 +3465,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: "<cur drive>:/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Windows: "<cur drive>:/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -4013,7 +4013,7 @@ error: * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" + * 1. target link: "/CWD/tmp_links/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" * Should be able to find the target file via main file's current drive/rel path @@ -4044,7 +4044,7 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks10" */ + /* set up name for target link: "/CWD/tmp_links/extlinks10" */ HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); @@ -4099,9 +4099,9 @@ error: * Function: external_link_win2 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks11" + * 1. target link: "/CWD/tmp_links/extlinks11" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" + * 3. target file: "tmp_links/extlinks11" * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 @@ -4127,17 +4127,17 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks11" */ + /* set up name for target link: "/CWD/tmp_links/extlinks11" */ HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[31]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks11" */ + /* set up name for target file: "tmp_links/extlinks11" */ h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4163,7 +4163,7 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4187,9 +4187,9 @@ error: * Function: external_link_win3 * * Purpose: - * 1. target link: "<cur drive>:tmp/extlinks12" + * 1. target link: "<cur drive>:tmp_links/extlinks12" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" + * 3. target file: "tmp_links/extlinks12" * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 @@ -4215,16 +4215,16 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target link: "<drive-letter>:tmp/extlinks12" */ + /* set up name for target link: "<drive-letter>:tmp_links/extlinks12" */ drive = HDgetdrive(); HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks12" */ + /* set up name for target file: "tmp_links/extlinks12" */ h5_fixname(FILENAME[32], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4250,7 +4250,7 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4274,8 +4274,8 @@ external_link_win3(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: "<cur drive>:extlinks13" - * 2. main file: "<cur-drive>:tmp/extlinks0" - * 3. target file: tmp/extlinks13 + * 2. main file: "<cur-drive>:tmp_links/extlinks0" + * 3. target file: tmp_links/extlinks13 * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 @@ -4298,7 +4298,7 @@ external_link_win4(hid_t fapl, hbool_t new_format) else TESTING("external links via main file's abs drive/rel path (windows)") - /* set up name for main file: "<drive-letter>:tmp/extlinks0" */ + /* set up name for main file: "<drive-letter>:tmp_links/extlinks0" */ drive = HDgetdrive(); HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -4307,7 +4307,7 @@ external_link_win4(hid_t fapl, hbool_t new_format) HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks13" */ + /* set up name for target file: "tmp_links/extlinks13" */ h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4356,9 +4356,9 @@ error: * Function: external_link_win5 * * Purpose: - * 1. target link: "<cur drive+1>:tmp/extlinks14" + * 1. target link: "<cur drive+1>:tmp_links/extlinks14" * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" + * 3. target file: "tmp_links/extlinks14" * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 @@ -4396,11 +4396,11 @@ external_link_win5(hid_t fapl, hbool_t new_format) HDstrcat(tmpname, FILENAME[12]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); - /* set up name for target link: "<drive-letter+1>:tmp/extlinks14" */ + /* set up name for target link: "<drive-letter+1>:tmp_links/extlinks14" */ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks14" */ + /* set up name for target file: "tmp_links/extlinks14" */ h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4449,9 +4449,9 @@ error: * Function: external_link_win6 * * Purpose: - * 1. target link: "<cur drive+1>:tmp/extlinks15" + * 1. target link: "<cur drive+1>:tmp_links/extlinks15" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" + * 3. target file: "tmp_links/extlinks15" * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 @@ -4474,7 +4474,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) else TESTING("external links via target's current drive/rel path (windows)") - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR drive = HDgetdrive(); @@ -4486,7 +4486,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* set up name for target link: "<drive-letter+1>:tmp/extlinks15" */ + /* set up name for target link: "<drive-letter+1>:tmp_links/extlinks15" */ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4515,7 +4515,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4539,7 +4539,7 @@ error: * Function: external_link_win7 * * Purpose: - * 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10" + * 1. UNC target link: "\\127.0.01\c$/tmp_links/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" * Should be able to find the target file via main file's local host/main drive/rel path @@ -4570,7 +4570,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */ + /* set up name for target link: "\\127.0.0.1\c$/tmp_links/extlinks10" */ HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); @@ -4657,7 +4657,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* create tmp directory */ + /* create tmp_links directory */ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target link: "<drive-letter>:\CWD\extlinks10" */ @@ -4690,7 +4690,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4714,7 +4714,7 @@ error: * Function: external_link_win9 * * Purpose: - * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10" + * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp_links/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" * Should be able to find the target file via main file's local host/main drive/rel path @@ -4744,7 +4744,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ + /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp_links/extlinks10" */ HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); @@ -5808,37 +5808,22 @@ error: static int external_link_endian(hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1, gid2 = -1; /* Group IDs */ - hid_t lapl_id = -1; /* Prop List ID */ - char *srcdir = getenv("srcdir"); /* The source directory */ - char pathbuf[NAME_BUF_SIZE]; /* Path to the files */ - char namebuf[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t lapl_id = -1; /* Prop List ID */ + const char *pathbuf = H5_get_srcdir(); /* Path to the files */ + const char *namebuf; if(new_format) TESTING("endianness of external links (w/new group format)") else TESTING("endianness of external links") - /* - * Create the name of the file to open (in case we are using the --srcdir - * option and the file is in a different directory from this test). - */ - if (srcdir && ((HDstrlen(srcdir) + 2) < sizeof(pathbuf)) ) - { - HDstrcpy(pathbuf, srcdir); - HDstrcat(pathbuf, "/"); - } - else - HDstrcpy(pathbuf, ""); - /* Create a link access property list with the path to the srcdir */ if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR - if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, LE_FILENAME); + namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */ /* Test LE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR @@ -5852,9 +5837,7 @@ external_link_endian(hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, BE_FILENAME); + namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */ /* Test BE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR @@ -6009,7 +5992,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks21A" */ h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) @@ -6019,29 +6002,29 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Set up names for files in the subdirectories */ - /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */ + /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */ h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); fix_ext_filename(tmpname, cwdpath, FILENAME[46]); h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ - /* (i.e. tmp/sym1.h5 -> <full path to>/tmp2/extlinks21B.h5) */ + /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */ if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */ + /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */ h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); - /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */ + /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */ h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); fix_ext_filename(tmpname, cwdpath, FILENAME[49]); h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ - /* (i.e. tmp2/sym2.h5 -> <full path to>/tmp/extlinks21D.h5) */ + /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */ if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */ + /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */ h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); @@ -6054,11 +6037,11 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - /* Create file #2 in tmp directory #2 */ + /* Create file #2 in tmp_links directory #2 */ if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(H5Fclose(file2) < 0) TEST_ERROR - /* Re-open file #2 in tmp directory through symlink */ + /* Re-open file #2 in tmp_links directory through symlink */ if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create group in file #2 in temporary directory */ @@ -8531,8 +8514,7 @@ build_visit_file(hid_t fapl) hid_t did = -1; /* Dataset ID */ hid_t tid = -1; /* Datatype ID */ char filename[NAME_BUF_SIZE]; - char pathname[1024]; /* Path of external link file */ - char *srcdir = getenv("srcdir"); /* where the src code is located */ + const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */ h5_fixname(FILENAME[9], fapl, filename, sizeof filename); @@ -8566,14 +8548,6 @@ build_visit_file(hid_t fapl) if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create external link to existing file */ - pathname[0] = '\0'; - /* Generate correct name for test file by prepending the source path */ - if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) { - HDstrcpy(pathname, srcdir); - HDstrcat(pathname, "/"); - } - HDstrcat(pathname, LINKED_FILE); - if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create dangling external link to non-existent file */ @@ -14029,7 +14003,7 @@ main(void) HDremove(SYMLINK1); HDremove(SYMLINK2); - /* clean up tmp directory created by external link tests */ + /* clean up tmp_links and tmp2_links directory created by external link tests */ HDrmdir(TMPDIR); HDrmdir(TMPDIR2); diff --git a/test/links_env.c b/test/links_env.c index 470ef9a..df14675 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -12,39 +12,39 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: Tests hard, soft (symbolic) & external links. + * Purpose: Tests hard, soft (symbolic) & external links. */ #define H5G_PACKAGE #define H5G_TESTING #include "h5test.h" -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ -#define TMPDIR "tmp/" +#define TMPDIR "tmp_links_env/" #define NAME_BUF_SIZE 1024 const char *FILENAME[] = { - "extlinks_env0", /* 0: main file */ - "extlinks_env1", /* 1: target file */ + "extlinks_env0", /* 0: main file */ + "extlinks_env1", /* 1: target file */ TMPDIR "extlinks_env1", /* 2 */ NULL }; static int external_link_env(hid_t fapl, hbool_t new_format); - + /*------------------------------------------------------------------------- * Function: external_link_env (moved from links.c) * - * Purpose: Verify that the target file is found successfully in "tmp" directory - * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX. - * 1. Target link: "extlinks_env1" - * 2. Main file: "extlinks_env0" - * 3. Target file is created in: "tmp/extlinks_env1" - * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp" + * Purpose: Verify that the target file is found successfully in "tmp_links_env" directory + * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX. + * 1. Target link: "extlinks_env1" + * 2. Main file: "extlinks_env0" + * 3. Target file is created in: "tmp_links_env/extlinks_env1" + * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp_links_env" * * Return: Success: 0 * Failure: -1 @@ -59,12 +59,12 @@ static int external_link_env(hid_t fapl, hbool_t new_format); static int external_link_env(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - const char *envval = NULL; /* Pointer to environment variable */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; /* Holders for filename */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + const char *envval = NULL; /* Pointer to environment variable */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; /* Holders for filename */ if(new_format) TESTING("external links via environment variable (w/new group format)") @@ -73,7 +73,7 @@ external_link_env(hid_t fapl, hbool_t new_format) if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) envval = "nomatch"; - if (HDstrcmp(envval, ".:tmp")) TEST_ERROR + if (HDstrcmp(envval, ".:tmp_links_env")) TEST_ERROR /* Set up name for main file:"extlinks_env0" */ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); @@ -81,14 +81,14 @@ external_link_env(hid_t fapl, hbool_t new_format) /* Set up name for external linked target file: "extlinks_env1" */ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - /* Create "tmp" directory */ + /* Create "tmp_links_env" directory */ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + TEST_ERROR - /* Set up name (location) for the target file: "tmp/extlinks1" */ + /* Set up name (location) for the target file: "tmp_links_env/extlinks1" */ h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3); - /* Create the target file in "tmp" directory */ + /* Create the target file in "tmp_links_env" directory */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -110,9 +110,9 @@ external_link_env(hid_t fapl, hbool_t new_format) /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ if (gid < 0) { - H5_FAILED(); - puts(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + puts(" Should have found the file in tmp_links_env directory."); + goto error; } /* closing for main file */ @@ -124,35 +124,30 @@ external_link_env(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_env() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test external link with environment variable HDF5_EXT_PREFIX + * Purpose: Test external link with environment variable HDF5_EXT_PREFIX * - * Return: Success: exit(EXIT_SUCCESS) - * Failure: exit(EXIT_FAILURE) + * Return: Success: exit(EXIT_SUCCESS) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Vailin Choi; Nov 2010 + * Programmer: Vailin Choi; Nov 2010 * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; /* File access property lists */ - int nerrors = 0; /* Error from tests */ - const char *env_h5_drvr; /* File Driver value from environment */ - - env_h5_drvr = HDgetenv("HDF5_DRIVER"); - if(env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + hid_t fapl; /* File access property lists */ + int nerrors = 0; /* Error from tests */ h5_reset(); fapl = h5_fileaccess(); @@ -177,7 +172,7 @@ main(void) } HDprintf("All external Link (HDF5_EXT_PREFIX) tests passed.\n"); - /* clean up tmp directory created by external link tests */ + /* clean up tmp_links_env directory created by external link tests */ HDrmdir(TMPDIR); return 0; @@ -162,15 +162,15 @@ error: static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl_new = -1; /* copy of fapl */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t fapl_new = -1; /* copy of fapl */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ - H5FD_mem_t type; - haddr_t addr1, addr2; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - hsize_t ma_size=0; + H5FD_mem_t type; + haddr_t addr1, addr2; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + hsize_t ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MM_alloc() of file allocation"); diff --git a/test/mtime.c b/test/mtime.c index 1928a17..b50dfeb 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -118,7 +118,7 @@ main(void) HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); tm = HDlocaltime(&now); HDstrftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm); - printf(" got: %s\n ans: %s\n", buf1, buf2); + HDprintf(" got: %s\n ans: %s\n", buf1, buf2); goto error; } PASSED(); @@ -153,7 +153,7 @@ main(void) } else { H5_FAILED(); - printf("***cannot open the pre-created old modification test file (%s)\n", + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; } /* end else */ @@ -187,7 +187,7 @@ main(void) } else { H5_FAILED(); - printf("***cannot open the pre-created old modification test file (%s)\n", + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; } /* end else */ diff --git a/test/ntypes.c b/test/ntypes.c index 05729d7..1cc7c33 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -149,8 +149,8 @@ test_atomic_dtype(hid_t file) for(j = 0; j < DIM1; j++) if(ipoints2[i][j] != icheck2[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -521,8 +521,8 @@ test_compound_dtype2(hid_t file) temp_point->st.ll2 != temp_check->st.ll2 || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ } /* end for */ @@ -728,8 +728,8 @@ test_compound_dtype(hid_t file) temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -942,16 +942,16 @@ test_compound_dtype3(hid_t file) if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ for(k = 0; k < 5; k++) { if(temp_point->a[k] != temp_check->a[k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d,%d\n", i, j, k); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d,%d\n", i, j, k); goto error; } /* end if */ } /* end for */ @@ -1157,16 +1157,16 @@ test_compound_opaque(hid_t file) if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ for(k = 0; k < 5; k++) { if(temp_point->o[k] != temp_check->o[k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d,%d\n", i, j, k); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d,%d\n", i, j, k); goto error; } /* end if */ } /* end for */ @@ -1320,9 +1320,9 @@ test_enum_dtype(hid_t file) for(j = 0; j < DIM1; j++) if(spoints2[i][j] != scheck2[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j], + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j], scheck2[i][j]); goto error; } /* end if */ @@ -1476,8 +1476,8 @@ test_array_dtype(hid_t file) temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -1610,8 +1610,8 @@ test_array_dtype2(hid_t file) for(k = 0; k < 5; k++) if(icheck3[i][j][k] != ipoints3[i][j][k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -1677,7 +1677,7 @@ test_vl_dtype(hid_t file) wdata[i].p = HDmalloc((i + 1) * sizeof(hvl_t)); if(NULL == wdata[i].p) { H5_FAILED(); - printf(" Cannot allocate memory for VL data! i=%u\n",(unsigned)i); + HDprintf(" Cannot allocate memory for VL data! i=%u\n",(unsigned)i); goto error; } /* end if */ wdata[i].len = i + 1; @@ -1685,7 +1685,7 @@ test_vl_dtype(hid_t file) t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); if(NULL == t1->p) { H5_FAILED(); - printf(" Cannot allocate memory for VL data! i=%u, j=%u\n",(unsigned)i,(unsigned)j); + HDprintf(" Cannot allocate memory for VL data! i=%u, j=%u\n",(unsigned)i,(unsigned)j); goto error; } /* end if */ t1->len = j + 1; @@ -1745,13 +1745,13 @@ test_vl_dtype(hid_t file) for(i = 0; i < SPACE1_DIM1; i++) { if(wdata[i].len != rdata[i].len) { H5_FAILED(); - printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; } /* end if */ for(t1 = (hvl_t *)wdata[i].p, t2 = (hvl_t *)rdata[i].p, j = 0; j < rdata[i].len; j++, t1++, t2++) { if(t1->len != t2->len) { H5_FAILED(); - printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; } /* end if */ @@ -1767,7 +1767,7 @@ test_vl_dtype(hid_t file) for(k = 0; k < t2->len; k++) { if(((unsigned int *)t1->p)[k] != ((unsigned int *)tmp)[k]) { H5_FAILED(); - printf(" VL data don't match!, wdata[%u].p=%d, rdata[%u].p=%u\n", + HDprintf(" VL data don't match!, wdata[%u].p=%d, rdata[%u].p=%u\n", (unsigned)i, ((unsigned int*)t1->p)[k], (unsigned)i, ((unsigned int*)tmp)[k]); goto error; } /* end if */ @@ -1903,13 +1903,13 @@ test_vlstr_dtype(hid_t file) for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { H5_FAILED(); - printf(" VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", + HDprintf(" VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); goto error; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { H5_FAILED(); - printf(" VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", + HDprintf(" VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]); goto error; } /* end if */ @@ -2026,13 +2026,13 @@ test_str_dtype(hid_t file) for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { H5_FAILED(); - printf(" data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", + HDprintf(" data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); goto error; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { H5_FAILED(); - printf(" data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", + HDprintf(" data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]); goto error; } /* end if */ @@ -2507,8 +2507,8 @@ test_opaque_dtype(hid_t file) for(i = 0; i < sizeof(rbuf); i++) if(rbuf[i] != wbuf[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %u\n", (unsigned)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %u\n", (unsigned)i); goto error; } /* end if */ @@ -2612,8 +2612,8 @@ test_bitfield_dtype(hid_t file) for(i = 0; i < BITFIELD_ENUMB*4; i++) { if(*p != wbuf[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %zu\n", i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %zu\n", i); TEST_ERROR; } p++; @@ -2637,8 +2637,8 @@ test_bitfield_dtype(hid_t file) for(i = 0; i < BITFIELD_ENUMB; i++) { if(intr[i] != intw[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %zu\n", i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %zu\n", i); TEST_ERROR; } } @@ -2792,13 +2792,13 @@ test_ninteger(void) /* check */ if(H5Tget_precision(nid1) != H5Tget_precision(nid2)) { - printf(" Precision differ.\n"); + HDprintf(" Precision differ.\n"); TEST_ERROR } /* end if */ /* compare dataset creation property lists */ if(H5Pequal(dcpl1, dcpl2) <= 0) { - printf(" Property lists differ.\n"); + HDprintf(" Property lists differ.\n"); TEST_ERROR } /* end if */ @@ -2806,8 +2806,8 @@ test_ninteger(void) for(i = 0; i < DIM3; i++) if(buf[i] != chk[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d\n", i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d\n", i); TEST_ERROR } /* end if */ @@ -2898,7 +2898,7 @@ main(void) if(nerrors) goto error; - printf("All native datatype tests passed.\n"); + HDprintf("All native datatype tests passed.\n"); h5_cleanup(FILENAME, fapl); return 0; @@ -2910,7 +2910,7 @@ error: } H5E_END_TRY; nerrors = MAX(1, nerrors); - printf("***** %d DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return 1; diff --git a/test/objcopy.c b/test/objcopy.c index ad9656f..db66285 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -551,7 +551,7 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id) goto done; for(u = 0; u < num_attributes_g; u++) { - sprintf(attr_name, "%u attr", u); + HDsprintf(attr_name, "%u attr", u); /* Set attribute data */ attr_data[0] = (int)(100 * u); @@ -620,7 +620,7 @@ test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id) if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0) goto done; for(u = 0; u < num_attributes_g; u++) { - sprintf(attr_name, "%u attr", u); + HDsprintf(attr_name, "%u attr", u); /* Set attribute data */ attr_data[0] = (int)(100 * u); @@ -5438,15 +5438,15 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create nested sub-groups & datasets */ for(i = 0; i < NUM_SUB_GROUPS; i++) { - sprintf(objname, "Group #%d", i); + HDsprintf(objname, "Group #%d", i); if((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR for(j = 0; j < NUM_SUB_GROUPS; j++) { - sprintf(objname, "Group #%d", j); + HDsprintf(objname, "Group #%d", j); if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR for(k = 0; k < NUM_DATASETS; k++) { - sprintf(objname, "Dataset #%d", k); + HDsprintf(objname, "Dataset #%d", k); /* add a dataset to the group */ if((did = H5Dcreate2(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -5679,11 +5679,11 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create wide sub-group hierarchy, with multiple links to higher groups */ for(u = 0; u < NUM_WIDE_LOOP_GROUPS; u++) { - sprintf(objname, "%s-%u", NAME_GROUP_SUB, u); + HDsprintf(objname, "%s-%u", NAME_GROUP_SUB, u); if((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR for(v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) { - sprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v); + HDsprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v); if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create link to top group */ diff --git a/test/plugin.c b/test/plugin.c index 0de8839..5ec6671 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -111,7 +111,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) /* Check if all the filters are available */ if(H5Pall_filters_avail(dcpl) != TRUE) { H5_FAILED(); - printf(" Line %d: Incorrect filter availability\n", __LINE__); + HDprintf(" Line %d: Incorrect filter availability\n", __LINE__); TEST_ERROR } /* end if */ @@ -132,8 +132,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) for(j=0; j<(size_t)size[1]; j++) if(0 != check[i][j]) { H5_FAILED(); - printf(" Read a non-zero value.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read a non-zero value.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); TEST_ERROR } /* end if */ PASSED(); @@ -200,8 +200,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) for(j=0; j<size[1]; j++) if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); TEST_ERROR } /* end if */ @@ -225,8 +225,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) for(j = 0; j < size[1]; j++) if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); TEST_ERROR } /* end if */ @@ -1068,14 +1068,14 @@ main(void) if(nerrors) TEST_ERROR - printf("All plugin tests passed.\n"); + HDprintf("All plugin tests passed.\n"); h5_cleanup(FILENAME, fapl); return 0; error: nerrors = MAX(1, nerrors); - printf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return 1; } diff --git a/test/reserved.c b/test/reserved.c index d8d0c59..e11ae19 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -71,7 +71,7 @@ rsrv_heap(void) dataspace_id = H5Screate_simple(1, dims, dims); } H5E_END_TRY - sprintf(dset_name, "Dset %d", i); + HDsprintf(dset_name, "Dset %d", i); H5E_BEGIN_TRY { dataset_id = H5Dcreate2(file_id, dset_name, H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -103,7 +103,7 @@ rsrv_heap(void) /* Re-open the library and try to read a dataset from the file we created */ if(H5open() < 0) TEST_ERROR; - sprintf(dset_name, "Dset %d", i - 2); + HDsprintf(dset_name, "Dset %d", i - 2); file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); if(file_id < 0) TEST_ERROR; @@ -195,7 +195,7 @@ rsrv_ohdr(void) } /* end for */ for(i = 0; i < 2000; i++) { - sprintf(attrname, "attr %d", i); + HDsprintf(attrname, "attr %d", i); H5E_BEGIN_TRY{ aid = H5Screate_simple(2, dims, NULL); attr_id = H5Acreate2(dataset_id, attrname, H5T_STD_I32BE, aid, H5P_DEFAULT, H5P_DEFAULT); @@ -439,7 +439,7 @@ main(void) num_errs+=rsrv_vlen(); if(num_errs > 0) - printf("**** %d FAILURE%s! ****\n", num_errs, num_errs==1?"":"S"); + HDprintf("**** %d FAILURE%s! ****\n", num_errs, num_errs==1?"":"S"); else puts("All address space reservation tests passed."); diff --git a/test/space_overflow.c b/test/space_overflow.c index 15be9ba..8a9bcf6 100644 --- a/test/space_overflow.c +++ b/test/space_overflow.c @@ -24,7 +24,7 @@ * Don't forget to change H5S_MAX_RANK back to its original * value and recompile once the test file is created. */ -#include "hdf5.h" +#include "h5test.h" /*------------------------------------------------------------------------- @@ -52,15 +52,15 @@ main(void) file = H5Fcreate("th5s.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(file < 0) - printf("file<0!\n"); + HDprintf("file<0!\n"); for(i = 0; i < H5S_MAX_RANK; i++) cur_dim[i] = 1; space = H5Screate_simple(H5S_MAX_RANK, cur_dim, NULL); if(space < 0) - printf("space<0!\n"); + HDprintf("space<0!\n"); dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dset < 0) - printf("dset<0!\n"); + HDprintf("dset<0!\n"); H5Sclose(space); H5Dclose(dset); H5Fclose(file); diff --git a/test/stab.c b/test/stab.c index 4296f1c..4b11ed7 100644 --- a/test/stab.c +++ b/test/stab.c @@ -127,7 +127,7 @@ test_misc(hid_t fapl, hbool_t new_format) if(HDstrcmp(comment, "hello world")) { H5_FAILED(); puts(" Read the wrong comment string from the group."); - printf(" got: \"%s\"\n ans: \"hello world\"\n", comment); + HDprintf(" got: \"%s\"\n ans: \"hello world\"\n", comment); TEST_ERROR } if(H5Gclose(g1) < 0) TEST_ERROR @@ -198,7 +198,7 @@ test_long(hid_t fapl, hbool_t new_format) name1[i] = (char)('A' + i%26); name1[LONG_NAME_LEN - 1] = '\0'; name2 = (char *)HDmalloc((size_t)((2 * LONG_NAME_LEN) + 2)); - sprintf(name2, "%s/%s", name1, name1); + HDsprintf(name2, "%s/%s", name1, name1); /* Create groups */ if((g1 = H5Gcreate2(fid, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -275,7 +275,7 @@ test_large(hid_t fapl, hbool_t new_format) if(new_format) if(H5G__has_stab_test(cwg) != FALSE) TEST_ERROR for(i = 0; i < LARGE_NOBJS; i++) { - sprintf(name, "%05d%05d", (HDrandom() % 100000), i); + HDsprintf(name, "%05d%05d", (HDrandom() % 100000), i); if((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(dir) < 0) TEST_ERROR } @@ -385,7 +385,7 @@ lifecycle(hid_t fapl2) if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Create first "bottom" group */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -402,7 +402,7 @@ lifecycle(hid_t fapl2) /* Create several more bottom groups, to push the top group almost to a symbol table */ /* (Start counting at '1', since we've already created one bottom group */ for(u = 1; u < LIFECYCLE_MAX_COMPACT; u++) { - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -426,7 +426,7 @@ lifecycle(hid_t fapl2) if(oinfo.hdr.nchunks != 1) TEST_ERROR /* Create one more "bottom" group, which should push top group into using a symbol table */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -449,7 +449,7 @@ lifecycle(hid_t fapl2) /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -462,7 +462,7 @@ lifecycle(hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink one more object from the group, which should transform back to using links */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; @@ -472,10 +472,10 @@ lifecycle(hid_t fapl2) if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR /* Unlink last two objects from top group */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ @@ -691,7 +691,7 @@ read_old(void) /* Create a bunch of objects in the group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { - sprintf(objname, "Group %u", u); + HDsprintf(objname, "Group %u", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -709,7 +709,7 @@ read_old(void) /* Delete new objects from old group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { - sprintf(objname, "Group %u", u); + HDsprintf(objname, "Group %u", u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -802,7 +802,7 @@ no_compact(hid_t fapl2) if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Create first "bottom" group */ - sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -817,7 +817,7 @@ no_compact(hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink object from top group */ - sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ diff --git a/test/tarray.c b/test/tarray.c index eb71ad6..0024746 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -65,7 +65,7 @@ typedef struct void *test_array_alloc_custom(size_t size, void *info); void test_array_free_custom(void *mem, void *info); - + /*------------------------------------------------------------------------- * Function: test_array_atomic_1d * @@ -189,7 +189,7 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ - + /*------------------------------------------------------------------------- * Function: test_array_funcs * @@ -252,7 +252,7 @@ test_array_funcs(void) CHECK(ret, FAIL, "H5Tclose"); } /* end test_array_funcs() */ - + /*------------------------------------------------------------------------- * Function: test_array_atomic_3d * @@ -381,7 +381,7 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ - + /*------------------------------------------------------------------------- * Function: test_array_array_atomic * @@ -540,7 +540,7 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_atomic * @@ -747,7 +747,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_array * @@ -1006,7 +1006,7 @@ test_array_compound_array(void) ** allocated. ** ****************************************************************/ - + /*------------------------------------------------------------------------- * Function: test_array_alloc_custom * @@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info) return ret_value; } /* end test_array_alloc_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_free_custom * @@ -1081,7 +1081,7 @@ test_array_free_custom(void *_mem, void *info) return; } /* end test_array_free_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_atomic * @@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_array * @@ -1551,7 +1551,7 @@ test_array_vlen_array(void) } /* end test_array_vlen_array() */ - + /*------------------------------------------------------------------------- * Function: test_array_bkg * @@ -1855,7 +1855,7 @@ test_array_bkg(void) HDfree(dtsinfo); } /* end test_array_bkg() */ - + /*------------------------------------------------------------------------- * Function: test_compat * @@ -2146,11 +2146,11 @@ test_compat(void) CHECK_I(ret, "H5Fclose"); } /* end if */ else - printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile); + HDprintf("***cannot open the pre-created compound datatype test file (%s)\n",testfile); } /* end test_compat() */ - + /*------------------------------------------------------------------------- * Function: test_array * @@ -2183,7 +2183,7 @@ test_array(void) } /* end test_array() */ - + /*------------------------------------------------------------------------- * Function: cleanup_array * diff --git a/test/tattr.c b/test/tattr.c index b252dbd..06c6a9a 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -879,8 +879,8 @@ test_attr_compound_read(hid_t fapl) for(i = 0; i < ATTR4_DIM1; i++) for(j = 0; j < ATTR4_DIM2; j++) if(HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct))) { - printf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); - printf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d); + HDprintf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); + HDprintf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d); TestErrPrintf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c); } /* end if */ @@ -1017,7 +1017,7 @@ test_attr_scalar_read(hid_t fapl) /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_FLT_ABS_EQUAL(rdata, attr_data5)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__); /* Get the attribute's dataspace */ @@ -2064,7 +2064,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) /* Re-open all the attributes by name and verify the data */ for(u = 0; u < max_attr; u++) { /* Open attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Aopen(loc_id, attrname, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); @@ -2088,7 +2088,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, check_name); VERIFY(name_len, HDstrlen(attrname), "H5Aget_name"); if(HDstrcmp(check_name, attrname)) @@ -2182,7 +2182,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2201,7 +2201,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) /* Add one more attribute, to push into "dense" storage */ /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2317,7 +2317,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2340,7 +2340,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) /* Add one more attribute, to push into "dense" storage */ /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2457,7 +2457,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2503,7 +2503,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Delete attributes until the attributes revert to compact storage again */ for(u--; u >= min_dense; u--) { /* Delete attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -2517,7 +2517,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); /* Delete one more attribute, which should cause reversion to compact storage */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -2530,7 +2530,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "test_attr_dense_verify"); /* Delete another attribute, to verify deletion in compact storage */ - sprintf(attrname, "attr %02u", (u - 1)); + HDsprintf(attrname, "attr %02u", (u - 1)); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -2637,7 +2637,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); @@ -2650,7 +2650,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Rename attribute */ - sprintf(new_attrname, "new attr %02u", u); + HDsprintf(new_attrname, "new attr %02u", u); /* Rename attribute */ ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT); @@ -2704,7 +2704,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) unsigned value; /* Attribute value */ /* Open attribute */ - sprintf(attrname, "new attr %02u", u); + HDsprintf(attrname, "new attr %02u", u); attr = H5Aopen(dataset, attrname, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Aopen"); @@ -2808,7 +2808,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2947,7 +2947,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2968,7 +2968,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 1; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3000,7 +3000,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3103,7 +3103,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3126,7 +3126,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(sid2, FAIL, "H5Screate_simple"); /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3414,7 +3414,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) /* Delete a few attributes until the storage switches to compact */ for(u = min_dense-1; u <= max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); add_attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(add_attr, FAIL, "H5Acreate2"); @@ -3484,7 +3484,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(gid1, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3646,7 +3646,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3665,7 +3665,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 1; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3684,7 +3684,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 2; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); if(low == H5F_LIBVER_LATEST) { CHECK(attr, FAIL, "H5Acreate2"); @@ -3708,7 +3708,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 3; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3731,7 +3731,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 1; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3746,7 +3746,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 3; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3761,7 +3761,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 2; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3776,7 +3776,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -4187,7 +4187,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create many attributes */ for(u = 0; u < nattr; u++) { - sprintf(attrname, "a-%06u", u); + HDsprintf(attrname, "a-%06u", u); exists = H5Aexists(gid, attrname); VERIFY(exists, FALSE, "H5Aexists"); @@ -4240,7 +4240,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) for(u = 0; u < nattr; u++) { unsigned value; /* Attribute value */ - sprintf(attrname, "a-%06u", u); + HDsprintf(attrname, "a-%06u", u); exists = H5Aexists(gid, attrname); VERIFY(exists, TRUE, "H5Aexists"); @@ -4480,7 +4480,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -4570,7 +4570,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) H5A_info_t ainfo; /* Attribute information */ /* Retrieve information for attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); @@ -4680,7 +4680,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -4703,7 +4703,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) } /* end for */ /* Create another attribute, to push into dense storage */ - sprintf(attrname, "attr %02u", max_compact); + HDsprintf(attrname, "attr %02u", max_compact); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -4797,7 +4797,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) H5A_info_t ainfo; /* Attribute information */ /* Retrieve information for attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); @@ -5068,7 +5068,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5091,7 +5091,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Create another attribute, to push into dense storage */ - sprintf(attrname, "attr %02u", max_compact); + HDsprintf(attrname, "attr %02u", max_compact); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5119,7 +5119,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5139,7 +5139,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ - sprintf(attrname, "attr %02u", (min_dense - 1)); + HDsprintf(attrname, "attr %02u", (min_dense - 1)); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5155,7 +5155,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5243,7 +5243,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5263,7 +5263,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ - sprintf(attrname, "attr %02u", (min_dense - 1)); + HDsprintf(attrname, "attr %02u", (min_dense - 1)); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5279,7 +5279,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5308,11 +5308,11 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Delete all attributes */ for(u = max_compact; u > 0; u--) { - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); } /* end for */ - sprintf(attrname, "attr %02u", 0); + HDsprintf(attrname, "attr %02u", 0); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); } /* end for */ @@ -5449,7 +5449,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) /* Create attributes, until attribute storage is in dense form */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5785,7 +5785,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5822,7 +5822,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6023,7 +6023,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6095,9 +6095,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", (u + 1)); + HDsprintf(attrname, "attr %02u", (u + 1)); else - sprintf(attrname, "attr %02u", (max_compact - (u + 2))); + HDsprintf(attrname, "attr %02u", (max_compact - (u + 2))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6133,7 +6133,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6220,9 +6220,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", (u + 1)); + HDsprintf(attrname, "attr %02u", (u + 1)); else - sprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2))); + HDsprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6266,7 +6266,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, to push into dense form */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6331,9 +6331,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", ((u * 2) + 1)); + HDsprintf(attrname, "attr %02u", ((u * 2) + 1)); else - sprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2))); + HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6380,9 +6380,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", ((u * 2) + 3)); + HDsprintf(attrname, "attr %02u", ((u * 2) + 3)); else - sprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4))); + HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6472,7 +6472,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); } /* end if */ /* Verify name of link */ - sprintf(attrname, "attr %02u", (unsigned)my_info.corder); + HDsprintf(attrname, "attr %02u", (unsigned)my_info.corder); if(HDstrcmp(attr_name, attrname)) return(H5_ITER_ERROR); @@ -6981,7 +6981,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7051,7 +7051,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7327,7 +7327,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7385,7 +7385,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7490,7 +7490,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, /* Open each attribute on object by index and check that it's the correct one */ for(u = 0; u < max_attrs; u++) { /* Open the attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Aopen"); @@ -7655,7 +7655,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7722,7 +7722,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7899,7 +7899,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate_by_name"); @@ -7956,7 +7956,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate_by_name"); @@ -8175,7 +8175,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -8501,7 +8501,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -8608,7 +8608,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Create new attribute name */ - sprintf(attrname2, "new attr %02u", u); + HDsprintf(attrname2, "new attr %02u", u); /* Change second dataset's attribute's name */ ret = H5Arename_by_name(fid, DSET2_NAME, attrname, attrname2, H5P_DEFAULT); @@ -8942,7 +8942,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -9052,7 +9052,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Delete attributes from second dataset */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Delete second dataset's attribute */ ret = H5Adelete_by_name(fid, DSET2_NAME, attrname, H5P_DEFAULT); @@ -9306,7 +9306,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -9433,7 +9433,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check ref count on attributes of first dataset */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Open attribute on first dataset */ attr = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -9705,7 +9705,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Create attributes on group */ for (i=0; i<BUG2_NATTR; i++) { - sprintf(aname, "%03u", i); + HDsprintf(aname, "%03u", i); aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); @@ -9715,7 +9715,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Delete every other attribute */ for (i=1; i<BUG2_NATTR; i+=2) { - sprintf(aname, "%03u", i); + HDsprintf(aname, "%03u", i); ret = H5Adelete(gid, aname); CHECK(ret, FAIL, "H5Adelete"); } @@ -9739,7 +9739,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Open an attribute in the middle */ i = (BUG2_NATTR / 4) * 2; - sprintf(aname, "%03u", i); + HDsprintf(aname, "%03u", i); aid = H5Aopen(gid, aname, H5P_DEFAULT); CHECK(aid, FAIL, "H5Aopen"); @@ -9782,7 +9782,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Create attributes on group */ for (i=0; i<BUG2_NATTR2; i++) { - sprintf(aname, "%03u", i); + HDsprintf(aname, "%03u", i); aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); @@ -9792,7 +9792,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Delete every other attribute */ for (i=0; i<BUG2_NATTR2; i++) { - sprintf(aname, "%03u", i); + HDsprintf(aname, "%03u", i); ret = H5Adelete(gid, aname); CHECK(ret, FAIL, "H5Adelete"); } diff --git a/test/tcheck_version.c b/test/tcheck_version.c index c2b454f..bbc0f52 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -29,7 +29,7 @@ #include "h5test.h" -#define progname "tcheck_version" +#define progname "tcheck_version" /* prototypes */ void showhelp(void); @@ -37,20 +37,20 @@ void parse(int ac, char **av); void abort_intercept (int H5_ATTR_UNUSED sig); /* global variables */ -unsigned major = H5_VERS_MAJOR; -unsigned minor = H5_VERS_MINOR; -unsigned release = H5_VERS_RELEASE; +unsigned major = H5_VERS_MAJOR; +unsigned minor = H5_VERS_MINOR; +unsigned release = H5_VERS_RELEASE; void showhelp(void) { - printf("Usage: " progname " [-h] [-t<vers>]\n"); - printf("\t-h\tShow this page and version information\n"); - printf("\t-t<vers>: Test by changing (adding 1 to) the <vers> to trigger\n"); - printf("\t\t the warning. <vers> can be:\n"); - printf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR); - printf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR); - printf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); + HDprintf("Usage: " progname " [-h] [-t<vers>]\n"); + HDprintf("\t-h\tShow this page and version information\n"); + HDprintf("\t-t<vers>: Test by changing (adding 1 to) the <vers> to trigger\n"); + HDprintf("\t\t the warning. <vers> can be:\n"); + HDprintf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR); + HDprintf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR); + HDprintf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); } @@ -60,36 +60,36 @@ parse(int ac, char **av) char *pt; while (--ac > 0){ - pt = *(++av); - if (*pt != '-') { - fprintf(stderr, "Unknown option(%s). Aborted.\n", *av); - exit(EXIT_FAILURE); - }else{ - switch(*(++pt)) { - case 't': /* option -t */ - switch(*(++pt)) { - case 'M': - major++; - break; - case 'm': - minor++; - break; - case 'r': - release++; - break; - default: - fprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); - exit(EXIT_FAILURE); - } - break; - case 'h': /* help page */ - showhelp(); - exit(EXIT_SUCCESS); - default: - fprintf(stderr, "Unknown option(%s). Aborted.\n", *av); - exit(EXIT_FAILURE); - } - } + pt = *(++av); + if (*pt != '-') { + HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + }else{ + switch(*(++pt)) { + case 't': /* option -t */ + switch(*(++pt)) { + case 'M': + major++; + break; + case 'm': + minor++; + break; + case 'r': + release++; + break; + default: + HDfprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + } + break; + case 'h': /* help page */ + showhelp(); + HDexit(EXIT_SUCCESS); + default: + HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + } + } } } diff --git a/test/tconfig.c b/test/tconfig.c index fe4f400..1a81d50 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -19,7 +19,6 @@ * *************************************************************/ -#include "hdf5.h" #include "testhdf5.h" /* macros definitions */ @@ -40,22 +39,22 @@ /* Needs this extra step so that we can print the macro name. */ #define vrfy_macrosize(type, macro, macroname) \ if (sizeof(type) != macro) \ - TestErrPrintf("Error: sizeof(%s) is %d but %s is %d\n", \ - #type, sizeof(type), macroname, macro); + TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", \ + #type, sizeof(type), macroname, (int)macro); /* local routine prototypes */ void test_config_ctypes(void); void test_exit_definitions(void); - + /*------------------------------------------------------------------------- - * Function: test_configure + * Function: test_configure * - * Purpose: Main configure definitions testing routine + * Purpose: Main configure definitions testing routine * - * Return: none (error is fed back via global variable num_errs) + * Return: none (error is fed back via global variable num_errs) * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * September 25, 2001 * *------------------------------------------------------------------------- @@ -69,15 +68,15 @@ test_configure(void) test_exit_definitions(); } - + /*------------------------------------------------------------------------- - * Function: cleanup_configure + * Function: cleanup_configure * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * September 25, 2001 * * Modifications: @@ -90,20 +89,20 @@ cleanup_configure(void) /* no file to clean */ } - + /*------------------------------------------------------------------------- - * Function: test_config_ctypes + * Function: test_config_ctypes * - * Purpose: test C language data type sizes + * Purpose: test C language data type sizes * - * Return: none (error is fed back via global variable num_errs) + * Return: none (error is fed back via global variable num_errs) * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * September 25, 2001 * * Modifications: - * Albert Cheng, 2004/10/14 - * Verified both signed and unsigned int types. + * Albert Cheng, 2004/10/14 + * Verified both signed and unsigned int types. * *------------------------------------------------------------------------- */ @@ -201,15 +200,15 @@ test_config_ctypes(void) } - + /*------------------------------------------------------------------------- - * Function: test_exit_definitions + * Function: test_exit_definitions * - * Purpose: test the exit macros values + * Purpose: test the exit macros values * - * Return: none (error is fed back via global variable num_errs) + * Return: none (error is fed back via global variable num_errs) * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * October 12, 2009 * * Modifications: @@ -222,9 +221,9 @@ test_exit_definitions(void) /* Verify the EXIT_SUCCESS and EXIT_FAILURE are 0 and 1 respectively. */ /* This should be true for POSIX compliant systems. */ if (EXIT_SUCCESS != 0) \ - TestErrPrintf("Error: EXIT_SUCCESS is %d, should be %d\n", \ - EXIT_SUCCESS, 0); + TestErrPrintf("Error: EXIT_SUCCESS is %d, should be %d\n", \ + EXIT_SUCCESS, 0); if (EXIT_FAILURE != 1) \ - TestErrPrintf("Error: EXIT_FAILURE is %d, should be %d\n", \ - EXIT_FAILURE, 1); + TestErrPrintf("Error: EXIT_FAILURE is %d, should be %d\n", \ + EXIT_FAILURE, 1); } diff --git a/test/testframe.c b/test/testframe.c index 80a3e01..231bcc9 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -15,7 +15,7 @@ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> * Tuesday, January 6, 2004 * - * Purpose: Provides support functions for the testing framework. + * Purpose: Provides support functions for the testing framework. * */ @@ -29,34 +29,34 @@ #define MAXTESTDESC 64 typedef struct TestStruct { - int NumErrors; - char Description[MAXTESTDESC]; - int SkipFlag; - char Name[MAXTESTNAME]; - void (*Call)(void); - void (*Cleanup)(void); - const void *Parameters; + int NumErrors; + char Description[MAXTESTDESC]; + int SkipFlag; + char Name[MAXTESTNAME]; + void (*Call)(void); + void (*Cleanup)(void); + const void *Parameters; } TestStruct; /* * Variables used by testing framework. */ -static int num_errs = 0; /* Total number of errors during testing */ +static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ +static int num_errs = 0; /* Total number of errors during testing */ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ -static int Summary = 0; /* Show test summary. Default is no. */ -static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ -static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ -static H5E_auto_t *PrintErrorStackFunc; -static void **PrintErrorStackData; -static TestStruct Test[MAXNUMOFTESTS]; -static int Index = 0; +static int Summary = 0; /* Show test summary. Default is no. */ +static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ +static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ +static TestStruct *Test = NULL; /* Array of tests */ +static unsigned TestAlloc = 0; /* Size of the Test array */ +static unsigned Index = 0; static const void *Test_parameters = NULL; static const char *TestProgName = NULL; static void (*TestPrivateUsage)(void) = NULL; static int (*TestPrivateParser)(int ac, char *av[]) = NULL; - + /* * Setup a test function and add it to the list of tests. * It must have no parameters and returns void. @@ -75,30 +75,44 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con { /* Sanity checking */ if (Index >= MAXNUMOFTESTS) { - printf("Too many tests added, increase MAXNUMOFTESTS(%d).\n", - MAXNUMOFTESTS); - exit(EXIT_FAILURE); + HDprintf("Too many tests added, increase MAXNUMOFTESTS(%d).\n", MAXNUMOFTESTS); + HDexit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { - printf("Test description too long, increase MAXTESTDESC(%d).\n", - MAXTESTDESC); - exit(EXIT_FAILURE); + HDprintf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", TheDescr, MAXTESTDESC); + HDexit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { - printf("Test name too long, increase MAXTESTNAME(%d).\n", - MAXTESTNAME); - exit(EXIT_FAILURE); + HDprintf("Test name too long, increase MAXTESTNAME(%d).\n", + MAXTESTNAME); + HDexit(EXIT_FAILURE); + } /* end if */ + + /* Check for increasing the Test array size */ + if(Index >= TestAlloc) { + TestStruct *newTest = Test; /* New array of tests */ + unsigned newAlloc = MAX(1, TestAlloc * 2); /* New array size */ + + /* Reallocate array */ + if(NULL == (newTest = (TestStruct *)HDrealloc(Test, newAlloc * sizeof(TestStruct)))) { + HDprintf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, newAlloc); + exit(EXIT_FAILURE); + } /* end if */ + + /* Update info */ + Test = newTest; + TestAlloc = newAlloc; } /* end if */ /* Set up test function */ HDstrcpy(Test[Index].Description, TheDescr); - if (*TheName != '-'){ - HDstrcpy(Test[Index].Name, TheName); - Test[Index].SkipFlag = 0; + if(*TheName != '-') { + HDstrcpy(Test[Index].Name, TheName); + Test[Index].SkipFlag = 0; } - else { /* skip test by default */ - HDstrcpy(Test[Index].Name, TheName+1); - Test[Index].SkipFlag = 1; + else { /* skip test by default */ + HDstrcpy(Test[Index].Name, TheName+1); + Test[Index].SkipFlag = 1; } Test[Index].Call = TheCall; Test[Index].Cleanup = Cleanup; @@ -109,7 +123,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con Index++; } - + /* * Initialize testing framework * @@ -121,74 +135,73 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con * private options. Default to NULL which means none is provided. * * Modifications: - * Albert Cheng 2004/08/17 - * Added the ProgName, private_usage and private_parser arguments. + * Albert Cheng 2004/08/17 + * Added the ProgName, private_usage and private_parser arguments. */ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[])) { - /* Save error printing settings */ - H5Eget_auto2(H5E_DEFAULT, PrintErrorStackFunc, PrintErrorStackData); /* * Turn off automatic error reporting since we do it ourselves. Besides, * half the functions this test calls are private, so automatic error * reporting wouldn't do much good since it's triggered at the API layer. */ - PrintErrorStackOff(); + if (enable_error_stack == 0) + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* * Record the program name and private routines if provided. */ TestProgName = ProgName; - if (NULL != private_usage) - TestPrivateUsage = private_usage; - if (NULL != private_parser) - TestPrivateParser = private_parser; + if(NULL != private_usage) + TestPrivateUsage = private_usage; + if(NULL != private_parser) + TestPrivateParser = private_parser; } - + /* * Print test usage. - * First print the common test options, then the extra options if provided. + * First print the common test options, then the extra options if provided. * * Modification: - * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. + * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. */ void TestUsage(void) { - int i; - - print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", - TestProgName, (TestPrivateUsage ? "<extra options>" : "")); - print_func(" [-[e]x[clude] name]+ \n"); - print_func(" [-o[nly] name]+ \n"); - print_func(" [-b[egin] name] \n"); - print_func(" [-s[ummary]] \n"); - print_func(" [-c[leanoff]] \n"); - print_func(" [-h[elp]] \n"); - print_func("\n\n"); - print_func("verbose controls the amount of information displayed\n"); - print_func("exclude to exclude tests by name\n"); - print_func("only to name tests which should be run\n"); - print_func("begin start at the name of the test givin\n"); - print_func("summary prints a summary of test results at the end\n"); - print_func("cleanoff does not delete *.hdf files after execution of tests\n"); - print_func("help print out this information\n"); - if (TestPrivateUsage){ - print_func("\nExtra options\n"); - TestPrivateUsage(); - } - print_func("\n\n"); - print_func("This program currently tests the following: \n\n"); - print_func("%16s %s\n", "Name", "Description"); - print_func("%16s %s\n", "----", "-----------"); - - for (i = 0; i < Index; i++) - print_func("%16s %s\n", Test[i].Name, Test[i].Description); - - print_func("\n\n"); + unsigned i; + + print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", + TestProgName, (TestPrivateUsage ? "<extra options>" : "")); + print_func(" [-[e]x[clude] name]+ \n"); + print_func(" [-o[nly] name]+ \n"); + print_func(" [-b[egin] name] \n"); + print_func(" [-s[ummary]] \n"); + print_func(" [-c[leanoff]] \n"); + print_func(" [-h[elp]] \n"); + print_func("\n\n"); + print_func("verbose controls the amount of information displayed\n"); + print_func("exclude to exclude tests by name\n"); + print_func("only to name tests which should be run\n"); + print_func("begin start at the name of the test givin\n"); + print_func("summary prints a summary of test results at the end\n"); + print_func("cleanoff does not delete *.hdf files after execution of tests\n"); + print_func("help print out this information\n"); + if (TestPrivateUsage){ + print_func("\nExtra options\n"); + TestPrivateUsage(); + } + print_func("\n\n"); + print_func("This program currently tests the following: \n\n"); + print_func("%16s %s\n", "Name", "Description"); + print_func("%16s %s\n", "----", "-----------"); + + for (i = 0; i < Index; i++) + print_func("%16s %s\n", Test[i].Name, Test[i].Description); + + print_func("\n\n"); } - + /* * Print test info. */ @@ -202,7 +215,7 @@ void TestInfo(const char *ProgName) print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release); } - + /* * Parse command line information. * argc, argv: the usual command line argument count and strings @@ -211,87 +224,94 @@ void TestInfo(const char *ProgName) * exit EXIT_FAILURE if error is encountered. * * Modification: - * 2004/08/18 Albert Cheng. Add extra_parse feature. + * 2004/08/18 Albert Cheng. Add extra_parse feature. */ void TestParseCmdLine(int argc, char *argv[]) { int ret_code; while (argv++, --argc > 0){ - if ((HDstrcmp(*argv, "-verbose") == 0) || - (HDstrcmp(*argv, "-v") == 0)) { - if (argc > 0){ - --argc; ++argv; - ParseTestVerbosity(*argv); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-exclude") == 0) || - (HDstrcmp(*argv, "-x") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, SKIPTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-begin") == 0) || - (HDstrcmp(*argv, "-b") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, BEGINTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-only") == 0) || - (HDstrcmp(*argv, "-o") == 0))) { - if (argc > 0){ - int Loop; - --argc; ++argv; - /* Skip all tests, then activate only one. */ - for (Loop = 0; Loop < Index; Loop++) - Test[Loop].SkipFlag = 1; - SetTest(*argv, ONLYTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) + if ((HDstrcmp(*argv, "-verbose") == 0) || (HDstrcmp(*argv, "-v") == 0)) { + if (argc > 0){ + --argc; ++argv; + ParseTestVerbosity(*argv); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-exclude") == 0) || + (HDstrcmp(*argv, "-x") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, SKIPTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-begin") == 0) || + (HDstrcmp(*argv, "-b") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, BEGINTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-only") == 0) || + (HDstrcmp(*argv, "-o") == 0))) { + if(argc > 0) { + unsigned Loop; + + --argc; ++argv; + + /* Skip all tests, then activate only one. */ + for(Loop = 0; Loop < Index; Loop++) + Test[Loop].SkipFlag = 1; + SetTest(*argv, ONLYTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } + } + else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) Summary = 1; - else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { + else if (HDstrcmp(*argv, "-enable-error-stack") == 0) + enable_error_stack = 1; + else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { TestUsage(); - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); + } + else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) + SetTestNoCleanup(); + else { + /* non-standard option. Break out. */ + break; } - else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) - SetTestNoCleanup(); - else { - /* non-standard option. Break out. */ - break; - } } /* Call extra parsing function if provided. */ if (NULL != TestPrivateParser){ - ret_code=TestPrivateParser(argc+1, argv-1); - if (ret_code != 0) - exit(EXIT_FAILURE); + ret_code=TestPrivateParser(argc+1, argv-1); + if (ret_code != 0) + HDexit(EXIT_FAILURE); } } - + /* * Perform Tests. */ void PerformTests(void) { - int Loop; + unsigned Loop; for (Loop = 0; Loop < Index; Loop++) if (Test[Loop].SkipFlag) { @@ -300,10 +320,10 @@ void PerformTests(void) MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); MESSAGE(5, ("===============================================\n")); Test[Loop].NumErrors = num_errs; - Test_parameters = Test[Loop].Parameters; - ALARM_ON; + Test_parameters = Test[Loop].Parameters; + ALARM_ON; Test[Loop].Call(); - ALARM_OFF; + ALARM_OFF; Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; MESSAGE(5, ("===============================================\n")); MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); @@ -318,13 +338,13 @@ void PerformTests(void) print_func("All tests were successful. \n\n"); } - + /* * Display test summary. */ void TestSummary(void) { - int Loop; + unsigned Loop; print_func("Summary of Test Results:\n"); print_func("Name of Test Errors Description of Test\n"); @@ -340,13 +360,13 @@ void TestSummary(void) print_func("\n\n"); } - + /* * Cleanup files from testing */ void TestCleanup(void) { - int Loop; + unsigned Loop; MESSAGE(2, ("\nCleaning Up temp files...\n\n")); @@ -356,7 +376,17 @@ void TestCleanup(void) Test[Loop].Cleanup(); } - + +/* + * Shutdown the test infrastructure + */ +void TestShutdown(void) +{ + if(Test) + HDfree(Test); +} + + /* * Retrieve the verbosity level for the testing framework */ @@ -412,18 +442,18 @@ int GetTestExpress(void) /* set it here for now. Should be done in something like h5test_init(). */ if(TestExpress==-1) { - env_val = getenv("HDF5TestExpress"); - - if(env_val == NULL) - SetTestExpress(1); - else if(strcmp(env_val, "0") == 0) - SetTestExpress(0); - else if(strcmp(env_val, "1") == 0) - SetTestExpress(1); - else if(strcmp(env_val, "2") == 0) - SetTestExpress(2); - else - SetTestExpress(3); + env_val = getenv("HDF5TestExpress"); + + if(env_val == NULL) + SetTestExpress(1); + else if(strcmp(env_val, "0") == 0) + SetTestExpress(0); + else if(strcmp(env_val, "1") == 0) + SetTestExpress(1); + else if(strcmp(env_val, "2") == 0) + SetTestExpress(2); + else + SetTestExpress(3); } return(TestExpress); @@ -480,16 +510,16 @@ int SetTestNoCleanup(void) void ParseTestVerbosity(char *argv) { if (*argv == 'l') - SetTestVerbosity(VERBO_LO); + SetTestVerbosity(VERBO_LO); else if (*argv == 'm') - SetTestVerbosity(VERBO_MED); + SetTestVerbosity(VERBO_MED); else if (*argv == 'h') - SetTestVerbosity(VERBO_HI); + SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(atoi(argv)); } - + /* * Retrieve the number of testing errors for the testing framework */ @@ -498,7 +528,7 @@ int GetTestNumErrs(void) return(num_errs); } - + /* * Increment the number of testing errors */ @@ -507,7 +537,7 @@ void IncTestNumErrs(void) num_errs++; } - + /* * Retrieve the current Test Parameters pointer. */ @@ -516,7 +546,7 @@ const void *GetTestParameters(void) return(Test_parameters); } - + /* * This routine is designed to provide equivalent functionality to 'printf' * and also increment the error count for the testing framework. @@ -531,15 +561,15 @@ TestErrPrintf(const char *format, ...) num_errs++; /* Print the requested information */ - va_start(arglist, format); - ret_value = vprintf(format, arglist); - va_end(arglist); + HDva_start(arglist, format); + ret_value = HDvprintf(format, arglist); + HDva_end(arglist); /* Return the length of the string produced (like printf() does) */ return ret_value; } - + /* * Set (control) which test will be tested. * SKIPTEST: skip this test @@ -549,48 +579,49 @@ TestErrPrintf(const char *format, ...) */ void SetTest(const char *testname, int action) { - int Loop; + unsigned Loop; + switch (action){ - case SKIPTEST: - for (Loop = 0; Loop < Index; Loop++) - if (HDstrcmp(testname, Test[Loop].Name) == 0){ - Test[Loop].SkipFlag = 1; - break; - } - break; - case BEGINTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else{ - /* Found it. Set it to run. Done. */ - Test[Loop].SkipFlag = 0; - break; - } - } - break; - case ONLYTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else { - /* Found it. Set it to run. Break to skip the rest. */ - Test[Loop].SkipFlag = 0; - break; - } - } - /* skip the rest */ - while (++Loop < Index) - Test[Loop].SkipFlag = 1; - break; - default: - /* error */ - printf("*** ERROR: Unknown action (%d) for SetTest\n", action); - break; + case SKIPTEST: + for (Loop = 0; Loop < Index; Loop++) + if (HDstrcmp(testname, Test[Loop].Name) == 0){ + Test[Loop].SkipFlag = 1; + break; + } + break; + case BEGINTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) != 0) + Test[Loop].SkipFlag = 1; + else{ + /* Found it. Set it to run. Done. */ + Test[Loop].SkipFlag = 0; + break; + } + } + break; + case ONLYTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) != 0) + Test[Loop].SkipFlag = 1; + else { + /* Found it. Set it to run. Break to skip the rest. */ + Test[Loop].SkipFlag = 0; + break; + } + } + /* skip the rest */ + while (++Loop < Index) + Test[Loop].SkipFlag = 1; + break; + default: + /* error */ + HDprintf("*** ERROR: Unknown action (%d) for SetTest\n", action); + break; } } - + /* * Enable alarm on test execution, configurable by environment variable */ @@ -607,19 +638,3 @@ void TestAlarmOn(void) HDalarm((unsigned)alarm_sec); } - -/* - * Enable error stack printing when errors occur. - */ -void PrintErrorStackOn(void) -{ - H5Eset_auto2(H5E_DEFAULT, PrintErrorStackFunc, PrintErrorStackData); -} - -/* - * Disable error stack printing when errors occur. - */ -void PrintErrorStackOff(void) -{ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); -} diff --git a/test/testhdf5.c b/test/testhdf5.c index de1c23d..7b600ef 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -85,11 +85,14 @@ main(int argc, char *argv[]) if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) TestCleanup(); + /* Release test infrastructure */ + TestShutdown(); + /* Exit failure if errors encountered; else exit success. */ /* No need to print anything since PerformTests() already does. */ if (GetTestNumErrs() > 0) - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); else - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* end main() */ diff --git a/test/testhdf5.h b/test/testhdf5.h index fd9d68d..04db0d5 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -18,142 +18,152 @@ #ifndef TESTHDF5_H #define TESTHDF5_H -/* - * Include required headers. This file tests internal library functions, - * so we include the private headers here. - */ -#include "H5private.h" -#include "H5Eprivate.h" - /* Include generic testing header also */ #include "h5test.h" /* Use %ld to print the value because long should cover most cases. */ /* Used to make certain a return value _is_not_ a value */ -#define CHECK(ret, val, where) do { \ - if (VERBOSE_HI) print_func(" Call to routine: %15s at line %4d " \ - "in %s returned %ld \n", \ - where, (int)__LINE__, __FILE__, \ - (long)(ret)); \ - if ((ret) == (val)) { \ - TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define CHECK(ret, val, where) do { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d " \ + "in %s returned %ld \n", \ + where, (int)__LINE__, __FILE__, \ + (long)(ret)); \ + } \ + if ((ret) == (val)) { \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) -#define CHECK_I(ret,where) { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ - (where), (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if ((ret)<0) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ - (where), (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define CHECK_I(ret,where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ + (where), (int)__LINE__, __FILE__, (long)(ret)); \ + } \ + if ((ret)<0) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ + (where), (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ +} + +/* Check that a pointer is valid (i.e.: not NULL) */ +#define CHECK_PTR(ret,where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ + (where), (int)__LINE__, __FILE__, (ret)); \ + } \ + if (!(ret)) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ + (where), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } -#define CHECK_PTR(ret,where) { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - } \ - if (!(ret)) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ - (where), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +/* Check that a pointer is NULL */ +#define CHECK_PTR_NULL(ret,where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ + (where), (int)__LINE__, __FILE__, (ret)); \ + } \ + if (ret) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", \ + (where), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } -#define CHECK_PTR_NULL(ret,where) { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - } \ - if (ret) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", \ - (where), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +/* Check that two pointers are equal */ +#define CHECK_PTR_EQ(ret, val, where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ + (where), (int)__LINE__, __FILE__, (const void *)(ret)); \ + } \ + if (ret != val) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s: returned value of %p is not equal to %p line %4d in %s\n", \ + (where), (const void *)(ret), (const void *)(val), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } /* Used to make certain a return value _is_ a value */ -#define VERIFY(_x, _val, where) do { \ - long __x = (long)_x, __val = (long)_val; \ - if(VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ - } \ - if((__x) != (__val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ - "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define VERIFY(_x, _val, where) do { \ + long __x = (long)_x, __val = (long)_val; \ + if(VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s had value " \ + "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ + } \ + if((__x) != (__val)) { \ + TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ + "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to make certain a (non-'long' type's) return value _is_ a value */ -#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \ - _type __x = (_type)_x, __val = (_type)_val; \ - if(VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - _format " \n", (where), (int)__LINE__, __FILE__, __x); \ - } \ - if((__x) != (__val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format " at line %4d " \ - "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \ + _type __x = (_type)_x, __val = (_type)_val; \ + if(VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s had value " \ + _format " \n", (where), (int)__LINE__, __FILE__, __x); \ + } \ + if((__x) != (__val)) { \ + TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format " at line %4d " \ + "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to make certain a string return value _is_ a value */ -#define VERIFY_STR(x, val, where) do { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%s \n", (where), (int)__LINE__, __FILE__, x); \ - } \ - if (HDstrcmp(x, val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ - "in %s\n", where, val, x, (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define VERIFY_STR(x, val, where) do { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s had value " \ + "%s \n", (where), (int)__LINE__, __FILE__, x); \ + } \ + if (HDstrcmp(x, val)) { \ + TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ + "in %s\n", where, val, x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to document process through a test and to check for errors */ -#define RESULT(ret,func) do { \ - if (VERBOSE_MED) { \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if (VERBOSE_HI) \ - H5Eprint2(H5E_DEFAULT, stdout); \ - if ((ret) == FAIL) { \ - TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define RESULT(ret,func) do { \ + if (VERBOSE_MED) { \ + print_func(" Call to routine: %15s at line %4d in %s returned " \ + "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ + } \ + if (VERBOSE_HI) \ + H5Eprint2(H5E_DEFAULT, stdout); \ + if ((ret) == FAIL) { \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to document process through a test */ #if defined(H5_HAVE_PARALLEL) && defined(H5_PARALLEL_TEST) -#define MESSAGE(V,A) { \ - int mpi_rank; \ - \ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \ - if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \ - print_func A ; \ +#define MESSAGE(V,A) { \ + int mpi_rank; \ + \ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \ + if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \ + print_func A ; \ } #else /* H5_HAVE_PARALLEL */ #define MESSAGE(V,A) {if (HDGetTestVerbosity() > (V)) print_func A;} #endif /* H5_HAVE_PARALLEL */ /* Used to indicate an error that is complex to check for */ -#define ERROR(where) do { \ - if(VERBOSE_HI) \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "invalid result\n", where, (int)__LINE__, __FILE__); \ - TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \ - where, (int)__LINE__, __FILE__); \ +#define ERROR(where) do { \ + if(VERBOSE_HI) \ + print_func(" Call to routine: %15s at line %4d in %s returned " \ + "invalid result\n", where, (int)__LINE__, __FILE__); \ + TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \ + where, (int)__LINE__, __FILE__); \ } while(0) /* definitions for command strings */ diff --git a/test/testlinks_env.sh.in b/test/testlinks_env.sh.in index d8d122a..3d6b3ce 100644 --- a/test/testlinks_env.sh.in +++ b/test/testlinks_env.sh.in @@ -19,23 +19,24 @@ nerrors=0 ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## # test for external links with HDF5_EXT_PREFIX echo "Testing external link with HDF5_EXT_PREFIX" -TEST_NAME=links_env # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -ENVCMD="env HDF5_EXT_PREFIX=.:tmp" # The environment variable & value +TEST_NAME=links_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_EXT_PREFIX=.:tmp_links_env" # The environment variable & value # # Run the test +echo "$ENVCMD $RUNSERIAL $TEST_BIN" $ENVCMD $RUNSERIAL $TEST_BIN exitcode=$? if [ $exitcode -eq 0 ]; then echo "Test for HDF5_EXT_PREFIX PASSED" else - nerrors="`expr $nerrors + 1`" - echo "***Error encountered for HDF5_EXT_PREFIX test***" + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_EXT_PREFIX test***" fi exit $nerrors diff --git a/test/testmeta.c b/test/testmeta.c index b97eb68..9a40e6f 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -23,34 +23,34 @@ */ -#include "hdf5.h" +#include "h5test.h" -#define FILEN "testmeta.h5" +#define FILEN "testmeta.h5" -#define CHUNK_SIZE 512 +#define CHUNK_SIZE 512 -#define NDATAARRAYS 3 -/*#define NPOINTS 2048*/ -#define NPOINTS 20 -#define NEXTARRAYS 10 -#define NDATAOBJECTS 100000 +#define NDATAARRAYS 3 +/*#define NPOINTS 2048*/ +#define NPOINTS 20 +#define NEXTARRAYS 10 +#define NDATAOBJECTS 100000 int main(void) { - hid_t file_id, prop_id, memspace_id, type_id; - hid_t group_id; - hid_t dataset_id, dataspace_id; - herr_t status; - hsize_t dims[1]; - hsize_t maxdims[1]; - float data[NPOINTS]; - float floatval; - unsigned numdataobj = 0; - unsigned i, j; - char name[80]; - hsize_t start[1] = {0}; - hsize_t stride[1] = {1}; - hsize_t count[1] = {1}; + hid_t file_id, prop_id, memspace_id, type_id; + hid_t group_id; + hid_t dataset_id, dataspace_id; + herr_t status; + hsize_t dims[1]; + hsize_t maxdims[1]; + float data[NPOINTS]; + float floatval; + unsigned numdataobj = 0; + unsigned i, j; + char name[80]; + hsize_t start[1] = {0}; + hsize_t stride[1] = {1}; + hsize_t count[1] = {1}; /* Create a file */ file_id = H5Fcreate(FILEN, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -64,8 +64,7 @@ int main(void) H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write value to NumDataObj dataset */ - status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, &numdataobj); + status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); /* Close the identifiers */ status = H5Dclose(dataset_id); @@ -78,16 +77,14 @@ int main(void) status = H5Pset_chunk(prop_id, 1, dims); /* Create dataspace */ - dims[0]=1; - maxdims[0]=H5S_UNLIMITED; + dims[0] = 1; + maxdims[0] = H5S_UNLIMITED; dataspace_id = H5Screate_simple(1, dims, maxdims); - for(i=0; i<NEXTARRAYS; i++) - { + for(i = 0; i < NEXTARRAYS; i++) { /* Create dataset */ sprintf(name, "/ExtArray%06d", i); - dataset_id = H5Dcreate2(file_id, name, - H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT); + dataset_id = H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT); /* Close the identifier */ status = H5Dclose(dataset_id); @@ -101,47 +98,43 @@ int main(void) group_id = H5Gcreate2(file_id, "/DataArray", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Gclose(group_id); - for(j=0; j<NDATAOBJECTS; j++) - { + for(j = 0; j < NDATAOBJECTS; j++) { /* Removed print statement as it would lock system resources on Windows */ /* - * printf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS); + * HDprintf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS); * fflush(stdout); */ floatval = (float)j; /* Create group to hold data arrays for this object */ - sprintf(name, "/DataArray/%06d", j); + HDsprintf(name, "/DataArray/%06d", j); group_id = H5Gcreate2(file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(group_id < 0) { - fprintf(stderr, "Failed to create DataArray group.\n"); + HDfprintf(stderr, "Failed to create DataArray group.\n"); status = H5Fclose(file_id); return -1; } /* Loop over data arrays */ - for(i=0; i<NDATAARRAYS; i++) - { + for(i = 0; i < NDATAARRAYS; i++) { /* Create dataspace */ dims[0]=NPOINTS; maxdims[0]=NPOINTS; dataspace_id = H5Screate_simple(1 ,dims, maxdims); /* Create dataset */ - sprintf(name, "DataArray%06d", i); - dataset_id = H5Dcreate2(group_id, name, - H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + HDsprintf(name, "DataArray%06d", i); + dataset_id = H5Dcreate2(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dataset_id < 0) { - fprintf(stderr, "Failed to create DataArray dataset.\n"); + HDfprintf(stderr, "Failed to create DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } /* Write the data array data */ - status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, data); + status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if(status < 0) { - fprintf(stderr, "Failed to write DataArray dataset.\n"); + HDfprintf(stderr, "Failed to write DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } @@ -154,17 +147,16 @@ int main(void) /* Open NumDataObj dataset */ dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT); if(dataset_id < 0) { - fprintf(stderr, "Failed to open NumDataObj dataset.\n"); + HDfprintf(stderr, "Failed to open NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; } /* Write value to NumDataObj dataset */ numdataobj = j + 1; - status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, &numdataobj); + status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); if(status < 0) { - fprintf(stderr, "Failed to write NumDataObj dataset.\n"); + HDfprintf(stderr, "Failed to write NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; } @@ -176,10 +168,10 @@ int main(void) /* Extend attribute arrays */ for(i = 0; i < NEXTARRAYS; i++) { /* Open extendable dataset */ - sprintf(name, "/ExtArray%06d", i); + HDsprintf(name, "/ExtArray%06d", i); dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT); if(dataset_id < 0) { - fprintf(stderr, "Failed to open ExtArray dataset.\n"); + HDfprintf(stderr, "Failed to open ExtArray dataset.\n"); status = H5Fclose(file_id); return -1; } /* end if */ @@ -188,7 +180,7 @@ int main(void) dims[0] = (hsize_t)j + 1; status = H5Dset_extent(dataset_id, dims); if(status < 0) { - fprintf(stderr, "Failed to extend DataArray dataset.\n"); + HDfprintf(stderr, "Failed to extend DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } /* end if */ @@ -200,16 +192,12 @@ int main(void) type_id = H5Dget_type(dataset_id); start[0] = 0; - status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, - start, stride, count, NULL); + status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL); start[0] = (hssize_t)j; - status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, - start, stride, count, NULL); - status = H5Dwrite(dataset_id, type_id, memspace_id, - dataspace_id, H5P_DEFAULT, &floatval); - if(status < 0) - { - fprintf(stderr, "Failed to write DataArray dataset.\n"); + status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL); + status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval); + if(status < 0) { + HDfprintf(stderr, "Failed to write DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } @@ -226,7 +214,7 @@ int main(void) /* Close the file */ status = H5Fclose(file_id); - printf("\n"); + HDprintf("\n"); return 0; } diff --git a/test/tfile.c b/test/tfile.c index db6b787..532ec9f 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -13,13 +13,12 @@ /*********************************************************** * -* Test program: tfile +* Test program: tfile * * Test the low-level file I/O features. * *************************************************************/ -#include "hdf5.h" #include "testhdf5.h" #include "H5srcdir.h" @@ -32,7 +31,7 @@ */ #define H5F_PACKAGE #define H5F_TESTING -#include "H5Fpkg.h" /* File access */ +#include "H5Fpkg.h" /* File access */ #define BAD_USERBLOCK_SIZE1 (hsize_t)1 #define BAD_USERBLOCK_SIZE2 (hsize_t)2 @@ -43,47 +42,47 @@ #define BAD_USERBLOCK_SIZE7 (hsize_t)6144 #define F1_USERBLOCK_SIZE (hsize_t)0 -#define F1_OFFSET_SIZE sizeof(haddr_t) -#define F1_LENGTH_SIZE sizeof(hsize_t) -#define F1_SYM_LEAF_K 4 -#define F1_SYM_INTERN_K 16 -#define FILE1 "tfile1.h5" -#define SFILE1 "sys_file1" +#define F1_OFFSET_SIZE sizeof(haddr_t) +#define F1_LENGTH_SIZE sizeof(hsize_t) +#define F1_SYM_LEAF_K 4 +#define F1_SYM_INTERN_K 16 +#define FILE1 "tfile1.h5" +#define SFILE1 "sys_file1" #define REOPEN_FILE "tfile_reopen.h5" #define REOPEN_DSET "dset" #define F2_USERBLOCK_SIZE (hsize_t)512 -#define F2_OFFSET_SIZE 8 -#define F2_LENGTH_SIZE 8 -#define F2_SYM_LEAF_K 8 -#define F2_SYM_INTERN_K 32 +#define F2_OFFSET_SIZE 8 +#define F2_LENGTH_SIZE 8 +#define F2_SYM_LEAF_K 8 +#define F2_SYM_INTERN_K 32 #define F2_RANK 2 #define F2_DIM0 4 #define F2_DIM1 6 #define F2_DSET "dset" -#define FILE2 "tfile2.h5" +#define FILE2 "tfile2.h5" #define F3_USERBLOCK_SIZE (hsize_t)0 -#define F3_OFFSET_SIZE F2_OFFSET_SIZE -#define F3_LENGTH_SIZE F2_LENGTH_SIZE -#define F3_SYM_LEAF_K F2_SYM_LEAF_K -#define F3_SYM_INTERN_K F2_SYM_INTERN_K -#define FILE3 "tfile3.h5" +#define F3_OFFSET_SIZE F2_OFFSET_SIZE +#define F3_LENGTH_SIZE F2_LENGTH_SIZE +#define F3_SYM_LEAF_K F2_SYM_LEAF_K +#define F3_SYM_INTERN_K F2_SYM_INTERN_K +#define FILE3 "tfile3.h5" #define GRP_NAME "/group" #define DSET_NAME "dataset" #define ATTR_NAME "attr" #define TYPE_NAME "type" -#define DSET_VL "vlinteger" -#define FILE4 "tfile4.h5" +#define DSET_VL "vlinteger" +#define FILE4 "tfile4.h5" #define OBJ_ID_COUNT_0 0 #define OBJ_ID_COUNT_1 1 #define OBJ_ID_COUNT_2 2 #define OBJ_ID_COUNT_3 3 #define OBJ_ID_COUNT_4 4 -#define OBJ_ID_COUNT_6 6 +#define OBJ_ID_COUNT_6 6 #define OBJ_ID_COUNT_8 8 #define GROUP1 "Group1" @@ -91,8 +90,8 @@ #define DSET2 "/Group1/Dataset2" #define TESTA_GROUPNAME "group" -#define TESTA_DSETNAME "dataset" -#define TESTA_ATTRNAME "attribute" +#define TESTA_DSETNAME "dataset" +#define TESTA_ATTRNAME "attribute" #define TESTA_DTYPENAME "compound" #define TESTA_NAME_BUF_SIZE 64 #define TESTA_RANK 2 @@ -102,12 +101,12 @@ #define USERBLOCK_SIZE ((hsize_t) 512) /* Declaration for test_libver_macros2() */ -#define FILE5 "tfile5.h5" /* Test file */ +#define FILE5 "tfile5.h5" /* Test file */ /* Declaration for test_get_obj_ids() */ -#define FILE6 "tfile6.h5" /* Test file */ -#define NGROUPS 2 -#define NDSETS 4 +#define FILE6 "tfile6.h5" /* Test file */ +#define NGROUPS 2 +#define NDSETS 4 static void create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *); @@ -124,14 +123,14 @@ check_file_id(hid_t, hid_t); static void test_file_create(void) { - hid_t fid1, fid2, fid3; /* HDF5 File IDs */ - hid_t tmpl1, tmpl2; /*file creation templates */ - hsize_t ublock; /*sizeof userblock */ - size_t parm; /*file-creation parameters */ - size_t parm2; /*file-creation parameters */ - unsigned iparm; - unsigned iparm2; - herr_t ret; /*generic return value */ + hid_t fid1, fid2, fid3; /* HDF5 File IDs */ + hid_t tmpl1, tmpl2; /*file creation templates */ + hsize_t ublock; /*sizeof userblock */ + size_t parm; /*file-creation parameters */ + size_t parm2; /*file-creation parameters */ + unsigned iparm; + unsigned iparm2; + herr_t ret; /*generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File Creation I/O\n")); @@ -383,7 +382,7 @@ test_file_create(void) /* Close third file */ ret = H5Fclose(fid3); CHECK(ret, FAIL, "H5Fclose"); -} /* test_file_create() */ +} /* test_file_create() */ /**************************************************************** ** @@ -393,17 +392,17 @@ test_file_create(void) static void test_file_open(void) { - hid_t fid1, fid2; /*HDF5 File IDs */ + hid_t fid1, fid2; /*HDF5 File IDs */ hid_t did; /*dataset ID */ hid_t fapl_id; /*file access property list ID */ - hid_t tmpl1; /*file creation templates */ - hsize_t ublock; /*sizeof user block */ - size_t parm; /*file-creation parameters */ - size_t parm2; /*file-creation parameters */ - unsigned iparm; - unsigned iparm2; - unsigned intent; - herr_t ret; /*generic return value */ + hid_t tmpl1; /*file creation templates */ + hsize_t ublock; /*sizeof user block */ + size_t parm; /*file-creation parameters */ + size_t parm2; /*file-creation parameters */ + unsigned iparm; + unsigned iparm2; + unsigned intent; + herr_t ret; /*generic return value */ /* * Test single file open @@ -567,7 +566,7 @@ test_file_close(void) { hid_t fid1, fid2; hid_t fapl_id, access_id; - hid_t dataset_id, group_id1, group_id2, group_id3; + hid_t dataset_id, group_id1, group_id2, group_id3; H5F_close_degree_t fc_degree; herr_t ret; @@ -757,7 +756,7 @@ test_file_close(void) /* Create more new files and test object count and ID list functions */ test_obj_count_and_id(fid1, fid2, dataset_id, group_id1, - group_id2, group_id3); + group_id2, group_id3); /* Close first open */ ret = H5Fclose(fid1); @@ -813,22 +812,22 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pget_fclose_degree"); switch(fc_degree) { - case H5F_CLOSE_STRONG: - /* Close first open */ - ret = H5Fclose(fid1); - CHECK(ret, FAIL, "H5Fclose"); - /* Close second open */ - ret = H5Fclose(fid2); - CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_SEMI: + case H5F_CLOSE_STRONG: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); - ret = H5Dclose(dataset_id); + /* Close second open */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); + break; + case H5F_CLOSE_SEMI: + /* Close first open */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Dclose(dataset_id); CHECK(ret, FAIL, "H5Dclose"); ret = H5Gclose(group_id1); - CHECK(ret, FAIL, "H5Gclose"); + CHECK(ret, FAIL, "H5Gclose"); ret = H5Gclose(group_id2); CHECK(ret, FAIL, "H5Gclose"); ret = H5Gclose(group_id3); @@ -836,8 +835,8 @@ test_file_close(void) /* Close second open */ ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_WEAK: + break; + case H5F_CLOSE_WEAK: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -852,7 +851,8 @@ test_file_close(void) CHECK(ret, FAIL, "H5Gclose"); ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); - break; + break; + case H5F_CLOSE_DEFAULT: default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); break; @@ -873,10 +873,10 @@ test_file_close(void) ****************************************************************/ static void create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, - hid_t *ret_gid2, hid_t *ret_gid3) + hid_t *ret_gid2, hid_t *ret_gid3) { - ssize_t oid_count; - herr_t ret; + ssize_t oid_count; + herr_t ret; /* Check reference counts of file IDs and opened object IDs. * The verification is hard-coded. If in any case, this testing @@ -978,7 +978,7 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, /**************************************************************** ** ** test_get_obj_ids(): Test the bug and the fix for Jira 8528. -** H5Fget_obj_ids overfilled the list of +** H5Fget_obj_ids overfilled the list of ** object IDs by one. This is an enhancement ** for test_obj_count_and_id(). ** @@ -1005,14 +1005,14 @@ test_get_obj_ids(void) /* creates NGROUPS groups under the root group */ for(m = 0; m < NGROUPS; m++) { - sprintf(gname, "group%d", m); + HDsprintf(gname, "group%d", m); gid[m] = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid[m], FAIL, "H5Gcreate2"); } /* create NDSETS datasets under the root group */ for(n = 0; n < NDSETS; n++) { - sprintf(dname, "dataset%d", n); + HDsprintf(dname, "dataset%d", n); dset[n] = H5Dcreate2(fid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dset[n], FAIL, "H5Dcreate2"); } @@ -1025,14 +1025,14 @@ test_get_obj_ids(void) oid_list = (hid_t *)HDcalloc((size_t)oid_list_size, sizeof(hid_t)); CHECK(oid_list, NULL, "HDcalloc"); - /* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here. - * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in + /* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here. + * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in * (oid_list_size) */ ret_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, (size_t)oid_list_size, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, oid_list_size, "H5Fget_obj_count"); - /* Close all object IDs on the list except the file ID. The first ID is supposed to be file ID according + /* Close all object IDs on the list except the file ID. The first ID is supposed to be file ID according * to the library design */ for(i = 0; i< ret_count; i++) { if(fid != oid_list[i]) { @@ -1047,7 +1047,7 @@ test_get_obj_ids(void) CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, NGROUPS + 2, "H5Fget_obj_count"); - /* Get the IDs of the left opend objects */ + /* Get the IDs of the left opend objects */ ret_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, (size_t)oid_list_size, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, oid_list_size, "H5Fget_obj_count"); @@ -1059,20 +1059,20 @@ test_get_obj_ids(void) CHECK(ret, FAIL, "H5Oclose"); } } - + H5Sclose(filespace); H5Fclose(fid); HDfree(oid_list); - /* Reopen the file to check whether H5Fget_obj_count and H5Fget_obj_ids still works - * when the file is closed first */ + /* Reopen the file to check whether H5Fget_obj_count and H5Fget_obj_ids still works + * when the file is closed first */ fid = H5Fopen(FILE6, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Open NDSETS datasets under the root group */ for(n = 0; n < NDSETS; n++) { - sprintf(dname, "dataset%d", n); + HDsprintf(dname, "dataset%d", n); dset[n] = H5Dopen2(fid, dname, H5P_DEFAULT); CHECK(dset[n], FAIL, "H5Dcreate2"); } @@ -1109,7 +1109,7 @@ static void test_get_file_id(void) { hid_t fid, fid2, fid3; - hid_t datatype_id, dataset_id, dataspace_id, group_id, attr_id; + hid_t datatype_id, dataset_id, dataspace_id, group_id, attr_id; hid_t plist; hsize_t dims[F2_RANK]; unsigned intent; @@ -1267,7 +1267,7 @@ check_file_id(hid_t fid, hid_t object_id) ****************************************************************/ static void test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, - hid_t gid2, hid_t gid3) + hid_t gid2, hid_t gid3) { hid_t fid3, fid4; ssize_t oid_count, ret_count; @@ -1308,7 +1308,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_8, "H5Fget_obj_count"); - + if(oid_count > 0) { hid_t *oid_list; @@ -1316,8 +1316,8 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, if(oid_list != NULL) { int i; - ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); - CHECK(ret_count, FAIL, "H5Fget_obj_ids"); + ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); + CHECK(ret_count, FAIL, "H5Fget_obj_ids"); for(i = 0; i < oid_count; i++) { H5I_type_t id_type; @@ -1418,11 +1418,11 @@ test_file_perm(void) /**************************************************************** ** ** test_file_perm2(): low-level file test routine. -** This test verifies that no object can be created in a +** This test verifies that no object can be created in a ** file that is opened for read-only. ** *****************************************************************/ -static void +static void test_file_perm2(void) { hid_t file; /* File opened with read-write permission */ @@ -1432,7 +1432,7 @@ test_file_perm2(void) hid_t dset; /* Dataset ID */ hid_t type; /* Datatype ID */ hid_t attr; /* Attribute ID */ - herr_t ret; + herr_t ret; /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File Permissions again\n")); @@ -1495,9 +1495,9 @@ test_file_perm2(void) ** situations. ** ** Modifications: -** Vailin Choi; July 2012 -** Remove datasets in reverse order so that all file spaces are shrunk. -** (A change due to H5FD_FLMAP_DICHOTOMY.) +** Vailin Choi; July 2012 +** Remove datasets in reverse order so that all file spaces are shrunk. +** (A change due to H5FD_FLMAP_DICHOTOMY.) ** *****************************************************************/ static void @@ -1510,7 +1510,7 @@ test_file_freespace(void) hid_t dspace; /* Dataspace ID */ hid_t dset; /* Dataset ID */ hid_t dcpl; /* Dataset creation property list */ - int k; /* Local index variable */ + int k; /* Local index variable */ unsigned u; /* Local index variable */ char name[32]; /* Dataset name */ herr_t ret; @@ -1659,7 +1659,7 @@ test_file_ishdf5(void) CHECK(fd, FAIL, "HDopen"); /* Initialize information to write */ - for(u=0; u<1024; u++) + for(u = 0; u < 1024; u++) buf[u]=(unsigned char)u; /* Write some information */ @@ -2130,15 +2130,15 @@ test_file_double_dataset_open(void) ** ** test_open2x_vlen(): ** This is the helper routine used by test_open2x_vlen(). -** This is modified based on the customer's test program. -** (HDFFV-9469): -** --read from the specified dataset +** This is modified based on the customer's test program. +** (HDFFV-9469): +** --read from the specified dataset ** *****************************************************************/ -static void +static void CheckRead(hid_t did) { - hid_t mtid = -1; + hid_t mtid = -1; hid_t sid = -1; hvl_t *read = NULL; herr_t ret; @@ -2176,11 +2176,11 @@ CheckRead(hid_t did) ** ** test_open2x_vlen(): ** This test is modified based on the customer's test program. -** (HDFFV-9469): -** --open a file and a dataset with variable length type twice -** --close both opens of the file -** --close the dataset from first open -** --verify that reading from the dataset (second open) is successful +** (HDFFV-9469): +** --open a file and a dataset with variable length type twice +** --close both opens of the file +** --close the dataset from first open +** --verify that reading from the dataset (second open) is successful ** *****************************************************************/ static void @@ -2194,7 +2194,7 @@ test_open2x_vlen(void) hsize_t dims[1] = { 1 }; int64_t integers[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; hvl_t written; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing open file and variable length dataset twice and closing 1 dataset\n")); @@ -3039,15 +3039,15 @@ test_libver_bounds(void) /**************************************************************** ** ** test_libver_macros(): -** Verify that H5_VERSION_GE and H5_VERSION_LE work correactly. +** Verify that H5_VERSION_GE and H5_VERSION_LE work correactly. ** ****************************************************************/ static void test_libver_macros(void) { - unsigned major = H5_VERS_MAJOR; - unsigned minor = H5_VERS_MINOR; - unsigned release = H5_VERS_RELEASE; + unsigned major = H5_VERS_MAJOR; + unsigned minor = H5_VERS_MINOR; + unsigned release = H5_VERS_RELEASE; /* Output message about test being performed */ MESSAGE(5, ("Testing macros for library version comparison\n")); @@ -3086,7 +3086,7 @@ test_libver_macros(void) /**************************************************************** ** ** test_libver_macros2(): -** Verify that H5_VERSION_GE works correactly and show how +** Verify that H5_VERSION_GE works correactly and show how ** to use it. ** ****************************************************************/ @@ -3119,9 +3119,9 @@ test_libver_macros2(void) ret = H5Gclose(grp); CHECK(ret, FAIL, "H5Gclose"); - /* + /* * Delete the group using different function based on the library version. - * And verify the action. + * And verify the action. */ #if H5_VERSION_GE(1,8,0) ret = H5Ldelete(file, "Group", H5P_DEFAULT); @@ -3175,7 +3175,7 @@ test_file(void) test_file_double_group_open(); /* Test opening same group from two files works properly */ test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ - test_open2x_vlen(); /* Test opening file and variable length dataset twice and closing 1 dataset */ + test_open2x_vlen(); /* Test opening file and variable length dataset twice and closing 1 dataset */ test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ @@ -3185,15 +3185,15 @@ test_file(void) test_libver_macros2(); /* Show the use of the macros for library version comparison */ } /* test_file() */ - + /*------------------------------------------------------------------------- - * Function: cleanup_file + * Function: cleanup_file * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * July 2, 1998 * * Modifications: diff --git a/test/tgenprop.c b/test/tgenprop.c index d6f4ac7..175e8b9 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -680,7 +680,7 @@ test_genprop_basic_list(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP2_DEF_VALUE, prop2_value, (int)__LINE__, __FILE__); @@ -772,7 +772,7 @@ test_genprop_basic_list_prop(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP2_DEF_VALUE, prop2_value, (int)__LINE__, __FILE__); @@ -785,7 +785,7 @@ test_genprop_basic_list_prop(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Delete permanent property */ @@ -822,7 +822,7 @@ test_genprop_basic_list_prop(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Close list */ @@ -1236,7 +1236,7 @@ test_genprop_list_callback(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP2_DEF_VALUE, prop2_value, (int)__LINE__, __FILE__); /* Check values of temporary properties (set with regular values) */ @@ -1251,7 +1251,7 @@ test_genprop_list_callback(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Verify get callback information for properties tracked */ diff --git a/test/th5s.c b/test/th5s.c index c56f0cc..cfb7b11 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -191,7 +191,7 @@ test_h5s_basic(void) CHECK_I(ret, "H5Fclose"); } else - printf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", + HDprintf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", testfile); } @@ -661,7 +661,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]); } } @@ -683,7 +683,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata_short[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata_short[i][j]); } } @@ -750,7 +750,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]); } } @@ -776,7 +776,7 @@ test_h5s_zero_dim(void) for(k=0; k<SPACE1_DIM3; k++) { if(rdata_real[i][j][k] != wdata_real[i][j][k]) { H5_FAILED(); - printf("element [%d][%d][%d] is %d but should have been %d\n", + HDprintf("element [%d][%d][%d] is %d but should have been %d\n", i, j, k, rdata_real[i][j][k], wdata_real[i][j][k]); } } @@ -800,7 +800,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]); } } @@ -847,7 +847,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]); } } @@ -891,7 +891,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]); } } @@ -923,7 +923,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]); } } @@ -945,7 +945,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata_short[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata_short[i][j]); } } @@ -1007,7 +1007,7 @@ test_h5s_zero_dim(void) for(k=0; k<SPACE1_DIM3; k++) { if(rdata_real[i][j][k] != wdata_real[i][j][k]) { H5_FAILED(); - printf("element [%d][%d][%d] is %d but should have been %d\n", + HDprintf("element [%d][%d][%d] is %d but should have been %d\n", i, j, k, rdata_real[i][j][k], wdata_real[i][j][k]); } } @@ -1094,7 +1094,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]); } } @@ -1132,7 +1132,7 @@ test_h5s_zero_dim(void) for(j=0; j<SPACE1_DIM3; j++) { if(rdata_short[i][j] != 7) { H5_FAILED(); - printf("element [%d][%d] is %d but should have been 7\n", + HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata_short[i][j]); } } @@ -1678,9 +1678,9 @@ test_h5s_compound_scalar_read(void) ret = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct))) { - printf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c1); - printf("scalar data different: space4_data.u=%u, read_data4.u=%u\n",space4_data.u,rdata.u); - printf("scalar data different: space4_data.f=%f, read_data4.f=%f\n",space4_data.f,rdata.f); + HDprintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c1); + HDprintf("scalar data different: space4_data.u=%u, read_data4.u=%u\n",space4_data.u,rdata.u); + HDprintf("scalar data different: space4_data.f=%f, read_data4.f=%f\n",space4_data.f,rdata.f); TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c2); } /* end if */ diff --git a/test/titerate.c b/test/titerate.c index 5c8960c..3170342 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -13,15 +13,14 @@ /*********************************************************** * -* Test program: titerate +* Test program: titerate * * Test the Group & Attribute functionality * *************************************************************/ #include "testhdf5.h" - -#include "hdf5.h" +#include "H5srcdir.h" #define DATAFILE "titerate.h5" @@ -38,8 +37,8 @@ #define NAMELEN 80 /* 1-D dataset with fixed dimensions */ -#define SPACE1_RANK 1 -#define SPACE1_DIM1 4 +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 typedef enum { RET_ZERO, @@ -106,7 +105,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ return(count2 > 10 ? 1 : 0); default: - printf("invalid iteration command"); + HDprintf("invalid iteration command"); return(-1); } /* end switch */ } /* end liter_cb() */ @@ -131,7 +130,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) char dataset_name[NAMELEN]; /* dataset name */ iter_info info; /* Custom iteration information */ H5G_info_t ginfo; /* Buffer for querying object's info */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Group Iteration Functionality\n")); @@ -153,13 +152,13 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(filespace, FAIL, "H5Screate"); for(i=0; i< NDATASETS; i++) { - sprintf(name,"Dataset %d",i); + HDsprintf(name,"Dataset %d",i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Keep a copy of the dataset names around for later */ lnames[i] = HDstrdup(name); - CHECK(lnames[i], NULL, "strdup"); + CHECK_PTR(lnames[i], "strdup"); ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -170,13 +169,13 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(ret, FAIL, "H5Gcreate2"); lnames[NDATASETS] = HDstrdup("grp"); - CHECK(lnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(lnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); lnames[NDATASETS + 1] = HDstrdup("dtype"); - CHECK(lnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(lnames[NDATASETS], "strdup"); /* Close everything up */ ret = H5Tclose(datatype); @@ -281,7 +280,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test all objects in group, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Literate"); @@ -306,7 +306,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test all objects in group, when callback changes return value */ /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Literate"); @@ -367,7 +368,7 @@ aiter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5A_info_t H5_ATTR_ return(count2 > 10 ? 1 : 0); default: - printf("invalid iteration command"); + HDprintf("invalid iteration command"); return(-1); } /* end switch */ } /* end aiter_cb() */ @@ -388,7 +389,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) char name[NAMELEN]; /* temporary name buffer */ char *anames[NATTR]; /* Names of the attributes created */ iter_info info; /* Custom iteration information */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Iteration Functionality\n")); @@ -404,13 +405,13 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) CHECK(dataset, FAIL, "H5Dcreate2"); for(i = 0; i < NATTR; i++) { - sprintf(name, "Attribute %02d", i); + HDsprintf(name, "Attribute %02d", i); attribute = H5Acreate2(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT); CHECK(attribute, FAIL, "H5Acreate2"); /* Keep a copy of the attribute names around for later */ anames[i] = HDstrdup(name); - CHECK(anames[i], NULL, "strdup"); + CHECK_PTR(anames[i], "strdup"); ret = H5Aclose(attribute); CHECK(ret, FAIL, "H5Aclose"); @@ -460,7 +461,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Test all attributes on dataset, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Aiterate2"); @@ -486,7 +488,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Test all attributes on dataset, when callback changes return value */ /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Aiterate2"); @@ -541,7 +544,7 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_ { const iter_info *test_info = (const iter_info *)opdata; H5O_info_t oinfo; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ if(HDstrcmp(name, test_info->name)) { TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name); @@ -571,16 +574,16 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_ static void test_iter_group_large(hid_t fapl) { - hid_t file; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t group; /* Group ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t dims[] = {SPACE1_DIM1}; - herr_t ret; /* Generic return value */ - char gname[20]; /* Temporary group name */ - iter_info names[ITER_NGROUPS+2]; /* Names of objects in the root group */ - iter_info *curr_name; /* Pointer to the current name in the root group */ + hid_t file; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t dims[] = {SPACE1_DIM1}; + herr_t ret; /* Generic return value */ + char gname[20]; /* Temporary group name */ + iter_info *names; /* Names of objects in the root group */ + iter_info *curr_name; /* Pointer to the current name in the root group */ int i; /* Compound datatype */ @@ -590,7 +593,9 @@ test_iter_group_large(hid_t fapl) float c; } s1_t; - HDmemset(names, 0, sizeof names); + /* Allocate & initialize array */ + names = (iter_info *)HDcalloc(sizeof(iter_info), (ITER_NGROUPS + 2)); + CHECK_PTR(names, "HDcalloc"); /* Output message about test being performed */ MESSAGE(5, ("Testing Large Group Iteration Functionality\n")); @@ -605,7 +610,7 @@ test_iter_group_large(hid_t fapl) /* Create a bunch of groups */ for(i = 0; i < ITER_NGROUPS; i++) { - sprintf(gname, "Group_%d", i); + HDsprintf(gname, "Group_%d", i); /* Add the name to the list of objects in the root group */ HDstrcpy(names[i].name, gname); @@ -670,7 +675,7 @@ test_iter_group_large(hid_t fapl) ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); CHECK(ret, FAIL, "H5Literate"); for(i = 1; i < 100; i++) { - hsize_t idx = i; + hsize_t idx = (hsize_t)i; curr_name = &names[i]; ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); @@ -680,6 +685,9 @@ test_iter_group_large(hid_t fapl) /* Close file */ ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); + + /* Release memory */ + HDfree(names); } /* test_iterate_group_large() */ /**************************************************************** @@ -702,7 +710,7 @@ static void test_grp_memb_funcs(hid_t fapl) char dataset_name[NAMELEN]; /* dataset name */ ssize_t name_len; /* Length of object's name */ H5G_info_t ginfo; /* Buffer for querying object's info */ - herr_t ret; /* Generic return value */ + herr_t ret = SUCCEED; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Group Member Information Functionality\n")); @@ -718,13 +726,13 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(filespace, FAIL, "H5Screate"); for(i = 0; i < NDATASETS; i++) { - sprintf(name, "Dataset %d", i); + HDsprintf(name, "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Keep a copy of the dataset names around for later */ dnames[i] = HDstrdup(name); - CHECK(dnames[i], NULL, "strdup"); + CHECK_PTR(dnames[i], "strdup"); ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -735,13 +743,13 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(ret, FAIL, "H5Gcreate2"); dnames[NDATASETS] = HDstrdup("grp"); - CHECK(dnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(dnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); dnames[NDATASETS + 1] = HDstrdup("dtype"); - CHECK(dnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(dnames[NDATASETS], "strdup"); /* Close everything up */ ret = H5Tclose(datatype); @@ -788,7 +796,7 @@ static void test_grp_memb_funcs(hid_t fapl) /* Keep a copy of the dataset names around for later */ obj_names[i] = HDstrdup(dataset_name); - CHECK(obj_names[i], NULL, "strdup"); + CHECK_PTR(obj_names[i], "strdup"); ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); @@ -842,7 +850,7 @@ static void test_links(hid_t fapl) hid_t gid, gid1; H5G_info_t ginfo; /* Buffer for querying object's info */ hsize_t i; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality\n")); @@ -951,15 +959,15 @@ test_iterate(void) CHECK(ret, FAIL, "H5Pclose"); } /* test_iterate() */ - + /*------------------------------------------------------------------------- - * Function: cleanup_iterate + * Function: cleanup_iterate * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * April 5, 2000 * * Modifications: @@ -969,6 +977,6 @@ test_iterate(void) void cleanup_iterate(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tmisc.c b/test/tmisc.c index aae1a99..26c1eb0 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -26,7 +26,6 @@ /* Define this macro to indicate that the testing APIs should be available */ #define H5D_TESTING -#include "hdf5.h" #include "testhdf5.h" #include "H5srcdir.h" #include "H5Dpkg.h" /* Datasets */ @@ -178,17 +177,12 @@ typedef struct #define MISC13_GROUP1_NAME "Group1" #define MISC13_GROUP2_NAME "Group2" #define MISC13_DTYPE_NAME "Datatype" -#define MISC13_RANK 2 -#define MISC13_DIM1 20 -#define MISC13_DIM2 30 +#define MISC13_RANK 1 +#define MISC13_DIM1 600 #define MISC13_CHUNK_DIM1 10 -#define MISC13_CHUNK_DIM2 15 #define MISC13_USERBLOCK_SIZE 512 #define MISC13_COPY_BUF_SIZE 4096 -unsigned m13_data[MISC13_DIM1][MISC13_DIM2]; /* Data to write to dataset */ -unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset */ - /* Definitions for misc. test #14 */ #define MISC14_FILE "tmisc14.h5" #define MISC14_DSET1_NAME "Dataset1" @@ -465,10 +459,11 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att1, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); ret = H5Aclose(att1); - CHECK(ret, FAIL, "HAclose"); + CHECK(ret, FAIL, "H5Aclose"); ret = H5Gclose(root1); CHECK(ret, FAIL, "H5Gclose"); @@ -490,10 +485,11 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att2, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); ret = H5Aclose(att2); - CHECK(ret, FAIL, "HAclose"); + CHECK(ret, FAIL, "H5Aclose"); ret = H5Gclose(root2); CHECK(ret, FAIL, "H5Gclose"); @@ -517,6 +513,7 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name { hid_t file, root, att; hid_t type; + hid_t space; herr_t ret; misc2_struct data_check; @@ -531,10 +528,17 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name att = H5Aopen(root, att_name, H5P_DEFAULT); CHECK(att, FAIL, "H5Aopen"); + space = H5Aget_space(att); + CHECK(space, FAIL, "H5Aget_space"); + ret = H5Aread(att, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); + + ret = H5Sclose(space); + CHECK(ret, FAIL, "H5Sclose"); ret = H5Aclose(att); CHECK(ret, FAIL, "H5Aclose"); @@ -716,8 +720,8 @@ create_struct3(void) misc5_struct3_hndl *str3hndl; /* New 'struct3' created */ herr_t ret; /* For error checking */ - str3hndl = HDmalloc(sizeof(misc5_struct3_hndl)); - CHECK(str3hndl,NULL,"malloc"); + str3hndl = (misc5_struct3_hndl *)HDmalloc(sizeof(misc5_struct3_hndl)); + CHECK_PTR(str3hndl, "malloc"); str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3)); CHECK(str3hndl->st3h_base, FAIL, "H5Tcreate"); @@ -725,10 +729,10 @@ create_struct3(void) ret = H5Tinsert(str3hndl->st3h_base, "st3_el1", HOFFSET( misc5_struct3, st3_el1), H5T_NATIVE_INT); CHECK(ret,FAIL,"H5Tinsert"); - str3hndl->st3h_id=H5Tvlen_create(str3hndl->st3h_base); + str3hndl->st3h_id = H5Tvlen_create(str3hndl->st3h_base); CHECK(str3hndl->st3h_id,FAIL,"H5Tvlen_create"); - return(str3hndl); + return str3hndl; } static void @@ -736,10 +740,10 @@ delete_struct3(misc5_struct3_hndl *str3hndl) { herr_t ret; /* For error checking */ - ret=H5Tclose(str3hndl->st3h_id); + ret = H5Tclose(str3hndl->st3h_id); CHECK(ret,FAIL,"H5Tclose"); - ret=H5Tclose(str3hndl->st3h_base); + ret = H5Tclose(str3hndl->st3h_base); CHECK(ret,FAIL,"H5Tclose"); HDfree(str3hndl); @@ -759,8 +763,8 @@ create_struct2(void) misc5_struct2_hndl *str2hndl; /* New 'struct2' created */ herr_t ret; /* For error checking */ - str2hndl = HDmalloc(sizeof(misc5_struct2_hndl)); - CHECK(str2hndl, NULL, "malloc"); + str2hndl = (misc5_struct2_hndl *)HDmalloc(sizeof(misc5_struct2_hndl)); + CHECK_PTR(str2hndl, "HDmalloc"); str2hndl->st2h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct2)); CHECK(str2hndl->st2h_base, FAIL, "H5Tcreate"); @@ -768,16 +772,16 @@ create_struct2(void) ret = H5Tinsert(str2hndl->st2h_base, "st2_el1", HOFFSET(misc5_struct2, st2_el1), H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); - str2hndl->st2h_st3hndl=create_struct3(); - CHECK(str2hndl->st2h_st3hndl,NULL,"create_struct3"); + str2hndl->st2h_st3hndl = create_struct3(); + CHECK_PTR(str2hndl->st2h_st3hndl, "create_struct3"); - ret=H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); + ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); CHECK(ret,FAIL,"H5Tinsert"); - str2hndl->st2h_id= H5Tvlen_create(str2hndl->st2h_base); + str2hndl->st2h_id = H5Tvlen_create(str2hndl->st2h_base); CHECK(str2hndl->st2h_id,FAIL,"H5Tvlen_create"); - return(str2hndl); + return str2hndl; } static void @@ -801,11 +805,11 @@ set_struct2(misc5_struct2 *buf) { unsigned i; /* Local index variable */ - buf->st2_el1=MISC5_DBGELVAL2; - buf->st2_el2.len=MISC5_DBGNELM3; + buf->st2_el1 = MISC5_DBGELVAL2; + buf->st2_el2.len = MISC5_DBGNELM3; - buf->st2_el2.p=HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); - CHECK(buf->st2_el2.p,NULL,"malloc"); + buf->st2_el2.p = HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); + CHECK_PTR(buf->st2_el2.p, "HDmalloc"); for(i=0; i<(buf->st2_el2.len); i++) set_struct3(&(((misc5_struct3 *)(buf->st2_el2.p))[i])); @@ -825,8 +829,8 @@ create_struct1(void) misc5_struct1_hndl *str1hndl; /* New 'struct1' created */ herr_t ret; /* For error checking */ - str1hndl = HDmalloc(sizeof(misc5_struct1_hndl)); - CHECK(str1hndl, NULL, "malloc"); + str1hndl = (misc5_struct1_hndl *)HDmalloc(sizeof(misc5_struct1_hndl)); + CHECK_PTR(str1hndl, "HDmalloc"); str1hndl->st1h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1)); CHECK(str1hndl->st1h_base, FAIL, "H5Tcreate"); @@ -835,15 +839,15 @@ create_struct1(void) CHECK(ret, FAIL, "H5Tinsert"); str1hndl->st1h_st2hndl=create_struct2(); - CHECK(str1hndl->st1h_st2hndl,NULL,"create_struct2"); + CHECK_PTR(str1hndl->st1h_st2hndl, "create_struct2"); - ret=H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); + ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); CHECK(ret,FAIL,"H5Tinsert"); - str1hndl->st1h_id=H5Tvlen_create(str1hndl->st1h_base); + str1hndl->st1h_id = H5Tvlen_create(str1hndl->st1h_base); CHECK(str1hndl->st1h_id,FAIL,"H5Tvlen_create"); - return(str1hndl); + return str1hndl; } static void @@ -851,12 +855,12 @@ delete_struct1(misc5_struct1_hndl *str1hndl) { herr_t ret; /* For error checking */ - ret=H5Tclose(str1hndl->st1h_id); + ret = H5Tclose(str1hndl->st1h_id); CHECK(ret,FAIL,"H5Tclose"); delete_struct2(str1hndl->st1h_st2hndl); - ret=H5Tclose(str1hndl->st1h_base); + ret = H5Tclose(str1hndl->st1h_base); CHECK(ret,FAIL,"H5Tclose"); HDfree(str1hndl); @@ -871,7 +875,7 @@ set_struct1(misc5_struct1 *buf) buf->st1_el2.len=MISC5_DBGNELM2; buf->st1_el2.p=HDmalloc((buf->st1_el2.len)*sizeof(misc5_struct2)); - CHECK(buf->st1_el2.p,NULL,"malloc"); + CHECK_PTR(buf->st1_el2.p, "HDmalloc"); for(i=0; i<(buf->st1_el2.len); i++) set_struct2(&(((misc5_struct2 *)(buf->st1_el2.p))[i])); @@ -907,7 +911,7 @@ test_misc5(void) /* Create the memory structure to write */ str1hndl = create_struct1(); - CHECK(str1hndl, NULL, "create_struct1"); + CHECK_PTR(str1hndl, "create_struct1"); /* Create the dataspace */ dims[0] = MISC5_NELMTOPLVL; @@ -921,7 +925,7 @@ test_misc5(void) /* Create the variable-length buffer */ buf.len = MISC5_DBGNELM1; buf.p = HDmalloc((buf.len) * sizeof(misc5_struct1)); - CHECK(buf.p, NULL, "malloc"); + CHECK_PTR(buf.p, "HDmalloc"); /* Create the top-level VL information */ for(i = 0; i < MISC5_DBGNELM1; i++) @@ -976,13 +980,13 @@ test_misc5(void) /* Verify the correct information was read in */ for(i=0; i<(buf.len); i++) { - /* printf("[%d]=%d\n",i, ((misc5_struct1 *)(buf.p))[i].st1_el1); */ + /* HDprintf("[%d]=%d\n",i, ((misc5_struct1 *)(buf.p))[i].st1_el1); */ VERIFY(((misc5_struct1 *)(buf.p))[i].st1_el1,MISC5_DBGELVAL1,"H5Dread"); for(j=0; j<(((misc5_struct1 *)(buf.p)) [i].st1_el2.len); j++) { - /* printf(" [%d]=%d\n",j, ((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1); */ + /* HDprintf(" [%d]=%d\n",j, ((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1); */ VERIFY(((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1, MISC5_DBGELVAL2,"H5Dread"); for(k=0; k<(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.len); k++) { - /* printf(" [%d]=%d\n",k, ((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1); */ + /* HDprintf(" [%d]=%d\n",k, ((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1); */ VERIFY(((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1, MISC5_DBGELVAL3,"H5Dread"); } /* end for */ } @@ -1059,7 +1063,7 @@ test_misc6(void) /* Loop through adding attributes to each dataset */ for(u = 0; u < MISC6_NUMATTR; u++) { /* Create name for attribute */ - sprintf(attr_name, "Attr#%u", u); + HDsprintf(attr_name, "Attr#%u", u); /* Open the file */ loc_id = H5Fopen(MISC6_FILE, H5F_ACC_RDWR, H5P_DEFAULT); @@ -1246,18 +1250,18 @@ test_misc8(void) MESSAGE(5, ("Testing dataset storage sizes\n")); /* Allocate space for the data to write & read */ - wdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); - CHECK(wdata,NULL,"malloc"); + wdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); + CHECK_PTR(wdata, "HDmalloc"); #ifdef VERIFY_DATA - rdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); - CHECK(rdata,NULL,"malloc"); + rdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); + CHECK_PTR(rdata, "HDmalloc"); #endif /* VERIFY_DATA */ /* Initialize values */ tdata=wdata; for(u=0; u<MISC8_DIM0; u++) for(v=0; v<MISC8_DIM1; v++) - *tdata++=((u*MISC8_DIM1)+v)%13; + *tdata++ = (int)(((u * MISC8_DIM1) + v) % 13); /* Create a file acccess property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -1313,7 +1317,7 @@ test_misc8(void) /* Check the storage size */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1339,7 +1343,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1364,7 +1368,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1408,7 +1412,7 @@ test_misc8(void) /* Check the storage size */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1435,7 +1439,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1465,7 +1469,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1489,7 +1493,7 @@ test_misc8(void) /* Check the storage size after only four chunks are written */ storage_size = H5Dget_storage_size(did); - VERIFY(storage_size, 4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Write entire dataset */ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); @@ -1512,7 +1516,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1739,20 +1743,12 @@ test_misc10(void) hid_t dataset, dataset_new; /* Dataset IDs for old & new datasets */ hid_t dcpl; /* Dataset creation property list */ hid_t space, type; /* Old dataset's dataspace & datatype */ - char testfile[512]=""; /* Character buffer for corrected test file name */ - char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */ + const char *testfile = H5_get_srcdir_filename(MISC10_FILE_OLD); /* Corrected test file name */ herr_t ret; /* Output message about test being performed */ MESSAGE(5, ("Testing using old dataset creation property list\n")); - /* Generate the correct name for the test file, by prepending the source path */ - if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC10_FILE_OLD) + 1) < sizeof(testfile))) { - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, MISC10_FILE_OLD); - /* * Open the old file and the dataset and get old settings. */ @@ -1870,7 +1866,7 @@ test_misc11(void) /* This should fail as (32770*2) will exceed ^16 - 2 bytes for storing btree entries */ H5E_BEGIN_TRY { - ret=H5Pset_sym_k(fcpl, 32770, 0); + ret=H5Pset_sym_k(fcpl, 32770, 0); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_sym_k"); @@ -1879,7 +1875,7 @@ test_misc11(void) /* This should fail as (32770*2) will exceed ^16 - 2 bytes for storing btree entries */ H5E_BEGIN_TRY { - ret=H5Pset_istore_k(fcpl, 32770); + ret=H5Pset_istore_k(fcpl, 32770); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_istore_k"); @@ -1992,19 +1988,19 @@ test_misc12(void) "las palabras del que murio en la cruz." }; char *rdata [MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE]; /* Information read in */ - hid_t fid1; - hid_t dataset; - hid_t sid1, space, memspace; - hid_t tid1, cparms; - hsize_t dims1[] = {MISC12_SPACE1_DIM1}; - hsize_t dimsn[] = {MISC12_APPEND_SIZE}; - hsize_t maxdims1[1] = {H5S_UNLIMITED}; - hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE}; + hid_t fid1; + hid_t dataset; + hid_t sid1, space, memspace; + hid_t tid1, cparms; + hsize_t dims1[] = {MISC12_SPACE1_DIM1}; + hsize_t dimsn[] = {MISC12_APPEND_SIZE}; + hsize_t maxdims1[1] = {H5S_UNLIMITED}; + hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE}; hsize_t newsize[1] = {MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE}; - hsize_t offset[1] = {MISC12_SPACE1_DIM1}; + hsize_t offset[1] = {MISC12_SPACE1_DIM1}; hsize_t count[1] = {MISC12_APPEND_SIZE}; int i; /* counting variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing VL-type in chunked dataset\n")); @@ -2096,38 +2092,36 @@ test_misc12(void) /* Various routines for misc. 13 test */ static void -init_data(void) +misc13_init_data(unsigned *original_data) { - unsigned u,v; /* Local index variables */ + unsigned u; - for(u=0; u<MISC13_DIM1; u++) - for(v=0; v<MISC13_DIM2; v++) - m13_data[u][v]=(u*MISC13_DIM2)+v; + for(u = 0; u < MISC13_DIM1; u++) + original_data[u] = u; } -static int -verify_data(void) +static hbool_t +misc13_verify_data_match(const unsigned *original_data, const unsigned *read_data) { - unsigned u,v; /* Local index variables */ + unsigned u; + + for(u = 0; u < MISC13_DIM1; u++) + if(original_data[u] != read_data[u]) + return FALSE; - for(u=0; u<MISC13_DIM1; u++) - for(v=0; v<MISC13_DIM2; v++) - if(m13_data[u][v]!=m13_rdata[u][v]) - return(-1); - return(0); + return TRUE; } static void -create_dataset(hid_t loc_id, const char *name, hid_t dcpl) +misc13_create_dataset(hid_t loc_id, const char *name, hid_t dcpl, const unsigned *data) { - hid_t dsid; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hsize_t dims[MISC13_RANK]; /* Dataset dimensions */ - herr_t ret; /* Generic return value */ + hid_t dsid = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hsize_t dims[MISC13_RANK]; /* Dataset dimensions */ + herr_t ret; /* Generic return value */ /* Create dataspace for use with dataset */ dims[0] = MISC13_DIM1; - dims[1] = MISC13_DIM2; sid = H5Screate_simple(MISC13_RANK, dims, NULL); CHECK(sid, FAIL, "H5Screate_simple"); @@ -2136,7 +2130,7 @@ create_dataset(hid_t loc_id, const char *name, hid_t dcpl) CHECK(dsid, FAIL, "H5Dcreate2"); /* Write some data to dataset */ - ret = H5Dwrite(dsid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, m13_data); + ret = H5Dwrite(dsid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); CHECK(ret, FAIL, "H5Dwrite"); /* Close the contiguous dataset */ @@ -2146,64 +2140,74 @@ create_dataset(hid_t loc_id, const char *name, hid_t dcpl) /* Close the dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} + +} /* end misc13_create_dataset() */ static void -verify_dataset(hid_t loc_id, const char *name) +misc13_verify_dataset(hid_t loc_id, const char *name, const unsigned *data) { - hid_t dsid; /* Dataset ID */ - herr_t ret; /* Generic return value */ + unsigned *read_data = NULL; /* Data to write to dataset */ + hid_t dsid = -1; /* Dataset ID */ + herr_t ret; /* Generic return value */ + + /* Create a data buffer for the dataset read */ + read_data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned)); + CHECK_PTR(read_data, "HDcalloc"); /* Open the contiguous dataset in the root group */ dsid = H5Dopen2(loc_id, name, H5P_DEFAULT); CHECK(dsid, FAIL, "H5Dopen2"); /* Read the data */ - ret = H5Dread(dsid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, m13_rdata); + ret = H5Dread(dsid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_data); CHECK(ret, FAIL, "H5Dread"); - /* Verify that the data is correct */ - ret=verify_data(); - CHECK(ret, FAIL, "verify_data"); + /* Verify that the data are correct */ + ret = misc13_verify_data_match(data, read_data); + CHECK(ret, FAIL, "misc13_verify_data_match"); /* Close the contiguous dataset */ ret = H5Dclose(dsid); CHECK(ret, FAIL, "H5Dclose"); -} + + /* Free the dataset read buffer */ + HDfree(read_data); + +} /* end misc13_verify_dataset() */ static void -create_hdf_file(const char *name) +misc13_create_hdf_file(const char *name, const unsigned *data) { - hid_t fid; /* File ID */ - hid_t gid,gid2; /* Group IDs */ - hid_t tid; /* Datatype ID */ - hid_t dcpl; /* Dataset creation property list ID */ - hsize_t chunk_dims[MISC13_RANK]; /* Chunk dimensions */ - herr_t ret; /* Generic return value */ + hid_t fid = -1; /* File ID */ + hid_t gid1 = -1; /* Group ID (level 1) */ + hid_t gid2 = -1; /* Group ID (level 2) */ + hid_t tid = -1; /* Datatype ID */ + hid_t dcplid = -1; /* Dataset creation property list ID */ + hsize_t chunk_dims[MISC13_RANK]; /* Chunk dimensions */ + herr_t ret; /* Generic return value */ /* Create file */ - fid=H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create DCPL for use with datasets */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + dcplid = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcplid, FAIL, "H5Pcreate"); /* Set the DCPL to be chunked */ - ret = H5Pset_layout(dcpl, H5D_CHUNKED); + ret = H5Pset_layout(dcplid, H5D_CHUNKED); CHECK(ret, FAIL, "H5Pset_layout"); /* Use chunked storage for this DCPL */ chunk_dims[0] = MISC13_CHUNK_DIM1; - chunk_dims[1] = MISC13_CHUNK_DIM2; - ret = H5Pset_chunk(dcpl, MISC13_RANK, chunk_dims); + ret = H5Pset_chunk(dcplid, MISC13_RANK, chunk_dims); CHECK(ret, FAIL, "H5Pset_chunk"); /* Create contiguous dataset in root group */ - create_dataset(fid, MISC13_DSET1_NAME, H5P_DEFAULT); + misc13_create_dataset(fid, MISC13_DSET1_NAME, H5P_DEFAULT, data); /* Create chunked dataset in root group */ - create_dataset(fid, MISC13_DSET2_NAME, dcpl); + misc13_create_dataset(fid, MISC13_DSET2_NAME, dcplid, data); /* Create a datatype to commit to the file */ tid = H5Tcopy(H5T_NATIVE_INT); @@ -2218,11 +2222,11 @@ create_hdf_file(const char *name) CHECK(ret, FAIL, "H5Tclose"); /* Create a group in the root group */ - gid = H5Gcreate2(fid, MISC13_GROUP1_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gcreate2"); + gid1 = H5Gcreate2(fid, MISC13_GROUP1_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gcreate2"); /* Create another group in the new group */ - gid2 = H5Gcreate2(gid, MISC13_GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid2 = H5Gcreate2(gid1, MISC13_GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid2, FAIL, "H5Gcreate2"); /* Close the second group */ @@ -2230,17 +2234,17 @@ create_hdf_file(const char *name) CHECK(ret, FAIL, "H5Gclose"); /* Create contiguous dataset in new group */ - create_dataset(gid, MISC13_DSET1_NAME, H5P_DEFAULT); + misc13_create_dataset(gid1, MISC13_DSET1_NAME, H5P_DEFAULT, data); /* Create chunked dataset in new group */ - create_dataset(gid, MISC13_DSET2_NAME, dcpl); + misc13_create_dataset(gid1, MISC13_DSET2_NAME, dcplid, data); /* Create a datatype to commit to the new group */ tid = H5Tcopy(H5T_NATIVE_INT); CHECK(tid, FAIL, "H5Tcopy"); /* Create a named datatype in the new group */ - ret = H5Tcommit2(gid, MISC13_DTYPE_NAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + ret = H5Tcommit2(gid1, MISC13_DTYPE_NAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); /* Close named datatype */ @@ -2248,65 +2252,66 @@ create_hdf_file(const char *name) CHECK(ret, FAIL, "H5Tclose"); /* Close the first group */ - ret = H5Gclose(gid); + ret = H5Gclose(gid1); CHECK(ret, FAIL, "H5Gclose"); /* Close the DCPL */ - ret = H5Pclose(dcpl); + ret = H5Pclose(dcplid); CHECK(ret, FAIL, "H5Pclose"); /* Close the file */ ret = H5Fclose(fid); - HDassert(ret >= 0); CHECK(ret, FAIL, "H5Fclose"); -} + +} /* end misc13_create_hdf_file() */ static void -insert_user_block(const char *old_name, const char *new_name,const char *str,size_t size) +misc13_insert_user_block(const char *old_name, const char *new_name, const char *str, size_t size) { - FILE *new_fp, *old_fp; /* Pointers to new & old files */ - void *user_block; /* Pointer to user block to write to file */ - void *copy_buf; /* Pointer to buffer for copying data */ + FILE *new_fp = NULL; /* Pointers to new & old files */ + FILE *old_fp = NULL; + void *user_block = NULL; /* Pointer to user block to write to file */ + void *copy_buf = NULL; /* Pointer to buffer for copying data */ size_t written; /* Amount of data written to new file */ size_t read_in; /* Amount of data read in from old file */ int ret; /* Generic status value */ /* Allocate space for the user block */ user_block = HDcalloc(size, (size_t)1); - CHECK(user_block, NULL, "HDcalloc"); + CHECK_PTR(user_block, "HDcalloc"); /* Copy in the user block data */ - HDmemcpy(user_block,str,strlen(str)); + HDmemcpy(user_block, str, HDstrlen(str)); /* Open the new file */ - new_fp=HDfopen(new_name,"wb"); - CHECK(new_fp, NULL, "HDfopen"); + new_fp = HDfopen(new_name,"wb"); + CHECK_PTR(new_fp, "HDfopen"); /* Write the user block to the new file */ written = HDfwrite(user_block, (size_t)1, size, new_fp); VERIFY(written, size, "HDfwrite"); /* Open the old file */ - old_fp=HDfopen(old_name,"rb"); - CHECK(old_fp, NULL, "HDfopen"); + old_fp = HDfopen(old_name,"rb"); + CHECK_PTR(old_fp, "HDfopen"); /* Allocate space for the copy buffer */ copy_buf = HDmalloc((size_t)MISC13_COPY_BUF_SIZE); - CHECK(copy_buf, NULL, "HDmalloc"); + CHECK_PTR(copy_buf, "HDmalloc"); /* Copy data from the old file to the new file */ while((read_in = HDfread(copy_buf, (size_t)1, (size_t)MISC13_COPY_BUF_SIZE, old_fp)) > 0) { /* Write the data to the new file */ written = HDfwrite(copy_buf, (size_t)1, read_in, new_fp); VERIFY(written, read_in, "HDfwrite"); - } /* end while */ + } /* Close the old file */ - ret=HDfclose(old_fp); + ret = HDfclose(old_fp); VERIFY(ret, 0, "HDfclose"); /* Close the new file */ - ret=HDfclose(new_fp); + ret = HDfclose(new_fp); VERIFY(ret, 0, "HDfclose"); /* Free the copy buffer */ @@ -2314,81 +2319,84 @@ insert_user_block(const char *old_name, const char *new_name,const char *str,siz /* Free the user block */ HDfree(user_block); -} + +} /* end misc13_insert_user_block() */ static void -verify_file(const char *name, hsize_t blk_size, unsigned check_new_data) +misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_size, + hbool_t check_for_new_dataset) { - hid_t fid; /* File ID */ - hid_t gid,gid2; /* Group IDs */ - hid_t tid; /* Datatype ID */ - hid_t fcpl; /* File creation property list ID */ - hsize_t userblock; /* Userblock size retrieved from FCPL */ - herr_t ret; /* Generic return value */ + hid_t fid = -1; /* File ID */ + hid_t gid1 = -1; /* Group IDs */ + hid_t gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t fcplid = -1; /* File creation property list ID */ + hsize_t ub_size_out; /* Userblock size retrieved from FCPL */ + herr_t ret; /* Generic return value */ /* Open the file */ - fid=H5Fopen(name, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(name, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Get the file's FCPL */ - fcpl=H5Fget_create_plist(fid); - CHECK(fcpl, FAIL, "H5Fget_create_plist"); + fcplid = H5Fget_create_plist(fid); + CHECK(fcplid, FAIL, "H5Fget_create_plist"); /* Get the user block size for the file */ - ret=H5Pget_userblock(fcpl,&userblock); + ret = H5Pget_userblock(fcplid, &ub_size_out); CHECK(ret, FAIL, "H5Pget_userblock"); /* Check the userblock size */ - VERIFY(userblock, blk_size, "H5Pget_userblock"); + VERIFY(userblock_size, ub_size_out, "H5Pget_userblock"); /* Close the FCPL */ - ret = H5Pclose(fcpl); + ret = H5Pclose(fcplid); CHECK(ret, FAIL, "H5Pclose"); /* Verify the contiguous dataset in the root group */ - verify_dataset(fid,MISC13_DSET1_NAME); + misc13_verify_dataset(fid, MISC13_DSET1_NAME, data); /* Verify the chunked dataset in the root group */ - verify_dataset(fid,MISC13_DSET2_NAME); + misc13_verify_dataset(fid, MISC13_DSET2_NAME, data); /* Verify the "new" contiguous dataset in the root group, if asked */ - if(check_new_data) - verify_dataset(fid,MISC13_DSET3_NAME); + if(check_for_new_dataset) + misc13_verify_dataset(fid, MISC13_DSET3_NAME, data); /* Open the named datatype in the root group */ tid = H5Topen2(fid, MISC13_DTYPE_NAME, H5P_DEFAULT); CHECK(tid, FAIL, "H5Topen2"); /* Verify the type is correct */ - VERIFY(H5Tequal(tid,H5T_NATIVE_INT), TRUE, "H5Tequal"); + VERIFY(H5Tequal(tid, H5T_NATIVE_INT), TRUE, "H5Tequal"); /* Close named datatype */ - ret=H5Tclose(tid); + ret = H5Tclose(tid); CHECK(ret, FAIL, "H5Tclose"); /* Open the first group */ - gid = H5Gopen2(fid, MISC13_GROUP1_NAME, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gopen2"); + gid1 = H5Gopen2(fid, MISC13_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gopen2"); /* Verify the contiguous dataset in the first group */ - verify_dataset(gid,MISC13_DSET1_NAME); + misc13_verify_dataset(gid1, MISC13_DSET1_NAME, data); /* Verify the chunked dataset in the first group */ - verify_dataset(gid,MISC13_DSET2_NAME); + misc13_verify_dataset(gid1, MISC13_DSET2_NAME, data); /* Open the named datatype in the first group */ - tid = H5Topen2(gid,MISC13_DTYPE_NAME, H5P_DEFAULT); + tid = H5Topen2(gid1, MISC13_DTYPE_NAME, H5P_DEFAULT); CHECK(tid, FAIL, "H5Topen2"); /* Verify the type is correct */ - VERIFY(H5Tequal(tid,H5T_NATIVE_INT), TRUE, "H5Tequal"); + VERIFY(H5Tequal(tid, H5T_NATIVE_INT), TRUE, "H5Tequal"); /* Close named datatype */ - ret=H5Tclose(tid); + ret = H5Tclose(tid); CHECK(ret, FAIL, "H5Tclose"); /* Open the second group */ - gid2 = H5Gopen2(gid, MISC13_GROUP2_NAME, H5P_DEFAULT); + gid2 = H5Gopen2(gid1, MISC13_GROUP2_NAME, H5P_DEFAULT); CHECK(gid2, FAIL, "H5Gopen2"); /* Close the second group */ @@ -2396,31 +2404,33 @@ verify_file(const char *name, hsize_t blk_size, unsigned check_new_data) CHECK(ret, FAIL, "H5Gclose"); /* Close the first group */ - ret = H5Gclose(gid); + ret = H5Gclose(gid1); CHECK(ret, FAIL, "H5Gclose"); /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} + +} /* end misc13_verify_file() */ static void -add_to_new_file(const char *name) +misc13_add_to_new_file(const char *name, const unsigned *data) { - hid_t fid; /* File ID */ + hid_t fid = -1; /* File ID */ herr_t ret; /* Generic return value */ /* Open the file */ - fid=H5Fopen(name, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(name, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Create new contiguous dataset in root group */ - create_dataset(fid, MISC13_DSET3_NAME, H5P_DEFAULT); + misc13_create_dataset(fid, MISC13_DSET3_NAME, H5P_DEFAULT, data); /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} + +} /* end misc13_add_to_new_file() */ /**************************************************************** ** @@ -2431,26 +2441,44 @@ add_to_new_file(const char *name) static void test_misc13(void) { + unsigned *data = NULL; /* Data to write to dataset */ + hsize_t userblock_size; /* Correct size of userblock */ + hbool_t check_for_new_dataset; /* Whether to check for the post-userblock-creation dataset */ + + /* Create a data buffer for the datasets */ + data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned)); + CHECK_PTR(data, "HDcalloc"); + /* Initialize data to write */ - init_data(); + misc13_init_data(data); /* Create first file, with no user block */ - create_hdf_file(MISC13_FILE_1); + misc13_create_hdf_file(MISC13_FILE_1, data); /* Verify file contents are correct */ - verify_file(MISC13_FILE_1,(hsize_t)0,0); + userblock_size = 0; + check_for_new_dataset = FALSE; + misc13_verify_file(MISC13_FILE_1, data, userblock_size, check_for_new_dataset); /* Create a new file by inserting a user block in front of the first file */ - insert_user_block(MISC13_FILE_1, MISC13_FILE_2, "Test String", (size_t)MISC13_USERBLOCK_SIZE); + misc13_insert_user_block(MISC13_FILE_1, MISC13_FILE_2, "Test String", (size_t)MISC13_USERBLOCK_SIZE); /* Verify file contents are still correct */ - verify_file(MISC13_FILE_2,(hsize_t)MISC13_USERBLOCK_SIZE,0); + userblock_size = MISC13_USERBLOCK_SIZE; + check_for_new_dataset = FALSE; + misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset); /* Make certain we can modify the new file */ - add_to_new_file(MISC13_FILE_2); + misc13_add_to_new_file(MISC13_FILE_2, data); /* Verify file contents are still correct */ - verify_file(MISC13_FILE_2,(hsize_t)MISC13_USERBLOCK_SIZE,1); + userblock_size = MISC13_USERBLOCK_SIZE; + check_for_new_dataset = TRUE; + misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset); + + /* Free the dataset buffer */ + HDfree(data); + } /* end test_misc13() */ /**************************************************************** @@ -2509,7 +2537,7 @@ test_misc14(void) /* Check data from first dataset */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata, data1)) + if(!H5_DBL_ABS_EQUAL(rdata, data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Unlink second dataset */ @@ -2523,7 +2551,7 @@ test_misc14(void) /* Verify the data from dataset #1 */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata,data1)) + if(!H5_DBL_ABS_EQUAL(rdata,data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Close first dataset */ @@ -2557,7 +2585,7 @@ test_misc14(void) /* Check data from second dataset */ ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata,data2)) + if(!H5_DBL_ABS_EQUAL(rdata,data2)) TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Unlink first dataset */ @@ -2571,7 +2599,7 @@ test_misc14(void) /* Verify the data from dataset #2 */ ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata,data2)) + if(!H5_DBL_ABS_EQUAL(rdata,data2)) TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Close second dataset */ @@ -2612,13 +2640,13 @@ test_misc14(void) /* Check data from first dataset */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata,data1)) + if(!H5_DBL_ABS_EQUAL(rdata,data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Check data from third dataset */ ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata,data3)) + if(!H5_DBL_ABS_EQUAL(rdata,data3)) TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Unlink second dataset */ @@ -2632,13 +2660,13 @@ test_misc14(void) /* Verify the data from dataset #1 */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata,data1)) + if(!H5_DBL_ABS_EQUAL(rdata,data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Verify the data from dataset #3 */ ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(!DBL_ABS_EQUAL(rdata,data3)) + if(!H5_DBL_ABS_EQUAL(rdata,data3)) TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Close first dataset */ @@ -2694,9 +2722,6 @@ test_misc15(void) fapl = H5Fget_access_plist(file); CHECK(fapl, FAIL, "H5Fget_access_plist"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -2704,6 +2729,9 @@ test_misc15(void) ret = H5Fis_hdf5(MISC15_FILE); CHECK(ret, FAIL, "H5Fis_hdf5"); + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); @@ -2724,15 +2752,21 @@ test_misc16(void) { hid_t file; /* File ID */ herr_t ret; /* Generic return value */ - const char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE] = - {"1234567", "1234567\0", "12345678", {NULL}}; + char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; char rdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; /* Information read in */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t dims[] = {MISC16_SPACE_DIM}; + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t dims[] = {MISC16_SPACE_DIM}; int i; + /* Initialize the data */ + /* (Note that these are supposed to stress the code, so are a little weird) */ + HDmemcpy(wdata[0], "1234567", MISC16_STR_SIZE); + HDmemcpy(wdata[1], "1234567\0", MISC16_STR_SIZE); + HDmemcpy(wdata[2], "12345678", MISC16_STR_SIZE); + HDmemcpy(wdata[3], "\0\0\0\0\0\0\0\0", MISC16_STR_SIZE); + /* Create the file */ file = H5Fcreate(MISC16_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); @@ -2766,11 +2800,11 @@ test_misc16(void) /* Compare data read in */ for(i = 0; i < MISC16_SPACE_DIM; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -2803,15 +2837,21 @@ test_misc17(void) { hid_t file; /* File ID */ herr_t ret; /* Generic return value */ - const char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2] = - {"1234567", "1234567\0", "12345678", {NULL}}; + char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; char rdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; /* Information read in */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t dims[] = {MISC17_SPACE_DIM1, MISC17_SPACE_DIM2}; + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t dims[] = {MISC17_SPACE_DIM1, MISC17_SPACE_DIM2}; int i; + /* Initialize the data */ + /* (Note that these are supposed to stress the code, so are a little weird) */ + HDmemcpy(wdata[0], "1234567", MISC17_SPACE_DIM2); + HDmemcpy(wdata[1], "1234567\0", MISC17_SPACE_DIM2); + HDmemcpy(wdata[2], "12345678", MISC17_SPACE_DIM2); + HDmemcpy(wdata[3], "\0\0\0\0\0\0\0\0", MISC17_SPACE_DIM2); + /* Create the file */ file = H5Fcreate(MISC17_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); @@ -2842,11 +2882,11 @@ test_misc17(void) /* Compare data in the way of strings. */ for(i = 0; i < MISC17_SPACE_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -2922,25 +2962,25 @@ test_misc18(void) /* Loop creating attributes on each dataset, flushing them to the file each time */ for(u = 0; u < 10; u++) { /* Set up attribute name */ - sprintf(attr_name, "Attr %u", u); + HDsprintf(attr_name, "Attr %u", u); /* Create & close attribute on first dataset */ aid = H5Acreate2(did1, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); ret = H5Aclose(aid); - CHECK(ret, FAIL, "HAclose"); + CHECK(ret, FAIL, "H5Aclose"); /* Create & close attribute on second dataset */ aid = H5Acreate2(did2, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); ret = H5Aclose(aid); - CHECK(ret, FAIL, "HAclose"); + CHECK(ret, FAIL, "H5Aclose"); /* Flush file, to 'fix' size of dataset object headers */ ret = H5Fflush(fid,H5F_SCOPE_GLOBAL); - CHECK(ret, FAIL, "HAclose"); + CHECK(ret, FAIL, "H5Fflush"); } /* end for */ /* Get object information for dataset #1 now */ @@ -2985,19 +3025,21 @@ test_misc18(void) static void test_misc19(void) { - hid_t fid; /* File ID */ - hid_t sid; /* 'Space ID */ - hid_t did; /* Dataset ID */ - hid_t tid; /* 'Type ID */ - hid_t aid; /* Attribute ID */ - hid_t plid; /* Property List ID */ - hid_t pcid; /* Property Class ID */ - hid_t gid; /* Group ID */ - hid_t ecid; /* Error Class ID */ - hid_t emid; /* Error Message ID */ - hid_t esid; /* Error Stack ID */ - int rc; /* Reference count */ - herr_t ret; /* Generic return value */ + hid_t fid = -1; /* File ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t did = -1; /* Dataset ID */ + hid_t tid = -1; /* Datatype ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t plid = -1; /* Property List ID */ + hid_t pcid = -1; /* Property Class ID */ + hid_t gid = -1; /* Group ID */ + hid_t ecid = -1; /* Error Class ID */ + hid_t emid = -1; /* Error Message ID */ + hid_t esid = -1; /* Error Stack ID */ + hid_t vfdid = -1; /* Virtual File Driver ID */ + H5FD_class_t *vfd_cls = NULL; /* VFD class */ + int rc; /* Reference count */ + herr_t ret; /* Generic return value */ /* Check H5I operations on files */ @@ -3407,6 +3449,45 @@ test_misc19(void) } H5E_END_TRY; VERIFY(ret, FAIL, "H5Eclose_stack"); + +/* Check H5I operations on virtual file drivers */ + + /* Get a VFD class to register */ + vfd_cls = h5_get_dummy_vfd_class(); + CHECK_PTR(vfd_cls, "h5_get_dummy_vfd_class"); + + /* Register a virtual file driver */ + vfdid = H5FDregister(vfd_cls); + CHECK(vfdid, FAIL, "H5FDregister"); + + /* Check the reference count */ + rc = H5Iget_ref(vfdid); + VERIFY(rc, 1, "H5Iget_ref"); + + /* Increment the reference count */ + rc = H5Iinc_ref(vfdid); + VERIFY(rc, 2, "H5Iinc_ref"); + + /* Unregister the VFD normally */ + ret = H5FDunregister(vfdid); + CHECK(ret, FAIL, "H5FDunregister"); + + /* Check the reference count */ + rc = H5Iget_ref(vfdid); + VERIFY(rc, 1, "H5Iget_ref"); + + /* Unregister the VFD by decrementing the reference count */ + rc = H5Idec_ref(vfdid); + VERIFY(rc, 0, "H5Idec_ref"); + + /* Try unregistering the VFD again (should fail) */ + H5E_BEGIN_TRY { + ret = H5FDunregister(vfdid); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5FDunregister"); + + HDfree(vfd_cls); + } /* end test_misc19() */ /**************************************************************** @@ -3427,8 +3508,7 @@ test_misc20(void) hsize_t small_dims[MISC20_SPACE_RANK]={MISC20_SPACE2_DIM0,MISC20_SPACE2_DIM1}; /* Small dimensions */ unsigned version; /* Version of storage layout info */ hsize_t contig_size; /* Size of contiguous storage size from layout into */ - char testfile[512]=""; /* Character buffer for corrected test file name */ - char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */ + const char *testfile = H5_get_srcdir_filename(MISC20_FILE_OLD); /* Corrected test file name */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -3542,13 +3622,6 @@ test_misc20(void) /* Verify that the storage size is computed correctly for older versions of layout info */ - /* Generate the correct name for the test file, by prepending the source path */ - if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC20_FILE_OLD) + 1) < sizeof(testfile))) { - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, MISC20_FILE_OLD); - /* * Open the old file and the dataset and get old settings. */ @@ -3733,13 +3806,13 @@ test_misc22(void) /* compute the correct PPB that should be set by SZIP */ if(offsets[k] == 0) - correct = prec[j]; + correct = prec[j]; else correct = H5Tget_size(idts[i]) * 8; if(correct > 24) { - if(correct <= 32) + if(correct <= 32) correct = 32; - else if(correct <= 64) + else if(correct <= 64) correct = 64; } /* end if */ @@ -3813,6 +3886,7 @@ test_misc23(void) char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */ H5O_info_t oinfo; htri_t tri_status; + ssize_t namelen; herr_t status; /* Output message about test being performed */ @@ -3882,8 +3956,8 @@ test_misc23(void) CHECK(tmp_id, FAIL, "H5Gcreate2"); /* Query that the name of the new group is correct */ - status = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); - CHECK(status, FAIL, "H5Iget_name"); + namelen = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); + CHECK(namelen, FAIL, "H5Iget_name"); VERIFY_STR(objname, "/A/B01/grp", "H5Iget_name"); status = H5Gclose(tmp_id); @@ -4656,6 +4730,7 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25a() */ + /**************************************************************** ** ** test_misc25b(): Exercise null object header message merge bug @@ -4668,20 +4743,12 @@ test_misc25b(void) { hid_t fid; /* File ID */ hid_t gid; /* Group ID */ - char testfile[512]=""; - char *srcdir = HDgetenv("srcdir"); + const char *testfile = H5_get_srcdir_filename(MISC25B_FILE); /* Corrected test file name */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Exercise null object header message bug\n")); - /* Build the name of the file, with the source directory */ - if (srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC25B_FILE) + 1) < sizeof(testfile))){ - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, MISC25B_FILE); - /* Open file */ fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -4699,7 +4766,7 @@ test_misc25b(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25b() */ - + /**************************************************************** ** ** test_misc25c(): Exercise another null object header message merge bug. @@ -4833,7 +4900,7 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25c() */ - + /**************************************************************** ** ** test_misc26(): Regression test: ensure that copying filter @@ -4919,7 +4986,7 @@ test_misc26(void) CHECK_I(ret, "H5Pclose"); } - + /**************************************************************** ** ** test_misc27(): Ensure that objects with incorrect # of object @@ -4933,20 +5000,12 @@ test_misc27(void) { hid_t fid; /* File ID */ hid_t gid; /* Group ID */ - char testfile[512]=""; /* Character buffer for corrected test file name */ - char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */ + const char *testfile = H5_get_srcdir_filename(MISC27_FILE); /* Corrected test file name */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Corrupt object header handling\n")); - /* Generate the correct name for the test file, by prepending the source path */ - if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC27_FILE) + 1) < sizeof(testfile))) { - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, MISC27_FILE); - /* Open the file */ fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -4972,7 +5031,7 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ - + /**************************************************************** ** ** test_misc28(): Ensure that the dataset chunk cache will hold @@ -5038,7 +5097,7 @@ test_misc28(void) /* Initialize write buffer */ for(i=0; i<MISC28_SIZE; i++) - buf[i] = i; + buf[i] = (char)i; /* Create memory dataspace and selection in file dataspace */ sidm = H5Screate_simple(1, mdims, NULL); @@ -5059,7 +5118,7 @@ test_misc28(void) /* Initialize write buffer */ for(i=0; i<MISC28_SIZE; i++) - buf[i] = MISC28_SIZE - 1 - i; + buf[i] = (char)(MISC28_SIZE - 1 - i); /* Select new hyperslab */ start[1] = 1; @@ -5149,7 +5208,7 @@ test_misc28(void) CHECK_I(ret, "H5Pclose"); } /* end test_misc28() */ - + /**************************************************************** ** ** test_misc29(): Ensure that speculative metadata reads don't @@ -5198,7 +5257,7 @@ test_misc30_get_info(hid_t loc_id) return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } - + /**************************************************************** ** ** test_misc30(): Exercise local heap code that loads prefix @@ -5230,19 +5289,19 @@ test_misc30(void) CHECK(ret, FAIL, "H5Gclose"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - + for(i = 0; i < 20; i++) { char gname[32]; fid = H5Fopen(MISC30_FILE, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); - + if(get_info) { - ret = test_misc30_get_info(fid); + ret = test_misc30_get_info(fid); CHECK(ret, FAIL, "test_misc30_get_info"); } - sprintf(gname, "/g0/group%d", i); + HDsprintf(gname, "/g0/group%d", i); gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid, FAIL, "H5Gcreate2"); @@ -5250,20 +5309,20 @@ test_misc30(void) CHECK(ret, FAIL, "H5Gclose"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - } - + } + fid = H5Fopen(MISC30_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); ret = H5Fget_filesize(fid, &file_size[get_info]); CHECK(fid, FAIL, "H5Fget_filesize"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - } - + } + VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ - + /**************************************************************** ** ** test_misc31(): Test reentering library through deprecated @@ -5354,14 +5413,14 @@ test_misc31(void) CHECK(ret, FAIL, "H5Fclose"); ret = H5Tclose(dtype_id); CHECK(ret, FAIL, "H5Tclose"); - + #else /* H5_NO_DEPRECATED_SYMBOLS */ /* Output message about test being skipped */ MESSAGE(5, (" ...Skipped")); #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end test_misc31() */ - + /**************************************************************** * * test_misc32(): Simple test of filter memory allocation @@ -5425,7 +5484,7 @@ test_misc32(void) resized = H5resize_memory(NULL, 0); CHECK_PTR_NULL(resized, "H5resize_memory"); /*BAD*/ #endif /* NDEBUG */ - + } /* end test_misc32() */ /**************************************************************** @@ -5477,7 +5536,6 @@ test_misc33(void) } /* end test_misc33() */ - /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5529,19 +5587,16 @@ test_misc(void) } /* test_misc() */ - + /*------------------------------------------------------------------------- - * Function: cleanup_misc + * Function: cleanup_misc * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * July 2, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -5583,5 +5638,5 @@ cleanup_misc(void) HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); HDremove(MISC31_FILE); -} +} /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index d5a1bb8..207267b 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: trefer +* Test program: trefer * * Test the Reference functionality * @@ -21,24 +21,22 @@ #include "testhdf5.h" -#include "hdf5.h" - -#define FILE1 "trefer1.h5" -#define FILE2 "trefer2.h5" -#define FILE3 "trefer3.h5" +#define FILE1 "trefer1.h5" +#define FILE2 "trefer2.h5" +#define FILE3 "trefer3.h5" /* 1-D dataset with fixed dimensions */ -#define SPACE1_RANK 1 -#define SPACE1_DIM1 4 +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 /* 2-D dataset with fixed dimensions */ -#define SPACE2_RANK 2 -#define SPACE2_DIM1 10 -#define SPACE2_DIM2 10 +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 /* Larger 1-D dataset with fixed dimensions */ -#define SPACE3_RANK 1 -#define SPACE3_DIM1 100 +#define SPACE3_RANK 1 +#define SPACE3_DIM1 100 /* Element selection information */ #define POINT1_NPOINTS 10 @@ -80,8 +78,9 @@ test_reference_params(void) unsigned *tu32; /* Temporary pointer to uint32 data */ int i; /* counting variables */ const char *write_comment = "Foo!"; /* Comments for group */ + hid_t ret_id; /* Generic hid_t return value */ + ssize_t name_size; /* Size of reference name */ herr_t ret; /* Generic return value */ - size_t name_size; /* Size of reference name */ /* Output message about test being performed */ MESSAGE(5, ("Testing Reference Parameters\n")); @@ -112,7 +111,7 @@ test_reference_params(void) CHECK(dataset, FAIL, "H5Dcreate2"); for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++=i*3; + *tu32++ = (unsigned)i * 3; /* Write selection to disk */ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -201,12 +200,12 @@ test_reference_params(void) VERIFY(name_size, FAIL, "H5Rget_name type"); /* Test parameters to H5Rget_region */ - ret = H5Rget_region((hid_t)-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"); + ret_id = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret_id, FAIL, "H5Rget_region loc_id"); + ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL); + VERIFY(ret_id, FAIL, "H5Rget_region ref"); + ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret_id, FAIL, "H5Rget_region type"); /* Close disk dataspace */ ret = H5Sclose(sid1); @@ -235,13 +234,14 @@ test_reference_params(void) static void test_reference_obj(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset, /* Dataset ID */ + 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}; + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hid_t dapl_id; /* Dataset access property list */ hobj_ref_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temp. buffer read from disk */ @@ -251,7 +251,8 @@ test_reference_obj(void) 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 */ + ssize_t size; /* Comment length */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Object Reference Functions\n")); @@ -282,7 +283,7 @@ test_reference_obj(void) CHECK(dataset, FAIL, "H5Dcreate2"); for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++=i*3; + *tu32++ = (unsigned)i * 3; /* Write selection to disk */ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -413,8 +414,8 @@ test_reference_obj(void) CHECK(group, FAIL, "H5Rdereference"); /* Get group's comment */ - ret = H5Oget_comment(group, read_comment, (size_t)10); - CHECK(ret, FAIL, "H5Oget_comment"); + size = H5Oget_comment(group, read_comment, (size_t)10); + CHECK(size, FAIL, "H5Oget_comment"); /* Check for correct comment value */ if(HDstrcmp(write_comment, read_comment) != 0) @@ -474,36 +475,48 @@ test_reference_obj(void) static void test_reference_region(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset2; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid2; /* Dataspace ID #2 */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE2_RANK]; /* Selection bounds */ - hsize_t high[SPACE2_RANK]; /* Selection bounds */ - hdset_reg_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Type of object */ - int i, j; /* counting variables */ - herr_t ret; /* Generic return value */ - haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ - hid_t dset_NA; /* Dataset id for undefined reference */ - hid_t space_NA; /* Dataspace id for undefined reference */ - hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ - hdset_reg_ref_t wdata_NA[1], /* Write buffer */ - rdata_NA[1]; /* Read buffer */ + hid_t fid1; /* HDF5 File IDs */ + hid_t fapl = -1; /* File access property list */ + hid_t dset1, /* Dataset ID */ + dset2, /* Dereferenced dataset ID */ + dset3; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2, /* Dataspace ID #2 */ + sid3; /* Dataspace ID #3 */ + hid_t dapl_id; /* Dataset access property list */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t *coords; /* Coordinate buffer */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ + hdset_reg_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ + uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ + *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Type of object */ + int i, j; /* counting variables */ + hssize_t hssize_ret; /* hssize_t return value */ + htri_t tri_ret; /* htri_t return value */ + herr_t ret; /* Generic return value */ + haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ + hid_t dset_NA; /* Dataset id for undefined reference */ + hid_t space_NA; /* Dataspace id for undefined reference */ + hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ + hdset_reg_ref_t wdata_NA[1], /* Write buffer */ + rdata_NA[1]; /* Read buffer */ + hsize_t numparticles = 8388608; + hsize_t ret_particles; + unsigned num_dsets = 513; + hsize_t total_particles = numparticles * num_dsets; + hsize_t vdsdims[1] = {total_particles}; + hsize_t start3, count3, block3; /* Output message about test being performed */ MESSAGE(5, ("Testing Dataset Region Reference Functions\n")); @@ -527,7 +540,7 @@ test_reference_region(void) CHECK(dset2, FAIL, "H5Dcreate2"); for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++) - *tu8++ = i * 3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -612,7 +625,7 @@ test_reference_region(void) /* Close and release resources for undefined region reference tests */ ret = H5Dclose(dset_NA); CHECK(ret, FAIL, "H5Dclose"); - ret = H5Sclose(space_NA); + ret = H5Sclose(space_NA); CHECK(ret, FAIL, "H5Sclose"); /* Close disk dataspace */ @@ -635,10 +648,10 @@ test_reference_region(void) fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fopen"); - /* - * Start the test of an undefined reference + /* + * Start the test of an undefined reference */ - + /* Open the dataset of the undefined references */ dset_NA = H5Dopen2(fid1, "DS_NA", H5P_DEFAULT); CHECK(dset_NA, FAIL, "H5Dopen2"); @@ -646,28 +659,28 @@ test_reference_region(void) /* Read the data */ ret = H5Dread(dset_NA, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_NA); CHECK(ret, FAIL, "H5Dread"); - + /* * Dereference an undefined reference (should fail) */ H5E_BEGIN_TRY { dset2 = H5Rdereference(dset_NA, H5R_DATASET_REGION, &rdata_NA[0]); - } H5E_END_TRY; - VERIFY(dset2, FAIL, "H5Rdereference"); + } H5E_END_TRY; + VERIFY(dset2, FAIL, "H5Rdereference"); /* Close and release resources. */ ret = H5Dclose(dset_NA); CHECK(ret, FAIL, "H5Dclose"); - /* This close should fail since H5Rdereference never created + /* This close should fail since H5Rdereference never created * the id of the referenced object. */ H5E_BEGIN_TRY { ret = H5Dclose(dset2); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Dclose"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dclose"); - /* - * End the test of an undefined reference + /* + * End the test of an undefined reference */ /* Open the dataset */ @@ -714,7 +727,7 @@ test_reference_region(void) VERIFY(ret, 36, "H5Sget_select_npoints"); ret = (int)H5Sget_select_hyper_nblocks(sid2); VERIFY(ret, 1, "H5Sget_select_hyper_nblocks"); - coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist"); VERIFY(coords[0], 2, "Hyperslab Coordinates"); @@ -742,7 +755,7 @@ test_reference_region(void) VERIFY(ret, 10, "H5Sget_select_npoints"); ret = (int)H5Sget_select_elem_npoints(sid2); VERIFY(ret, 10, "H5Sget_select_elem_npoints"); - coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); VERIFY(coords[0], coord1[0][0], "Element Coordinates"); @@ -817,29 +830,29 @@ test_reference_region(void) static void test_reference_region_1D(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset3; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid3; /* Dataspace ID #3 */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims3[] = {SPACE3_DIM1}; - hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE3_RANK]; /* Selection bounds */ - hsize_t high[SPACE3_RANK]; /* Selection bounds */ - hdset_reg_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Object type */ - int i; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset3; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid3; /* Dataspace ID #3 */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims3[] = {SPACE3_DIM1}; + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t *coords; /* Coordinate buffer */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ + hdset_reg_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ + *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Object type */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n")); @@ -863,7 +876,7 @@ test_reference_region_1D(void) CHECK(dset3, FAIL, "H5Dcreate2"); for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) - *tu8++ = i * 3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -986,7 +999,7 @@ test_reference_region_1D(void) VERIFY(ret, 30, "H5Sget_select_npoints"); ret = (int)H5Sget_select_hyper_nblocks(sid3); VERIFY(ret, 15, "H5Sget_select_hyper_nblocks"); - coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist"); VERIFY(coords[0], 2, "Hyperslab Coordinates"); @@ -1038,7 +1051,7 @@ test_reference_region_1D(void) VERIFY(ret, 10, "H5Sget_select_npoints"); ret = (int)H5Sget_select_elem_npoints(sid3); VERIFY(ret, 10, "H5Sget_select_elem_npoints"); - coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); VERIFY(coords[0], coord1[0][0], "Element Coordinates"); @@ -1093,14 +1106,14 @@ test_reference_region_1D(void) static void test_reference_obj_deleted(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset, /* Dataset ID */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ dset2; /* Dereferenced dataset ID */ - hid_t sid1; /* Dataspace ID */ + hid_t sid1; /* Dataspace ID */ hobj_ref_t oref; /* Object Reference to test */ H5O_type_t obj_type; /* Object type */ - haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ - herr_t ret; /* Generic return value */ + haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ + herr_t ret; /* Generic return value */ /* Create file */ fid1 = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1243,6 +1256,7 @@ test_reference_group(void) char objname[NAME_SIZE]; /* Buffer to store name */ H5O_info_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ + ssize_t size; /* Name length */ herr_t ret; /* Create file with a group and a dataset containing an object reference to the group */ @@ -1323,8 +1337,8 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Gget_info"); VERIFY(ginfo.nlinks, 3, "H5Gget_info"); - ret = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_name_by_idx"); + size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT); + CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5P_DEFAULT); @@ -1358,25 +1372,25 @@ test_reference_group(void) static void test_reference_compat(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t group; /* Group ID */ - hid_t sid1, /* Dataspace IDs */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1, /* Dataspace IDs */ sid2; - hid_t tid1; /* Datatype ID */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hobj_ref_t *wbuf_obj, /* Buffer to write to disk */ *rbuf_obj; /* Buffer read from disk */ hdset_reg_ref_t *wbuf_reg, /* Buffer to write to disk */ *rbuf_reg; /* Buffer read from disk */ H5G_obj_t obj_type; /* Object type */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deprecated Object Reference Functions\n")); @@ -1625,15 +1639,15 @@ test_reference(void) } /* test_reference() */ - + /*------------------------------------------------------------------------- - * Function: cleanup_reference + * Function: cleanup_reference * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * September 8, 1998 * * Modifications: diff --git a/test/trefstr.c b/test/trefstr.c index 40ce344..83e2951 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -67,7 +67,7 @@ test_refstr_create(void) /* Try creating a ref-counted string */ rs=H5RS_create("foo"); - CHECK(rs, NULL, "H5RS_create"); + CHECK_PTR(rs, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs); @@ -97,7 +97,7 @@ test_refstr_count(void) /* Try creating a ref-counted string */ rs=H5RS_create("foo"); - CHECK(rs, NULL, "H5RS_create"); + CHECK_PTR(rs, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs); @@ -144,7 +144,7 @@ test_refstr_dup(void) /* Try creating a ref-counted string */ rs1=H5RS_create("foo"); - CHECK(rs1, NULL, "H5RS_create"); + CHECK_PTR(rs1, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs1); @@ -152,7 +152,7 @@ test_refstr_dup(void) /* Duplicate r-string */ rs2=H5RS_dup(rs1); - CHECK(rs2, NULL, "H5RS_dup"); + CHECK_PTR(rs2, "H5RS_dup"); /* Get the reference count on the strings */ count=H5RS_get_count(rs1); @@ -194,11 +194,11 @@ test_refstr_cmp(void) /* Create first reference counted string */ rs1=H5RS_create("foo"); - CHECK(rs1, NULL, "H5RS_create"); + CHECK_PTR(rs1, "H5RS_create"); /* Create second reference counted string */ rs2=H5RS_create("foo2"); - CHECK(rs2, NULL, "H5RS_create"); + CHECK_PTR(rs2, "H5RS_create"); /* Compare the strings in various ways */ cmp=H5RS_cmp(rs1,rs1); @@ -246,12 +246,12 @@ test_refstr_wrap(void) /* Wrap ref-counted string around existing buffer */ rs=H5RS_wrap(buf); - CHECK(rs, NULL, "H5RS_wrap"); + CHECK_PTR(rs, "H5RS_wrap"); /* Get pointer to raw string in ref-counted string */ s=H5RS_get_str(rs); - CHECK(s, NULL, "H5RS_get_str"); - VERIFY(s, buf, "wrapping"); + CHECK_PTR(s, "H5RS_get_str"); + CHECK_PTR_EQ(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); VERIFY(cmp, 0, "HDstrcmp"); @@ -264,7 +264,7 @@ test_refstr_wrap(void) /* Get pointer to raw string in ref-counted string */ s=H5RS_get_str(rs); - CHECK(s, NULL, "H5RS_get_str"); + CHECK_PTR(s, "H5RS_get_str"); CHECK(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); if(cmp<=0) @@ -299,17 +299,17 @@ test_refstr_own(void) /* Initialize buffer */ s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1); - CHECK(s, NULL, "H5FL_BLK_MALLOC"); + CHECK_PTR(s, "H5FL_BLK_MALLOC"); HDstrcpy(s, "foo"); /* Transfer ownership of dynamically allocated string to ref-counted string */ rs=H5RS_own(s); - CHECK(rs, NULL, "H5RS_own"); + CHECK_PTR(rs, "H5RS_own"); /* Get pointer to raw string in ref-counted string */ t=H5RS_get_str(rs); - CHECK(t, NULL, "H5RS_get_str"); - VERIFY(t, s, "transferring"); + CHECK_PTR(t, "H5RS_get_str"); + CHECK_PTR_EQ(t, s, "transferring"); cmp=HDstrcmp(s,t); VERIFY(cmp, 0, "HDstrcmp"); @@ -322,8 +322,8 @@ test_refstr_own(void) /* Get pointer to raw string in ref-counted string */ t=H5RS_get_str(rs); - CHECK(t, NULL, "H5RS_get_str"); - VERIFY(t, s, "transferring"); + CHECK_PTR(t, "H5RS_get_str"); + CHECK_PTR_EQ(t, s, "transferring"); cmp=HDstrcmp(t,s); VERIFY(cmp, 0, "HDstrcmp"); diff --git a/test/tselect.c b/test/tselect.c index 7826bde..a4ff1b9 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -222,9 +222,9 @@ test_select_hyper(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -426,9 +426,9 @@ test_select_point(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -704,15 +704,15 @@ test_select_all(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++) for(j=0; j<SPACE4_DIM2; j++) for(k=0; k<SPACE4_DIM3; k++) - *tbuf++ = (uint8_t)(((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k; + *tbuf++ = (uint8_t)((((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k); /* Create file */ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -791,9 +791,9 @@ test_select_all_hyper(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -933,9 +933,9 @@ test_select_combo(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1100,9 +1100,9 @@ test_select_hyper_stride(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1173,8 +1173,8 @@ test_select_hyper_stride(hid_t xfer_plist) tbuf=wbuf+loc1[i]; tbuf2=rbuf+loc2[i]; if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n",__LINE__,i,(int)loc1[i],i,(int)loc2[i]); - printf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",(void *)wbuf,(void *)tbuf,(void *)rbuf,(void *)tbuf2); + HDprintf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n",__LINE__,i,(int)loc1[i],i,(int)loc2[i]); + HDprintf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",(void *)wbuf,(void *)tbuf,(void *)rbuf,(void *)tbuf2); TestErrPrintf("*tbuf=%u, *tbuf2=%u\n",(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end for */ @@ -1228,9 +1228,9 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1302,14 +1302,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) { + if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -1358,9 +1352,9 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM1; i++) @@ -1426,14 +1420,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) { + if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) TestErrPrintf("Error: hyperslab values don't match!\n"); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -1485,9 +1473,9 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM4; i++) @@ -1562,13 +1550,13 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) (k>=start[2] && k<(start[2]+count[2])) && (l>=start[3] && l<(start[3]+count[3])) ) { if(*tbuf!=*tbuf2) { - printf("Error: hyperslab values don't match!\n"); + HDprintf("Error: hyperslab values don't match!\n"); TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end if */ else { if(*tbuf2!=0) { - printf("Error: invalid data in read buffer!\n"); + HDprintf("Error: invalid data in read buffer!\n"); TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end else */ @@ -1729,9 +1717,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* Allocate buffers */ small_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), small_cube_size); - CHECK(small_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(small_cube_buf_1, "HDcalloc"); large_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), large_cube_size); - CHECK(large_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(large_cube_buf_1, "HDcalloc"); /* Create a dataset transfer property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -2336,7 +2324,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for writing values */ cube_buf = (uint16_t *)HDmalloc(sizeof(uint16_t) * max_cube_size); - CHECK(cube_buf, NULL, "HDmalloc"); + CHECK_PTR(cube_buf, "HDmalloc"); /* Initialize the cube buffer */ cube_ptr = cube_buf; @@ -2345,7 +2333,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for zeroing values on disk */ zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size); - CHECK(zero_buf, NULL, "HDcalloc"); + CHECK_PTR(zero_buf, "HDcalloc"); for(large_rank = 1; large_rank <= max_rank; large_rank++) { for(small_rank = 1; small_rank < large_rank; small_rank++) { @@ -2805,9 +2793,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* Allocate & initialize buffers */ small_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), small_cube_size); - CHECK(small_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(small_cube_buf_1, "HDcalloc"); large_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), large_cube_size); - CHECK(large_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(large_cube_buf_1, "HDcalloc"); /* Create a dataset transfer property list */ @@ -3531,13 +3519,13 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /**************************************************************** ** -** test_select_hyper_checker_board_dr(): Test H5S (dataspace) -** selection code with checkerboard source and target having +** test_select_hyper_checker_board_dr(): Test H5S (dataspace) +** selection code with checkerboard source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5S_shape_same in isolation, so now we try to do ** I/O. ** -** This is just an initial smoke check, so we will work +** This is just an initial smoke check, so we will work ** with a slice through a cube only. ** ****************************************************************/ @@ -3568,7 +3556,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for writing values */ cube_buf = (uint16_t *)HDmalloc(sizeof(uint16_t) * max_cube_size); - CHECK(cube_buf, NULL, "HDmalloc"); + CHECK_PTR(cube_buf, "HDmalloc"); /* Initialize the cube buffer */ cube_ptr = cube_buf; @@ -3577,7 +3565,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for zeroing values on disk */ zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size); - CHECK(zero_buf, NULL, "HDcalloc"); + CHECK_PTR(zero_buf, "HDcalloc"); for(large_rank = 1; large_rank <= max_rank; large_rank++) { for(small_rank = 1; small_rank < large_rank; small_rank++) { @@ -3645,11 +3633,11 @@ test_select_hyper_copy(void) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf2, NULL, "HDcalloc"); + CHECK_PTR(rbuf2, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3737,15 +3725,8 @@ test_select_hyper_copy(void) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) { + if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0; i<SPACE3_DIM1; i++) - for(j=0; j<SPACE3_DIM2; j++) - if((unsigned)*(rbuf+i*SPACE3_DIM2+j)!=(unsigned)*(rbuf2+i*SPACE3_DIM2+j)) - printf("i=%d, j=%d, *rbuf=%u, *rbuf2=%u\n",i,j,(unsigned)*(rbuf+i*SPACE3_DIM2+j),(unsigned)*(rbuf2+i*SPACE3_DIM2+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -3807,11 +3788,11 @@ test_select_point_copy(void) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf2, NULL, "HDcalloc"); + CHECK_PTR(rbuf2, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3985,9 +3966,9 @@ test_select_hyper_offset(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -4143,9 +4124,9 @@ test_select_hyper_offset2(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE7_DIM1 * SPACE7_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -4266,9 +4247,9 @@ test_select_point_offset(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -4446,9 +4427,9 @@ test_select_hyper_union(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5050,10 +5031,10 @@ test_select_hyper_union_stagger(void) /* Verify input data */ for(i=0; i<8; i++) { if(data[input_loc[i][0]][input_loc[i][1]]!=data_out[output_loc[i][0]][output_loc[i][1]]) { - printf("input data #%d is wrong!\n",i); - printf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]); - printf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]); - printf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]); + HDprintf("input data #%d is wrong!\n",i); + HDprintf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]); + HDprintf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]); + HDprintf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]); TestErrPrintf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]); } /* end if */ } /* end for */ @@ -5214,7 +5195,7 @@ test_select_hyper_union_3d(void) tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space); CHECK(tmp2_space, FAIL, "H5Scombin_select"); - npoints = H5Sget_select_npoints(tmp2_space); + npoints = (hsize_t)H5Sget_select_npoints(tmp2_space); VERIFY(npoints, 15*26, "H5Sget_select_npoints"); /* Create a dataset */ @@ -5313,9 +5294,9 @@ test_select_hyper_and_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5381,12 +5362,12 @@ test_select_hyper_and_2d(void) for(j=0; j<SPACE2_DIM2; j++, tbuf++) { if((i>=5 && i<=9) && (j>=5 && j<=9)) { if(*tbuf!=*tbuf2) - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); + HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) - printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); + HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ @@ -5442,9 +5423,9 @@ test_select_hyper_xor_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5512,12 +5493,12 @@ test_select_hyper_xor_2d(void) ((i>=5 && i<=9) && ((j>=0 && j<=4) || (j>=10 && j<=14))) || ((i>=10 && i<=14) && (j>=5 && j<=14))) { if(*tbuf!=*tbuf2) - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); + HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) - printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); + HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ @@ -5573,9 +5554,9 @@ test_select_hyper_notb_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5642,12 +5623,12 @@ test_select_hyper_notb_2d(void) if(((i>=0 && i<=4) && (j>=0 && j<=9)) || ((i>=5 && i<=9) && (j>=0 && j<=4))) { if(*tbuf!=*tbuf2) - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); + HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) - printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); + HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ @@ -5703,9 +5684,9 @@ test_select_hyper_nota_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5816,14 +5797,14 @@ test_select_hyper_iter2(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim if(*tbuf!=**tbuf2) { TestErrPrintf("Error in hyperslab iteration!\n"); - printf("location: { "); + HDprintf("location: { "); for(u=0; u<ndim; u++) { - printf("%2d",(int)point[u]); + HDprintf("%2d",(int)point[u]); if(u<(ndim-1)) - printf(", "); + HDprintf(", "); } /* end for */ - printf("}\n"); - printf("*tbuf=%d, **tbuf2=%d\n",*tbuf,**tbuf2); + HDprintf("}\n"); + HDprintf("*tbuf=%d, **tbuf2=%d\n",*tbuf,**tbuf2); return(-1); } /* end if */ else { @@ -5863,9 +5844,9 @@ test_select_hyper_union_random_5d(hid_t read_plist) /* Allocate write & read buffers */ wbuf = (int *)HDmalloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (int *)HDcalloc(sizeof(int), (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE5_DIM1; i++) @@ -5896,42 +5877,29 @@ test_select_hyper_union_random_5d(hid_t read_plist) CHECK(sid2, FAIL, "H5Screate_simple"); /* Get initial random # seed */ - seed=(unsigned)time(NULL)+(unsigned)clock(); + seed = (unsigned)HDtime(NULL) + (unsigned)HDclock(); /* Crunch through a bunch of random hyperslab reads from the file dataset */ for(test_num=0; test_num<NRAND_HYPER; test_num++) { /* Save random # seed for later use */ /* (Used in case of errors, to regenerate the hyperslab sequence) */ -#ifndef QAK - seed+=(unsigned)clock(); -#else /* QAK */ - seed=987909620; -#endif /* QAK */ + seed += (unsigned)HDclock(); HDsrandom(seed); -#ifdef QAK -printf("test_num=%d, seed=%u\n",test_num,seed); -#endif /* QAK */ -#ifndef QAK for(i=0; i<NHYPERSLABS; i++) { -#else /* QAK */ - for(i=0; i<2; i++) { -#endif /* QAK */ -#ifdef QAK -printf("hyperslab=%d\n",i); -#endif /* QAK */ /* Select random hyperslab location & size for selection */ for(j=0; j<SPACE5_RANK; j++) { start[j] = ((hsize_t)HDrandom() % dims1[j]); count[j] = (((hsize_t)HDrandom() % (dims1[j] - start[j])) + 1); -#ifdef QAK -printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[j],j,(int)(start[j]+count[j]-1)); -#endif /* QAK */ } /* end for */ /* Select hyperslab */ ret = H5Sselect_hyperslab(sid1, (i == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, NULL, count, NULL); CHECK(ret, FAIL, "H5Sselect_hyperslab"); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ } /* end for */ /* Get the number of elements selected */ @@ -5947,49 +5915,21 @@ printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[ npoints2 = H5Sget_select_npoints(sid2); VERIFY(npoints, npoints2, "H5Sget_select_npoints"); -#ifdef QAK -printf("random I/O, before H5Dread(), npoints=%lu\n",(unsigned long)npoints); -{ - hsize_t blocks[128][2][SPACE5_RANK]; - hssize_t nblocks; - int k; - - nblocks=H5Sget_select_hyper_nblocks(sid1); - printf("nblocks=%d\n",(int)nblocks); - H5Sget_select_hyper_blocklist(sid1,0,nblocks,blocks); - for(j=0; j<nblocks; j++) { - printf("Block #%d, start = {",j); - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][0][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}, end = {"); - } /* end for */ - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][1][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}\n"); - } /* end for */ - } /* end for */ -} -#endif /* QAK */ /* Read selection from disk */ ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf); CHECK(ret, FAIL, "H5Dread"); -#ifdef QAK -printf("random I/O, after H5Dread()\n"); -#endif /* QAK */ + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ /* Compare data read with data written out */ tbuf=rbuf; ret = H5Diterate(wbuf,H5T_NATIVE_INT,sid1,test_select_hyper_iter2,&tbuf); - if(ret<0) { - TestErrPrintf("Random hyperslabs for seed %u failed!\n",seed); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); break; - } + } /* end if */ /* Set the read buffer back to all zeroes */ HDmemset(rbuf, 0, (size_t)SPACE6_DIM1); @@ -6055,9 +5995,9 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) /* Allocate the transfer buffers */ data = (short *)HDmalloc(sizeof(short) * X * Y * Z); - CHECK(data, NULL, "HDmalloc"); + CHECK_PTR(data, "HDmalloc"); data_out = (short *)HDcalloc((size_t)(NX * NY * NZ), sizeof(short)); - CHECK(data_out, NULL, "HDcalloc"); + CHECK_PTR(data_out, "HDcalloc"); /* * Data buffer initialization. @@ -6276,9 +6216,6 @@ test_select_point_chunk(void) herr_t ret; /* Generic return value */ unsigned *data_out; /* output buffer */ -#ifdef LATER - unsigned *tmpdata_out; /* output buffer */ -#endif /* LATER */ hsize_t start[SPACE7_RANK]; /* hyperslab offset */ hsize_t count[SPACE7_RANK]; /* size of the hyperslab */ @@ -6290,9 +6227,9 @@ test_select_point_chunk(void) /* Allocate the transfer buffers */ data = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(data, NULL, "HDmalloc"); + CHECK_PTR(data, "HDmalloc"); data_out = (unsigned *)HDcalloc((size_t)(SPACE7_DIM1 * SPACE7_DIM2), sizeof(unsigned)); - CHECK(data_out, NULL, "HDcalloc"); + CHECK_PTR(data_out, "HDcalloc"); /* * Data buffer initialization. @@ -7051,7 +6988,7 @@ test_select_fill_all(void) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7127,7 +7064,7 @@ test_select_fill_point(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7180,8 +7117,8 @@ test_select_fill_point(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_points; u++) { - points[u][0] = (hsize_t)(points[u][0] + real_offset[0]); - points[u][1] = (hsize_t)(points[u][1] + real_offset[1]); + points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]); + points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7224,7 +7161,7 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7261,8 +7198,8 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Verify memory buffer the hard way... */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { - if((u >= (unsigned)(start[0] + real_offset[0]) && u < (unsigned)(start[0] + count[0] + real_offset[0])) - && (v >= (unsigned)(start[1] + real_offset[1]) && v < (unsigned)(start[1] + count[1] + real_offset[1]))) { + if((u >= (unsigned)((hssize_t)start[0] + real_offset[0]) && u < (unsigned)((hssize_t)(start[0] + count[0]) + real_offset[0])) + && (v >= (unsigned)((hssize_t)start[1] + real_offset[1]) && v < (unsigned)((hssize_t)(start[1] + count[1]) + real_offset[1]))) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); } /* end if */ @@ -7280,8 +7217,8 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Set the coordinates of the selection (with the offset) */ for(u = 0, num_points = 0; u < (unsigned)count[0]; u++) for(v = 0; v < (unsigned)count[1]; v++, num_points++) { - points[num_points][0] = (hsize_t)(u + start[0] + real_offset[0]); - points[num_points][1] = (hsize_t)(v + start[1] + real_offset[1]); + points[num_points][0] = (hsize_t)((hssize_t)(u + start[0]) + real_offset[0]); + points[num_points][1] = (hsize_t)((hssize_t)(v + start[1]) + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7331,7 +7268,7 @@ test_select_fill_hyper_regular(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7371,7 +7308,7 @@ test_select_fill_hyper_regular(hssize_t *offset) for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { for(w = 0; w < (unsigned)num_points; w++) { - if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) { + if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); break; @@ -7388,8 +7325,8 @@ test_select_fill_hyper_regular(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_points; u++) { - points[u][0] = (hsize_t)(points[u][0] + real_offset[0]); - points[u][1] = (hsize_t)(points[u][1] + real_offset[1]); + points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]); + points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7450,7 +7387,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7494,7 +7431,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { for(w = 0; w < (unsigned)num_points; w++) { - if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) { + if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); break; @@ -7511,8 +7448,8 @@ test_select_fill_hyper_irregular(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_iter_points; u++) { - iter_points[u][0] = (hsize_t)(iter_points[u][0] + real_offset[0]); - iter_points[u][1] = (hsize_t)(iter_points[u][1] + real_offset[1]); + iter_points[u][0] = (hsize_t)((hssize_t)iter_points[u][0] + real_offset[0]); + iter_points[u][1] = (hsize_t)((hssize_t)iter_points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7552,9 +7489,9 @@ test_select_none(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE7_DIM1 * SPACE7_DIM2); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -7655,9 +7592,9 @@ test_scalar_select(void) /* Allocate write & read buffers */ wbuf_uint8 = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf_uint8, NULL, "HDmalloc"); + CHECK_PTR(wbuf_uint8, "HDmalloc"); wbuf_ushort = (unsigned short *)HDmalloc(sizeof(unsigned short) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf_ushort, NULL, "HDmalloc"); + CHECK_PTR(wbuf_ushort, "HDmalloc"); /* Initialize write buffers */ for(i=0, tbuf_uint8=wbuf_uint8, tbuf_ushort=wbuf_ushort; i<SPACE7_DIM1; i++) @@ -8149,53 +8086,53 @@ test_shape_same(void) /* Compare "all" selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(all_sid,all_sid); + check = H5S_select_shape_same_test(all_sid,all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(all_sid,tmp_sid); + check = H5S_select_shape_same_test(all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(all_sid,none_sid); + check = H5S_select_shape_same_test(all_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(all_sid,single_pt_sid); + check = H5S_select_shape_same_test(all_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(all_sid,mult_pt_sid); + check = H5S_select_shape_same_test(all_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_sid); + check = H5S_select_shape_same_test(all_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(all_sid,single_hyper_all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(all_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(all_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(all_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,none_hyper_sid); + check = H5S_select_shape_same_test(all_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8208,53 +8145,53 @@ test_shape_same(void) /* Compare "none" selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(none_sid,none_sid); + check = H5S_select_shape_same_test(none_sid,none_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(none_sid); + tmp_sid = H5Scopy(none_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(none_sid,tmp_sid); + check = H5S_select_shape_same_test(none_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(none_sid,all_sid); + check = H5S_select_shape_same_test(none_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(none_sid,single_pt_sid); + check = H5S_select_shape_same_test(none_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(none_sid,mult_pt_sid); + check = H5S_select_shape_same_test(none_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_sid); + check = H5S_select_shape_same_test(none_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(none_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(none_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(none_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(none_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,none_hyper_sid); + check = H5S_select_shape_same_test(none_sid,none_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8267,49 +8204,49 @@ test_shape_same(void) /* Compare single point selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_pt_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_pt_sid); + tmp_sid = H5Scopy(single_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_pt_sid,tmp_sid); + check = H5S_select_shape_same_test(single_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_pt_sid,all_sid); + check = H5S_select_shape_same_test(single_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_pt_sid,none_sid); + check = H5S_select_shape_same_test(single_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_pt_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_pt_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_hyper_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(single_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ @@ -8326,53 +8263,53 @@ test_shape_same(void) /* Compare multiple point selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(mult_pt_sid,mult_pt_sid); + check = H5S_select_shape_same_test(mult_pt_sid,mult_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(mult_pt_sid); + tmp_sid = H5Scopy(mult_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(mult_pt_sid,tmp_sid); + check = H5S_select_shape_same_test(mult_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(mult_pt_sid,all_sid); + check = H5S_select_shape_same_test(mult_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(mult_pt_sid,none_sid); + check = H5S_select_shape_same_test(mult_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_pt_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,none_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8385,45 +8322,45 @@ test_shape_same(void) /* Compare single "normal" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_sid); + tmp_sid = H5Scopy(single_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_sid,all_sid); + check = H5S_select_shape_same_test(single_hyper_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_sid,none_sid); + check = H5S_select_shape_same_test(single_hyper_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_hyper_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ @@ -8431,7 +8368,7 @@ test_shape_same(void) VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,none_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); #ifdef NOT_YET @@ -8449,14 +8386,15 @@ test_shape_same(void) /* Select sequence of points for point selection */ for(u=1; u<(SPACE9_DIM1-1); u++) { for(v=1; v<(SPACE9_DIM2-1); v++) { - coord2[v-1][0]=u; coord2[v-1][1]=v; + coord2[v - 1][0] = u; + coord2[v - 1][1] = v; } /* end for */ ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,(SPACE9_DIM2-2),coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8483,7 +8421,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8499,53 +8437,53 @@ test_shape_same(void) /* Compare single "all" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_all_sid); + tmp_sid = H5Scopy(single_hyper_all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,all_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,none_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,none_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); #ifdef NOT_YET @@ -8563,14 +8501,15 @@ test_shape_same(void) /* Select sequence of points for point selection */ for(u=0; u<SPACE9_DIM1; u++) { for(v=0; v<SPACE9_DIM2; v++) { - coord2[v][0]=u; coord2[v][1]=v; + coord2[v][0] = u; + coord2[v][1] = v; } /* end for */ ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,SPACE9_DIM2,coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8597,7 +8536,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8613,53 +8552,53 @@ test_shape_same(void) /* Compare single "point" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_pt_sid); + tmp_sid = H5Scopy(single_hyper_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_pt_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,all_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,none_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,none_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8672,53 +8611,53 @@ test_shape_same(void) /* Compare regular, strided hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(regular_hyper_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,regular_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(regular_hyper_sid); + tmp_sid = H5Scopy(regular_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,all_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_pt_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,mult_pt_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Construct point selection which matches regular, strided hyperslab selection */ @@ -8727,16 +8666,17 @@ test_shape_same(void) CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select sequence of points for point selection */ - for(u=2; u<11; u+=2) { - for(v=0; v<2; v++) { - coord2[v][0]=u; coord2[v][1]=(v*2)+2; + for(u = 2; u < 11; u += 2) { + for(v = 0; v < 2; v++) { + coord2[v][0] = u; + coord2[v][1] = (v * 2) + 2; } /* end for */ ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (size_t)2, (const hsize_t *)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8752,17 +8692,17 @@ test_shape_same(void) CHECK(ret, FAIL, "H5Sselect_none"); /* Select sequence of rows for hyperslab selection */ - for(u=2; u<11; u+=2) { - start[0]=u; start[1]=3; - stride[0]=1; stride[1]=2; - count[0]=1; count[1]=2; - block[0]=1; block[1]=1; + for(u = 2; u < 11; u += 2) { + start[0] = u; start[1] = 3; + stride[0] = 1; stride[1] = 2; + count[0] = 1; count[1] = 2; + block[0] = 1; block[1] = 1; ret = H5Sselect_hyperslab(tmp_sid,H5S_SELECT_OR,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8774,15 +8714,15 @@ test_shape_same(void) CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select regular, strided hyperslab selection at an offset */ - start[0]=1; start[1]=1; - stride[0]=2; stride[1]=2; - count[0]=5; count[1]=2; - block[0]=1; block[1]=1; + start[0] = 1; start[1] = 1; + stride[0] = 2; stride[1] = 2; + count[0] = 5; count[1] = 2; + block[0] = 1; block[1] = 1; ret = H5Sselect_hyperslab(tmp_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8798,53 +8738,53 @@ test_shape_same(void) /* Compare irregular hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(irreg_hyper_sid); + tmp_sid = H5Scopy(irreg_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,all_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_pt_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,mult_pt_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Construct hyperslab selection which matches irregular hyperslab selection */ @@ -8870,7 +8810,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -9036,28 +8976,28 @@ test_shape_same(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_1(): +** test_shape_same_dr__smoke_check_1(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2-D dataspace (10 X 10), and select ** all of it. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select (10 X 10 X 1) hyper slabs in each, three with -** the slab parallel to the xy plane, three parallel to the +** Similarly, create nine, 3-D dataspaces (10 X 10 X 10), +** and select (10 X 10 X 1) hyper slabs in each, three with +** the slab parallel to the xy plane, three parallel to the ** xz plane, and three parallel to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the full 2 D space against any hyperslab parallel to the -** yz plane in the 3 D space, and FALSE when comparing the -** full 2 D space against the other two hyper slabs. +** Assuming that z is the fastest changing dimension, +** H5Sselect_shape_same() should return TRUE when comparing +** the full 2-D space against any hyperslab parallel to the +** yz plane in the 3-D space, and FALSE when comparing the +** full 2-D space against the other two hyperslabs. ** -** Also create two additional 3 D data spaces (10 X 10 X 10), -** and select a (10 X 10 X 2) hyper slab parallel to the yz -** axis in one of them, and two parallel (10 X 10 X 1) hyper -** slabs parallel to the yz axis in the other. -** H5S_select_shape_same() should return FALSE when comparing -** each to the 2 D selection. +** Also create two additional 3-D dataspaces (10 X 10 X 10), +** and select a (10 X 10 X 2) hyper slab parallel to the yz +** axis in one of them, and two parallel (10 X 10 X 1) hyper +** slabs parallel to the yz axis in the other. +** H5Sselect_shape_same() should return FALSE when comparing +** each to the 2-D selection. ** ****************************************************************/ static void @@ -9327,9 +9267,9 @@ test_shape_same_dr__smoke_check_1(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_2(): +** test_shape_same_dr__smoke_check_2(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2-D dataspace (10 X 10), and select ** a "checker board" hyper slab as follows: ** ** * * - - * * - - * * @@ -9343,28 +9283,28 @@ test_shape_same_dr__smoke_check_1(void) ** * * - - * * - - * * ** * * - - * * - - * * ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar (10 X 10 X 1) checker board hyper -** slabs in each, three with the slab parallel to the xy -** plane, three parallel to the xz plane, and three parallel +** Similarly, create nine, 3-D dataspaces (10 X 10 X 10), +** and select similar (10 X 10 X 1) checker board hyper +** slabs in each, three with the slab parallel to the xy +** plane, three parallel to the xz plane, and three parallel ** to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the 2 D space checker board selection against a checker -** board hyperslab parallel to the yz plane in the 3 D -** space, and FALSE when comparing the 2 D checkerboard -** selection against two hyper slabs parallel to the xy +** Assuming that z is the fastest changing dimension, +** H5Sselect_shape_same() should return TRUE when comparing +** the 2-D space checker board selection against a checker +** board hyperslab parallel to the yz plane in the 3-D +** space, and FALSE when comparing the 2-D checkerboard +** selection against two hyper slabs parallel to the xy ** or xz planes. ** -** Also create an additional 3 D data spaces (10 X 10 X 10), -** and select a checker board parallel with the yz axis, -** save with some squares being on different planes. -** H5S_select_shape_same() should return FALSE when -** comparing this selection to the 2 D selection. +** Also create an additional 3-D dataspaces (10 X 10 X 10), +** and select a checker board parallel with the yz axis, +** save with some squares being on different planes. +** H5Sselect_shape_same() should return FALSE when +** comparing this selection to the 2-D selection. ** ****************************************************************/ static void @@ -9646,7 +9586,7 @@ test_shape_same_dr__smoke_check_2(void) start[0] = 4; /* This test gets the right answer, but it fails the shape same - * test in an unexpected point. Bring this up with Quincey, as + * test in an unexpected point. Bring this up with Quincey, as * the oddness looks like it is not related to my code. * -- JRM */ @@ -9735,9 +9675,9 @@ test_shape_same_dr__smoke_check_2(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_3(): +** test_shape_same_dr__smoke_check_3(): ** -** Create a square, 2 D data space (10 X 10), and select an +** Create a square, 2-D dataspace (10 X 10), and select an ** irregular hyper slab as follows: ** ** y @@ -9753,22 +9693,22 @@ test_shape_same_dr__smoke_check_2(void) ** 0 - - - - - - - - - - ** 0 1 2 3 4 5 6 7 8 9 x ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar irregular hyper slabs in each, three -** with the slab parallel to the xy plane, three parallel -** to the xz plane, and three parallel to the yz plane. -** Further, translate the irregular slab in 2/3rds of the +** Similarly, create nine, 3-D dataspaces (10 X 10 X 10), +** and select similar irregular hyper slabs in each, three +** with the slab parallel to the xy plane, three parallel +** to the xz plane, and three parallel to the yz plane. +** Further, translate the irregular slab in 2/3rds of the ** cases. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when -** comparing the 2 D irregular hyperslab selection -** against the irregular hyperslab selections parallel -** to the yz plane in the 3 D space, and FALSE when -** comparing it against the irregular hyper slabs +** Assuming that z is the fastest changing dimension, +** H5Sselect_shape_same() should return TRUE when +** comparing the 2-D irregular hyperslab selection +** against the irregular hyperslab selections parallel +** to the yz plane in the 3-D space, and FALSE when +** comparing it against the irregular hyper slabs ** selections parallel to the xy or xz planes. ** ****************************************************************/ @@ -10252,12 +10192,12 @@ test_shape_same_dr__smoke_check_3(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_4(): +** test_shape_same_dr__smoke_check_4(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2-D dataspace (10 X 10), and select ** the entire space. ** -** Similarly, create 3 D and 4 D data spaces: +** Similarly, create 3-D and 4-D dataspaces: ** ** (1 X 10 X 10) ** (10 X 1 X 10) @@ -10274,8 +10214,8 @@ test_shape_same_dr__smoke_check_3(void) ** ** And select these entire spaces as well. ** -** Compare the 2 D space against all the other spaces -** with H5S_select_shape_same(). The (1 X 10 X 10) & +** Compare the 2-D space against all the other spaces +** with H5Sselect_shape_same(). The (1 X 10 X 10) & ** (1 X 1 X 10 X 10) should return TRUE. All others ** should return FALSE. ** @@ -10472,12 +10412,12 @@ test_shape_same_dr__smoke_check_4(void) /**************************************************************** ** ** test_shape_same_dr__full_space_vs_slice(): Tests selection -** of a full n-cube data space vs an n-dimensional slice of -** of an m-cube (m > n) in a call to H5S_select_shape_same(). -** Note that this test does not require the n-cube and the +** of a full n-cube data space vs an n-dimensional slice of +** of an m-cube (m > n) in a call to H5Sselect_shape_same(). +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5Sselect_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10493,7 +10433,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; hid_t n_cube_0_sid; /* the fully selected hyper cube */ hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */ @@ -10514,16 +10454,16 @@ test_shape_same_dr__full_space_vs_slice(int test_num, HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 <= offset ); HDassert( offset < large_rank ); - HDassert( edge_size > 0 ); - HDassert( edge_size <= 1000 ); + HDassert( edge_size > 0 ); + HDassert( edge_size <= 1000 ); - sprintf(test_desc_0, - "\tn-cube slice through m-cube (n <= m) test %d.\n", + HDsprintf(test_desc_0, + "\tn-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + HDsprintf(test_desc_1, "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank, large_rank, offset, (int)dim_selected[0], @@ -10604,27 +10544,27 @@ test_shape_same_dr__full_space_vs_slice(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_full_space_vs_slice_tests(): +** test_shape_same_dr__run_full_space_vs_slice_tests(): ** -** Run the est_shape_same_dr__full_space_vs_slice() test +** Run the test_shape_same_dr__full_space_vs_slice() test ** over a variety of ranks and offsets. ** -** At present, we test H5S_select_shape_same() with +** At present, we test H5Sselect_shape_same() with ** fully selected 1, 2, 3, and 4 cubes as one parameter, and ** 1, 2, 3, and 4 dimensional slices through a n-cube of rank -** no more than 5 (and at least the rank of the slice). -** We stop at rank 5, as Quincey suggested that it would be +** no more than 5 (and at least the rank of the slice). +** We stop at rank 5, as Quincey suggested that it would be ** sufficient. ** -** All the n-cubes will have lengths of the same size, so -** H5S_select_shape_same() should return true iff: +** All the n-cubes will have lengths of the same size, so +** H5Sselect_shape_same() should return true iff: ** -** 1) the rank for the fully selected n cube equals the +** 1) the rank for the fully selected n cube equals the ** number of dimensions selected in the slice through the ** m-cube (m >= n). ** ** 2) The dimensions selected in the slice through the m-cube -** are the dimesnions with the most quickly changing +** are the dimesnions with the most quickly changing ** indices. ** ****************************************************************/ @@ -10730,7 +10670,7 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) dim_selected, expected_result ); - + z++; } while((z < 2) && (large_rank >= 1)); @@ -10753,15 +10693,15 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) /**************************************************************** ** -** test_shape_same_dr__checkerboard(): Tests selection of a -** "checker board" subset of a full n-cube data space vs +** test_shape_same_dr__checkerboard(): Tests selection of a +** "checker board" subset of a full n-cube data space vs ** a "checker board" n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10778,14 +10718,14 @@ test_shape_same_dr__checkerboard(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; int dims_selected = 0; - hid_t n_cube_0_sid; /* the checker board selected - * hyper cube + hid_t n_cube_0_sid; /* the checker board selected + * hyper cube */ - hid_t n_cube_1_sid; /* the hyper cube in which a - * checkerboard slice is selected + hid_t n_cube_1_sid; /* the hyper cube in which a + * checkerboard slice is selected */ hsize_t dims[SS_DR_MAX_RANK]; hsize_t base_start[2]; @@ -10807,8 +10747,8 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 < checker_size ); - HDassert( checker_size <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( checker_size <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= offset ); HDassert( offset < (int)edge_size ); @@ -10819,13 +10759,13 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", + HDsprintf(test_desc_0, + "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + HDsprintf(test_desc_1, "\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, (int)edge_size, (int)checker_size, @@ -10865,17 +10805,17 @@ test_shape_same_dr__checkerboard(int test_num, * * * - - * * - - * * * * * - - * * - - * * * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * 3-D and 4-D ascii art is somewhat painful, so I'll * leave those selections to your imagination. :-) * * Note, that since the edge_size and checker_size are - * parameters that are passed in, the selection need + * parameters that are passed in, the selection need * not look exactly like the selection shown above. - * At present, the function allows checker sizes that - * are not even divisors of the edge size -- thus + * At present, the function allows checker sizes that + * are not even divisors of the edge size -- thus * something like the following is also possible: * * * * * - - - * * * - @@ -10889,14 +10829,14 @@ test_shape_same_dr__checkerboard(int test_num, * * * * - - - * * * - * - - - * * * - - - * * - * As the above pattern can't be selected in one + * As the above pattern can't be selected in one * call to H5Sselect_hyperslab(), and since the * values in the start, stride, count, and block - * arrays will be repeated over all entries in + * arrays will be repeated over all entries in * the selected space case, and over all selected * dimensions in the selected hyperslab case, we - * compute these values first and store them in - * in the base_start, base_stride, base_count, + * compute these values first and store them in + * in the base_start, base_stride, base_count, * and base_block arrays. */ @@ -10906,9 +10846,9 @@ test_shape_same_dr__checkerboard(int test_num, base_stride[0] = 2 * checker_size; base_stride[1] = 2 * checker_size; - /* Note that the following computation depends on the C99 - * requirement that integer division discard any fraction - * (truncation towards zero) to function correctly. As we + /* Note that the following computation depends on the C99 + * requirement that integer division discard any fraction + * (truncation towards zero) to function correctly. As we * now require C99, this shouldn't be a problem, but noting * it may save us some pain if we are ever obliged to support * pre-C99 compilers again. @@ -10925,7 +10865,7 @@ test_shape_same_dr__checkerboard(int test_num, base_block[0] = checker_size; base_block[1] = checker_size; - /* now setup start, stride, count, and block arrays for + /* now setup start, stride, count, and block arrays for * the first call to H5Sselect_hyperslab(). */ for(i = 0; i < SS_DR_MAX_RANK; i++) { @@ -10939,10 +10879,10 @@ test_shape_same_dr__checkerboard(int test_num, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* if small_rank == 1, or if edge_size == checker_size, we + /* if small_rank == 1, or if edge_size == checker_size, we * are done, as either there is no added dimension in which * to place offset selected "checkers". - * + * * Otherwise, set up start, stride, count and block, and * make the additional selection. */ @@ -10962,7 +10902,7 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * - * Some how, it seems that selections can extend beyond the + * Some how, it seems that selections can extend beyond the * boundaries of the target data space -- hence the following * code to manually clip the selection back to the data space * proper. @@ -10985,8 +10925,8 @@ test_shape_same_dr__checkerboard(int test_num, /* Now select the checkerboard selection in the (possibly larger) n-cube. - * - * Since we have already calculated the base start, stride, count, + * + * Since we have already calculated the base start, stride, count, * and block, re-use the values in setting up start, stride, count, * and block. */ @@ -11030,10 +10970,10 @@ test_shape_same_dr__checkerboard(int test_num, start_ptr, stride_ptr, count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* As before, if the number of dimensions selected is less than or - * equal to 1, or if edge_size == checker_size, we are done, as - * either there is no added dimension in which to place offset selected - * "checkers", or the hyperslab is completely occupied by one + /* As before, if the number of dimensions selected is less than or + * equal to 1, or if edge_size == checker_size, we are done, as + * either there is no added dimension in which to place offset selected + * "checkers", or the hyperslab is completely occupied by one * "checker". * * Otherwise, set up start, stride, count and block, and @@ -11096,23 +11036,23 @@ test_shape_same_dr__checkerboard(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_checkerboard_tests(): +** test_shape_same_dr__run_checkerboard_tests(): ** -** In this set of tests, we test H5S_select_shape_same() -** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as -** one parameter, and 1, 2, 3, and 4 dimensional checkerboard -** slices through a n-cube of rank no more than 5 (and at -** least the rank of the slice). +** In this set of tests, we test H5S_select_shape_same() +** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as +** one parameter, and 1, 2, 3, and 4 dimensional checkerboard +** slices through a n-cube of rank no more than 5 (and at +** least the rank of the slice). ** -** All the n-cubes will have lengths of the same size, so +** All the n-cubes will have lengths of the same size, so ** H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the checker board slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the checker board slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the checkerboard slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the checkerboard slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11163,7 +11103,7 @@ test_shape_same_dr__run_checkerboard_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11367,17 +11307,17 @@ test_shape_same_dr__run_checkerboard_tests(void) /**************************************************************** ** -** test_shape_same_dr__irregular(): +** test_shape_same_dr__irregular(): ** -** Tests selection of an "irregular" subset of a full +** Tests selection of an "irregular" subset of a full ** n-cube data space vs an identical "irregular" subset ** of an n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ****************************************************************/ static void @@ -11390,7 +11330,7 @@ test_shape_same_dr__irregular(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int edge_size = 10; int i; int j; @@ -11399,7 +11339,7 @@ test_shape_same_dr__irregular(int test_num, hid_t n_cube_0_sid; /* the hyper cube containing * an irregular selection */ - hid_t n_cube_1_sid; /* the hyper cube in which a + hid_t n_cube_1_sid; /* the hyper cube in which a * slice contains an irregular * selection. */ @@ -11435,7 +11375,7 @@ test_shape_same_dr__irregular(int test_num, hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t *(starts[SS_DR_MAX_RANK]) = + hsize_t *(starts[SS_DR_MAX_RANK]) = {start_0, start_1, start_2, start_3, start_4}; hsize_t *(strides[SS_DR_MAX_RANK]) = {stride_0, stride_1, stride_2, stride_3, stride_4}; @@ -11458,8 +11398,8 @@ test_shape_same_dr__irregular(int test_num, HDassert( 0 < small_rank ); HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); - HDassert( 9 <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( 9 <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= slice_offset ); HDassert( slice_offset < edge_size ); HDassert( -2 <= pattern_offset ); @@ -11472,16 +11412,16 @@ test_shape_same_dr__irregular(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", + HDsprintf(test_desc_0, + "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + HDsprintf(test_desc_1, "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, - edge_size, + edge_size, slice_offset, pattern_offset, (int)dim_selected[0], (int)dim_selected[1], @@ -11500,11 +11440,11 @@ test_shape_same_dr__irregular(int test_num, CHECK(n_cube_0_sid, FAIL, "H5Screate_simple"); /* Select an "irregular" pattern in the small n-cube. This - * pattern can be though of a set of four 3 x 2 x 2 X 2 - * four dimensional prisims, each parallel to one of the - * axies and none of them intersecting with the other. + * pattern can be though of a set of four 3 x 2 x 2 X 2 + * four dimensional prisims, each parallel to one of the + * axies and none of them intersecting with the other. * - * In the lesser dimensional cases, this 4D pattern is + * In the lesser dimensional cases, this 4D pattern is * projected onto the lower dimensional space. * * In the 1-D case, the projection of the pattern looks @@ -11529,12 +11469,12 @@ test_shape_same_dr__irregular(int test_num, * 0 - - - - - - - - - - * 0 1 2 3 4 5 6 7 8 9 x * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * Note that is this case, since the edge size is fixed, - * the pattern does not change. However, we do use the - * displacement parameter to allow it to be moved around + * the pattern does not change. However, we do use the + * displacement parameter to allow it to be moved around * within the n-cube or hyper slab. */ @@ -11549,7 +11489,7 @@ test_shape_same_dr__irregular(int test_num, CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ - /* finally, clip the selection to ensure that it lies fully + /* finally, clip the selection to ensure that it lies fully * within the n-cube. */ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND, @@ -11588,8 +11528,8 @@ test_shape_same_dr__irregular(int test_num, /* Now select the irregular selection in the (possibly larger) n-cube. - * - * Basic idea is to project the pattern used in the smaller n-cube + * + * Basic idea is to project the pattern used in the smaller n-cube * onto the dimensions selected in the larger n-cube, with the displacement * specified. */ @@ -11642,7 +11582,7 @@ test_shape_same_dr__irregular(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_irregular_tests(): +** test_shape_same_dr__run_irregular_tests(): ** ** In this set of tests, we test H5S_select_shape_same() ** with an "irregular" subselection of 1, 2, 3, and 4 cubes as @@ -11655,12 +11595,12 @@ test_shape_same_dr__irregular(int test_num, ** All the irregular selections will be identical (modulo rank) ** so H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the irregular slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the irregular slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the irregular slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the irregular slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11711,7 +11651,7 @@ test_shape_same_dr__run_irregular_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11857,8 +11797,8 @@ test_shape_same_dr__run_irregular_tests(void) /**************************************************************** ** -** test_shape_same_dr(): Tests selections on dataspace with -** different ranks, to verify that "shape same" routine +** test_shape_same_dr(): Tests selections on dataspace with +** different ranks, to verify that "shape same" routine ** is now handling this case correctly. ** ****************************************************************/ @@ -12576,9 +12516,9 @@ test_select_hyper_chunk_offset(void) /* Allocate buffers */ wbuf = (int *)HDmalloc(sizeof(int) * SPACE10_DIM1); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (int *)HDcalloc(sizeof(int), SPACE10_DIM1); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize the write buffer */ for(i=0; i<SPACE10_DIM1; i++) @@ -13066,6 +13006,7 @@ test_select_bounds(void) CHECK(ret, FAIL, "H5Sclose"); } /* test_select_bounds() */ + /**************************************************************** ** ** test_select(): Main H5S selection testing routine. @@ -13240,13 +13181,11 @@ test_select(void) * Programmer: Albert Cheng * July 2, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ void cleanup_select(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/tskiplist.c b/test/tskiplist.c index 1adcd4b..2806afe 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -29,9 +29,6 @@ 11/15/04 - Started coding */ -#include <time.h> -#include <stdlib.h> - #include "testhdf5.h" #include "H5SLprivate.h" @@ -39,9 +36,9 @@ #define NUM_ELEMS 1000 /* Random numbers */ -static int rand_num[NUM_ELEMS]; -static int sort_rand_num[NUM_ELEMS]; -static int rev_sort_rand_num[NUM_ELEMS]; +static int *rand_num; +static int *sort_rand_num; +static int *rev_sort_rand_num; static int tst_sort(const void *i1, const void *i2) { @@ -67,23 +64,31 @@ test_skiplist_init(void) unsigned found; /* Flag to indicate value was inserted already */ size_t u,v; /* Local index variables */ + /* Allocate arrays */ + rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); + CHECK_PTR(rand_num, "HDmalloc"); + sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); + CHECK_PTR(sort_rand_num, "HDmalloc"); + rev_sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); + CHECK_PTR(rev_sort_rand_num, "HDmalloc"); + /* Initialize random number seed */ curr_time = HDtime(NULL); HDsrandom((unsigned)curr_time); /* Create randomized set of numbers */ - for(u=0; u<NUM_ELEMS; u++) { + for(u = 0; u < NUM_ELEMS; u++) { do { /* Reset flag */ - found=0; + found = 0; /* Generate random numbers from -5000 to 5000 */ - new_val=(int)(HDrandom()%10001)-5001; + new_val = (int)(HDrandom() % 10001) - 5001; /* Check if the value is already in the array */ - for(v=0; v<u; v++) - if(rand_num[v]==new_val) - found=1; + for(v = 0; v < u; v++) + if(rand_num[v] == new_val) + found = 1; } while(found); /* Set unique value in array */ @@ -91,7 +96,7 @@ test_skiplist_init(void) } /* end for */ /* Copy random values to sorted array */ - HDmemcpy(sort_rand_num,rand_num,sizeof(int)*NUM_ELEMS); + HDmemcpy(sort_rand_num, rand_num, sizeof(int) * NUM_ELEMS); /* Sort random numbers */ HDqsort(sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_sort); @@ -101,7 +106,7 @@ test_skiplist_init(void) /* Sort random numbers */ HDqsort(rev_sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_rev_sort); -} /* end test_tst_init() */ +} /* end test_skiplist_init() */ /**************************************************************** ** @@ -120,7 +125,7 @@ test_skiplist_create(void) /* Try creating a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Try closing the skip list */ ret=H5SL_close(slist); @@ -150,7 +155,7 @@ test_skiplist_insert(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -159,7 +164,7 @@ test_skiplist_insert(void) /* Try searching for item in empty skip list */ key=37; found_item=(int *)H5SL_search(slist,&key); - VERIFY(found_item, NULL, "H5SL_search"); + CHECK_PTR_NULL(found_item, "H5SL_search"); /* Insert an object into the skip list */ key=2; item=10; @@ -172,13 +177,13 @@ test_skiplist_insert(void) /* Search for the item just inserted */ found_item=(int *)H5SL_search(slist,&key); - CHECK(found_item, NULL, "H5SL_search"); - VERIFY(*found_item,item,"H5SL_search"); + CHECK_PTR(found_item, "H5SL_search"); + VERIFY(*found_item, item, "H5SL_search"); /* Search for an item not in list */ search_key=37; found_item=(int *)H5SL_search(slist,&search_key); - VERIFY(found_item, NULL, "H5SL_search"); + CHECK_PTR_NULL(found_item, "H5SL_search"); /* Attempt to insert duplicate key (should fail) */ search_key=2; @@ -211,7 +216,7 @@ test_skiplist_insert_many(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -230,7 +235,7 @@ test_skiplist_insert_many(void) /* Search for all objects in the skip list */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_search(slist,&rand_num[u]); - CHECK(found_item, NULL, "H5SL_search"); + CHECK_PTR(found_item, "H5SL_search"); VERIFY(*found_item,rand_num[u],"H5SL_search"); } /* end for */ @@ -285,7 +290,7 @@ test_skiplist_remove(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -294,7 +299,7 @@ test_skiplist_remove(void) /* Try removing an item in empty skip list */ search_key=37; found_item=(int *)H5SL_remove(slist,&search_key); - VERIFY(found_item, NULL, "H5SL_remove"); + CHECK_PTR_NULL(found_item, "H5SL_remove"); /* Insert three objects into the skip list */ key1=15; @@ -316,18 +321,18 @@ test_skiplist_remove(void) /* Try removing items from skip list */ search_key=key1; found_item=(int *)H5SL_remove(slist,&search_key); - CHECK(found_item, NULL, "H5SL_remove"); - VERIFY(found_item, &key1, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); + CHECK_PTR_EQ(found_item, &key1, "H5SL_remove"); search_key=key2; found_item=(int *)H5SL_remove(slist,&search_key); - CHECK(found_item, NULL, "H5SL_remove"); - VERIFY(found_item, &key2, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); + CHECK_PTR_EQ(found_item, &key2, "H5SL_remove"); search_key=key3; found_item=(int *)H5SL_remove(slist,&search_key); - CHECK(found_item, NULL, "H5SL_remove"); - VERIFY(found_item, &key3, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); + CHECK_PTR_EQ(found_item, &key3, "H5SL_remove"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -336,7 +341,7 @@ test_skiplist_remove(void) /* Try removing items from empty skip list (after its been worked on) */ search_key=key1; found_item=(int *)H5SL_remove(slist,&search_key); - VERIFY(found_item, NULL, "H5SL_remove"); + CHECK_PTR_NULL(found_item, "H5SL_remove"); /* Close the skip list */ ret=H5SL_close(slist); @@ -364,7 +369,7 @@ test_skiplist_remove_many(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -383,7 +388,7 @@ test_skiplist_remove_many(void) /* Remove all objects from the skip list (in random order) */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_remove(slist,&rand_num[u]); - CHECK(found_item, NULL, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); VERIFY(*found_item,rand_num[u],"H5SL_remove"); } /* end for */ @@ -406,7 +411,7 @@ test_skiplist_remove_many(void) /* Remove all objects from the skip list */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_remove(slist,&sort_rand_num[u]); - CHECK(found_item, NULL, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); VERIFY(*found_item,sort_rand_num[u],"H5SL_remove"); } /* end for */ @@ -429,7 +434,7 @@ test_skiplist_remove_many(void) /* Remove all objects from the skip list */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_remove(slist,&rev_sort_rand_num[u]); - CHECK(found_item, NULL, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); VERIFY(*found_item,rev_sort_rand_num[u],"H5SL_remove"); } /* end for */ @@ -464,7 +469,7 @@ test_skiplist_firstnext(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -472,7 +477,7 @@ test_skiplist_firstnext(void) VERIFY(num, 0, "H5SL_count"); /* Check that the list appears empty */ node=H5SL_first(slist); - VERIFY(node, NULL, "H5SL_first"); + CHECK_PTR_NULL(node, "H5SL_first"); /* Insert many objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -486,7 +491,7 @@ test_skiplist_firstnext(void) /* Iterate over all the nodes in the skip list */ node=H5SL_first(slist); - CHECK(node, NULL, "H5SL_first"); + CHECK_PTR(node, "H5SL_first"); u=0; while(node!=NULL) { found_item=(int *)H5SL_item(node); @@ -501,7 +506,7 @@ test_skiplist_firstnext(void) /* Check that the list appears empty again */ node=H5SL_first(slist); - VERIFY(node, NULL, "H5SL_first"); + CHECK_PTR_NULL(node, "H5SL_first"); /* Close the skip list */ ret=H5SL_close(slist); @@ -557,7 +562,7 @@ test_skiplist_string(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_STR, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -619,7 +624,7 @@ test_skiplist_iterate(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -669,7 +674,7 @@ test_skiplist_hsize(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_HSIZE, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -724,7 +729,7 @@ test_skiplist_unsigned(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -779,7 +784,7 @@ test_skiplist_obj(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_OBJ, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -857,7 +862,7 @@ test_skiplist_generic(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_GENERIC, test_skiplist_generic_cmp); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -911,7 +916,7 @@ test_skiplist_lastprev(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -919,7 +924,7 @@ test_skiplist_lastprev(void) /* Check that the list appears empty */ node=H5SL_last(slist); - VERIFY(node, NULL, "H5SL_last"); + CHECK_PTR_NULL(node, "H5SL_last"); /* Insert many objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -933,7 +938,7 @@ test_skiplist_lastprev(void) /* Iterate over all the nodes in the skip list */ node=H5SL_last(slist); - CHECK(node, NULL, "H5SL_last"); + CHECK_PTR(node, "H5SL_last"); u=NUM_ELEMS-1; while(node!=NULL) { found_item=(int *)H5SL_item(node); @@ -948,7 +953,7 @@ test_skiplist_lastprev(void) /* Check that the list appears empty again */ node=H5SL_last(slist); - VERIFY(node, NULL, "H5SL_last"); + CHECK_PTR_NULL(node, "H5SL_last"); /* Close the skip list */ ret=H5SL_close(slist); @@ -979,7 +984,7 @@ test_skiplist_find(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<10; u++) { @@ -990,7 +995,7 @@ test_skiplist_find(void) /* Find the element with key==30 in the skip list */ find_item=30; node=H5SL_find(slist,&find_item); - CHECK(node, NULL, "H5SL_find"); + CHECK_PTR(node, "H5SL_find"); /* Iterate over the rest of the nodes in the skip list */ u=4; @@ -1004,7 +1009,7 @@ test_skiplist_find(void) /* Check for trying to locate non-existent item */ find_item=81; node=H5SL_find(slist,&find_item); - VERIFY(node, NULL, "H5SL_find"); + CHECK_PTR_NULL(node, "H5SL_find"); /* Close the skip list */ ret=H5SL_close(slist); @@ -1035,7 +1040,7 @@ test_skiplist_add(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<10; u++) { @@ -1046,11 +1051,11 @@ test_skiplist_add(void) /* Add the element with key==12 in the skip list */ new_item=12; node=H5SL_add(slist,&new_item,&new_item); - CHECK(node, NULL, "H5SL_add"); + CHECK_PTR(node, "H5SL_add"); /* Advance to next node in list */ node=H5SL_next(node); - CHECK(node, NULL, "H5SL_next"); + CHECK_PTR(node, "H5SL_next"); /* Iterate over the rest of the nodes in the skip list */ u=2; @@ -1097,7 +1102,7 @@ test_skiplist_destroy(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -1133,7 +1138,7 @@ test_skiplist_free(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -1205,8 +1210,8 @@ static herr_t test_tfs_iter(void *_obj, void *key, void *_udata) { test_tfs_it_ud_t *udata = (test_tfs_it_ud_t *)_udata; /* Check consistency */ - VERIFY((void *)&obj->idx, key, "obj->idx"); - VERIFY(obj, &udata->obj_list->list[obj->idx], "obj_list->list[obj->idx]"); + CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx"); + CHECK_PTR_EQ(obj, &udata->obj_list->list[obj->idx], "obj_list->list[obj->idx]"); /* Increment number of calls */ udata->ncalls++; @@ -1231,8 +1236,8 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { htri_t ret_value; /* Check consistency */ - VERIFY((void *)&obj->idx, key, "obj->idx"); - VERIFY(obj, &obj_list->list[obj->idx], "obj_list->list[obj->idx]"); + CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx"); + CHECK_PTR_EQ(obj, &obj_list->list[obj->idx], "obj_list->list[obj->idx]"); /* Mark this object as freed (to make sure it isn't recursively freed, that * is not something we support, we will undo this if we decide later not to @@ -1264,7 +1269,7 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { else { /* Remove the object */ obj_ret = (test_tfs_obj_t *)H5SL_remove(obj_list->slist, &j); - CHECK(obj_ret, NULL, "H5SL_remove"); + CHECK_PTR(obj_ret, "H5SL_remove"); obj_ret->nfrees++; obj_list->nobjs_rem--; } /* end else */ @@ -1319,7 +1324,7 @@ test_skiplist_try_free_safe(void) /* Create a skip list */ obj_list.slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(obj_list.slist, NULL, "H5SL_create"); + CHECK_PTR(obj_list.slist, "H5SL_create"); /* Init obj_list.list */ obj_list.list = list; @@ -1391,7 +1396,7 @@ test_skiplist_less(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<10; u++) { @@ -1425,7 +1430,7 @@ test_skiplist_less(void) VERIFY(*found_item,5,"H5SL_less"); find_item=4; found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(found_item,NULL,"H5SL_less"); + CHECK_PTR_NULL(found_item, "H5SL_less"); /* Close the skip list */ ret=H5SL_close(slist); @@ -1455,7 +1460,7 @@ test_skiplist_greater(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1483,7 +1488,7 @@ test_skiplist_greater(void) VERIFY(*found_item, 90, "H5SL_greater"); find_item = 100; found_item = (unsigned *)H5SL_greater(slist, &find_item); - VERIFY(found_item, NULL, "H5SL_greater"); + CHECK_PTR_NULL(found_item, "H5SL_greater"); find_item = 6; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, 10, "H5SL_greater"); @@ -1520,7 +1525,7 @@ test_skiplist_below(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1531,44 +1536,44 @@ test_skiplist_below(void) /* Check for exact match of items in various positions */ find_item = 20; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 90; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 5; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); /* Find item less than a missing key, in various positions */ find_item = 19; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 15, "H5SL_below"); find_item = 89; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 80, "H5SL_below"); find_item = 100; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_below"); find_item = 9; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_below"); find_item = 4; node = (H5SL_node_t *)H5SL_less(slist, &find_item); - VERIFY(node, NULL, "H5SL_below"); + CHECK_PTR_NULL(node, "H5SL_below"); /* Close the skip list */ ret = H5SL_close(slist); @@ -1599,7 +1604,7 @@ test_skiplist_above(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1610,42 +1615,42 @@ test_skiplist_above(void) /* Check for exact match of items in various positions */ find_item = 20; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 90; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 5; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); /* Find item greater than a missing key, in various positions */ find_item = 19; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 20, "H5SL_above"); find_item = 89; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_above"); find_item = 100; node = H5SL_above(slist, &find_item); - VERIFY(node, NULL, "H5SL_above"); + CHECK_PTR_NULL(node, "H5SL_above"); find_item = 6; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 10, "H5SL_above"); find_item = 4; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_above"); @@ -1676,7 +1681,7 @@ test_skiplist_remove_first(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1692,7 +1697,7 @@ test_skiplist_remove_first(void) /* Check for removing object from empty list */ found_item = (unsigned *)H5SL_remove_first(slist); - VERIFY(found_item, NULL, "H5SL_remove_first"); + CHECK_PTR_NULL(found_item, "H5SL_remove_first"); /* Close the skip list */ ret = H5SL_close(slist); @@ -1720,7 +1725,7 @@ test_skiplist_remove_first_many(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < NUM_ELEMS; u++) { @@ -1737,7 +1742,7 @@ test_skiplist_remove_first_many(void) /* Check for removing object from empty list */ found_item = (int *)H5SL_remove_first(slist); - VERIFY(found_item, NULL, "H5SL_remove_first"); + CHECK_PTR_NULL(found_item, "H5SL_remove_first"); /* Close the skip list */ ret = H5SL_close(slist); @@ -1747,6 +1752,24 @@ test_skiplist_remove_first_many(void) /**************************************************************** ** +** test_skiplist_term(): Test H5SL (skiplist) code. +** Release data for skip list testing +** +****************************************************************/ +static void +test_skiplist_term(void) +{ + /* Release arrays */ + if(rand_num) + HDfree(rand_num); + if(sort_rand_num) + HDfree(sort_rand_num); + if(rev_sort_rand_num) + HDfree(rev_sort_rand_num); +} /* end test_skiplist_term() */ + +/**************************************************************** +** ** test_skiplist(): Main H5SL testing routine. ** ****************************************************************/ @@ -1785,5 +1808,8 @@ test_skiplist(void) test_skiplist_remove_first(); /* Test 'remove first' operation */ test_skiplist_remove_first_many(); /* Test 'remove first' operation on large skip lists */ + /* Release skip list testing data */ + test_skiplist_term(); + } /* end test_skiplist() */ diff --git a/test/tsohm.c b/test/tsohm.c index df464ffd..171b069 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -618,7 +618,7 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR @@ -662,13 +662,13 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos HDmemset(&rdata, 0, sizeof(rdata)); if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ @@ -695,13 +695,13 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos HDmemset(&rdata, 0, sizeof(rdata)); if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ @@ -1374,14 +1374,14 @@ static void size2_dump_struct(const char *name, size2_helper_struct *sizes) { puts(name); - printf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); - printf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); - printf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); - printf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); - printf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); - printf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); - printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); - printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); + HDprintf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); + HDprintf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); + HDprintf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); + HDprintf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); + HDprintf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); + HDprintf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); + HDprintf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); + HDprintf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); } #endif /* NOT_NOW */ diff --git a/test/ttime.c b/test/ttime.c index 2eb2117..5b3436d 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: ttime +* Test program: ttime * * Test the Time Datatype functionality * @@ -21,8 +21,6 @@ #include "testhdf5.h" -#include "hdf5.h" - #define DATAFILE "ttime.h5" #ifdef NOT_YET #define DATASETNAME "Dataset" @@ -180,13 +178,13 @@ test_time_io(void) tid = H5Dget_type(dsid); CHECK(tid, FAIL, "H5Dget_type"); if( H5Tget_class (tid) == H5T_TIME) - fprintf(stderr,"datatype class is H5T_TIME\n"); + HDfprintf(stderr,"datatype class is H5T_TIME\n"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); status = H5Dread (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen); CHECK(status, FAIL, "H5Dread"); -fprintf(stderr,"time written was: %s\n", HDctime(&timethen)); +HDfprintf(stderr,"time written was: %s\n", HDctime(&timethen)); status = H5Dclose(dsid); CHECK(status, FAIL, "H5Dclose"); @@ -215,15 +213,15 @@ test_time(void) } /* test_time() */ - + /*------------------------------------------------------------------------- - * Function: cleanup_time + * Function: cleanup_time * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * October 19, 2000 * * Modifications: @@ -233,6 +231,6 @@ test_time(void) void cleanup_time(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/ttsafe.c b/test/ttsafe.c index d348667..3febdd8 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -27,14 +27,8 @@ * Each test module should include ttsafe.h and define a unique set of * names for test files they create. * - * BUGS/LIMITATIONS - * - * EXPORTED ROUTINES/VARIABLES: - * */ -#include "h5test.h" - /* ANY new test needs to have a prototype in ttsafe.h */ #include "ttsafe.h" @@ -120,7 +114,7 @@ int main(int argc, char *argv[]) #else /* H5_HAVE_THREADSAFE */ - printf("Most thread-safety tests skipped because THREADSAFE not enabled\n"); + HDprintf("Most thread-safety tests skipped because THREADSAFE not enabled\n"); #endif /* H5_HAVE_THREADSAFE */ @@ -141,6 +135,9 @@ int main(int argc, char *argv[]) if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) TestCleanup(); + /* Release test infrastructure */ + TestShutdown(); + return GetTestNumErrs(); } /* end main() */ diff --git a/test/ttsafe.h b/test/ttsafe.h index 6cf449f..c29fadc 100644 --- a/test/ttsafe.h +++ b/test/ttsafe.h @@ -22,9 +22,6 @@ * Include required headers. This file tests internal library functions, * so we include the private headers here. */ -#include "hdf5.h" -#include "H5private.h" -#include "H5Eprivate.h" #include "testhdf5.h" diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index 754c72a..5c08d09 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -26,31 +26,15 @@ * dataset), there is a small chance that consecutive reads occur * before a write to that shared variable. * - * HDF5 APIs exercised in thread: - * H5Acreate2, H5Awrite, H5Aclose. - * * Created: Oct 5 1999 * Programmer: Chee Wai LEE * - * Modification History - * -------------------- - * - * 15 May 2000, Chee Wai LEE - * Incorporated into library tests. - * - * 19 May 2000, Bill Wendling - * Changed so that it creates its own HDF5 file and removes it at cleanup - * time. - * ********************************************************************/ #include "ttsafe.h" #ifdef H5_HAVE_THREADSAFE -#include <stdio.h> -#include <stdlib.h> - #define FILENAME "ttsafe_acreate.h5" #define DATASETNAME "IntData" #define NUM_THREADS 16 @@ -64,20 +48,24 @@ typedef struct acreate_data_struct { int current_index; } ttsafe_name_data_t; -void tts_acreate(void) +void +tts_acreate(void) { /* Thread declarations */ H5TS_thread_t threads[NUM_THREADS]; /* HDF5 data declarations */ - hid_t file, dataset; - hid_t dataspace, datatype; - hid_t attribute; + hid_t file = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + hid_t dataspace = H5I_INVALID_HID; + hid_t datatype = H5I_INVALID_HID; + hid_t attribute = H5I_INVALID_HID; hsize_t dimsf[1]; /* dataset dimensions */ /* data declarations */ int data; /* data to write */ - int buffer, ret, i; + int buffer, i; + herr_t status; ttsafe_name_data_t *attrib_data; @@ -86,76 +74,79 @@ void tts_acreate(void) * creation plist and default file access plist */ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(file>=0); + CHECK(file, H5I_INVALID_HID, "H5Fcreate"); /* create a simple dataspace for the dataset */ dimsf[0] = 1; dataspace = H5Screate_simple(1, dimsf, NULL); - assert(dataspace>=0); + CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple"); /* define datatype for the data using native little endian integers */ datatype = H5Tcopy(H5T_NATIVE_INT); - H5Tset_order(datatype, H5T_ORDER_LE); + CHECK(datatype, H5I_INVALID_HID, "H5Tcopy"); + status = H5Tset_order(datatype, H5T_ORDER_LE); + CHECK(status, FAIL, "H5Tset_order"); /* create a new dataset within the file */ dataset = H5Dcreate2(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(dataset >= 0); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* initialize data for dataset and write value to dataset */ data = NUM_THREADS; - ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data); - assert(ret >= 0); + status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data); + CHECK(status, FAIL, "H5Dwrite"); /* * Simultaneously create a large number of attributes to be associated * with the dataset */ for(i = 0; i < NUM_THREADS; i++) { - attrib_data = HDmalloc(sizeof(ttsafe_name_data_t)); + attrib_data = (ttsafe_name_data_t *)HDmalloc(sizeof(ttsafe_name_data_t)); attrib_data->dataset = dataset; attrib_data->datatype = datatype; attrib_data->dataspace = dataspace; attrib_data->current_index = i; threads[i] = H5TS_create_thread(tts_acreate_thread, NULL, attrib_data); - } /* end for */ + } - for(i = 0; i < NUM_THREADS; i++) { + for(i = 0; i < NUM_THREADS; i++) H5TS_wait_for_thread(threads[i]); - } /* end for */ - /* verify the correctness of the test */ for(i = 0; i < NUM_THREADS; i++) { attribute = H5Aopen(dataset, gen_name(i), H5P_DEFAULT); + CHECK(attribute, H5I_INVALID_HID, "H5Aopen"); if(attribute < 0) TestErrPrintf("unable to open appropriate attribute. Test failed!\n"); else { - ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer); - - if(ret < 0 || buffer != i) - TestErrPrintf("wrong data values. Test failed!\n"); + status = H5Aread(attribute, H5T_NATIVE_INT, &buffer); + CHECK(status, FAIL, "H5Aread"); + VERIFY(buffer, i, "data values don't match"); - H5Aclose(attribute); - } /* end else */ - } /* end for */ + status = H5Aclose(attribute); + CHECK(status, FAIL, "H5Aclose"); + } + } /* close remaining resources */ - ret = H5Sclose(dataspace); - assert(ret >= 0); - ret = H5Tclose(datatype); - assert(ret >= 0); - ret = H5Dclose(dataset); - assert(ret >= 0); - ret = H5Fclose(file); - assert(ret >= 0); -} - -void *tts_acreate_thread(void *client_data) + status = H5Sclose(dataspace); + CHECK(status, FAIL, "H5Sclose"); + status = H5Tclose(datatype); + CHECK(status, FAIL, "H5Sclose"); + status = H5Dclose(dataset); + CHECK(status, FAIL, "H5Dclose"); + status = H5Fclose(file); + CHECK(status, FAIL, "H5Fclose"); +} /* end tts_acreate() */ + +void * +tts_acreate_thread(void *client_data) { - hid_t attribute; + hid_t attribute = H5I_INVALID_HID; char *attribute_name; int *attribute_data; /* data for attributes */ + herr_t status; ttsafe_name_data_t *attrib_data; @@ -166,18 +157,23 @@ void *tts_acreate_thread(void *client_data) attribute = H5Acreate2(attrib_data->dataset, attribute_name, attrib_data->datatype, attrib_data->dataspace, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attribute, H5I_INVALID_HID, "H5Acreate2"); /* Write data to the attribute */ - attribute_data = HDmalloc(sizeof(int)); + attribute_data = (int *)HDmalloc(sizeof(int)); *attribute_data = attrib_data->current_index; - H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); - H5Aclose(attribute); + status = H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); + CHECK(status, FAIL, "H5Awrite"); + status = H5Aclose(attribute); + CHECK(status, FAIL, "H5Aclose"); return NULL; -} +} /* end tts_acreate_thread() */ -void cleanup_acreate(void) +void +cleanup_acreate(void) { HDunlink(FILENAME); } #endif /*H5_HAVE_THREADSAFE*/ + diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 623ef98..dd52232 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -27,20 +27,9 @@ * Temporary files generated: * ttsafe_cancel.h5 * - * HDF5 APIs exercised in thread: - * H5Screate_simple, H5Tcopy, H5Tset_order, H5Dcreate2, H5Dclose, - * H5Dwrite, H5Dread, H5Diterate, H5Tclose, H5Sclose. - * * Created: May 15 2000 * Programmer: Chee Wai LEE * - * Modification History - * -------------------- - * - * 19 May 2000, Bill Wendling - * Changed so that it creates its own HDF5 file and removes it at cleanup - * time. - * ********************************************************************/ #include "ttsafe.h" @@ -66,7 +55,8 @@ pthread_t childthread; pthread_mutex_t mutex; pthread_cond_t cond; -void tts_cancel(void) +void +tts_cancel(void) { pthread_attr_t attribute; hid_t dataset; @@ -116,31 +106,34 @@ void tts_cancel(void) /* Destroy the thread attribute */ ret=pthread_attr_destroy(&attribute); assert(ret==0); -} +} /* end tts_cancel() */ -void *tts_cancel_thread(void H5_ATTR_UNUSED *arg) +void * +tts_cancel_thread(void H5_ATTR_UNUSED *arg) { + hid_t dataspace = H5I_INVALID_HID; + hid_t datatype = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; int datavalue; int buffer; - hid_t dataspace, datatype, dataset; hsize_t dimsf[1]; /* dataset dimensions */ cancel_cleanup_t *cleanup_structure; - int ret; + herr_t status; /* define dataspace for dataset */ dimsf[0] = 1; dataspace = H5Screate_simple(1, dimsf, NULL); - assert(dataspace >= 0); + CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple"); /* define datatype for the data using native little endian integers */ datatype = H5Tcopy(H5T_NATIVE_INT); - assert(datatype >= 0); - ret = H5Tset_order(datatype, H5T_ORDER_LE); - assert(ret >= 0); + CHECK(datatype, H5I_INVALID_HID, "H5Tcopy"); + status = H5Tset_order(datatype, H5T_ORDER_LE); + CHECK(status, FAIL, "H5Tset_order"); /* create a new dataset within the file */ dataset = H5Dcreate2(cancel_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(dataset >= 0); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* If thread is cancelled, make cleanup call */ cleanup_structure = (cancel_cleanup_t*)HDmalloc(sizeof(cancel_cleanup_t)); @@ -151,25 +144,26 @@ void *tts_cancel_thread(void H5_ATTR_UNUSED *arg) datavalue = 1; - ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); - assert(ret>=0); + status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); + CHECK(status, FAIL, "H5Dwrite"); - ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); - assert(ret>=0); - ret=H5Diterate(&buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset); - assert(ret>=0); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); + CHECK(status, FAIL, "H5Dread"); + status = H5Diterate(&buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset); + CHECK(status, FAIL, "H5Diterate"); - sleep(3); + HDsleep(3); datavalue = 100; - ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); - assert(ret>=0); - ret=H5Dclose(dataset); - assert(ret>=0); - ret=H5Tclose(datatype); - assert(ret>=0); - ret=H5Sclose(dataspace); - assert(ret>=0); + status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); + CHECK(status, FAIL, "H5Dwrite"); + + status = H5Dclose(dataset); + CHECK(status, FAIL, "H5Dclose"); + status = H5Tclose(datatype); + CHECK(status, FAIL, "H5Tclose"); + status = H5Sclose(dataspace); + CHECK(status, FAIL, "H5Sclose"); /* * Required by pthreads. The argument 0 pops the stack but does not @@ -178,73 +172,78 @@ void *tts_cancel_thread(void H5_ATTR_UNUSED *arg) pthread_cleanup_pop(0); return NULL; -} +} /* end tts_cancel_thread() */ -herr_t tts_cancel_callback(void *elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim, +herr_t +tts_cancel_callback(void *elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, void *operator_data) { - int value = *(int *)elem; hid_t dataset = *(hid_t *)operator_data; - int ret; + int value = *(int *)elem; + herr_t status; tts_cancel_barrier(); - sleep(3); + HDsleep(3); if (value != 1) { TestErrPrintf("Error! Element value should be 1 and not %d\n", value); - return -1; + return FAIL; } value += 10; - ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); - assert(ret>=0); - return 0; -} + status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); + CHECK(status, FAIL, "H5Dwrite"); + + return SUCCEED; +} /* end tts_cancel_callback() */ /* * Need to perform the dataset, datatype and dataspace close that was never * performed because of thread cancellation */ -void cancellation_cleanup(void *arg) +void +cancellation_cleanup(void *arg) { cancel_cleanup_t *cleanup_structure = (cancel_cleanup_t *)arg; - int ret; + herr_t status; - ret=H5Dclose(cleanup_structure->dataset); - assert(ret>=0); - ret=H5Tclose(cleanup_structure->datatype); - assert(ret>=0); - ret=H5Sclose(cleanup_structure->dataspace); - assert(ret>=0); + status = H5Dclose(cleanup_structure->dataset); + CHECK(status, FAIL, "H5Dclose"); + status = H5Tclose(cleanup_structure->datatype); + CHECK(status, FAIL, "H5Tclose"); + status = H5Sclose(cleanup_structure->dataspace); + CHECK(status, FAIL, "H5Sclose"); /* retained for debugging */ /* print_func("cancellation noted, cleaning up ... \n"); */ -} +} /* end cancellation_cleanup() */ /* * Artificial (and specific to this test) barrier to keep track of whether * both the main and child threads have reached a point in the program. */ -void tts_cancel_barrier(void) +void +tts_cancel_barrier(void) { static int count = 2; - int ret; + int status; - ret=pthread_mutex_lock(&mutex); - assert(ret==0); + status = pthread_mutex_lock(&mutex); + VERIFY(status, 0, "pthread_mutex_lock"); if (count != 1) { count--; - ret=pthread_cond_wait(&cond, &mutex); - assert(ret==0); - } else { - ret=pthread_cond_signal(&cond); - assert(ret==0); + status = pthread_cond_wait(&cond, &mutex); + VERIFY(status, 0, "pthread_cond_wait"); + } + else { + status = pthread_cond_signal(&cond); + VERIFY(status, 0, "pthread_cond_signal"); } - ret=pthread_mutex_unlock(&mutex); - assert(ret==0); -} + status = pthread_mutex_unlock(&mutex); + VERIFY(status, 0, "pthread_mutex_unlock"); +} /* end tts_cancel_barrier() */ void cleanup_cancel(void) { @@ -253,3 +252,4 @@ void cleanup_cancel(void) #endif /*H5_HAVE_WIN_THREADS*/ #endif /*H5_HAVE_THREADSAFE*/ + diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index 65051c7..36b5f1f 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -23,20 +23,9 @@ * Temporary files generated: * ttsafe_dcreate.h5 * - * HDF5 APIs exercised in thread: - * H5Screate_simple, H5Tcopy, H5Tset_order, H5Dcreate2, H5Dwrite, H5Dclose, - * H5Tclose, H5Sclose. - * * Created: Apr 28 2000 * Programmer: Chee Wai LEE * - * Modification History - * -------------------- - * - * 19 May 2000, Bill Wendling - * Changed so that it creates its own HDF5 file and removes it at cleanup - * time. - * ********************************************************************/ #include "ttsafe.h" @@ -83,16 +72,18 @@ thread_info thread_out[NUM_THREAD]; * Thread safe test - multiple dataset creation ********************************************************************** */ -void tts_dcreate(void) +void +tts_dcreate(void) { /* thread definitions */ H5TS_thread_t threads[NUM_THREAD]; /* HDF5 data definitions */ - hid_t file, dataset; + hid_t file = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; int datavalue, i; H5TS_attr_t attribute; - int ret; + herr_t status; /* set pthread attribute to perform global scheduling */ H5TS_attr_init(&attribute); @@ -107,7 +98,7 @@ void tts_dcreate(void) * creation plist and default file access plist */ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(file >= 0); + CHECK(file, H5I_INVALID_HID, "H5Fcreate"); /* simultaneously create a large number of datasets within the file */ for(i = 0; i < NUM_THREAD; i++) { @@ -115,11 +106,10 @@ void tts_dcreate(void) thread_out[i].file = file; thread_out[i].dsetname = dsetname[i]; threads[i] = H5TS_create_thread(tts_dcreate_creator, NULL, &thread_out[i]); - } /* end for */ + } - for(i = 0;i < NUM_THREAD; i++) { + for(i = 0;i < NUM_THREAD; i++) H5TS_wait_for_thread(threads[i]); - } /* end for */ /* compare data to see if it is written correctly */ @@ -129,36 +119,38 @@ void tts_dcreate(void) H5Fclose(file); return; } else { - ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); - assert(ret >= 0); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); + CHECK(status, FAIL, "H5Dread"); if(datavalue != i) { TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n", datavalue, dsetname[i]); - ret = H5Dclose(dataset); - assert(ret >= 0); - ret = H5Fclose(file); - assert(ret >= 0); + status = H5Dclose(dataset); + CHECK(status, FAIL, "H5Dclose"); + status = H5Fclose(file); + CHECK(status, FAIL, "H5Fclose"); return; } - ret = H5Dclose(dataset); - assert(ret >= 0); + status= H5Dclose(dataset); + CHECK(status, FAIL, "H5Dclose"); } } /* close remaining resources */ - ret = H5Fclose(file); - assert(ret >= 0); + status = H5Fclose(file); + CHECK(status, FAIL, "H5Fclose"); /* Destroy the thread attribute */ H5TS_attr_destroy(&attribute); -} +} /* end tts_dcreate() */ -void *tts_dcreate_creator(void *_thread_data) +void * +tts_dcreate_creator(void *_thread_data) { - hid_t dataspace, dataset; - herr_t ret; + hid_t dataspace = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + herr_t status; hsize_t dimsf[1]; /* dataset dimensions */ struct thread_info thread_data; @@ -167,28 +159,29 @@ void *tts_dcreate_creator(void *_thread_data) /* define dataspace for dataset */ dimsf[0] = 1; dataspace = H5Screate_simple(1, dimsf, NULL); - assert(dataspace >= 0); + CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple"); /* create a new dataset within the file */ dataset = H5Dcreate2(thread_data.file, thread_data.dsetname, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(dataset >= 0); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* initialize data for dataset and write value to dataset */ - ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &thread_data.id); - assert(ret >= 0); + CHECK(status, FAIL, "H5Dwrite"); /* close dataset and dataspace resources */ - ret = H5Dclose(dataset); - assert(ret >= 0); - ret = H5Sclose(dataspace); - assert(ret >= 0); + status = H5Dclose(dataset); + CHECK(status, FAIL, "H5Dclose"); + status = H5Sclose(dataspace); + CHECK(status, FAIL, "H5Sclose"); return NULL; -} +} /* end tts_dcreate_creator() */ -void cleanup_dcreate(void) +void +cleanup_dcreate(void) { HDunlink(FILENAME); } diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 889d64b..4160d3a 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -25,21 +25,9 @@ * * ttsafe_error.h5 * - * HDF5 APIs exercised in thread: - * - * H5Screate_simple, H5Tcopy, H5Tset_order, H5Dcreate2, H5Dclose, - * H5Tclose, H5Sclose. - * * Created: Apr 28 2000 * Programmer: Chee Wai LEE * - * Modification History - * -------------------- - * - * 19 May 2000, Bill Wendling - * Modified so that it creates a unique HDF5 file and removes it on - * cleanup. - * ********************************************************************/ #include "ttsafe.h" @@ -49,181 +37,191 @@ #define FILENAME "ttsafe_error.h5" /* Having a common dataset name is an error */ -#define DATASETNAME "commonname" -#define EXPECTED_ERROR_DEPTH 8 -#define WRITE_NUMBER 37 - -static herr_t error_callback(hid_t , void *); -static herr_t walk_error_callback(unsigned, const H5E_error2_t *, void *); -static void *tts_error_thread(void *); - -/* Global variables */ -hid_t error_file; +#define DATASETNAME "commonname" +#define EXPECTED_ERROR_DEPTH 7 +#define WRITE_NUMBER 37 +/* Typedefs */ typedef struct err_num_struct { hid_t maj_num; hid_t min_num; } err_num_t; -err_num_t expected[8]; +/* Global variables */ +hid_t error_file_g = H5I_INVALID_HID; +int error_flag_g = 0; +int error_count_g = 0; +err_num_t expected_g[EXPECTED_ERROR_DEPTH]; +H5TS_mutex_simple_t error_mutex_g; + +/* Prototypes */ +static herr_t error_callback(hid_t , void *); +static herr_t walk_error_callback(unsigned, const H5E_error2_t *, void *); +static void *tts_error_thread(void *); -int error_flag = 0; -int error_count = 0; -H5TS_mutex_simple_t error_mutex; -void tts_error(void) +void +tts_error(void) { - H5TS_thread_t threads[NUM_THREAD]; - H5TS_attr_t attribute; - hid_t dataset; - int value, i; - int ret; + hid_t dataset = H5I_INVALID_HID; + H5TS_thread_t threads[NUM_THREAD]; + H5TS_attr_t attribute; + int value, i; + herr_t status; /* Must initialize these at runtime */ - expected[0].maj_num = H5E_DATASET; - expected[0].min_num = H5E_CANTINIT; + expected_g[0].maj_num = H5E_DATASET; + expected_g[0].min_num = H5E_CANTINIT; - expected[1].maj_num = H5E_DATASET; - expected[1].min_num = H5E_CANTINIT; + expected_g[1].maj_num = H5E_DATASET; + expected_g[1].min_num = H5E_CANTINIT; - expected[2].maj_num = H5E_LINK; - expected[2].min_num = H5E_CANTINIT; + expected_g[2].maj_num = H5E_LINK; + expected_g[2].min_num = H5E_CANTINIT; - expected[3].maj_num = H5E_SYM; - expected[3].min_num = H5E_CANTINSERT; + expected_g[3].maj_num = H5E_LINK; + expected_g[3].min_num = H5E_CANTINSERT; - expected[4].maj_num = H5E_SYM; - expected[4].min_num = H5E_NOTFOUND; + expected_g[4].maj_num = H5E_SYM; + expected_g[4].min_num = H5E_NOTFOUND; - expected[5].maj_num = H5E_SYM; - expected[5].min_num = H5E_CALLBACK; + expected_g[5].maj_num = H5E_SYM; + expected_g[5].min_num = H5E_CALLBACK; - expected[6].maj_num = H5E_SYM; - expected[6].min_num = H5E_EXISTS; + expected_g[6].maj_num = H5E_LINK; + expected_g[6].min_num = H5E_EXISTS; /* set up mutex for global count of errors */ - H5TS_mutex_init(&error_mutex); + H5TS_mutex_init(&error_mutex_g); /* make thread scheduling global */ H5TS_attr_init(&attribute); - /* set thread scope to system */ - #ifdef H5_HAVE_SYSTEM_SCOPE_THREADS + /* set thread scope to system */ H5TS_attr_setscope(&attribute, H5TS_SCOPE_SYSTEM); #endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */ - /* - * Create a hdf5 file using H5F_ACC_TRUNC access, default file + /* Create a hdf5 file using H5F_ACC_TRUNC access, default file * creation plist and default file access plist */ - error_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(error_file>=0); + error_file_g = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(error_file_g, H5I_INVALID_HID, "H5Fcreate"); - for (i = 0; i < NUM_THREAD; i++){ + for (i = 0; i < NUM_THREAD; i++) threads[i] = H5TS_create_thread(tts_error_thread, &attribute, NULL); - } - for (i = 0; i < NUM_THREAD; i++){ + for (i = 0; i < NUM_THREAD; i++) H5TS_wait_for_thread(threads[i]); - } - if (error_flag) - TestErrPrintf("Threads reporting different error values!\n"); + if (error_flag_g) { + TestErrPrintf("At least one thread reported a value that was different from the exected value\n"); + HDprintf("(Update this test if the error stack changed!)\n"); + } - if (error_count != NUM_THREAD - 1) - TestErrPrintf("Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1); + if (error_count_g != NUM_THREAD - 1) + TestErrPrintf("Error: %d threads failed instead of %d\n", error_count_g, NUM_THREAD-1); - dataset = H5Dopen2(error_file, DATASETNAME, H5P_DEFAULT); - assert(dataset >= 0); + dataset = H5Dopen2(error_file_g, DATASETNAME, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); - ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); - assert(ret>=0); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); + CHECK(status, FAIL, "H5Dread"); if (value != WRITE_NUMBER) TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER); - ret=H5Dclose(dataset); - assert(ret>=0); - ret=H5Fclose(error_file); - assert(ret>=0); + status = H5Dclose(dataset); + CHECK(status, FAIL, "H5Dclose"); + status = H5Fclose(error_file_g); + CHECK(status, FAIL, "H5Fclose"); H5TS_attr_destroy(&attribute); -} +} /* end tts_error() */ -static -void *tts_error_thread(void H5_ATTR_UNUSED *arg) +static void * +tts_error_thread(void H5_ATTR_UNUSED *arg) { - hid_t dataspace, datatype, dataset; + hid_t dataspace = H5I_INVALID_HID; + hid_t datatype = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; hsize_t dimsf[1]; /* dataset dimensions */ H5E_auto2_t old_error_cb; void *old_error_client_data; int value; - int ret; + herr_t status; /* preserve previous error stack handler */ - H5Eget_auto2(H5E_DEFAULT, &old_error_cb, &old_error_client_data); + status = H5Eget_auto2(H5E_DEFAULT, &old_error_cb, &old_error_client_data); + CHECK(status, FAIL, "H5Eget_auto2"); /* set each thread's error stack handler */ - H5Eset_auto2(H5E_DEFAULT, error_callback, NULL); + status = H5Eset_auto2(H5E_DEFAULT, error_callback, NULL); + CHECK(status, FAIL, "H5Eset_auto2"); /* define dataspace for dataset */ dimsf[0] = 1; dataspace = H5Screate_simple(1, dimsf, NULL); - assert(dataspace >= 0); + CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple"); /* define datatype for the data using native little endian integers */ datatype = H5Tcopy(H5T_NATIVE_INT); - assert(datatype >= 0); - H5Tset_order(datatype, H5T_ORDER_LE); + CHECK(datatype, H5I_INVALID_HID, "H5Tcopy"); + status = H5Tset_order(datatype, H5T_ORDER_LE); + CHECK(status, FAIL, "H5Tset_order"); /* create a new dataset within the file */ - dataset = H5Dcreate2(error_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) { /* not an error */ + dataset = H5Dcreate2(error_file_g, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + /* Most of these will fail, so don't check the error here */ + if (dataset >= 0) { value = WRITE_NUMBER; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); - H5Dclose(dataset); - } /* end if */ + status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); + CHECK(status, FAIL, "H5Dwrite"); + status = H5Dclose(dataset); + CHECK(status, FAIL, "H5Dclose"); + } - ret = H5Tclose(datatype); - assert(ret >= 0); - ret = H5Sclose(dataspace); - assert(ret >= 0); + status = H5Tclose(datatype); + CHECK(status, FAIL, "H5Tclose"); + status = H5Sclose(dataspace); + CHECK(status, FAIL, "H5Sclose"); /* turn our error stack handler off */ - H5Eset_auto2(H5E_DEFAULT, old_error_cb, old_error_client_data); + status = H5Eset_auto2(H5E_DEFAULT, old_error_cb, old_error_client_data); + CHECK(status, FAIL, "H5Eset_auto2"); return NULL; -} +} /* end tts_error_thread() */ -static -herr_t error_callback(hid_t H5_ATTR_UNUSED estack_id, void *client_data) +static herr_t +error_callback(hid_t H5_ATTR_UNUSED estack_id, void *client_data) { - H5TS_mutex_lock_simple(&error_mutex); - error_count++; - H5TS_mutex_unlock_simple(&error_mutex); + H5TS_mutex_lock_simple(&error_mutex_g); + error_count_g++; + H5TS_mutex_unlock_simple(&error_mutex_g); return H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, client_data); } -static -herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void H5_ATTR_UNUSED *client_data) +static herr_t +walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void H5_ATTR_UNUSED *client_data) { - hid_t maj_num, min_num; + hid_t maj_num = H5I_INVALID_HID; + hid_t min_num = H5I_INVALID_HID; if (err_desc) { maj_num = err_desc->maj_num; min_num = err_desc->min_num; - if (n < EXPECTED_ERROR_DEPTH && maj_num == expected[n].maj_num && - min_num == expected[n].min_num) + if (n <= EXPECTED_ERROR_DEPTH && maj_num == expected_g[n].maj_num && min_num == expected_g[n].min_num) return SUCCEED; } - error_flag = -1; + error_flag_g = -1; return SUCCEED; } -void cleanup_error(void) +void +cleanup_error(void) { HDunlink(FILENAME); } diff --git a/test/ttst.c b/test/ttst.c index c424d76..c5912c5 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -31,9 +31,6 @@ 12/9/02 - Started coding */ -#include <time.h> -#include <stdlib.h> - #include "testhdf5.h" #include "H5STprivate.h" @@ -93,13 +90,13 @@ test_tst_init(void) } /* end for */ /* Allocate space for the array of unique words */ - uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Allocate space for the array of randomized order unique words also */ - rand_uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + rand_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Allocate space for the array of sorted order unique words also */ - sort_uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + sort_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Insert unique words from test set into unique word set */ w=0; @@ -124,7 +121,7 @@ test_tst_init(void) curr_time=HDtime(NULL); HDsrandom((unsigned)curr_time); for(u=0; u<num_uniq_words; u++) { - v=u+(HDrandom()%(num_uniq_words-u)); + v = u + ((size_t)HDrandom() % (num_uniq_words - u)); if(u!=v) { tmp_word=rand_uniq_words[u]; rand_uniq_words[u]=rand_uniq_words[v]; @@ -160,7 +157,7 @@ test_tst_create(void) /* Try creating a TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Try closing a real tree */ ret=H5ST_close(tree); @@ -189,7 +186,7 @@ test_tst_insert(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; u<num_uniq_words; u++) { @@ -205,13 +202,13 @@ test_tst_insert(void) /* Check that the value "payloads" are correct */ found=H5ST_find(tree,uniq_words[u]); - CHECK(found, NULL, "H5ST_find"); + CHECK_PTR(found, "H5ST_find"); if(HDstrcmp((const char *)found->eqkid,uniq_words[u])) TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]); obj=H5ST_locate(tree,uniq_words[u]); - CHECK(obj, NULL, "H5ST_locate"); + CHECK_PTR(obj, "H5ST_locate"); if(HDstrcmp((const char *)obj,uniq_words[u])) TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]); @@ -249,7 +246,7 @@ test_tst_iterate(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; u<num_uniq_words; u++) { @@ -259,7 +256,7 @@ test_tst_iterate(void) /* Use findfirst/findnext calls to iterate through TST */ found=H5ST_findfirst(tree); - CHECK(found, NULL, "H5ST_findfirst"); + CHECK_PTR(found, "H5ST_findfirst"); u=0; do { /* Check that the strings in the TST are in the correct order */ @@ -297,7 +294,7 @@ test_tst_remove(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; u<num_uniq_words; u++) { @@ -308,7 +305,7 @@ test_tst_remove(void) /* Remove strings from TST in random order */ for(u=0; u<num_uniq_words; u++) { obj=H5ST_remove(tree,rand_uniq_words[u]); - CHECK(obj, NULL, "H5ST_remove"); + CHECK_PTR(obj, "H5ST_remove"); /* Check that the correct string was removed from TST */ if(HDstrcmp((const char *)obj,rand_uniq_words[u])) @@ -329,7 +326,7 @@ test_tst_remove(void) for(u=0; u<num_uniq_words; u++) { /* Get the pointer to the node to delete */ found=H5ST_find(tree,rand_uniq_words[u]); - CHECK(found, NULL, "H5ST_find"); + CHECK_PTR(found, "H5ST_find"); /* Check that the correct object will be removed from TST */ if(HDstrcmp((const char *)found->eqkid,rand_uniq_words[u])) diff --git a/test/tunicode.c b/test/tunicode.c index 566c21c..a089870 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -12,10 +12,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Unicode test */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> #include "testhdf5.h" #define NUM_CHARS 16 @@ -167,8 +163,8 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(buf, new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); @@ -230,8 +226,8 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string. * It will look like "abcdefghabcdefgh". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(buf, new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); @@ -386,6 +382,7 @@ void test_objnames(hid_t fid, const char* string) char path_buf[MAX_PATH_LENGTH]; hsize_t dims=1; hobj_ref_t obj_ref; + ssize_t size; herr_t ret; /* Create a group with a UTF-8 name */ @@ -397,8 +394,8 @@ void test_objnames(hid_t fid, const char* string) */ ret = H5Oset_comment_by_name(fid, string, string, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oset_comment_by_name"); - ret = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + size = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT); + CHECK(size, FAIL, "H5Oget_comment_by_name"); ret = H5Gclose(grp_id); CHECK(ret, FAIL, "H5Gclose"); @@ -512,6 +509,7 @@ void test_attrname(hid_t fid, const char * string) hid_t dtype_id, space_id; hsize_t dims=1; char read_buf[MAX_STRING_LENGTH]; + ssize_t size; herr_t ret; /* Create a new group and give it an attribute whose @@ -530,8 +528,8 @@ void test_attrname(hid_t fid, const char * string) /* Create the attribute and check that its name is correct */ attr_id = H5Acreate2(group_id, string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); - ret = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf); - CHECK(ret, FAIL, "H5Aget_name"); + size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf); + CHECK(size, FAIL, "H5Aget_name"); ret = strcmp(read_buf, string); VERIFY(ret, 0, "strcmp"); read_buf[0] = '\0'; @@ -742,25 +740,25 @@ static hid_t mkstr(size_t len, H5T_str_t strpad) unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos) { if (c < 0x80) { - test_string[cur_pos] = c; + test_string[cur_pos] = (char)c; cur_pos++; } else if (c < 0x800) { - test_string[cur_pos] = (0xC0 | c>>6); - test_string[cur_pos+1] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xC0 | c >> 6); + test_string[cur_pos + 1] = (char)(0x80 | (c & 0x3F)); cur_pos += 2; } else if (c < 0x10000) { - test_string[cur_pos] = (0xE0 | c>>12); - test_string[cur_pos+1] = (0x80 | (c>>6 & 0x3F)); - test_string[cur_pos+2] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xE0 | c >> 12); + test_string[cur_pos + 1] = (char)(0x80 | (c >> 6 & 0x3F)); + test_string[cur_pos + 2] = (char)(0x80 | (c & 0x3F)); cur_pos += 3; } else if (c < 0x200000) { - test_string[cur_pos] = (0xF0 | c>>18); - test_string[cur_pos+1] = (0x80 | (c>>12 & 0x3F)); - test_string[cur_pos+2] = (0x80 | (c>>6 & 0x3F)); - test_string[cur_pos+3] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xF0 | c >> 18); + test_string[cur_pos + 1] = (char)(0x80 | (c >> 12 & 0x3F)); + test_string[cur_pos + 2] = (char)(0x80 | (c >> 6 & 0x3F)); + test_string[cur_pos + 3] = (char)(0x80 | (c & 0x3F)); cur_pos += 4; } @@ -773,18 +771,18 @@ unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos * could confuse printf (e.g., '\n'). */ void dump_string(const char * string) { - unsigned int length; - unsigned int x; + size_t length; + size_t x; - printf("The string was:\n %s", string); - printf("Or in hex:\n"); + HDprintf("The string was:\n %s", string); + HDprintf("Or in hex:\n"); - length = strlen(string); + length = HDstrlen(string); for(x=0; x<length; x++) - printf("%x ", string[x] & (0x000000FF)); + HDprintf("%x ", string[x] & (0x000000FF)); - printf("\n"); + HDprintf("\n"); } /* Main test. @@ -812,7 +810,7 @@ void test_unicode(void) /* We need to avoid unprintable characters (codes 0-31) and the * . and / characters, since they aren't allowed in path names. */ - unicode_point = (HDrandom() % (MAX_CODE_POINT-32)) + 32; + unicode_point = (unsigned)(HDrandom() % (MAX_CODE_POINT-32)) + 32; if(unicode_point != 46 && unicode_point != 47) cur_pos = write_char(unicode_point, test_string, cur_pos); } @@ -856,7 +854,7 @@ void test_unicode(void) */ void cleanup_unicode(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/tvlstr.c b/test/tvlstr.c index e5b2a60..f401406 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: tvlstr +* Test program: tvlstr * * Test the Variable-Length String functionality * @@ -21,16 +21,14 @@ #include "testhdf5.h" -#include "hdf5.h" - #define DATAFILE "tvlstr.h5" #define DATAFILE2 "tvlstr2.h5" /* 1-D dataset with fixed dimensions */ -#define SPACE1_RANK 1 -#define SPACE1_DIM1 4 +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 -#define VLSTR_TYPE "vl_string_type" +#define VLSTR_TYPE "vl_string_type" /* Definitions for the VL re-writing test */ #define REWRITE_NDATASETS 32 @@ -92,7 +90,7 @@ void test_vlstr_free_custom(void *_mem, void *info) if(_mem!=NULL) { mem=((unsigned char *)_mem)-extra; - *mem_used-=*(size_t *)mem; + *mem_used-=*(size_t *)((void *)mem); HDfree(mem); } /* end if */ } @@ -115,17 +113,17 @@ test_vlstrings_basic(void) char *rdata[SPACE1_DIM1]; /* Information read in */ char *wdata2; hid_t dataspace, dataset2; - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Datatype ID */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t dims1[] = {SPACE1_DIM1}; hsize_t size; /* Number of bytes which will be used */ unsigned i; /* counting variable */ size_t str_used; /* String data in memory */ size_t mem_used=0; /* Memory used during allocation */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic VL String Functionality\n")); @@ -181,7 +179,7 @@ test_vlstrings_basic(void) /* Count the actual number of bytes used by the strings */ for(i=0,str_used=0; i<SPACE1_DIM1; i++) - str_used+=HDstrlen(wdata[i])+1; + str_used += HDstrlen(wdata[i])+1; /* Compare against the strings actually written */ VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size"); @@ -196,7 +194,7 @@ test_vlstrings_basic(void) /* Compare data read in */ for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { @@ -247,14 +245,14 @@ test_vlstrings_special(void) const char *wdata2[SPACE1_DIM1] = {NULL, NULL, NULL, NULL}; char *rdata[SPACE1_DIM1]; /* Information read in */ char *fill; /* Fill value */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Datatype ID */ - hid_t dcpl; /* Dataset creation property list ID */ - hsize_t dims1[] = {SPACE1_DIM1}; + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hid_t dcpl; /* Dataset creation property list ID */ + hsize_t dims1[] = {SPACE1_DIM1}; unsigned i; /* counting variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Special VL Strings\n")); @@ -298,7 +296,7 @@ test_vlstrings_special(void) /* Compare data read in */ for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i])); continue; } /* end if */ if((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) { @@ -477,14 +475,14 @@ test_compact_vlstring(void) { const char *wdata[SPACE1_DIM1] = {"one", "two", "three", "four"}; char *rdata[SPACE1_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 */ - hid_t plist; /* Dataset creation property list */ - hsize_t dims1[] = {SPACE1_DIM1}; + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hid_t plist; /* Dataset creation property list */ + hsize_t dims1[] = {SPACE1_DIM1}; unsigned i; /* counting variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing VL Strings in compact dataset\n")); @@ -525,7 +523,7 @@ test_compact_vlstring(void) /* Compare data read in */ for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0) { @@ -760,7 +758,8 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch if(HDstrcmp(data, data_read)) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); - HDfree(data_read); + ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_read); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); } /**************************************************************** @@ -799,33 +798,33 @@ static void test_vl_rewrite(void) /* Create in file 1 */ for(i=0; i<REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); write_scalar_dset(file1, type, space, name, name); } /* Effectively copy data from file 1 to 2 */ for(i=0; i<REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file1, type, space, name, name); write_scalar_dset(file2, type, space, name, name); } /* Read back from file 2 */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file2, type, space, name, name); } /* end for */ /* Remove from file 2. */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); ret = H5Ldelete(file2, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ /* Effectively copy from file 1 to file 2 */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file1, type, space, name, name); write_scalar_dset(file2, type, space, name, name); } /* end for */ @@ -872,15 +871,14 @@ test_vlstrings(void) test_vl_rewrite(); } /* test_vlstrings() */ - /*------------------------------------------------------------------------- - * Function: cleanup_vlstrings + * Function: cleanup_vlstrings * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * September 10, 1999 * * Modifications: diff --git a/test/tvltypes.c b/test/tvltypes.c index 2147ac7..60720a0 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: tvltypes +* Test program: tvltypes * * Test the Variable-Length Datatype functionality * @@ -21,24 +21,23 @@ #include "testhdf5.h" -#include "hdf5.h" #include "H5Dprivate.h" #define FILENAME "tvltypes.h5" /* 1-D dataset with fixed dimensions */ -#define SPACE1_RANK 1 +#define SPACE1_RANK 1 #define SPACE1_DIM1 4 /* 1-D dataset with fixed dimensions */ -#define SPACE3_RANK 1 +#define SPACE3_RANK 1 #define SPACE3_DIM1 128 #define L1_INCM 16 #define L2_INCM 8 #define L3_INCM 3 /* 1-D dataset with fixed dimensions */ -#define SPACE4_RANK 1 +#define SPACE4_RANK 1 #define SPACE4_DIM_SMALL 128 #define SPACE4_DIM_LARGE (H5D_TEMP_BUF_SIZE / 64) @@ -89,7 +88,7 @@ void test_vltypes_free_custom(void *_mem, void *mem_used) */ unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */ - *(size_t *)mem_used -= *(size_t *)mem; + *(size_t *)mem_used -= *(size_t *)((void *)mem); HDfree(mem); } /* end if */ } @@ -104,7 +103,7 @@ static void test_vltypes_dataset_create(void) { hid_t fid1; /* HDF5 File IDs */ - hid_t dcpl; /* Dataset Property list */ + hid_t dcpl; /* Dataset Property list */ hid_t dataset; /* Dataset ID */ hsize_t dims1[] = {SPACE1_DIM1}; hid_t sid1; /* Dataspace ID */ @@ -136,7 +135,7 @@ test_vltypes_dataset_create(void) /* Create a dataset, supposed to fail */ H5E_BEGIN_TRY { - dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; VERIFY(dataset, FAIL, "H5Dcreate2"); @@ -167,7 +166,7 @@ static void test_vltypes_funcs(void) { hid_t type; /* Datatype ID */ - int size; + size_t size; H5T_pad_t inpad; H5T_norm_t norm; H5T_cset_t cset; @@ -181,16 +180,16 @@ test_vltypes_funcs(void) type = H5Tvlen_create (H5T_IEEE_F32BE); CHECK(type, FAIL, "H5Tvlen_create"); - size=H5Tget_precision(type); - CHECK(size, FAIL, "H5Tget_precision"); + size = H5Tget_precision(type); + CHECK(size, 0, "H5Tget_precision"); - size=H5Tget_size(type); - CHECK(size, FAIL, "H5Tget_size"); + size = H5Tget_size(type); + CHECK(size, 0, "H5Tget_size"); - size=H5Tget_ebias(type); - CHECK(size, FAIL, "H5Tget_ebias"); + size = H5Tget_ebias(type); + CHECK(size, 0, "H5Tget_ebias"); - ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); + ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); CHECK(ret, FAIL, "H5Tset_pad"); inpad = H5Tget_inpad(type); @@ -230,18 +229,18 @@ test_vltypes_vlen_atomic(void) hvl_t wdata2[SPACE1_DIM1]; /* Information to write */ hvl_t rdata[SPACE1_DIM1]; /* Information read in */ hvl_t fill; /* Fill value */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ hid_t sid2; /* ID of bad dataspace (no extent set) */ - hid_t tid1; /* Datatype ID */ + hid_t tid1; /* Datatype ID */ hid_t dcpl_pid; /* Dataset creation property list ID */ hid_t xfer_pid; /* Dataset transfer property list ID */ hsize_t dims1[] = {SPACE1_DIM1}; hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Atomic VL Datatype Functionality\n")); @@ -468,7 +467,7 @@ test_vltypes_vlen_atomic(void) /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { - ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); @@ -500,7 +499,7 @@ test_vltypes_vlen_atomic(void) /* Try to reclaim read data using "bad" dataspace with no extent * Should fail */ H5E_BEGIN_TRY { - ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); + ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_reclaim"); @@ -556,7 +555,7 @@ rewrite_vltypes_vlen_atomic(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=4; + unsigned increment=4; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -709,16 +708,16 @@ test_vltypes_vlen_compound(void) } s1; hvl_t wdata[SPACE1_DIM1]; /* Information to write */ hvl_t rdata[SPACE1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1, tid2; /* Datatype IDs */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1, tid2; /* Datatype IDs */ hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t dims1[] = {SPACE1_DIM1}; hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Compound VL Datatype Functionality\n")); @@ -728,8 +727,8 @@ test_vltypes_vlen_compound(void) wdata[i].p=HDmalloc((i+1)*sizeof(s1)); wdata[i].len=i+1; for(j=0; j<(i+1); j++) { - ((s1 *)wdata[i].p)[j].i=i*10+j; - ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F); + ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j); + ((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F; } /* end for */ } /* end for */ @@ -796,7 +795,7 @@ test_vltypes_vlen_compound(void) TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); continue; } /* end if */ - if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) { + if(!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) { TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); continue; } /* end if */ @@ -863,7 +862,7 @@ rewrite_vltypes_vlen_compound(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=4; + unsigned increment=4; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -874,8 +873,8 @@ rewrite_vltypes_vlen_compound(void) wdata[i].p = HDmalloc((i + increment) * sizeof(s1)); wdata[i].len = i + increment; for(j = 0; j < (i + increment); j++) { - ((s1 *)wdata[i].p)[j].i = i * 40 + j; - ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F); + ((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j); + ((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F; } /* end for */ } /* end for */ @@ -941,7 +940,7 @@ rewrite_vltypes_vlen_compound(void) TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); continue; } /* end if */ - if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) { + if(!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) { TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); continue; } /* end if */ @@ -999,32 +998,36 @@ test_vltypes_compound_vlen_vlen(void) float f; hvl_t v; } s1; - s1 wdata[SPACE3_DIM1]; /* data to write */ - s1 rdata[SPACE3_DIM1]; /* data to read */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1, tid2, tid3; /* Datatype IDs */ - hsize_t dims1[] = {SPACE3_DIM1}; + s1 *wdata; /* data to write */ + s1 *rdata; /* data to read */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1, tid2, tid3; /* Datatype IDs */ + hsize_t dims1[] = {SPACE3_DIM1}; unsigned i,j,k; /* counting variables */ hvl_t *t1, *t2; /* Temporary pointer to VL information */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; i<SPACE3_DIM1; i++) { - wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0F); - wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t)); - wdata[i].v.len=i+L1_INCM; - for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) { - t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int)); - t1->len=j+L2_INCM; - for(k=0; k<j+L2_INCM; k++) - ((unsigned int*)t1->p)[k] = i*100 + j*10 + k; - } + wdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1); + CHECK_PTR(wdata, "HDmalloc"); + rdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1); + CHECK_PTR(rdata, "HDmalloc"); + for(i = 0; i < SPACE3_DIM1; i++) { + wdata[i].i = (int)(i * 10); + wdata[i].f = (float)(i * 20) / 3.0F; + wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t)); + wdata[i].v.len = i + L1_INCM; + for(t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) { + t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int)); + t1->len = j + L2_INCM; + for(k = 0; k < j + L2_INCM; k++) + ((unsigned int*)t1->p)[k] = i * 100 + j * 10 + k; + } /* end for */ } /* end for */ /* Create file */ @@ -1090,7 +1093,7 @@ test_vltypes_compound_vlen_vlen(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { + if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ @@ -1100,7 +1103,7 @@ test_vltypes_compound_vlen_vlen(void) continue; } /* end if */ - for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) { + for(t1=(hvl_t *)(wdata[i].v.p), t2=(hvl_t *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) { if(t1->len != t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -1145,6 +1148,10 @@ test_vltypes_compound_vlen_vlen(void) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); + + /* Release buffers */ + HDfree(wdata); + HDfree(rdata); } /* end test_vltypes_compound_vlen_vlen() */ /**************************************************************** @@ -1159,13 +1166,13 @@ static void test_vltypes_compound_vlstr(void) { typedef enum { - red, - blue, - green + red, + blue, + green } e1; typedef struct { char *string; - e1 color; + e1 color; } s2; typedef struct { /* Struct that the compound type are composed of */ hvl_t v; @@ -1174,21 +1181,21 @@ test_vltypes_compound_vlstr(void) s1 wdata2[SPACE1_DIM1]; /* data to write */ s1 rdata[SPACE1_DIM1]; /* data to read */ s1 rdata2[SPACE1_DIM1]; /* data to read */ - char str[64] = "a\0"; - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset, dset2; /* Dataset ID */ - hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */ - hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */ - hid_t cparms; - hsize_t dims1[] = {SPACE1_DIM1}; - hsize_t chunk_dims[] = {SPACE1_DIM1/2}; - hsize_t maxdims[] = {H5S_UNLIMITED}; - hsize_t size[] = {SPACE1_DIM1}; - hsize_t offset[] = {0}; + char str[64] = "a\0"; + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, dset2; /* Dataset ID */ + hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */ + hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */ + hid_t cparms; + hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t chunk_dims[] = {SPACE1_DIM1/2}; + hsize_t maxdims[] = {H5S_UNLIMITED}; + hsize_t size[] = {SPACE1_DIM1}; + hsize_t offset[] = {0}; unsigned i,j; /* counting variables */ s2 *t1, *t2; /* Temporary pointer to VL information */ - int val; - herr_t ret; /* Generic return value */ + int val; + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing VL Datatype of Compound Datatype with VL String Functionality\n")); @@ -1197,12 +1204,12 @@ test_vltypes_compound_vlstr(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2)); wdata[i].v.len=i+L3_INCM; - for(t1=(wdata[i].v).p, j=0; j<(i+L3_INCM); j++, t1++) { - strcat(str, "m"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); - /*t1->color = red;*/ - t1->color = blue; + for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) { + HDstrcat(str, "m"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); + /*t1->color = red;*/ + t1->color = blue; } } /* end for */ @@ -1340,8 +1347,8 @@ test_vltypes_compound_vlstr(void) continue; } /* end if */ - for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) { - if( strcmp(t1->string, t2->string) ) { + for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1361,15 +1368,15 @@ test_vltypes_compound_vlstr(void) CHECK(ret, FAIL, "H5Dvlen_reclaim"); /* Use this part for new data */ - strcpy(str, "bbbbbbbb\0"); + HDstrcpy(str, "bbbbbbbb\0"); for(i=0; i<SPACE1_DIM1; i++) { wdata2[i].v.p=(s2*)HDmalloc((i+1)*sizeof(s2)); wdata2[i].v.len=i+1; for(t1=(s2*)(wdata2[i].v).p, j=0; j<i+1; j++, t1++) { - strcat(str, "pp"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); - t1->color = green; + HDstrcat(str, "pp"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); + t1->color = green; } } /* end for */ @@ -1398,8 +1405,8 @@ test_vltypes_compound_vlstr(void) continue; } /* end if */ - for(t1=wdata2[i].v.p, t2=rdata2[i].v.p, j=0; j<rdata2[i].v.len; j++, t1++, t2++) { - if( strcmp(t1->string, t2->string) ) { + for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; j<rdata2[i].v.len; j++, t1++, t2++) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1459,29 +1466,29 @@ test_vltypes_compound_vlen_atomic(void) s1 wdata[SPACE1_DIM1]; /* Information to write */ s1 rdata[SPACE1_DIM1]; /* Information read in */ s1 fill; /* Fill value */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1, tid2; /* Datatype IDs */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1, tid2; /* Datatype IDs */ hid_t xfer_pid; /* Dataset transfer property list ID */ hid_t dcpl_pid; /* Dataset creation property list ID */ - hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t dims1[] = {SPACE1_DIM1}; hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0F); - wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int)); - wdata[i].v.len=i+1; - for(j=0; j<(i+1); j++) - ((unsigned int *)wdata[i].v.p)[j]=i*10+j; + for(i = 0; i < SPACE1_DIM1; i++) { + wdata[i].i = (int)(i * 10); + wdata[i].f = (float)(i * 20) / 3.0F; + wdata[i].v.p = HDmalloc((i + 1)*sizeof(unsigned int)); + wdata[i].v.len = i + 1; + for(j = 0; j < (i + 1); j++) + ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j; } /* end for */ /* Create file */ @@ -1544,7 +1551,7 @@ test_vltypes_compound_vlen_atomic(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { + if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ @@ -1593,8 +1600,8 @@ test_vltypes_compound_vlen_atomic(void) /* Check data read in */ for(i = 0; i < SPACE1_DIM1; i++) - if(rdata[i].i != 0 || !FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL) - TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p); + if(rdata[i].i != 0 || !H5_FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL) + TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,(double)rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); @@ -1610,7 +1617,7 @@ test_vltypes_compound_vlen_atomic(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { + if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ @@ -1663,9 +1670,9 @@ test_vltypes_compound_vlen_atomic(void) /**************************************************************** ** ** rewrite_vltypes_compound_vlen_atomic(): Check memory leak for -** basic VL datatype code. +** basic VL datatype code. ** Check memory leak for compound datatypes with VL datatypes -** of atomic datatypes. +** of atomic datatypes. ** ****************************************************************/ static void @@ -1686,7 +1693,7 @@ rewrite_vltypes_compound_vlen_atomic(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=4; + unsigned increment=4; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1694,8 +1701,8 @@ rewrite_vltypes_compound_vlen_atomic(void) /* Allocate and initialize VL data to write */ for(i = 0; i < SPACE1_DIM1; i++) { - wdata[i].i = i * 40; - wdata[i].f = (float)((i * 50) / 3.0F); + wdata[i].i = (int)(i * 40); + wdata[i].f = (float)(i * 50) / 3.0F; wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int)); wdata[i].v.len = i + increment; for(j = 0; j < (i + increment); j++) @@ -1762,7 +1769,7 @@ rewrite_vltypes_compound_vlen_atomic(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { + if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ @@ -1847,16 +1854,16 @@ test_vltypes_vlen_vlen_atomic(void) hvl_t wdata[SPACE1_DIM1]; /* Information to write */ hvl_t rdata[SPACE1_DIM1]; /* Information read in */ hvl_t *t1, *t2; /* Temporary pointer to VL information */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1, tid2; /* Datatype IDs */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1, tid2; /* Datatype IDs */ hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t dims1[] = {SPACE1_DIM1}; hsize_t size; /* Number of bytes which will be used */ unsigned i,j,k; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing VL Datatypes with VL Atomic Datatype Component Functionality\n")); @@ -1869,7 +1876,7 @@ test_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len=i+1; - for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) { + for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+1); j++, t1++) { t1->p=HDmalloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -1958,7 +1965,7 @@ test_vltypes_vlen_vlen_atomic(void) /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); + VERIFY(size, (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata); @@ -1967,7 +1974,7 @@ test_vltypes_vlen_vlen_atomic(void) /* Make certain the correct amount of memory has been used */ /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dread"); + VERIFY(mem_used, (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dread"); /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { @@ -1975,7 +1982,7 @@ test_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { + for(t1=(hvl_t *)wdata[i].p, t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2041,12 +2048,12 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1; /* Dataspace ID */ - hid_t tid2; /* Datatype IDs */ + hid_t tid2; /* Datatype IDs */ hid_t xfer_pid; /* Dataset transfer property list ID */ hsize_t size; /* Number of bytes which will be used */ unsigned i,j,k; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=1; + unsigned increment=1; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -2060,7 +2067,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len = i + increment; - for(t1 = wdata[i].p, j = 0; j < (i + increment); j++, t1++) { + for(t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) { t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); if(t1->p == NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); @@ -2155,7 +2162,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { + for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2222,7 +2229,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) hsize_t size; /* Number of bytes which will be used */ unsigned i,j,k; /* counting variables */ size_t mem_used=0; /* Memory used during allocation */ - int increment=1; + unsigned increment=1; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -2236,7 +2243,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len=i+increment; - for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) { + for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+increment); j++, t1++) { t1->p=HDmalloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -2314,7 +2321,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); + VERIFY(size, (hsize_t)(((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata); @@ -2323,7 +2330,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) /* Make certain the correct amount of memory has been used */ /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dread"); + VERIFY(mem_used, (size_t)(((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int)),"H5Dread"); /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2331,7 +2338,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { + for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2494,8 +2501,8 @@ test_vltypes_fill_value(void) /* Allocate space for the buffer to read data */ - rbuf = HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); - CHECK(rbuf, NULL, "HDmalloc"); + rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); + CHECK_PTR(rbuf, "HDmalloc"); /* Create the small & large dataspaces to use */ @@ -2536,7 +2543,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fcreate"); /* Create datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2646,7 +2653,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Read empty datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2841,7 +2848,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Write one element & fill values to datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -3145,15 +3152,15 @@ test_vltypes(void) /* These next tests use the same file */ test_vltypes_dataset_create(); /* Check dataset of VL when fill value - * won't be rewritten to it.*/ + * won't be rewritten to it.*/ test_vltypes_funcs(); /* Test functions with VL types */ test_vltypes_vlen_atomic(); /* Test VL atomic datatypes */ - rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */ + rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */ test_vltypes_vlen_compound(); /* Test VL compound datatypes */ - rewrite_vltypes_vlen_compound(); /* Check VL memory leak */ + rewrite_vltypes_vlen_compound(); /* Check VL memory leak */ test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */ - rewrite_vltypes_compound_vlen_atomic();/* Check VL memory leak */ - test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */ + rewrite_vltypes_compound_vlen_atomic();/* Check VL memory leak */ + test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */ rewrite_longer_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of longer sequence*/ rewrite_shorter_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of shorted sequence*/ test_vltypes_compound_vlen_vlen();/* Test compound datatypes with VL atomic components */ @@ -3161,15 +3168,15 @@ test_vltypes(void) test_vltypes_fill_value(); /* Test fill value for VL data */ } /* test_vltypes() */ - + /*------------------------------------------------------------------------- - * Function: cleanup_vltypes + * Function: cleanup_vltypes * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * June 8, 1999 * * Modifications: diff --git a/test/unlink.c b/test/unlink.c index 1275c3e..6b99443 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -15,17 +15,16 @@ * Programmer: Robb Matzke <matzke@llnl.gov> * Friday, September 25, 1998 * - * Purpose: Test unlinking operations. + * Purpose: Test unlinking operations. */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5G_PACKAGE /*suppress error about including H5Gpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5G_TESTING -#include <time.h> #include "h5test.h" -#include "H5Gpkg.h" /* Groups */ +#include "H5Gpkg.h" /* Groups */ const char *FILENAME[] = { "unlink", @@ -78,18 +77,18 @@ const char *FILENAME[] = { #define FULL_GROUP_EST_NUM_ENTRIES 8 #define FULL_GROUP_EST_ENTRY_LEN 9 - + /*------------------------------------------------------------------------- - * Function: test_one + * Function: test_one * - * Purpose: Creates a group that has just one entry and then unlinks that - * entry. + * Purpose: Creates a group that has just one entry and then unlinks that + * entry. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -99,8 +98,8 @@ const char *FILENAME[] = { static int test_one(hid_t file) { - hid_t work = -1, grp = -1; - herr_t status; + hid_t work = -1, grp = -1; + herr_t status; /* Create a test group */ if((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -123,10 +122,10 @@ test_one(hid_t file) TESTING("unlink without a name"); if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Ldelete(grp, ".", H5P_DEFAULT); + status = H5Ldelete(grp, ".", H5P_DEFAULT); } H5E_END_TRY; if(status>=0) - FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.") + FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.") if(H5Gclose(grp) < 0) FAIL_STACK_ERROR /* Cleanup */ @@ -137,23 +136,23 @@ test_one(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); - H5Gclose(grp); + H5Gclose(work); + H5Gclose(grp); } H5E_END_TRY; return 1; } /* end test_one() */ - + /*------------------------------------------------------------------------- - * Function: test_many + * Function: test_many * - * Purpose: Tests many unlinks in a single directory. + * Purpose: Tests many unlinks in a single directory. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -163,10 +162,10 @@ test_one(hid_t file) static int test_many(hid_t file) { - hid_t work=-1, grp=-1; - int i; - const int how_many=500; - char name[32]; + hid_t work=-1, grp=-1; + int i; + const int how_many=500; + char name[32]; /* Create a test group */ if((work = H5Gcreate2(file, "/test_many", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; @@ -176,54 +175,54 @@ test_many(hid_t file) /* Create a bunch of names and unlink them in order */ TESTING("forward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); /* Create a bunch of names and unlink them in reverse order */ TESTING("backward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = (how_many - 1); i >= 0; --i) { - sprintf(name, "obj_%05d", i); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); /* Create a bunch of names and unlink them from both directions */ TESTING("inward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = 0; i < how_many; i++) { - if(i % 2) - sprintf(name, "obj_%05d", how_many - (1 + i / 2)); - else - sprintf(name, "obj_%05d", i / 2); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(i % 2) + HDsprintf(name, "obj_%05d", how_many - (1 + i / 2)); + else + HDsprintf(name, "obj_%05d", i / 2); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); /* Create a bunch of names and unlink them from the midle */ TESTING("outward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = (how_many - 1); i >= 0; --i) { - if(i % 2) - sprintf(name, "obj_%05d", how_many - (1 + i / 2)); - else - sprintf(name, "obj_%05d", i / 2); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(i % 2) + HDsprintf(name, "obj_%05d", how_many - (1 + i / 2)); + else + HDsprintf(name, "obj_%05d", i / 2); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -234,23 +233,23 @@ test_many(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); - H5Gclose(grp); + H5Gclose(work); + H5Gclose(grp); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- - * Function: test_symlink + * Function: test_symlink * - * Purpose: Tests removal of symbolic links. + * Purpose: Tests removal of symbolic links. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * *------------------------------------------------------------------------- @@ -258,7 +257,7 @@ test_many(hid_t file) static int test_symlink(hid_t file) { - hid_t work=-1; + hid_t work=-1; TESTING("symlink removal"); @@ -275,22 +274,22 @@ test_symlink(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); + H5Gclose(work); } H5E_END_TRY; return 1; } /* end test_symlink() */ - + /*------------------------------------------------------------------------- - * Function: test_rename + * Function: test_rename * - * Purpose: Tests H5Lmove() + * Purpose: Tests H5Lmove() * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -300,7 +299,7 @@ error: static int test_rename(hid_t file) { - hid_t work=-1, foo=-1, inner=-1; + hid_t work=-1, foo=-1, inner=-1; /* Create a test group and rename something */ TESTING("object renaming"); @@ -327,14 +326,14 @@ test_rename(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); - H5Gclose(foo); - H5Gclose(inner); + H5Gclose(work); + H5Gclose(foo); + H5Gclose(inner); } H5E_END_TRY; return 1; } /* end test_rename() */ - + /*------------------------------------------------------------------------- * Function: test_new_move * @@ -354,9 +353,9 @@ error: static int test_new_move(hid_t fapl) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; TESTING("new move"); @@ -404,17 +403,17 @@ test_new_move(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: check_new_move * @@ -434,10 +433,10 @@ test_new_move(hid_t fapl) static int check_new_move(hid_t fapl) { - hid_t file; - H5O_info_t oi_hard1, oi_hard2; - char filename[1024]; - char linkval[1024]; + hid_t file; + H5O_info_t oi_hard1, oi_hard2; + char filename[1024]; + char linkval[1024]; TESTING("check new move function"); @@ -474,7 +473,7 @@ error: return 1; } /* end check_new_move() */ - + /*------------------------------------------------------------------------- * Function: test_filespace * @@ -493,21 +492,21 @@ error: static int test_filespace(hid_t fapl) { - hid_t fapl_nocache; /* File access property list with raw data cache turned off */ - hid_t contig_dcpl; /* Dataset creation property list for contiguous dataset */ - hid_t early_chunk_dcpl; /* Dataset creation property list for chunked dataset & early allocation */ - hid_t late_chunk_dcpl; /* Dataset creation property list for chunked dataset & late allocation */ - hid_t comp_dcpl; /* Dataset creation property list for compressed, chunked dataset */ - hid_t compact_dcpl; /* Dataset creation property list for compact dataset */ - hid_t file; /* File ID */ - hid_t group, group2; /* Group IDs */ - hid_t dataset, dataset2; /* Dataset IDs */ - hid_t space; /* Dataspace ID */ - hid_t type; /* Datatype ID */ - hid_t attr_space; /* Dataspace ID for attributes */ - hid_t attr; /* Attribute ID */ - char filename[1024]; /* Name of file to create */ - char objname[128]; /* Name of object to create */ + hid_t fapl_nocache; /* File access property list with raw data cache turned off */ + hid_t contig_dcpl; /* Dataset creation property list for contiguous dataset */ + hid_t early_chunk_dcpl; /* Dataset creation property list for chunked dataset & early allocation */ + hid_t late_chunk_dcpl; /* Dataset creation property list for chunked dataset & late allocation */ + hid_t comp_dcpl; /* Dataset creation property list for compressed, chunked dataset */ + hid_t compact_dcpl; /* Dataset creation property list for compact dataset */ + hid_t file; /* File ID */ + hid_t group, group2; /* Group IDs */ + hid_t dataset, dataset2; /* Dataset IDs */ + hid_t space; /* Dataspace ID */ + hid_t type; /* Datatype ID */ + hid_t attr_space; /* Dataspace ID for attributes */ + hid_t attr; /* Attribute ID */ + char filename[1024]; /* Name of file to create */ + char objname[128]; /* Name of object to create */ hsize_t dims[FILESPACE_NDIMS]= {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2}; /* Dataset dimensions */ hsize_t chunk_dims[FILESPACE_NDIMS]= {FILESPACE_CHUNK0, FILESPACE_CHUNK1, FILESPACE_CHUNK2}; /* Chunk dimensions */ hsize_t attr_dims[FILESPACE_ATTR_NDIMS]= {FILESPACE_ATTR_DIM0, FILESPACE_ATTR_DIM1}; /* Attribute dimensions */ @@ -515,7 +514,7 @@ test_filespace(hid_t fapl) int *tmp_data; /* Temporary pointer to dataset buffer */ h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ - herr_t status; /* Function status return value */ + herr_t status; /* Function status return value */ unsigned u,v,w; /* Local index variables */ /* Metadata cache parameters */ @@ -807,7 +806,7 @@ test_filespace(hid_t fapl) /* Alternate adding attributes to each one */ for(u = 0; u < FILESPACE_NATTR; u++) { /* Set the name of the attribute to create */ - sprintf(objname,"%s %u",ATTRNAME,u); + HDsprintf(objname,"%s %u",ATTRNAME,u); /* Create an attribute on the first dataset */ if((attr = H5Acreate2(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -913,7 +912,7 @@ test_filespace(hid_t fapl) /* Create a many groups to remove */ for(u = 0; u < UNLINK_NGROUPS; u++) { - sprintf(objname, "%s %u", GROUPNAME, u); + HDsprintf(objname, "%s %u", GROUPNAME, u); if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(group) < 0) FAIL_STACK_ERROR } /* end for */ @@ -921,7 +920,7 @@ test_filespace(hid_t fapl) /* Remove the all the groups */ /* (Remove them in reverse order just to make file size calculation easier -QAK) */ for(u = UNLINK_NGROUPS; u > 0; u--) { - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -976,19 +975,19 @@ test_filespace(hid_t fapl) /* Create a complex group hierarchy to remove */ for(u = 0; u < FILESPACE_TOP_GROUPS; u++) { /* Create group */ - sprintf(objname,"%s %u",GROUPNAME,u); + HDsprintf(objname,"%s %u",GROUPNAME,u); if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create nested groups inside top groups */ for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { /* Create group */ - sprintf(objname, "%s %u", GROUP2NAME, v); + HDsprintf(objname, "%s %u", GROUP2NAME, v); if((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create datasets inside nested groups */ for(w = 0; w < FILESPACE_NDATASETS; w++) { /* Create & close a dataset */ - sprintf(objname, "%s %u", DATASETNAME, w); + HDsprintf(objname, "%s %u", DATASETNAME, w); if((dataset = H5Dcreate2(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1005,19 +1004,19 @@ test_filespace(hid_t fapl) /* (Remove them in reverse order just to make file size calculation easier -QAK) */ for(u = FILESPACE_TOP_GROUPS; u > 0; u--) { /* Open group */ - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open nested groups inside top groups */ for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { /* Create group */ - sprintf(objname, "%s %u", GROUP2NAME, v); + HDsprintf(objname, "%s %u", GROUP2NAME, v); if((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Remove datasets inside nested groups */ for(w = 0; w < FILESPACE_NDATASETS; w++) { /* Remove dataset */ - sprintf(objname, "%s %u", DATASETNAME, w); + HDsprintf(objname, "%s %u", DATASETNAME, w); if(H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1025,7 +1024,7 @@ test_filespace(hid_t fapl) if(H5Gclose(group2) < 0) FAIL_STACK_ERROR /* Remove nested group */ - sprintf(objname, "%s %u",GROUP2NAME, v); + HDsprintf(objname, "%s %u",GROUP2NAME, v); if(H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1033,7 +1032,7 @@ test_filespace(hid_t fapl) if(H5Gclose(group) < 0) FAIL_STACK_ERROR /* Remove top group */ - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1233,7 +1232,7 @@ error: return 1; } /* end test_filespace() */ - + /*------------------------------------------------------------------------- * Function: test_create_unlink * @@ -1252,10 +1251,10 @@ error: static int test_create_unlink(const char *msg, hid_t fapl) { - hid_t file, group; + hid_t file, group; unsigned u; - char groupname[1024]; - char filename[1024]; + char groupname[1024]; + char filename[1024]; TESTING(msg); @@ -1266,25 +1265,25 @@ test_create_unlink(const char *msg, hid_t fapl) /* Create a many groups to remove */ for(u = 0; u < UNLINK_NGROUPS; u++) { - sprintf(groupname, "%s %u", GROUPNAME, u); + HDsprintf(groupname, "%s %u", GROUPNAME, u); if((group = H5Gcreate2(file, groupname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf("group %s creation failed\n", groupname); + HDprintf("group %s creation failed\n", groupname); goto error; } /* end if */ if(H5Gclose (group) < 0) { H5_FAILED(); - printf("closing group %s failed\n", groupname); + HDprintf("closing group %s failed\n", groupname); goto error; } /* end if */ } /* end for */ /* Remove the all the groups */ for(u = 0; u < UNLINK_NGROUPS; u++) { - sprintf(groupname, "%s %u", GROUPNAME, u); + HDsprintf(groupname, "%s %u", GROUPNAME, u); if(H5Ldelete(file, groupname, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Unlinking group %s failed\n", groupname); + HDprintf("Unlinking group %s failed\n", groupname); goto error; } /* end if */ } /* end for */ @@ -1300,7 +1299,7 @@ error: return 1; } /* end test_create_unlink() */ - + /*------------------------------------------------------------------------- * Function: test_link_slashes * @@ -1321,7 +1320,7 @@ test_link_slashes(hid_t fapl) { hid_t fid; /* File ID */ hid_t gid, gid2; /* Group ID */ - char filename[1024]; + char filename[1024]; TESTING("creating links with multiple slashes"); @@ -1368,7 +1367,7 @@ error: return 1; } /* end test_link_slashes() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_slashes * @@ -1389,7 +1388,7 @@ test_unlink_slashes(hid_t fapl) { hid_t fid; /* File ID */ hid_t gid; /* Group ID */ - char filename[1024]; + char filename[1024]; TESTING("deleting links with multiple slashes"); @@ -1465,7 +1464,7 @@ delete_node(hid_t pid, hid_t id) return(0); } - + /*------------------------------------------------------------------------- * Function: test_unlink_rightleaf * @@ -1500,14 +1499,14 @@ test_unlink_rightleaf(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - sprintf(name, "Zone%d", n + 1); + HDsprintf(name, "Zone%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR } /* end for */ /* Unlink & re-create each group */ for (n = 0; n < ngroups; n++) { if(delete_node (rootid, gids[n]) < 0) TEST_ERROR - sprintf(name, "Zone%d", n + 1); + HDsprintf(name, "Zone%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR } /* end for */ @@ -1544,7 +1543,7 @@ error: return 1; } /* end test_unlink_rightleaf() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_rightnode * @@ -1579,7 +1578,7 @@ test_unlink_rightnode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - sprintf(name, "ZoneB%d", n + 1); + HDsprintf(name, "ZoneB%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1623,7 +1622,7 @@ error: return 1; } /* end test_unlink_rightnode() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_middlenode * @@ -1658,7 +1657,7 @@ test_unlink_middlenode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - sprintf(name, "ZoneC%d", n + 1); + HDsprintf(name, "ZoneC%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1845,7 +1844,7 @@ error: return 1; } /* end test_unlink_middlenode() */ - + /*------------------------------------------------------------------------- * Function: test_resurrect_dataset * @@ -1866,7 +1865,7 @@ static int test_resurrect_dataset(hid_t fapl) { hid_t f = -1, s = -1, d = -1; - char filename[1024]; + char filename[1024]; TESTING("resurrecting dataset after deletion"); @@ -1909,14 +1908,14 @@ test_resurrect_dataset(hid_t fapl) error: H5E_BEGIN_TRY { - H5Sclose(s); - H5Dclose(d); - H5Fclose(f); + H5Sclose(s); + H5Dclose(d); + H5Fclose(f); } H5E_END_TRY; return 1; } /* end test_resurrect_dataset() */ - + /*------------------------------------------------------------------------- * Function: test_resurrect_datatype * @@ -1979,13 +1978,13 @@ test_resurrect_datatype(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(type); - H5Fclose(file); + H5Tclose(type); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_resurrect_datatype() */ - + /*------------------------------------------------------------------------- * Function: test_resurrect_group * @@ -2047,13 +2046,13 @@ test_resurrect_group(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(group); - H5Fclose(file); + H5Gclose(group); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_resurrect_group() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_chunked_dataset * @@ -2130,15 +2129,15 @@ test_unlink_chunked_dataset(hid_t fapl) error: H5E_BEGIN_TRY { - H5Pclose(dcpl_id); - H5Sclose(space_id); - H5Dclose(dset_id); - H5Fclose(file_id); + H5Pclose(dcpl_id); + H5Sclose(space_id); + H5Dclose(dset_id); + H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_unlink_chunked_dataset() */ - + /*------------------------------------------------------------------------- * Function: test_full_group_compact * @@ -2157,7 +2156,7 @@ test_full_group_compact(hid_t fapl) { hid_t file_id = -1; hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2178,7 +2177,7 @@ test_full_group_compact(hid_t fapl) /* Create several objects to link to */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "keep %u\n", u); + HDsprintf(objname, "keep %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2206,14 +2205,14 @@ test_full_group_compact(hid_t fapl) /* Create hard links to objects in group to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); - sprintf(objname2, "keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname2, "keep %u\n", u); if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Create several objects to delete */ for(u = 0; u < FULL_GROUP_NUM_DELETE_COMPACT; u++) { - sprintf(objname, "delete %u\n", u); + HDsprintf(objname, "delete %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2228,7 +2227,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2245,7 +2244,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2264,14 +2263,14 @@ test_full_group_compact(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(file_id); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_full_group_compact() */ - + /*------------------------------------------------------------------------- * Function: test_full_group_dense * @@ -2291,7 +2290,7 @@ test_full_group_dense(hid_t fapl) hid_t file_id = -1; hid_t gcpl = (-1); /* Group creation property list ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2312,7 +2311,7 @@ test_full_group_dense(hid_t fapl) /* Create several objects to link to */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "keep %u\n", u); + HDsprintf(objname, "keep %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2352,14 +2351,14 @@ test_full_group_dense(hid_t fapl) /* Create hard links to objects in group to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); - sprintf(objname2, "keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname2, "keep %u\n", u); if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Create several objects to delete */ for(u = 0; u < FULL_GROUP_NUM_DELETE_DENSE; u++) { - sprintf(objname, "delete %u\n", u); + HDsprintf(objname, "delete %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2374,7 +2373,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2391,7 +2390,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2410,25 +2409,25 @@ test_full_group_dense(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(gcpl); - H5Fclose(file_id); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(gcpl); + H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_full_group_dense() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test unlinking operations + * Purpose: Test unlinking operations * - * Return: Success: zero + * Return: Success: zero * - * Failure: non-zero + * Failure: non-zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -2438,10 +2437,10 @@ error: int main(void) { - hid_t fapl, fapl2, file; - int nerrors = 0; - char filename[1024]; - hbool_t new_format; + hid_t fapl, fapl2, file; + int nerrors = 0; + char filename[1024]; + unsigned new_format; /* Metadata cache parameters */ int mdc_nelmts; @@ -2468,11 +2467,11 @@ main(void) /* Set the FAPL for the type of format */ if(new_format) { - puts("\nTesting with new group format:"); + HDputs("\nTesting with new group format:"); my_fapl = fapl2; } /* end if */ else { - puts("Testing with old group format:"); + HDputs("Testing with old group format:"); my_fapl = fapl; } /* end else */ @@ -2501,12 +2500,12 @@ main(void) /* Get FAPL cache settings */ if(H5Pget_cache(fapl_small_mdc, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) - printf("H5Pget_cache failed\n"); + HDprintf("H5Pget_cache failed\n"); /* Change FAPL cache settings */ mdc_nelmts=1; if(H5Pset_cache(fapl_small_mdc, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) - printf("H5Pset_cache failed\n"); + HDprintf("H5Pset_cache failed\n"); /* Test creating & unlinking lots of objects with a 1-element metadata cache FAPL */ nerrors += test_create_unlink("create and unlink large number of objects with small cache", fapl_small_mdc); @@ -2551,11 +2550,11 @@ main(void) nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); if (nerrors) { - printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); - exit(1); + HDprintf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); + exit(EXIT_FAILURE); } - puts("All unlink tests passed."); + HDputs("All unlink tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/unregister.c b/test/unregister.c index f241a61..a5432fc 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -23,8 +23,8 @@ const char *FILENAME[] = { NULL }; -#define GROUP_NAME "group" -#define DSET_NAME "dataset" +#define GROUP_NAME "test_group" +#define DSET_NAME "test_dataset" #define FILENAME_BUF_SIZE 1024 #define DSET_DIM1 100 #define DSET_DIM2 200 @@ -34,39 +34,34 @@ const char *FILENAME[] = { #define H5Z_FILTER_DUMMY 312 -static size_t filter_dummy(unsigned int flags, size_t cd_nelmts, +static size_t do_nothing(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* Dummy filter for test_unregister_filters only */ const H5Z_class2_t H5Z_DUMMY[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DUMMY, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dummy", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_dummy, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DUMMY, /* Filter ID number */ + 1, 1, /* Encoding and decoding enabled */ + "dummy", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + do_nothing, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: filter_dummy + * Function: do_nothing * - * Purpose: A dummy compression method that doesn't do anything. This - * filter is only for test_unregister_filters. Please don't + * Purpose: A dummy compression method that doesn't do anything. This + * filter is only for test_unregister_filters. Please don't * use it for other tests because it may mess up this test. * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * April 24, 2013 + * Return: Data chunk size * *------------------------------------------------------------------------- */ static size_t -filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, +do_nothing(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { @@ -74,181 +69,221 @@ filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, } /*------------------------------------------------------------------------- - * Function: test_unregister_filters + * Function: test_unregister_filters * - * Purpose: Tests unregistering filter before closing the file + * Purpose: Tests unregistering filter before closing the file * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -test_unregister_filters(hid_t my_fapl) +test_unregister_filters(hid_t fapl_id) { - hid_t file1, file2; - hid_t dc; - hid_t gcpl, gid, group; - hid_t dataset, space; - int i, j, n; - char gname[256]; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t gid_loop = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + int i, j, n; + char group_name[32]; char filename[FILENAME_BUF_SIZE]; - const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ - hsize_t dims[2]; - int points[DSET_DIM1][DSET_DIM2]; + const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ + hsize_t dims[2]; + int data[DSET_DIM1][DSET_DIM2]; herr_t ret; TESTING("Unregistering filter"); /* Create first file */ - h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename); - if((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename)); + if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Create second file */ - h5_fixname(FILENAME[1], my_fapl, filename, sizeof filename); - if((file2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)); + if((fid2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Register DUMMY filter */ - if(H5Zregister(H5Z_DUMMY) < 0) goto error; - - if(H5Zfilter_avail(H5Z_FILTER_DUMMY)!=TRUE) goto error; + if (H5Zregister(H5Z_DUMMY) < 0) + goto error; + if (H5Zfilter_avail(H5Z_FILTER_DUMMY) != TRUE) + goto error; + + /******************* + * PART 1 - GROUPS * + *******************/ - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error; - /* Use DUMMY filter for creating groups */ - if(H5Pset_filter (gcpl, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) goto error; + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + if(H5Pset_filter(gcpl_id, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) + goto error; /* Create a group using this filter */ - if((gid = H5Gcreate2(file1, GROUP_NAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error; + if((gid = H5Gcreate2(fid1, GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Create multiple groups under the main group */ - for (i=0; i < GROUP_ITERATION; i++) { - sprintf(gname, "group_%d", i); - if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Gclose(group) < 0) goto error; + for(i = 0; i < GROUP_ITERATION; i++) { + HDsprintf(group_name, "group_%d", i); + if((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Gclose(gid_loop) < 0) + goto error; } - if(H5Fflush(file1, H5F_SCOPE_GLOBAL) < 0) goto error; + /* Flush the file containing the groups */ + if(H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0) + goto error; /* Unregister the filter before closing the group. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } /* Close the group */ - if(H5Gclose(gid) < 0) goto error; + if(H5Gclose(gid) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (gcpl) < 0) goto error; + if(H5Pclose (gcpl_id) < 0) + goto error; - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + /********************* + * PART 2 - DATASETS * + *********************/ - if(H5Pset_filter(dc, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) goto error; + /* Use DUMMY filter for creating datasets */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0) + goto error; + if(H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) + goto error; - /* Initialize the dataset */ + /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - points[i][j] = n++; + data[i][j] = n++; - /* Create the data space */ + /* Create the dataspace */ dims[0] = DSET_DIM1; dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) + goto error; /* Create a dataset in the first file */ - if((dataset = H5Dcreate2(file1, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; /* Create a dataset in the second file */ - if((dataset = H5Dcreate2(file2, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset in the second file */ + if(H5Dclose(did) < 0) + goto error; /* Unregister the filter after closing all objects but before closing files. - * It should flush all files. */ - if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) goto error; + * It should flush all files. + */ + if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (dc) < 0) goto error; - if(H5Fclose(file1) < 0) goto error; - if(H5Fclose(file2) < 0) goto error; + if(H5Pclose(dcpl_id) < 0) + goto error; + if(H5Fclose(fid1) < 0) + goto error; + if(H5Fclose(fid2) < 0) + goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Fclose(fid1); + H5Fclose(fid2); + H5Pclose(dcpl_id); + H5Pclose(gcpl_id); + H5Gclose(gid); + H5Gclose(gid_loop); + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + + return FAIL; } /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests unregistering filter with H5Zunregister + * Purpose: Tests unregistering filter with H5Zunregister * - * Return: Success: exit(0) - * - * Failure: exit(1) - * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; - int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; /* Testing setup */ h5_reset(); - fapl = h5_fileaccess(); + fapl_id = h5_fileaccess(); /* Test unregistering filter in its own file */ - nerrors += (test_unregister_filters(fapl) < 0 ? 1 : 0); + nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0); + + h5_cleanup(FILENAME, fapl_id); - if(nerrors) + if (nerrors) goto error; - printf("All filter unregistration tests passed.\n"); - h5_cleanup(FILENAME, fapl); + HDprintf("All filter unregistration tests passed.\n"); - return 0; + HDexit(EXIT_SUCCESS); error: nerrors = MAX(1, nerrors); - printf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", + HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - return 1; -} + + HDexit(EXIT_FAILURE); +} /* end main() */ @@ -205,7 +205,7 @@ test_direct(void) if(file<0) { H5Pclose (fapl); SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); + HDprintf(" Probably the file system doesn't support Direct I/O\n"); return 0; } @@ -282,8 +282,8 @@ test_direct(void) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set 1.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -314,8 +314,8 @@ test_direct(void) for(i = 0; i < DSET2_DIM; i++) if(wdata2[i] != rdata2[i]) { H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); + HDprintf(" Read different values than written in data set 2.\n"); + HDprintf(" At index %d\n", i); TEST_ERROR; } /* end if */ @@ -428,7 +428,7 @@ test_core(void) TEST_ERROR; if(fhandle==NULL) { - printf("fhandle==NULL\n"); + HDprintf("fhandle==NULL\n"); TEST_ERROR; } @@ -497,8 +497,8 @@ test_core(void) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set 1.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -547,8 +547,8 @@ test_core(void) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set 1.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -1023,19 +1023,19 @@ test_multi(void) memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3; @@ -1238,12 +1238,12 @@ test_multi_compat(void) memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; @@ -1254,12 +1254,12 @@ test_multi_compat(void) /* Make copy for the data file in the build directory, to protect the * original file in the source directory */ - sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); - sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); + HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); + HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); h5_make_local_copy(filename_s, newname_s); - sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); - sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); + HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); + HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); h5_make_local_copy(filename_r, newname_r); /* Reopen the file for read only. Verify 1.8 library can open file @@ -1647,7 +1647,7 @@ main(void) h5_reset(); - printf("Testing basic Virtual File Driver functionality.\n"); + HDprintf("Testing basic Virtual File Driver functionality.\n"); nerrors += test_sec2() < 0 ? 1 : 0; nerrors += test_core() < 0 ? 1 : 0; @@ -1661,12 +1661,12 @@ main(void) nerrors += test_windows() < 0 ? 1 : 0; if(nerrors) { - printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", + HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return 1; } - printf("All Virtual File Driver tests passed.\n"); + HDprintf("All Virtual File Driver tests passed.\n"); return 0; } |