summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5B2hdr.c3
-rw-r--r--test/cache_common.c70
-rw-r--r--test/testhdf5.h9
-rw-r--r--test/tfile.c72
4 files changed, 79 insertions, 75 deletions
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index 696eb89..a4f7d8e 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -264,9 +264,6 @@ H5B2_hdr_alloc(H5F_t *f)
ret_value = hdr;
done:
- if(!ret_value && hdr)
- if(H5B2_hdr_free(hdr) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to free shared v2 B-tree info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_hdr_alloc() */
diff --git a/test/cache_common.c b/test/cache_common.c
index eb40a0e..9e27c80 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -2712,61 +2712,59 @@ flush_cache(H5F_t * file_ptr,
hbool_t dump_detailed_stats)
{
const char * fcn_name = "flush_cache()";
- H5C_t * cache_ptr;
- herr_t result = 0;
hbool_t verbose = FALSE;
verify_unprotected();
- if ( pass ) {
+ if(pass) {
+ H5C_t * cache_ptr = NULL;
+ herr_t result = 0;
HDassert(file_ptr);
cache_ptr = file_ptr->shared->cache;
- if ( destroy_entries ) {
+ if(destroy_entries) {
- result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- H5C__FLUSH_INVALIDATE_FLAG);
+ result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG);
- } else {
-
- result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- H5C__NO_FLAGS_SET);
}
- }
+ else {
- if ( dump_stats ) {
+ result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
+ }
- H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
- }
+ if(dump_stats) {
- if ( result < 0 ) {
+ H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
+ }
- pass = FALSE;
- failure_mssg = "error in H5C_flush_cache().";
- }
- else if ( ( destroy_entries ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( cache_ptr->clean_index_size != 0 ) ||
- ( cache_ptr->dirty_index_size != 0 ) ) ) {
+ if(result < 0) {
- if ( verbose ) {
- HDfprintf(stdout,
- "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
- fcn_name,
- (long long)(cache_ptr->index_len),
- (long long)(cache_ptr->index_size),
- (long long)(cache_ptr->clean_index_size),
- (long long)(cache_ptr->dirty_index_size));
- }
- pass = FALSE;
- failure_mssg =
- "non zero index len/sizes after H5C_flush_cache() with invalidate.";
+ pass = FALSE;
+ failure_mssg = "error in H5C_flush_cache().";
+ }
+ else if((destroy_entries) && ((cache_ptr->index_len != 0)
+ || (cache_ptr->index_size != 0)
+ || (cache_ptr->clean_index_size != 0)
+ || (cache_ptr->dirty_index_size != 0))) {
+
+ if(verbose) {
+ HDfprintf(stdout,
+ "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
+ fcn_name,
+ (long long)(cache_ptr->index_len),
+ (long long)(cache_ptr->index_size),
+ (long long)(cache_ptr->clean_index_size),
+ (long long)(cache_ptr->dirty_index_size));
+ }
+ pass = FALSE;
+ failure_mssg = "non zero index len/sizes after H5C_flush_cache() with invalidate.";
+ }
}
-
return;
} /* flush_cache() */
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 3aefa0c..149b4c8 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -127,6 +127,15 @@
/* Used to document process through a test */
#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
+/* 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__); \
+} while(0)
+
/* definitions for command strings */
#define VERBOSITY_STR "Verbosity"
#define SKIP_STR "Skip"
diff --git a/test/tfile.c b/test/tfile.c
index d080b4a..3992c47 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1119,46 +1119,46 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
oid_count = H5Fget_obj_count(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;
- {
- hid_t *oid_list;
- int i;
- H5I_type_t id_type;
-
- oid_list = (hid_t*)calloc((size_t)oid_count, sizeof(hid_t));
+ oid_list = (hid_t *)HDcalloc((size_t)oid_count, sizeof(hid_t));
if(oid_list != NULL) {
+ int i;
+
ret_count = H5Fget_obj_ids(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++) {
- id_type = H5Iget_type(oid_list[i]);
- switch(id_type) {
- case H5I_FILE:
- if(oid_list[i]!=fid1 && oid_list[i]!=fid2 &&
- oid_list[i]!=fid3 && oid_list[i]!=fid4) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5Fget_obj_ids");
- }
- break;
- case H5I_GROUP:
- if(oid_list[i]!=gid1 && oid_list[i]!=gid2 &&
- oid_list[i]!=gid3) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5Fget_obj_ids");
- }
- break;
- case H5I_DATASET:
- VERIFY(oid_list[i], did, "H5Fget_obj_ids");
- break;
- default:
- ret = FAIL;
- CHECK(ret, FAIL, "H5Fget_obj_ids");
- }
- }
-
- free(oid_list);
- }
+
+ for(i = 0; i < oid_count; i++) {
+ H5I_type_t id_type;
+
+ id_type = H5Iget_type(oid_list[i]);
+ switch(id_type) {
+ case H5I_FILE:
+ if(oid_list[i] != fid1 && oid_list[i] != fid2
+ && oid_list[i] != fid3 && oid_list[i] != fid4)
+ ERROR("H5Fget_obj_ids");
+ break;
+
+ case H5I_GROUP:
+ if(oid_list[i] != gid1 && oid_list[i] != gid2
+ && oid_list[i] != gid3)
+ ERROR("H5Fget_obj_ids");
+ break;
+
+ case H5I_DATASET:
+ VERIFY(oid_list[i], did, "H5Fget_obj_ids");
+ break;
+
+ default:
+ ERROR("H5Fget_obj_ids");
+ } /* end switch */
+ } /* end for */
+
+ HDfree(oid_list);
+ } /* end if */
+ } /* end if */
/* close the two new files */
ret = H5Fclose(fid3);