summaryrefslogtreecommitdiffstats
path: root/test/error_test.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-05-17 02:25:15 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-05-17 02:25:15 (GMT)
commiteddcc2f800db71d4c4309f74f57ed58ae7854727 (patch)
tree0e9877377f7e8a75f486b5803d275ffdae63c275 /test/error_test.c
parent44dc4134b7d8542bdf9b25ad9eeea418ad75b5e1 (diff)
downloadhdf5-eddcc2f800db71d4c4309f74f57ed58ae7854727.zip
hdf5-eddcc2f800db71d4c4309f74f57ed58ae7854727.tar.gz
hdf5-eddcc2f800db71d4c4309f74f57ed58ae7854727.tar.bz2
Brought error tests in line with develop. Fixes warnings.
Diffstat (limited to 'test/error_test.c')
-rw-r--r--test/error_test.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/test/error_test.c b/test/error_test.c
index 1de9065..7c6cf9f 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -38,7 +38,10 @@ const char *FILENAME[] = {
#define DIM0 100
#define DIM1 200
-int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
+int **ipoints2 = NULL;
+int **icheck2 = NULL;
+int *ipoints2_data = NULL;
+int *icheck2_data = NULL;
hid_t ERR_CLS;
hid_t ERR_CLS2;
@@ -326,8 +329,7 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie
* 'full_desc' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static herr_t
test_long_desc(void)
{
@@ -382,7 +384,7 @@ error:
return -1;
} /* end test_long_desc() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -679,6 +681,7 @@ main(void)
hid_t estack_id = -1;
char filename[1024];
const char *FUNC_main = "main";
+ int i;
HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n");
@@ -689,6 +692,21 @@ main(void)
if ((fapl = h5_fileaccess()) < 0)
TEST_ERROR;
+ /* Set up data arrays */
+ if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIM0; i++)
+ ipoints2[i] = ipoints2_data + (i * DIM1);
+
+ if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIM0; i++)
+ icheck2[i] = icheck2_data + (i * DIM1);
+
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
@@ -755,10 +773,20 @@ main(void)
h5_clean_files(FILENAME, fapl);
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDfprintf(stderr, "\nAll error API tests passed.\n");
return 0;
error:
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDfprintf(stderr, "\n***** ERROR TEST FAILED (real problem)! *****\n");
return 1;
}