summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/accum.c18
-rw-r--r--test/cache_common.c2
-rw-r--r--test/dsets.c14
-rw-r--r--test/dt_arith.c6
-rw-r--r--test/dtypes.c35
-rw-r--r--test/file_image.c26
-rw-r--r--test/freespace.c2
-rw-r--r--test/h5test.c4
-rw-r--r--test/ntypes.c1
-rw-r--r--test/objcopy.c2
-rw-r--r--test/tunicode.c2
11 files changed, 64 insertions, 48 deletions
diff --git a/test/accum.c b/test/accum.c
index c5f6610..e4c1bd8 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -1793,15 +1793,17 @@ accum_printf(void)
printf("=====================================================\n");
} else {
printf("=====================================================\n");
- printf(" accumulator allocated size == %lu\n", (unsigned long)accum->alloc_size);
- printf(" accumulated data size == %lu\n", (unsigned long)accum->size);
- printf(" accumulator dirty? == %d\n", accum->dirty);
+ printf(" accumulator allocated size == %zu\n", accum->alloc_size);
+ printf(" accumulated data size == %zu\n", accum->size);
+ HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty);
printf("=====================================================\n");
- printf(" start of accumulated data, loc = %llu\n", accum->loc);
- if (accum->dirty) printf(" start of dirty region, loc = %llu\n", accum->loc + accum->dirty_off);
- if (accum->dirty) printf(" end of dirty region, loc = %llu\n", accum->loc + accum->dirty_off + accum->dirty_len);
- printf(" end of accumulated data, loc = %llu\n", accum->loc + accum->size);
- printf(" end of accumulator allocation, loc = %llu\n", accum->loc + accum->alloc_size);
+ HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc);
+ if(accum->dirty) {
+ HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off));
+ HDfprintf(stdout, " end of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off + accum->dirty_len));
+ } /* end if */
+ HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size));
+ HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size));
printf("=====================================================\n");
}
printf("\n\n");
diff --git a/test/cache_common.c b/test/cache_common.c
index c2c0b12..f41e6af 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -1879,7 +1879,7 @@ verify_entry_status(H5C_t * cache_ptr,
int num_entries,
struct expected_entry_status expected[])
{
- static char msg[128];
+ static char msg[256];
hbool_t in_cache = FALSE; /* will set to TRUE if necessary */
int i;
test_entry_t * entry_ptr;
diff --git a/test/dsets.c b/test/dsets.c
index 043c44a..3b0d25d 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -1004,8 +1004,8 @@ test_conv_buffer(hid_t fid)
herr_t status = -1;
int j, k, l;
- CmpField *cf;
- CmpFieldR *cfrR;
+ CmpField *cf = NULL;
+ CmpFieldR *cfrR = NULL;
hid_t dataset = -1; /* dataset ID */
hid_t space = -1; /* data space ID */
@@ -1019,7 +1019,7 @@ test_conv_buffer(hid_t fid)
TESTING("data type conversion buffer size");
- cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField));
+ if ((cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField))) == 0) goto error;
/* Populate the data members */
for(j = 0; j < DIM1; j++)
@@ -1068,7 +1068,7 @@ test_conv_buffer(hid_t fid)
if(H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
/* Read should succeed since library will set conversion buffer big enough */
- cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR));
+ if ((cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR))) == 0) goto error;
if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0) goto error;
/* Read should fail since conversion buffer isn't big enough */
@@ -1105,10 +1105,8 @@ test_conv_buffer(hid_t fid)
if(H5Tclose(arr_type5) < 0) goto error;
if(H5Dclose(dataset) < 0) goto error;
- if(cf)
- HDfree(cf);
- if(cfrR)
- HDfree(cfrR);
+ HDfree(cf);
+ HDfree(cfrR);
puts(" PASSED");
return(0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 1b0af7a..e85e355 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -1105,9 +1105,9 @@ test_derived_flt(void)
}
fails_this_test = 0;
- if(buf) free(buf);
- if(saved_buf) free(saved_buf);
- if(aligned) free(aligned);
+ free(buf);
+ free(saved_buf);
+ free(aligned);
buf = NULL;
saved_buf = NULL;
aligned = NULL;
diff --git a/test/dtypes.c b/test/dtypes.c
index 17349b9..dca7eec 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1127,10 +1127,8 @@ test_compound_5(void)
}
/* Free memory buffers */
- if(buf)
- HDfree(buf);
- if(bkg)
- HDfree(bkg);
+ HDfree(buf);
+ HDfree(bkg);
return retval;
}
@@ -4699,11 +4697,12 @@ test_bitfield_funcs(void)
{
hid_t type=-1, ntype=-1, super=-1;
int size;
- char* tag;
+ char* tag=0;
H5T_pad_t inpad;
H5T_cset_t cset;
H5T_str_t strpad;
herr_t ret;
+ int retval=-1;
TESTING("some type functions for bitfield");
@@ -4787,16 +4786,18 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5Tclose(type);
- H5Tclose(ntype);
- PASSED();
- reset_hdf5();
- return 0;
+ retval = 0;
error:
+
+ if (retval == -1) retval = 1;
+
+ HDfree(tag);
+ H5Tclose(ntype);
H5Tclose(type);
+ if (retval == 0) PASSED();
reset_hdf5();
- return 1;
+ return retval;
}
@@ -7050,11 +7051,13 @@ error:
*/
int test_utf_ascii_conv(void)
{
- hid_t fid;
- hid_t did;
- hid_t utf8_vtid, ascii_vtid;
- hid_t utf8_tid, ascii_tid;
- hid_t sid;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t utf8_vtid = -1;
+ hid_t ascii_vtid = -1;
+ hid_t utf8_tid = -1;
+ hid_t ascii_tid = -1;
+ hid_t sid = -1;
const char *utf8_w = "foo!";
char *ascii_r = NULL;
const char *ascii_w = "bar!";
diff --git a/test/file_image.c b/test/file_image.c
index 73c901e..9d7a48c 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -86,15 +86,16 @@ typedef struct {
static int
test_properties(void)
{
- hid_t fapl_1;
- hid_t fapl_2;
- char *buffer;
+ hid_t fapl_1 = -1;
+ hid_t fapl_2 = -1;
+ char *buffer = 0;
int count = 10;
- void *temp;
- char *temp2;
+ void *temp = 0;
+ char *temp2 = 0;
int i;
size_t size;
size_t temp_size;
+ int retval = 1;
TESTING("File image property list functions");
@@ -145,18 +146,21 @@ test_properties(void)
VERIFY(temp2 != temp, "Retrieved buffer is the same as previously retrieved buffer");
VERIFY(0 == HDmemcmp(temp2, buffer, size),"Buffers contain different data");
+ retval = 0;
+
+error:
+
/* Close everything */
- if(H5Pclose(fapl_1) < 0) FAIL_STACK_ERROR
- if(H5Pclose(fapl_2) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(fapl_1) < 0) retval = 1;
+ if(H5Pclose(fapl_2) < 0) retval = 1;
HDfree(buffer);
HDfree(temp);
HDfree(temp2);
- PASSED();
- return 0;
+ if(retval == 0)
+ PASSED();
-error:
- return 1;
+ return retval;
} /* end test_properties() */
/******************************************************************************
diff --git a/test/freespace.c b/test/freespace.c
index 6960e6d..c0df4c8 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -1522,8 +1522,10 @@ test_fs_sect_merge(hid_t fapl)
/* Free the section node(s) */
if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
TEST_ERROR
+ sect_node1 = NULL;
if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
TEST_ERROR
+ sect_node2 = NULL;
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
diff --git a/test/h5test.c b/test/h5test.c
index 7faba81..ea30fad 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -735,6 +735,8 @@ h5_set_info_object(void)
valp = envp = next = HDstrdup(envp);
+ if (!valp) return 0;
+
/* create an INFO object if not created yet */
if (h5_io_info_g == MPI_INFO_NULL)
MPI_Info_create(&h5_io_info_g);
@@ -761,6 +763,8 @@ h5_set_info_object(void)
while (*namep && (*namep == ' ' || *namep == '\t'))
namep++;
+ if (!*namep) continue; /* was all white space, so move to next k/v pair */
+
/* eat up any ending white spaces */
endp = &namep[strlen(namep) - 1];
diff --git a/test/ntypes.c b/test/ntypes.c
index a63cea5..25060ec 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -1776,6 +1776,7 @@ test_vl_dtype(hid_t file)
} /* end for */
HDfree(tmp);
+ tmp = NULL;
} /* end for */
} /* end for */
diff --git a/test/objcopy.c b/test/objcopy.c
index 1306524..01f93ed 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -10351,7 +10351,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
hid_t did = -1; /* Dataset ID */
hid_t exp_did = -1; /* Dataset ID */
hid_t tid_short = -1; /* Datatype ID */
- hid_t exp_tid; /* Expected datatype ID */
+ hid_t exp_tid = -1; /* Expected datatype ID */
hid_t ocpypl_id = -1; /* Object copy plist ID */
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
diff --git a/test/tunicode.c b/test/tunicode.c
index 892e563..bd3090c 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -161,6 +161,7 @@ void test_strpad(hid_t UNUSED fid, const char *string)
/* Create a src_type that holds the UTF-8 string and its final NULL */
big_len = length + 1; /* +1 byte for final NULL */
+ HDassert((2*big_len)<=sizeof(cmpbuf));
src_type = mkstr(big_len, H5T_STR_NULLTERM);
CHECK(src_type, FAIL, "mkstr");
/* Create a dst_type that holds half of the UTF-8 string and a final
@@ -224,6 +225,7 @@ void test_strpad(hid_t UNUSED fid, const char *string)
/* Create a src_type that holds the UTF-8 string */
big_len = length;
+ HDassert((2*big_len)<=sizeof(cmpbuf));
src_type = mkstr(big_len, H5T_STR_NULLPAD);
CHECK(src_type, FAIL, "mkstr");
/* Create a dst_type that holds half of the UTF-8 string */