diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-07-28 19:33:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 19:33:16 (GMT) |
commit | 8ddf2706f7e0cde59fad6624e2863960e62f6544 (patch) | |
tree | f090bb9fa368c90f67029f5d860ef39df3e8b038 /test | |
parent | b1ab59d239c74cdbea7d518b1398458c4150655f (diff) | |
download | hdf5-8ddf2706f7e0cde59fad6624e2863960e62f6544.zip hdf5-8ddf2706f7e0cde59fad6624e2863960e62f6544.tar.gz hdf5-8ddf2706f7e0cde59fad6624e2863960e62f6544.tar.bz2 |
Sync of src w/ develop (#3307)
Diffstat (limited to 'test')
-rw-r--r-- | test/cache_common.h | 56 | ||||
-rw-r--r-- | test/cache_image.c | 8 | ||||
-rw-r--r-- | test/hdfs.c | 43 | ||||
-rw-r--r-- | test/ros3.c | 6 |
4 files changed, 46 insertions, 67 deletions
diff --git a/test/cache_common.h b/test/cache_common.h index 53f783e..8c54b5c 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -397,59 +397,40 @@ typedef struct test_entry_t { unsigned verify_ct; /* Count the # of checksum verification for an entry */ } test_entry_t; -/* The following are cut down test versions of the hash table manipulation - * macros from H5Cpkg.h, which have been further modified to avoid references - * to the error reporting macros. Needless to say, these macros must be - * updated as necessary. - */ - -#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) - #define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ - if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || \ - ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \ - (!H5_addr_defined(Addr)) || (H5C__HASH_FCN(Addr) < 0) || \ - (H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN)) { \ - HDfprintf(stdout, "Pre HT search SC failed.\n"); \ + if (H5C__PRE_HT_SEARCH_SC_CMP(cache_ptr, Addr)) { \ + fprintf(stdout, "Pre HT search SC failed.\n"); \ } #define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k) \ - if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || ((cache_ptr)->index_len < 1) || \ - ((entry_ptr) == NULL) || ((cache_ptr)->index_size < (entry_ptr)->size) || \ - ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \ - ((entry_ptr)->size <= 0) || (((cache_ptr)->index)[k] == NULL) || \ - ((((cache_ptr)->index)[k] != (entry_ptr)) && ((entry_ptr)->ht_prev == NULL)) || \ - ((((cache_ptr)->index)[k] == (entry_ptr)) && ((entry_ptr)->ht_prev != NULL)) || \ - (((entry_ptr)->ht_prev != NULL) && ((entry_ptr)->ht_prev->ht_next != (entry_ptr))) || \ - (((entry_ptr)->ht_next != NULL) && ((entry_ptr)->ht_next->ht_prev != (entry_ptr)))) { \ - HDfprintf(stdout, "Post successful HT search SC failed.\n"); \ + if (H5C__POST_SUC_HT_SEARCH_SC_CMP(cache_ptr, entry_ptr, k)) { \ + fprintf(stdout, "Post successful HT search SC failed.\n"); \ } -#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \ - if (((cache_ptr) == NULL) || (((cache_ptr)->index)[k] != (entry_ptr)) || \ - ((entry_ptr)->ht_prev != NULL)) { \ - HDfprintf(stdout, "Post HT shift to front failed.\n"); \ +#define H5C_TEST__POST_HT_SHIFT_TO_FRONT_SC(cache_ptr, entry_ptr, k) \ + if (H5C__POST_HT_SHIFT_TO_FRONT_SC_CMP(cache_ptr, entry_ptr, k)) { \ + fprintf(stdout, "Post HT shift to front failed.\n"); \ } #define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ { \ int k; \ H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ - k = H5C__HASH_FCN(Addr); \ - entry_ptr = ((cache_ptr)->index)[k]; \ + k = H5C__HASH_FCN(Addr); \ + (entry_ptr) = (cache_ptr)->index[k]; \ while (entry_ptr) { \ if (H5_addr_eq(Addr, (entry_ptr)->addr)) { \ H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k) \ - if (entry_ptr != ((cache_ptr)->index)[k]) { \ + if ((entry_ptr) != (cache_ptr)->index[k]) { \ if ((entry_ptr)->ht_next) \ (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ assert((entry_ptr)->ht_prev != NULL); \ - (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ - ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \ - (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ - (entry_ptr)->ht_prev = NULL; \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \ + (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ + (cache_ptr)->index[k]->ht_prev = (entry_ptr); \ + (entry_ptr)->ht_next = (cache_ptr)->index[k]; \ + (entry_ptr)->ht_prev = NULL; \ + (cache_ptr)->index[k] = (entry_ptr); \ + H5C_TEST__POST_HT_SHIFT_TO_FRONT_SC(cache_ptr, entry_ptr, k) \ } \ break; \ } \ @@ -563,11 +544,6 @@ H5TEST_DLL void add_flush_op(int target_type, int target_idx, int op_code, int t H5TEST_DLL void addr_to_type_and_index(haddr_t addr, int32_t *type_ptr, int32_t *index_ptr); -#if 0 /* keep this for a while -- it may be useful */ -H5TEST_DLL haddr_t type_and_index_to_addr(int32_t type, - int32_t idx); -#endif - H5TEST_DLL void dirty_entry(H5F_t *file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin); H5TEST_DLL void expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx); diff --git a/test/cache_image.c b/test/cache_image.c index ada65e4..2e95a97 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -717,10 +717,10 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, hbool_t read_onl */ if (pass) { - if (H5C_get_cache_image_config(cache_ptr, &image_ctl) < 0) { + if (H5C__get_cache_image_config(cache_ptr, &image_ctl) < 0) { pass = FALSE; - failure_mssg = "error returned by H5C_get_cache_image_config()."; + failure_mssg = "error returned by H5C__get_cache_image_config()."; } } @@ -921,7 +921,7 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, const hbool_t set_mdci_fa { file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl_id); } - H5E_END_TRY; + H5E_END_TRY } else { @@ -929,7 +929,7 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, const hbool_t set_mdci_fa { file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl_id); } - H5E_END_TRY; + H5E_END_TRY } if (file_id >= 0) { diff --git a/test/hdfs.c b/test/hdfs.c index 3c4add5..52e2eae 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -1062,17 +1062,19 @@ test_H5FDread_without_eoa_set_fails(void) * TEST * ********/ - H5E_BEGIN_TRY{ - /* mute stack trace on expected failure */ - JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer), - "cannot read before eoa is set")} H5E_END_TRY for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++){ - JSVERIFY(0, (unsigned)buffer[i], "buffer was modified by write!")} + H5E_BEGIN_TRY{/* mute stack trace on expected failure */ + JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer), + "cannot read before eoa is set")} H5E_END_TRY + for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) { + JSVERIFY(0, (unsigned)buffer[i], "buffer was modified by write!") + } /************ * TEARDOWN * ************/ - FAIL_IF(FAIL == H5FDclose(file_shakespeare)) file_shakespeare = NULL; + FAIL_IF(FAIL == H5FDclose(file_shakespeare)) + file_shakespeare = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; @@ -1377,17 +1379,17 @@ test_noops_and_autofails(void) H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data), "write must fail")} H5E_END_TRY - H5E_BEGIN_TRY{ - JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY + H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY - H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), - "truncate must fail (closing)")} H5E_END_TRY + H5E_BEGIN_TRY{ + JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY - /************ - * TEARDOWN * - ************/ + /************ + * TEARDOWN * + ************/ - FAIL_IF(FAIL == H5FDclose(file)) file = NULL; + FAIL_IF(FAIL == H5FDclose(file)) + file = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; @@ -1504,14 +1506,13 @@ test_H5F_integration(void) */ H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fopen(filename_example_h5, H5F_ACC_RDWR, fapl_id))} H5E_END_TRY - /* H5Fcreate() is not allowed with this file driver. - */ - H5E_BEGIN_TRY{ - FAIL_IF(0 <= H5Fcreate(filename_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY + /* H5Fcreate() is not allowed with this file driver. + */ + H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fcreate(filename_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY - /* Successful open. - */ - file = H5Fopen(filename_example_h5, H5F_ACC_RDONLY, fapl_id); + /* Successful open. + */ + file = H5Fopen(filename_example_h5, H5F_ACC_RDONLY, fapl_id); FAIL_IF(file < 0) /************ diff --git a/test/ros3.c b/test/ros3.c index e7bc131..267aa0a 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -1087,7 +1087,8 @@ test_H5FDread_without_eoa_set_fails(void) * TEARDOWN * ************/ - FAIL_IF(FAIL == H5FDclose(file_shakespeare)) file_shakespeare = NULL; + FAIL_IF(FAIL == H5FDclose(file_shakespeare)) + file_shakespeare = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; @@ -1396,7 +1397,8 @@ test_noops_and_autofails(void) * TEARDOWN * ************/ - FAIL_IF(FAIL == H5FDclose(file)) file = NULL; + FAIL_IF(FAIL == H5FDclose(file)) + file = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; |