summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cache.c122
-rw-r--r--test/dt_arith.c2
-rw-r--r--test/dtypes.c148
3 files changed, 132 insertions, 140 deletions
diff --git a/test/cache.c b/test/cache.c
index 734fc3b..7828725 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -13769,45 +13769,53 @@ check_expunge_entry(void)
* it without marking it dirty.
*/
- protect_entry(cache_ptr, 0, 0);
+ if ( pass ) {
- unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET);
+ protect_entry(cache_ptr, 0, 0);
+
+ unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( pass ) {
result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size,
&in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 2.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5AC_get_entry_status() reports failure 2.");
+ failure_mssg = msg;
- } else if ( !in_cache || is_dirty || is_protected || is_pinned ) {
+ } else if ( !in_cache || is_dirty || is_protected || is_pinned ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
+ failure_mssg = msg;
- } else if ( ( ! entry_ptr->loaded ) ||
- ( entry_ptr->cleared ) ||
- ( entry_ptr->flushed ) ||
- ( entry_ptr->destroyed ) ) {
+ } else if ( ( ! entry_ptr->loaded ) ||
+ ( entry_ptr->cleared ) ||
+ ( entry_ptr->flushed ) ||
+ ( entry_ptr->destroyed ) ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected entry history 2.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected entry history 2.");
+ failure_mssg = msg;
- }
+ }
}
/* Expunge the entry and then verify that it is no longer in the cache.
* Also verify that the entry was loaded, cleared, and destroyed, but
* not flushed.
*/
- expunge_entry(cache_ptr, 0, 0);
+ if ( pass ) {
+
+ expunge_entry(cache_ptr, 0, 0);
+
+ }
if ( pass ) {
@@ -13818,29 +13826,29 @@ check_expunge_entry(void)
result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size,
&in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 3.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5AC_get_entry_status() reports failure 3.");
+ failure_mssg = msg;
- } else if ( in_cache ) {
+ } else if ( in_cache ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
+ failure_mssg = msg;
- } else if ( ( ! entry_ptr->loaded ) ||
- ( ! entry_ptr->cleared ) ||
- ( entry_ptr->flushed ) ||
- ( ! entry_ptr->destroyed ) ) {
+ } else if ( ( ! entry_ptr->loaded ) ||
+ ( ! entry_ptr->cleared ) ||
+ ( entry_ptr->flushed ) ||
+ ( ! entry_ptr->destroyed ) ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected entry history 3.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected entry history 3.");
+ failure_mssg = msg;
- }
+ }
}
/* now repeat the process with a different entry. On unprotect
@@ -13860,14 +13868,14 @@ check_expunge_entry(void)
&in_cache, &is_dirty, &is_protected,
&is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 4.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5AC_get_entry_status() reports failure 4.");
+ failure_mssg = msg;
- } else if ( in_cache ) {
+ } else if ( in_cache ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 4.");
@@ -13882,16 +13890,20 @@ check_expunge_entry(void)
HDsnprintf(msg, (size_t)128, "Unexpected entry history 4.");
failure_mssg = msg;
- }
+ }
}
/* protect the entry to force the cache to load it, and then unprotect
* it with the dirty flag set.
*/
- protect_entry(cache_ptr, 0, 1);
+ if ( pass ) {
+
+ protect_entry(cache_ptr, 0, 1);
+
+ unprotect_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET);
- unprotect_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET);
+ }
if ( pass ) {
@@ -13899,14 +13911,14 @@ check_expunge_entry(void)
&in_cache, &is_dirty, &is_protected,
&is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5AC_get_entry_status() reports failure 5.");
failure_mssg = msg;
- } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) {
+ } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 5.");
@@ -13921,14 +13933,18 @@ check_expunge_entry(void)
HDsnprintf(msg, (size_t)128, "Unexpected entry history 5.");
failure_mssg = msg;
- }
+ }
}
/* Expunge the entry and then verify that it is no longer in the cache.
* Also verify that the entry was loaded, cleared and destroyed, but not
* flushed.
*/
- expunge_entry(cache_ptr, 0, 1);
+ if ( pass ) {
+
+ expunge_entry(cache_ptr, 0, 1);
+
+ }
if ( pass ) {
@@ -13940,14 +13956,14 @@ check_expunge_entry(void)
&in_cache, &is_dirty, &is_protected,
&is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5AC_get_entry_status() reports failure 6.");
failure_mssg = msg;
- } else if ( in_cache ) {
+ } else if ( in_cache ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 6.");
@@ -13962,7 +13978,7 @@ check_expunge_entry(void)
HDsnprintf(msg, (size_t)128, "Unexpected entry history 6.");
failure_mssg = msg;
- }
+ }
}
if ( pass ) {
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 13cf5ba..ff6b4e0 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -1334,7 +1334,6 @@ test_derived_integer(void)
char filename[1024];
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
- int *aligned=NULL;
int endian; /*endianess */
size_t nelmts = NTESTELEM;
unsigned int fails_this_test = 0;
@@ -1597,7 +1596,6 @@ test_derived_integer(void)
error:
if (buf) free(buf);
if (saved_buf) free(saved_buf);
- if (aligned) free(aligned);
HDfflush(stdout);
H5E_BEGIN_TRY {
H5Tclose (tid1);
diff --git a/test/dtypes.c b/test/dtypes.c
index 020a603..f32afe5 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -515,39 +515,37 @@ test_compound_1(void)
H5T_str_t strpad;
H5T_order_t order;
H5T_sign_t sign;
- char* tag;
+ char *tag = NULL;
int offset;
herr_t ret;
+ int retval = 1;
TESTING("compound datatypes");
/* Create the empty type */
- if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0) goto error;
+ if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0)
+ goto error;
/* Attempt to add the new compound datatype as a field within itself */
H5E_BEGIN_TRY {
ret=H5Tinsert(complex_id, "compound", 0, complex_id);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Inserted compound datatype into itself?\n");
- goto error;
+ FAIL_PUTS_ERROR("Inserted compound datatype into itself?");
} /* end if */
/* Add a couple fields */
- if (H5Tinsert(complex_id, "real", HOFFSET(complex_t, re),
- H5T_NATIVE_DOUBLE) < 0) goto error;
- if (H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im),
- H5T_NATIVE_DOUBLE) < 0) goto error;
+ if(H5Tinsert(complex_id, "real", HOFFSET(complex_t, re), H5T_NATIVE_DOUBLE) < 0)
+ goto error;
+ if(H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im), H5T_NATIVE_DOUBLE) < 0)
+ goto error;
/* Test some functions that aren't supposed to work for compound type */
H5E_BEGIN_TRY {
size=H5Tget_precision(complex_id);
} H5E_END_TRY;
if (size>0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
size = 128;
@@ -555,108 +553,89 @@ test_compound_1(void)
ret = H5Tset_precision(complex_id, size);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
ret = H5Tget_pad(complex_id, &lsb, &msb);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
size = H5Tget_ebias(complex_id);
} H5E_END_TRY;
if (size>0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
lsb = H5Tget_inpad(complex_id);
} H5E_END_TRY;
if (lsb>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
cset = H5Tget_cset(complex_id);
} H5E_END_TRY;
if (cset>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
strpad = H5Tget_strpad(complex_id);
} H5E_END_TRY;
if (strpad>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
offset = H5Tget_offset(complex_id);
} H5E_END_TRY;
if (offset>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
order = H5Tget_order(complex_id);
} H5E_END_TRY;
if (order>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
sign = H5Tget_sign(complex_id);
} H5E_END_TRY;
if (sign>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
tag = H5Tget_tag(complex_id);
} H5E_END_TRY;
if (tag) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
super = H5Tget_super(complex_id);
} H5E_END_TRY;
if (super>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- if (H5Tclose (complex_id) < 0) goto error;
+ if (H5Tclose (complex_id) < 0)
+ goto error;
PASSED();
- return 0;
+ retval = 0;
- error:
- return 1;
+error:
+ if(tag)
+ HDfree(tag);
+ return retval;
}
@@ -1068,6 +1047,7 @@ test_compound_5(void)
dst_type_t *dst;
void *buf = calloc(2, sizeof(dst_type_t));
void *bkg = calloc(2, sizeof(dst_type_t));
+ int retval = 1;
#if 1
TESTING("optimized struct converter");
@@ -1124,14 +1104,17 @@ test_compound_5(void)
src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
src[1].coll_ids[3]!=dst[1].coll_ids[3]) {
H5_FAILED();
- return 1;
+ } else {
+ PASSED();
+ retval = 0;
}
/* Free memory buffers */
- free(buf);
- free(bkg);
- PASSED();
- return 0;
+ if(buf)
+ HDfree(buf);
+ if(bkg)
+ HDfree(bkg);
+ return retval;
}
@@ -2054,10 +2037,11 @@ test_compound_11(void)
hid_t big_tid, little_tid; /* Datatype IDs for type conversion */
hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */
hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */
- void *buf, /* Conversion buffer */
- *buf_orig, /* Copy of original conversion buffer */
- *bkg; /* Background buffer */
+ void *buf = NULL; /* Conversion buffer */
+ void *buf_orig = NULL; /* Copy of original conversion buffer */
+ void *bkg = NULL; /* Background buffer */
size_t u; /* Local index variable */
+ int retval = 1;
TESTING("registering type conversion routine with compound conversions");
@@ -2216,18 +2200,21 @@ test_compound_11(void)
if(H5Tclose(opaq_src_tid) < 0) TEST_ERROR
if(H5Tclose(little_tid2) < 0) TEST_ERROR
if(H5Tclose(big_tid2) < 0) TEST_ERROR
- HDfree(bkg);
- HDfree(buf_orig);
- HDfree(buf);
if(H5Tclose(little_tid) < 0) TEST_ERROR
if(H5Tclose(big_tid) < 0) TEST_ERROR
if(H5Tclose(var_string_tid) < 0) TEST_ERROR
PASSED();
- return 0;
+ retval = 0;
- error:
- return 1;
+error:
+ if(buf)
+ HDfree(buf);
+ if(buf_orig)
+ HDfree(buf_orig);
+ if(bkg)
+ HDfree(bkg);
+ return retval;
}
@@ -4133,7 +4120,7 @@ test_conv_str_3(void)
int size;
H5T_pad_t inpad;
H5T_sign_t sign;
- char* tag;
+ char *tag = NULL;
herr_t ret;
TESTING("some type functions for string");
@@ -4163,63 +4150,54 @@ test_conv_str_3(void)
ret=H5Tset_precision(type, nelmts);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
size = H5Tget_ebias(type);
} H5E_END_TRY;
if (size>0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
inpad=H5Tget_inpad(type);
} H5E_END_TRY;
if (inpad>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
sign=H5Tget_sign(type);
} H5E_END_TRY;
if (sign>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
tag = H5Tget_tag(type);
} H5E_END_TRY;
if (tag) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
super = H5Tget_super(type);
} H5E_END_TRY;
if (super>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
PASSED();
ret_value = 0;
- error:
- if (buf) HDfree(buf);
+error:
+ if(buf)
+ HDfree(buf);
+ if(tag)
+ HDfree(tag);
reset_hdf5();
- return ret_value;
+ return ret_value; /* Number of errors */
}