summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/file_image.c17
-rw-r--r--test/h5test.c20
-rw-r--r--test/h5test.h2
-rw-r--r--test/testframe.c6
-rw-r--r--test/testhdf5.h12
-rw-r--r--test/tgenprop.c122
6 files changed, 150 insertions, 29 deletions
diff --git a/test/file_image.c b/test/file_image.c
index 9d7a48c..c734db8 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -163,6 +163,7 @@ error:
return retval;
} /* end test_properties() */
+
/******************************************************************************
* Function: malloc_cb
*
@@ -185,6 +186,7 @@ malloc_cb(size_t size, H5FD_file_image_op_t op, void *udata)
return HDmalloc(size);
}
+
/******************************************************************************
* Function: memcpy_cb
*
@@ -207,6 +209,7 @@ memcpy_cb(void *dest, const void *src, size_t size, H5FD_file_image_op_t op, voi
return HDmemcpy(dest, src, size);
}
+
/******************************************************************************
* Function: realloc_cb
*
@@ -229,6 +232,7 @@ realloc_cb(void *ptr, size_t size, H5FD_file_image_op_t op, void *udata)
return HDrealloc(ptr,size);
}
+
/******************************************************************************
* Function: free_cb
*
@@ -250,6 +254,7 @@ free_cb(void *ptr, H5FD_file_image_op_t op, void *udata)
return(SUCCEED);
}
+
/******************************************************************************
* Function: udata_copy_cb
*
@@ -273,6 +278,7 @@ udata_copy_cb(void *udata)
return udata;
}
+
/******************************************************************************
* Function: udata_free_cb
*
@@ -296,6 +302,7 @@ udata_free_cb(void *udata)
return(SUCCEED);
}
+
/******************************************************************************
* Function: reset_udata
*
@@ -314,6 +321,7 @@ reset_udata(udata_t *u)
u->malloc_src = u->memcpy_src = u->realloc_src = u->free_src = H5FD_FILE_IMAGE_OP_NO_OP;
}
+
/******************************************************************************
* Function: test_callbacks
*
@@ -502,6 +510,7 @@ error:
return 1;
} /* test_callbacks() */
+
/******************************************************************************
* Function: test_core
*
@@ -647,6 +656,7 @@ error:
return 1;
} /* end test_core() */
+
/******************************************************************************
* Function: test_get_file_image
*
@@ -899,6 +909,7 @@ error:
return 1;
} /* end test_get_file_image() */
+
/******************************************************************************
* Function: test_get_file_image_error_rejection
*
@@ -1282,7 +1293,7 @@ main(void)
/* test H5Fget_file_image() with sec2 driver */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(0 > H5Pset_fapl_sec2(fapl))
+ if(H5Pset_fapl_sec2(fapl) < 0)
errors++;
else
errors += test_get_file_image("H5Fget_file_image() with sec2 driver",
@@ -1290,7 +1301,7 @@ main(void)
/* test H5Fget_file_image() with stdio driver */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(0 > H5Pset_fapl_stdio(fapl))
+ if(H5Pset_fapl_stdio(fapl) < 0)
errors++;
else
errors += test_get_file_image("H5Fget_file_image() with stdio driver",
@@ -1298,7 +1309,7 @@ main(void)
/* test H5Fget_file_image() with core driver */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(0 > H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE))
+ if(H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE) < 0)
errors++;
else
errors += test_get_file_image("H5Fget_file_image() with core driver",
diff --git a/test/h5test.c b/test/h5test.c
index ea30fad..91497e3 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -408,7 +408,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (!fullname[0])
/* We didn't append the prefix yet */
- HDstrncpy(fullname, prefix, MIN(strlen(prefix), size));
+ HDstrncpy(fullname, prefix, MIN(HDstrlen(prefix), size));
if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
/*
@@ -751,7 +751,7 @@ h5_set_info_object(void)
/* copy key/value pair into temporary buffer */
len = strcspn(valp, ";");
next = &valp[len];
- key_val = calloc(1, len + 1);
+ key_val = (char *)calloc(1, len + 1);
/* increment the next pointer past the terminating semicolon */
if (*next == ';')
@@ -766,7 +766,7 @@ h5_set_info_object(void)
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];
+ endp = &namep[HDstrlen(namep) - 1];
while (endp && (*endp == ' ' || *endp == '\t'))
*endp-- = '\0';
@@ -1061,7 +1061,7 @@ getenv_all(MPI_Comm comm, int root, const char* name)
if(mpi_rank == root) {
env = HDgetenv(name);
if(env) {
- len = HDstrlen(env);
+ len = (int)HDstrlen(env);
MPI_Bcast(&len, 1, MPI_INT, root, comm);
MPI_Bcast(env, len, MPI_CHAR, root, comm);
}
@@ -1075,9 +1075,9 @@ getenv_all(MPI_Comm comm, int root, const char* name)
MPI_Bcast(&len, 1, MPI_INT, root, comm);
if(len >= 0) {
if(env == NULL)
- env = (char*) HDmalloc(len+1);
- else if(strlen(env) < len)
- env = (char*) HDrealloc(env, len+1);
+ env = (char*) HDmalloc((size_t)len+1);
+ else if(HDstrlen(env) < (size_t)len)
+ env = (char*) HDrealloc(env, (size_t)len+1);
MPI_Bcast(env, len, MPI_CHAR, root, comm);
env[len] = '\0';
@@ -1129,7 +1129,11 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
#ifdef H5_VMS
HDstrcat(filename, origfilename);
#else
- char * srcdir = HDgetenv("srcdir"); /* The source directory */
+ const char * srcdir = HDgetenv("srcdir"); /* The source directory */
+
+ /* Check for using the srcdir from configure time */
+ if(NULL == srcdir)
+ srcdir = config_srcdir;
if(srcdir && ((HDstrlen(srcdir) +
HDstrlen(origfilename) + 6) < FILENAME_BUF_SIZE)) {
diff --git a/test/h5test.h b/test/h5test.h
index dd38546..0c52bd1 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -175,7 +175,7 @@ H5TEST_DLL void ParseTestVerbosity(char *argv);
H5TEST_DLL int GetTestNumErrs(void);
H5TEST_DLL void IncTestNumErrs(void);
H5TEST_DLL const void *GetTestParameters(void);
-H5TEST_DLL int TestErrPrintf(const char *format, ...);
+H5TEST_DLL int TestErrPrintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
H5TEST_DLL void SetTest(const char *testname, int action);
H5TEST_DLL void TestAlarmOn(void);
H5TEST_DLL void TestAlarmOff(void);
diff --git a/test/testframe.c b/test/testframe.c
index 6fbace1..5835b73 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -124,12 +124,6 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
*/
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
{
-#if !(defined MAC)
- /* Un-buffer the stdout and stderr */
- setbuf(stderr, NULL);
- setbuf(stdout, NULL);
-#endif
-
/*
* Turn off automatic error reporting since we do it ourselves. Besides,
* half the functions this test calls are private, so automatic error
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 149b4c8..c92c0f0 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -125,7 +125,17 @@
} while(0)
/* Used to document process through a test */
-#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
+#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 ; \
+}
+#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 { \
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 3dbaa14..f304f11 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -743,11 +743,11 @@ test_genprop_basic_list_prop(void)
/* Add temporary properties */
- /* Insert first temporary property into class (with no callbacks) */
+ /* Insert first temporary property into list (with no callbacks) */
ret = H5Pinsert2(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pinsert2");
- /* Insert second temporary property into class (with no callbacks) */
+ /* Insert second temporary property into list (with no callbacks) */
ret = H5Pinsert2(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pinsert2");
@@ -1215,10 +1215,10 @@ test_genprop_list_callback(void)
/* The compare callback should have been called once on property 1 (to check
* if the create callback modified the value) */
- VERIFY(prop1_cb_info.cmp_count, 1, "H5Pequal");
+ VERIFY(prop1_cb_info.cmp_count, 1, "H5Pcreate");
/* The compare callback should not have been called on property 3, as there
* is no create callback */
- VERIFY(prop3_cb_info.cmp_count, 0, "H5Pequal");
+ VERIFY(prop3_cb_info.cmp_count, 0, "H5Pcreate");
/* Verify creation callback information for properties tracked */
VERIFY(prop1_cb_info.crt_count, 1, "H5Pcreate");
@@ -1233,7 +1233,7 @@ test_genprop_list_callback(void)
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
/* The compare callback should have been called once (to check if the get
* callback modified the value) */
- VERIFY(prop1_cb_info.cmp_count, 2, "H5Pequal");
+ VERIFY(prop1_cb_info.cmp_count, 2, "H5Pget");
ret = H5Pget(lid1, PROP2_NAME,&prop2_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
@@ -1248,7 +1248,7 @@ test_genprop_list_callback(void)
TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
/* The compare callback should not have been called, as there is no get
* callback for this property */
- VERIFY(prop3_cb_info.cmp_count, 0, "H5Pequal");
+ VERIFY(prop3_cb_info.cmp_count, 0, "H5Pget");
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
@@ -1278,7 +1278,7 @@ test_genprop_list_callback(void)
/* The compare callback should have been called once (to check if the new
* value needed to be copied onto the property list) */
- VERIFY(prop1_cb_info.cmp_count, 3, "H5Pequal");
+ VERIFY(prop1_cb_info.cmp_count, 3, "H5Pset");
/* Set value of property #3 to different value */
ret = H5Pset(lid1, PROP3_NAME,prop3_new_value);
@@ -1286,7 +1286,7 @@ test_genprop_list_callback(void)
/* The compare callback should have been called once (to check if the new
* value needed to be copied onto the property list) */
- VERIFY(prop3_cb_info.cmp_count, 1, "H5Pequal");
+ VERIFY(prop3_cb_info.cmp_count, 1, "H5Pset");
/* Check new value of tracked properties */
ret = H5Pget(lid1, PROP1_NAME,&prop1_value);
@@ -1625,6 +1625,7 @@ test_genprop_equal(void)
hid_t cid1; /* Generic Property class ID */
hid_t lid1; /* Generic Property list ID */
hid_t lid2; /* Generic Property list ID */
+ int prop1_new_value = 20; /* Property #1 new value */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1651,13 +1652,114 @@ test_genprop_equal(void)
CHECK_I(lid2, "H5Pcopy");
/* Check that the lists are equal */
- ret = H5Pequal(lid1,lid2);
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Set property in first list to another value */
+ ret = H5Pset(lid1, PROP1_NAME, &prop1_new_value);
+ CHECK_I(ret, "H5Pset");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Set property in first list back to default */
+ ret = H5Pset(lid1, PROP1_NAME, PROP1_DEF_VALUE);
+ CHECK_I(ret, "H5Pset");
+
+ /* Check that the lists are still equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Insert first temporary property into first list (with no callbacks) */
+ ret = H5Pinsert2(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Insert first temporary property into second list (with no callbacks) */
+ ret = H5Pinsert2(lid2, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Insert second temporary property into second list (with no callbacks) */
+ ret = H5Pinsert2(lid2, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Insert second temporary property into first list (with no callbacks) */
+ ret = H5Pinsert2(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are equal */
+ ret = H5Pequal(lid1, lid2);
VERIFY(ret, 1, "H5Pequal");
+ /* Remove first temporary property from first list */
+ ret = H5Premove(lid1, PROP3_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove second temporary property from second list */
+ ret = H5Premove(lid2, PROP4_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove first temporary property from second list */
+ ret = H5Premove(lid2, PROP3_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove first permanent property from first list */
+ ret = H5Premove(lid1, PROP1_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove second temporary property from first list */
+ ret = H5Premove(lid1, PROP4_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove first permanent property from second list */
+ ret = H5Premove(lid2, PROP1_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Close property lists */
+ ret = H5Pclose(lid1);
+ CHECK_I(ret, "H5Pclose");
+ ret = H5Pclose(lid2);
+ CHECK_I(ret, "H5Pclose");
+
/* Close class */
ret = H5Pclose_class(cid1);
CHECK_I(ret, "H5Pclose_class");
-
} /* ent test_genprop_equal() */
/****************************************************************