summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c673
-rw-r--r--test/efc.c31
-rw-r--r--test/err_compat.c35
-rw-r--r--test/error_test.c31
-rw-r--r--test/extend.c181
-rw-r--r--test/fheap.c22
-rw-r--r--test/th5s.c59
-rw-r--r--test/unregister.c23
-rw-r--r--test/vds.c161
-rw-r--r--test/vfd.c196
10 files changed, 977 insertions, 435 deletions
diff --git a/test/dsets.c b/test/dsets.c
index a394210..237a050 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -272,10 +272,16 @@ const char *FILENAME[] = {
/* Shared global arrays */
#define DSET_DIM1 100
#define DSET_DIM2 200
-int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
-double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2];
-size_t count_nbytes_read = 0;
-size_t count_nbytes_written = 0;
+int **points = NULL;
+int *points_data = NULL;
+double **points_dbl = NULL;
+double *points_dbl_data = NULL;
+int **check = NULL;
+int *check_data = NULL;
+double **check_dbl = NULL;
+double *check_dbl_data = NULL;
+size_t count_nbytes_read = 0;
+size_t count_nbytes_written = 0;
/* Temporary buffer dimensions */
#define DSET_TMP_DIM1 50
@@ -511,7 +517,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
void *tconv_buf = NULL;
int f = -1;
haddr_t offset;
- int rdata[DSET_DIM1][DSET_DIM2];
+ int **rdata = NULL;
+ int *rdata_bytes = NULL;
TESTING("simple I/O");
@@ -519,6 +526,14 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+ /* Set up data array */
+ if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ rdata[i] = rdata_bytes + (i * DSET_DIM2);
+
/* Initialize the dataset */
for(i = n = 0; i < DSET_DIM1; i++)
for(j = 0; j < DSET_DIM2; j++)
@@ -548,7 +563,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points) < 0)
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points_data) < 0)
goto error;
/* Test dataset address in file. Open the same file as a C file, seek
@@ -557,7 +572,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
if((offset=H5Dget_offset(dataset))==HADDR_UNDEF) goto error;
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check_data) < 0)
goto error;
/* Check that the values read are the same as the values written */
@@ -581,7 +596,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
f = HDopen(filename, O_RDONLY);
HDlseek(f, (off_t)offset, SEEK_SET);
- if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
goto error;
/* Check that the values read are the same as the values written */
@@ -600,6 +615,9 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
f = -1;
HDfree(tconv_buf);
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
PASSED();
} /* end if */
else {
@@ -620,8 +638,11 @@ error:
if(H5Fclose(file) < 0) TEST_ERROR
if(f > 0)
HDclose(f);
- if(tconv_buf)
- HDfree(tconv_buf);
+
+ HDfree(tconv_buf);
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
return FAIL;
} /* end test_simple_io() */
@@ -644,7 +665,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
hsize_t dims[2];
int f = -1;
haddr_t offset;
- int rdata[DSET_DIM1][DSET_DIM2];
+ int **rdata = NULL;
+ int *rdata_bytes = NULL;
TESTING("dataset offset with user block");
@@ -652,6 +674,14 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ /* Set up data array */
+ if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ rdata[i] = rdata_bytes + (i * DSET_DIM2);
+
if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error;
if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error;
if(new_format)
@@ -675,7 +705,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
space = -1;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0)
goto error;
/* Test dataset address in file. Open the same file as a C file, seek
@@ -690,7 +720,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
f = HDopen(filename, O_RDONLY);
HDlseek(f, (off_t)offset, SEEK_SET);
- if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
goto error;
/* Check that the values read are the same as the values written */
@@ -708,6 +738,9 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
HDclose(f);
f = -1;
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
PASSED();
} /* end if */
else {
@@ -728,6 +761,10 @@ error:
if(H5Fclose(file) < 0) TEST_ERROR
if(f > 0)
HDclose(f);
+
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
return FAIL;
} /* end test_userblock_offset() */
@@ -1786,7 +1823,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
*/
TESTING(" filters (uninitialized read)");
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
for(i=0; i<(size_t)size[0]; i++) {
@@ -1815,7 +1852,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
}
}
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
TEST_ERROR;
if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR;
@@ -1833,25 +1870,25 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
else {
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -1885,33 +1922,33 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
points[i][j] = (int)HDrandom ();
}
}
- if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
+ if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
TEST_ERROR;
if(corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
else {
/* Read the dataset back and check it */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -1946,13 +1983,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status >= 0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
@@ -1960,12 +1997,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status >= 0) TEST_ERROR;
} /* end if */
else {
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -1999,32 +2036,32 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
NULL) < 0) TEST_ERROR;
/* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */
- if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0)
+ if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points_data) < 0)
TEST_ERROR;
if(corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
else {
- if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0)
+ if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -2629,7 +2666,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -2658,7 +2695,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
@@ -2719,7 +2756,7 @@ test_missing_filter(hid_t file)
/* Read data (should fail, since deflate filter is missing) */
H5E_BEGIN_TRY {
- ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check);
+ ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data);
} H5E_END_TRY;
if(ret>=0) {
H5_FAILED();
@@ -4127,149 +4164,164 @@ test_nbit_int_size(hid_t file)
hid_t dataspace, dataset, datatype, mem_datatype, dset_create_props;
hsize_t dims[2], chunk_size[2];
hsize_t dset_size = 0;
- int orig_data[DSET_DIM1][DSET_DIM2];
+ int **orig = NULL;
+ int *orig_data = NULL;
double power;
int i, j;
size_t precision, offset;
TESTING(" nbit integer dataset size");
- /* Define dataset datatype (integer), and set precision, offset */
- if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Set up data array */
+ if(NULL == (orig_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (orig = (int **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ orig[i] = orig_data + (i * DSET_DIM2);
- precision = 16; /* precision includes sign bit */
- if(H5Tset_precision(datatype,precision)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_precision failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Define dataset datatype (integer), and set precision, offset */
+ if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
+ goto error;
+ }
- offset = 8;
- if(H5Tset_offset(datatype,offset)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
- goto error;
- } /* end if */
+ precision = 16; /* precision includes sign bit */
+ if(H5Tset_precision(datatype,precision)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_precision failed\n",__LINE__);
+ goto error;
+ }
- /* Copy to memory datatype */
- if((mem_datatype = H5Tcopy(datatype)) < 0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
- goto error;
- } /* end if */
+ offset = 8;
+ if(H5Tset_offset(datatype,offset)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
+ goto error;
+ }
- /* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ /* Copy to memory datatype */
+ if((mem_datatype = H5Tcopy(datatype)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
- goto error;
- } /* end if */
+ HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
+ goto error;
+ }
- if(H5Tset_size(datatype, 4)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Set order of dataset datatype */
+ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
+ goto error;
+ }
- /* Initiliaze data buffer with random data within correct range
- * corresponding to the memory datatype's precision and offset.
- */
- for (i=0; i < DSET_DIM1; i++)
- for (j=0; j < DSET_DIM2; j++) {
- power = HDpow(2.0F, (double)(precision-1));
- orig_data[i][j] = HDrandom() % (int)power << offset;
- } /* end for */
+ if(H5Tset_size(datatype, 4)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
+ goto error;
+ }
+ /* Initiliaze data buffer with random data within correct range
+ * corresponding to the memory datatype's precision and offset.
+ */
+ for (i=0; i < DSET_DIM1; i++)
+ for (j=0; j < DSET_DIM2; j++) {
+ power = HDpow(2.0F, (double)(precision-1));
+ orig[i][j] = HDrandom() % (int)power << offset;
+ }
- /* Describe the dataspace. */
- dims[0] = DSET_DIM1;
- dims[1] = DSET_DIM2;
- if((dataspace = H5Screate_simple (2, dims, NULL))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
- goto error;
- } /* end if */
- /*
- * Set the dataset creation property list to specify the chunks
- */
- chunk_size[0] = DSET_DIM1/10;
- chunk_size[1] = DSET_DIM2/10;
- if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Describe the dataspace. */
+ dims[0] = DSET_DIM1;
+ dims[1] = DSET_DIM2;
+ if((dataspace = H5Screate_simple(2, dims, NULL))<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ }
- if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
- goto error;
- } /* end if */
+ /*
+ * Set the dataset creation property list to specify the chunks
+ */
+ chunk_size[0] = DSET_DIM1/10;
+ chunk_size[1] = DSET_DIM2/10;
+ if((dset_create_props = H5Pcreate(H5P_DATASET_CREATE))<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Set for n-bit compression
- */
- if(H5Pset_nbit (dset_create_props)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
- goto error;
- } /* end if */
+ if(H5Pset_chunk(dset_create_props, 2, chunk_size)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Create a new dataset within the file.
- */
- if((dataset = H5Dcreate2 (file, DSET_NBIT_INT_SIZE_NAME, datatype,
+ /*
+ * Set for n-bit compression
+ */
+ if(H5Pset_nbit(dset_create_props)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
+ goto error;
+ }
+
+ /*
+ * Create a new dataset within the file.
+ */
+ if((dataset = H5Dcreate2(file, DSET_NBIT_INT_SIZE_NAME, datatype,
dataspace, H5P_DEFAULT,
dset_create_props, H5P_DEFAULT))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5dwrite failed\n",__LINE__);
- goto error;
- } /* end if */
+ H5_FAILED();
+ HDprintf(" line %d: H5dwrite failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Write the array to the file.
- */
- if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, orig_data)<0) {
- H5_FAILED();
- HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
- goto error;
- } /* end if */
+ /*
+ * Write the array to the file.
+ */
+ if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) {
+ H5_FAILED();
+ HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Get the precision of the data type
- */
- if((precision = H5Tget_precision(datatype)) == 0) {
- H5_FAILED();
- HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
- goto error;
- } /* end if */
+ /*
+ * Get the precision of the data type
+ */
+ if((precision = H5Tget_precision(datatype)) == 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
+ goto error;
+ }
- /*
- * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
- */
- if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
- dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
- H5_FAILED();
- HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size);
- goto error;
- } /* end if */
+ /*
+ * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
+ */
+ if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
+ dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
+ H5_FAILED();
+ HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size);
+ goto error;
+ }
- H5Tclose (datatype);
- H5Tclose (mem_datatype);
- H5Dclose (dataset);
- H5Sclose (dataspace);
- H5Pclose (dset_create_props);
+ H5Tclose(datatype);
+ H5Tclose(mem_datatype);
+ H5Dclose(dataset);
+ H5Sclose(dataspace);
+ H5Pclose(dset_create_props);
+
+ HDfree(orig);
+ HDfree(orig_data);
PASSED();
- return SUCCEED;
+ return SUCCEED;
+
error:
+ HDfree(orig);
+ HDfree(orig_data);
+
return FAIL;
} /* end test_nbit_int_size() */
@@ -4295,13 +4347,22 @@ test_nbit_flt_size(hid_t file)
hid_t dataspace, dataset, datatype, dset_create_props;
hsize_t dims[2], chunk_size[2];
hsize_t dset_size = 0;
- float orig_data[DSET_DIM1][DSET_DIM2];
+ float **orig = NULL;
+ float *orig_data = NULL;
int i, j;
size_t precision, offset;
size_t spos, epos, esize, mpos, msize;
TESTING(" nbit floating-number dataset size");
+ /* Set up data array */
+ if(NULL == (orig_data = (float *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(float))))
+ TEST_ERROR;
+ if(NULL == (orig = (float **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ orig[i] = orig_data + (i * DSET_DIM2);
+
/* Define floating-point type for dataset
*-------------------------------------------------------------------
* size=4 byte, precision=16 bits, offset=8 bits,
@@ -4380,7 +4441,7 @@ test_nbit_flt_size(hid_t file)
*/
for (i=0; i < DSET_DIM1; i++)
for (j=0; j < DSET_DIM2; j++)
- orig_data[i][j] = (float)(HDrandom() % 1234567) / 2;
+ orig[i][j] = (float)(HDrandom() % 1234567) / 2;
/* Describe the dataspace. */
@@ -4465,8 +4526,14 @@ test_nbit_flt_size(hid_t file)
PASSED();
+ HDfree(orig);
+ HDfree(orig_data);
+
return SUCCEED;
error:
+ HDfree(orig);
+ HDfree(orig_data);
+
return FAIL;
} /* end test_nbit_flt_size() */
@@ -5460,7 +5527,7 @@ test_can_apply(hid_t file)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -5488,7 +5555,7 @@ test_can_apply(hid_t file)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
@@ -5619,7 +5686,7 @@ test_can_apply2(hid_t file)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -5647,7 +5714,7 @@ test_can_apply2(hid_t file)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
@@ -5988,7 +6055,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -6010,7 +6077,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -6073,7 +6140,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
@@ -6123,7 +6190,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
@@ -6856,10 +6923,12 @@ test_missing_chunk(hid_t file)
hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2];/* Hyperslab setting */
/* Buffers for reading/writing dataset */
- int wdata[MISSING_CHUNK_DIM],
- rdata[MISSING_CHUNK_DIM];
- int wdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM],
- rdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM];
+ int *wdata = NULL;
+ int *rdata = NULL;
+ int **wdata2 = NULL;
+ int **rdata2 = NULL;
+ int *wdata2_bytes = NULL;
+ int *rdata2_bytes = NULL;
/* Setting for 1-D dataset */
hsize_t dsize=100, dmax=H5S_UNLIMITED;
@@ -6876,6 +6945,26 @@ test_missing_chunk(hid_t file)
TESTING("Read dataset with unwritten chunk & undefined fill value");
+ /* Set up data arrays */
+ if(NULL == (wdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+
+ if(NULL == (wdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (wdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(wdata2_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < MISSING_CHUNK_DIM; i++)
+ wdata2[i] = wdata2_bytes + (i * MISSING_CHUNK_DIM);
+
+ if(NULL == (rdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(rdata2_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < MISSING_CHUNK_DIM; i++)
+ rdata2[i] = rdata2_bytes + (i * MISSING_CHUNK_DIM);
+
/* Get the file's file access property list */
if((fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR;
@@ -6893,10 +6982,10 @@ test_missing_chunk(hid_t file)
/* Initialize data for 2-D dataset */
for(i = 0; i < MISSING_CHUNK_DIM; i++) {
- for(j = 0; j < MISSING_CHUNK_DIM; j++) {
- wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
- rdata2[i][j] = 911;
- }
+ for(j = 0; j < MISSING_CHUNK_DIM; j++) {
+ wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
+ rdata2[i][j] = 911;
+ }
} /* end for */
/* Create dataspace */
@@ -6954,11 +7043,11 @@ test_missing_chunk(hid_t file)
/* Write selected data to the datasets */
if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
- if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2) < 0) TEST_ERROR;
+ if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2_bytes) < 0) TEST_ERROR;
/* Read all data from the datasets */
if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR;
+ if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2_bytes) < 0) TEST_ERROR;
/* Validata values read for the 1-D dataset */
for(u=0; u<MISSING_CHUNK_DIM; u++) {
@@ -7005,6 +7094,13 @@ test_missing_chunk(hid_t file)
if(H5Dclose(d) < 0) TEST_ERROR;
if(H5Dclose(did2) < 0) TEST_ERROR;
+ HDfree(rdata);
+ HDfree(wdata);
+ HDfree(rdata2);
+ HDfree(wdata2);
+ HDfree(rdata2_bytes);
+ HDfree(wdata2_bytes);
+
PASSED();
return SUCCEED;
@@ -7019,6 +7115,14 @@ error:
H5Sclose(s);
H5Sclose(sid2);
} H5E_END_TRY;
+
+ HDfree(rdata);
+ HDfree(wdata);
+ HDfree(rdata2);
+ HDfree(wdata2);
+ HDfree(rdata2_bytes);
+ HDfree(wdata2_bytes);
+
return FAIL;
} /* end test_missing_chunk() */
@@ -8077,9 +8181,13 @@ test_big_chunks_bypass_cache(hid_t fapl)
hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */
/* Buffers for reading and writing data (1-D) */
int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL;
- /* Buffer for reading and writing data (2-D) */
- static int t_wdata[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2], t_rdata1[BYPASS_DIM][BYPASS_DIM],
- t_rdata2[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2];
+ /* Buffers for reading and writing data (2-D) */
+ int **t_wdata = NULL;
+ int **t_rdata1 = NULL;
+ int **t_rdata2 = NULL;
+ int *t_wdata_bytes = NULL;
+ int *t_rdata1_bytes = NULL;
+ int *t_rdata2_bytes = NULL;
int i, j; /* Local index variables */
H5F_libver_t low; /* File format low bound */
H5D_chunk_index_t idx_type, t_idx_type; /* Dataset chunk index types */
@@ -8089,6 +8197,29 @@ test_big_chunks_bypass_cache(hid_t fapl)
h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
+ /* Set up data arrays */
+ if(NULL == (t_wdata_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (t_wdata = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_wdata_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++)
+ t_wdata[i] = t_wdata_bytes + (i * (BYPASS_CHUNK_DIM/2));
+
+ if(NULL == (t_rdata1_bytes = (int *)HDcalloc(BYPASS_DIM * BYPASS_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (t_rdata1 = (int **)HDcalloc(BYPASS_DIM, sizeof(t_rdata1_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < BYPASS_DIM; i++)
+ t_rdata1[i] = t_rdata1_bytes + (i * BYPASS_DIM);
+
+ if(NULL == (t_rdata2_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (t_rdata2 = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_rdata2_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++)
+ t_rdata2[i] = t_rdata2_bytes + (i * (BYPASS_CHUNK_DIM/2));
+
+
/* Check if we are using the latest version of the format */
if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR
@@ -8177,8 +8308,8 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Initialize data to write for 2-D dataset */
for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
- t_wdata[i][j] = j;
+ for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
+ t_wdata[i][j] = j;
/* Set up memory space for the 2-D dataset */
mid = H5Screate_simple(2, t_block, NULL);
@@ -8187,7 +8318,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* This write should go through the cache because fill value is used. */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0)
+ if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
FAIL_STACK_ERROR
/* Close the first 1-D & 2-D datasets */
@@ -8202,7 +8333,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
* chunk is bigger than the cache size and it isn't allocated on disk. */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0)
FAIL_STACK_ERROR
- if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1) < 0)
+ if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1_bytes) < 0)
FAIL_STACK_ERROR
/* Verify data for the first 1-D dataset */
@@ -8233,8 +8364,8 @@ test_big_chunks_bypass_cache(hid_t fapl)
for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++)
for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++)
if(t_rdata1[i][j] != fvalue) {
- HDprintf(" Read different values than written in the 2nd chunk.\n");
- HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n",
+ HDprintf(" Read different values than written in the 2nd chunk.\n");
+ HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n",
__LINE__, i, j, t_rdata1[i][j], fvalue);
TEST_ERROR
} /* end if */
@@ -8258,7 +8389,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Write to the second 1-D & 2-D dataset */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0)
+ if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
FAIL_STACK_ERROR
/* Close the second 1-D & 2-D dataset */
@@ -8274,7 +8405,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
* the cache size. */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0)
FAIL_STACK_ERROR
- if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2) < 0)
+ if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2_bytes) < 0)
FAIL_STACK_ERROR
/* Verify data for the second 1-D dataset */
@@ -8309,6 +8440,12 @@ test_big_chunks_bypass_cache(hid_t fapl)
HDfree(wdata);
HDfree(rdata1);
HDfree(rdata2);
+ HDfree(t_wdata);
+ HDfree(t_rdata1);
+ HDfree(t_rdata2);
+ HDfree(t_wdata_bytes);
+ HDfree(t_rdata1_bytes);
+ HDfree(t_rdata2_bytes);
PASSED();
return SUCCEED;
@@ -8324,12 +8461,17 @@ error:
H5Sclose(t_sid);
H5Fclose(fid);
} H5E_END_TRY;
- if(wdata)
- HDfree(wdata);
- if(rdata1)
- HDfree(rdata1);
- if(rdata2)
- HDfree(rdata2);
+
+ HDfree(wdata);
+ HDfree(rdata1);
+ HDfree(rdata2);
+ HDfree(t_wdata);
+ HDfree(t_rdata1);
+ HDfree(t_rdata2);
+ HDfree(t_wdata_bytes);
+ HDfree(t_rdata1_bytes);
+ HDfree(t_rdata2_bytes);
+
return FAIL;
} /* end test_big_chunks_bypass_cache() */
@@ -8831,13 +8973,33 @@ test_chunk_fast_bug1(hid_t fapl)
hid_t dsid = -1; /* Dataset ID */
hsize_t dim[2], max_dim[2], chunk_dim[2]; /* Dataset and chunk dimensions */
H5D_alloc_time_t alloc_time; /* Storage allocation time */
- static unsigned wbuf[40][20], rbuf[40][20]; /* Element written/read */
+
+ unsigned **wbuf = NULL;
+ unsigned **rbuf = NULL;
+ unsigned *wbuf_bytes = NULL;
+ unsigned *rbuf_bytes = NULL;
+
unsigned i, j; /* Local index variables */
TESTING("datasets w/extensible array chunk indexing bug");
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
+ /* Set up data array */
+ if(NULL == (wbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
+ TEST_ERROR;
+ if(NULL == (wbuf = (unsigned **)HDcalloc(40, sizeof(wbuf_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 40; i++)
+ wbuf[i] = wbuf_bytes + (i * 20);
+
+ if(NULL == (rbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
+ TEST_ERROR;
+ if(NULL == (rbuf = (unsigned **)HDcalloc(40, sizeof(rbuf_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 40; i++)
+ rbuf[i] = rbuf_bytes + (i * 20);
+
/* Initialize write buffer */
for(i=0; i<40; i++)
for(j=0; j<20; j++)
@@ -8871,7 +9033,7 @@ test_chunk_fast_bug1(hid_t fapl)
FAIL_STACK_ERROR
/* Write buffer to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &wbuf) < 0)
+ if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, wbuf_bytes) < 0)
FAIL_STACK_ERROR
/* Close everything */
@@ -8881,7 +9043,7 @@ test_chunk_fast_bug1(hid_t fapl)
if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Read from dataset */
- if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &rbuf) < 0)
+ if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, rbuf_bytes) < 0)
FAIL_STACK_ERROR
/* Verify read data */
@@ -8898,6 +9060,11 @@ test_chunk_fast_bug1(hid_t fapl)
if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(wbuf_bytes);
+ HDfree(rbuf_bytes);
+
PASSED();
return SUCCEED;
@@ -8908,6 +9075,12 @@ error:
H5Sclose(sid);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(wbuf_bytes);
+ HDfree(rbuf_bytes);
+
return FAIL;
} /* end test_chunk_fast_bug1() */
@@ -9432,13 +9605,25 @@ test_fixed_array(hid_t fapl)
int *rbuf_big = NULL; /* read buffer for big dataset */
const hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */
- int chunks[12][6]; /* # of chunks for dataset dimensions */
- int chunks_big[125][20]; /* # of chunks for big dataset dimensions */
+
+// int chunks[12][6]; /* # of chunks for dataset dimensions */
+// int chunks_big[125][20]; /* # of chunks for big dataset dimensions */
+
+ int **chunks = NULL; /* # of chunks for dataset dimensions */
+ int **chunks_big = NULL; /* # of chunks for big dataset dimensions */
+ int *chunks_bytes = NULL;
+ int *chunks_big_bytes = NULL;
+
int chunk_row; /* chunk row index */
int chunk_col; /* chunk column index */
- hsize_t coord[POINTS][2]; /* datdaset coordinates */
- hsize_t coord_big[POINTS_BIG][2]; /* big dataset coordinates */
+// hsize_t coord[POINTS][2]; /* datdaset coordinates */
+// hsize_t coord_big[POINTS_BIG][2]; /* big dataset coordinates */
+
+ hsize_t **coord = NULL; /* datdaset coordinates */
+ hsize_t **coord_big = NULL; /* big datdaset coordinates */
+ hsize_t *coord_bytes = NULL;
+ hsize_t *coord_big_bytes = NULL;
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
H5F_libver_t low, high; /* File format bounds */
@@ -9461,6 +9646,35 @@ test_fixed_array(hid_t fapl)
h5_fixname(FILENAME[12], fapl, filename, sizeof filename);
+ /* Set up 2D data arrays */
+ if(NULL == (chunks_bytes = (int *)HDcalloc(12 * 6, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (chunks = (int **)HDcalloc(12, sizeof(chunks_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 12; i++)
+ chunks[i] = chunks_bytes + (i * 6);
+
+ if(NULL == (chunks_big_bytes = (int *)HDcalloc(125 * 20, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (chunks_big = (int **)HDcalloc(125, sizeof(chunks_big_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 125; i++)
+ chunks_big[i] = chunks_big_bytes + (i * 20);
+
+ if(NULL == (coord_bytes = (hsize_t *)HDcalloc(POINTS * 2, sizeof(hsize_t))))
+ TEST_ERROR;
+ if(NULL == (coord = (hsize_t **)HDcalloc(POINTS, sizeof(coord_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < POINTS; i++)
+ coord[i] = coord_bytes + (i * 2);
+
+ if(NULL == (coord_big_bytes = (hsize_t *)HDcalloc(POINTS_BIG * 2, sizeof(hsize_t))))
+ TEST_ERROR;
+ if(NULL == (coord_big = (hsize_t **)HDcalloc(POINTS_BIG, sizeof(coord_big_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < POINTS_BIG; i++)
+ coord_big[i] = coord_big_bytes + (i * 2);
+
/* Check if we are using the latest version of the format */
if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR
@@ -9560,7 +9774,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0)
+ if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
TEST_ERROR;
/* Write into dataset */
@@ -9601,7 +9815,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0)
+ if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
TEST_ERROR;
/* Write into dataset */
@@ -9663,7 +9877,7 @@ test_fixed_array(hid_t fapl)
if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0)
+ if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0)
TEST_ERROR;
/* Write into dataset */
@@ -9685,7 +9899,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -9713,7 +9927,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -9740,7 +9954,7 @@ test_fixed_array(hid_t fapl)
if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) TEST_ERROR;
+ if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR;
@@ -9782,6 +9996,15 @@ test_fixed_array(hid_t fapl)
HDfree(wbuf_big);
HDfree(rbuf_big);
+ HDfree(chunks);
+ HDfree(chunks_big);
+ HDfree(coord);
+ HDfree(coord_big);
+ HDfree(chunks_bytes);
+ HDfree(chunks_big_bytes);
+ HDfree(coord_bytes);
+ HDfree(coord_big_bytes);
+
PASSED();
return SUCCEED;
@@ -9793,10 +10016,18 @@ error:
H5Sclose(mem_id);
H5Fclose(fid);
} H5E_END_TRY;
- if(wbuf_big)
- HDfree(wbuf_big);
- if(rbuf_big)
- HDfree(rbuf_big);
+
+ HDfree(wbuf_big);
+ HDfree(rbuf_big);
+ HDfree(chunks);
+ HDfree(chunks_big);
+ HDfree(coord);
+ HDfree(coord_big);
+ HDfree(chunks_bytes);
+ HDfree(chunks_big_bytes);
+ HDfree(coord_bytes);
+ HDfree(coord_big_bytes);
+
return FAIL;
} /* end test_fixed_array() */
@@ -13283,6 +13514,7 @@ main(void)
int nerrors = 0;
const char *envval;
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ int i;
/* Don't run this test using certain file drivers */
envval = HDgetenv("HDF5_DRIVER");
@@ -13295,6 +13527,39 @@ main(void)
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
+ /* Initialize global arrays */
+ /* points */
+ if(NULL == (points_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (points = (int **)HDcalloc(DSET_DIM1, sizeof(points_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ points[i] = points_data + (i * DSET_DIM2);
+
+ /* check */
+ if(NULL == (check_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (check = (int **)HDcalloc(DSET_DIM1, sizeof(check_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ check[i] = check_data + (i * DSET_DIM2);
+
+ /* points_dbl */
+ if(NULL == (points_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
+ TEST_ERROR;
+ if(NULL == (points_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(points_dbl_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ points_dbl[i] = points_dbl_data + (i * DSET_DIM2);
+
+ /* check_dbl */
+ if(NULL == (check_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
+ TEST_ERROR;
+ if(NULL == (check_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(check_dbl_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ check_dbl[i] = check_dbl_data + (i * DSET_DIM2);
+
/* Testing setup */
h5_reset();
fapl = h5_fileaccess();
diff --git a/test/efc.c b/test/efc.c
index b427884..e508b47 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -33,7 +33,8 @@ const char *FILENAME[] = {
};
/* Global patched filename buffer */
-static char filename[6][1024];
+#define N_FILENAMES 6
+static char *filename[N_FILENAMES];
/* Global property lists - just copies of the defaults (necessary to use
* internal functions */
@@ -2896,10 +2897,11 @@ error:
int
main(void)
{
- unsigned nerrors = 0; /* track errors */
- H5P_genplist_t *plist; /* Property list pointer for FAPL */
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ unsigned nerrors = 0; /* track errors */
+ H5P_genplist_t *plist; /* Property list pointer for FAPL */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ int i; /* iterator */
/* Test Setup */
HDputs("Testing the external file cache");
@@ -2908,6 +2910,11 @@ main(void)
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
fapl_id = h5_fileaccess();
+ /* Allocate memory for filenames */
+ for(i = 0; i < N_FILENAMES; i++) {
+ filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char));
+ }
+
/* Patch filenames */
h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0]));
h5_fixname(FILENAME[1], fapl_id, filename[1], sizeof(filename[1]));
@@ -2942,7 +2949,8 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if(api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
if(nerrors)
@@ -2952,6 +2960,10 @@ main(void)
h5_clean_files(FILENAME, fapl_id);
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
+
return EXIT_SUCCESS;
error:
@@ -2961,7 +2973,12 @@ error:
H5Pclose(fapl_id);
} H5E_END_TRY
- if(api_ctx_pushed) H5CX_pop();
+ if(api_ctx_pushed)
+ H5CX_pop();
+
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
return EXIT_FAILURE;
} /* end main() */
diff --git a/test/err_compat.c b/test/err_compat.c
index d2d039a..eb86760 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -35,7 +35,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;
#define DSET_NAME "a_dataset"
#define FAKE_ID (hid_t)-1
@@ -465,13 +468,29 @@ dump_error(void)
int
main(void)
{
- hid_t file, fapl;
+ hid_t file, fapl;
char filename[1024];
- const char *FUNC_main="main";
+ const char *FUNC_main="main";
+ int i;
HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n");
fapl = h5_fileaccess();
+ /* 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 ;
@@ -500,10 +519,20 @@ main(void)
if(H5Fclose(file) < 0) TEST_ERROR ;
h5_clean_files(FILENAME, fapl);
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDprintf("All error API tests passed.\n");
return 0;
error:
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDprintf("***** ERROR TEST FAILED! *****\n");
return 1;
}
diff --git a/test/error_test.c b/test/error_test.c
index 1de9065..e99a82f 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;
@@ -679,6 +682,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 +693,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 +774,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;
}
diff --git a/test/extend.c b/test/extend.c
index a31ac0e..1e2b5b5 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -25,11 +25,16 @@ const char *FILENAME[] = {
NULL
};
-#define NX 100 /* USE AN EVEN NUMBER!*/
-#define NY 100 /* USE AN EVEN NUMBER!*/
+#define N1X 100 /* USE AN EVEN NUMBER! */
+#define N1Y 100 /* USE AN EVEN NUMBER! */
+#define N2X (N1X / 2)
+#define N2Y (N1Y / 2)
/* Data buffers */
-static int buf1[NY][NX], buf2[NX / 2][NY / 2];
+static int **buf1 = NULL;
+static int *buf1_data = NULL;
+static int **buf2 = NULL;
+static int *buf2_data = NULL;
/*-------------------------------------------------------------------------
@@ -49,8 +54,8 @@ static int
write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space)
{
hid_t dataset, file_space, half_space;
- static const hsize_t dims[2] = {NX, NY};
- static const hsize_t half_dims[2] = {NX / 2, NY / 2};
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t half_dims[2] = {N2X, N2Y};
hsize_t size[2];
hsize_t max_size[2] = {0, 0};
hsize_t offset[2];
@@ -63,13 +68,13 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me
/* Write the data */
for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++) {
+ for(j = 0; j < 5; j++) {
- /* Extend the dataset */
- offset[0] = (hsize_t)(i * NX);
- offset[1] = (hsize_t)(j * NY);
- size[0] = offset[0] + NX;
- size[1] = offset[1] + NY;
+ /* Extend the dataset */
+ offset[0] = (hsize_t)(i * N1X);
+ offset[1] = (hsize_t)(j * N1Y);
+ size[0] = offset[0] + N1X;
+ size[1] = offset[1] + N1Y;
if(size[0] > max_size[0] || size[1] > max_size[1]) {
if(size[0] > max_size[0])
max_size[0] = size[0];
@@ -78,42 +83,41 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me
if(H5Dset_extent(dataset, max_size) < 0) TEST_ERROR;
} /* end if */
- /* Select a hyperslab */
+ /* Select a hyperslab */
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
- /* Write to the hyperslab */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR;
+ /* Write to the hyperslab */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR;
if(H5Sclose(file_space) < 0) TEST_ERROR;
- } /* end for */
+ } /* end for */
/* Read the data */
if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR;
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
-
- /* Select a hyperslab */
- offset[0] = (hsize_t)(i * (NX / 2));
- offset[1] = (hsize_t)(j * (NY / 2));
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
-
- /* Read */
- if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR;
-
- /* Compare */
- for(k = 0; k < (NX / 2); k++)
- for(m = 0; m < (NY / 2); m++)
- if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) {
- HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
- HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
- HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]);
- TEST_ERROR;
- } /* end if */
- } /* end for */
+ for(j = 0; j < 10; j++) {
+
+ /* Select a hyperslab */
+ offset[0] = (hsize_t)(i * N2X);
+ offset[1] = (hsize_t)(j * N2Y);
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
+
+ /* Read */
+ if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR;
+
+ /* Compare */
+ for(k = 0; k < N2X; k++)
+ for(m = 0; m < N2Y; m++)
+ if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
+ HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
+ HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
+ HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
+ TEST_ERROR;
+ } /* end if */
+ } /* end for */
} /* end for */
-
/* Cleanup */
if(H5Dclose(dataset) < 0) TEST_ERROR;
if(H5Sclose(file_space) < 0) TEST_ERROR;
@@ -146,8 +150,8 @@ static int
write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space)
{
hid_t dataset, file_space, half_space;
- static const hsize_t dims[2] = {NX, NY};
- static const hsize_t half_dims[2] = {NX / 2, NY / 2};
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t half_dims[2] = {N2X, N2Y};
static hsize_t size[2];
hsize_t offset[2];
int i, j, k, m;
@@ -159,48 +163,48 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h
/* Write the data */
for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++) {
+ for(j = 0; j < 5; j++) {
- /* Extend the dataset */
- offset[0] = (hsize_t)(i * NX);
- offset[1] = (hsize_t)(j * NY);
- size[0] = offset[0] + NX;
- size[1] = offset[1] + NY;
- if(H5Dextend(dataset, size) < 0) TEST_ERROR;
+ /* Extend the dataset */
+ offset[0] = (hsize_t)(i * N1X);
+ offset[1] = (hsize_t)(j * N1Y);
+ size[0] = offset[0] + N1X;
+ size[1] = offset[1] + N1Y;
+ if(H5Dextend(dataset, size) < 0) TEST_ERROR;
- /* Select a hyperslab */
+ /* Select a hyperslab */
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
- /* Write to the hyperslab */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR;
+ /* Write to the hyperslab */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR;
if(H5Sclose(file_space) < 0) TEST_ERROR;
- } /* end for */
+ } /* end for */
/* Read the data */
if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR;
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
-
- /* Select a hyperslab */
- offset[0] = (hsize_t)(i * (NX / 2));
- offset[1] = (hsize_t)(j * (NY / 2));
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
-
- /* Read */
- if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR;
-
- /* Compare */
- for(k = 0; k < (NX / 2); k++)
- for(m = 0; m < (NY / 2); m++)
- if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) {
- HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
- HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
- HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]);
- TEST_ERROR;
- } /* end if */
- } /* end for */
+ for(j = 0; j < 10; j++) {
+
+ /* Select a hyperslab */
+ offset[0] = (hsize_t)(i * N2X);
+ offset[1] = (hsize_t)(j * N2Y);
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
+
+ /* Read */
+ if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR;
+
+ /* Compare */
+ for(k = 0; k < N2X; k++)
+ for(m = 0; m < N2Y; m++)
+ if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
+ HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
+ HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
+ HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
+ TEST_ERROR;
+ } /* end if */
+ } /* end for */
} /* end for */
@@ -236,8 +240,8 @@ main (void)
hid_t file, mem_space, cparms;
hid_t fapl;
int nerrors = 0;
- static const hsize_t dims[2] = {NX, NY};
- static const hsize_t chunk_dims[2] = {NX/2, NY/2};
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t chunk_dims[2] = {N2X, N2Y};
static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
char filename[1024];
int i, j;
@@ -246,9 +250,23 @@ main (void)
fapl = h5_fileaccess();
/* Initialize buffer and space */
- for(i = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
- buf1[i][j] = i * NY + j;
+ if(NULL == (buf1_data = (int *)HDcalloc(N1X * N1Y, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf1 = (int **)HDcalloc(N1X, sizeof(buf1_data))))
+ TEST_ERROR;
+ for (i = 0; i < N1X; i++)
+ buf1[i] = buf1_data + (i * N1Y);
+
+ if(NULL == (buf2_data = (int *)HDcalloc(N2X * N2Y, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf2 = (int **)HDcalloc(N2X, sizeof(buf2_data))))
+ TEST_ERROR;
+ for (i = 0; i < N2X; i++)
+ buf2[i] = buf2_data + (i * N2Y);
+
+ for(i = 0; i < N1X; i++)
+ for(j = 0; j < N1Y; j++)
+ buf1[i][j] = i * N1Y + j;
if((mem_space = H5Screate_simple(2, dims, maxdims)) < 0) TEST_ERROR;
@@ -288,9 +306,20 @@ main (void)
HDprintf("All extend tests passed.\n");
h5_cleanup(FILENAME, fapl);
+ HDfree(buf1);
+ HDfree(buf1_data);
+ HDfree(buf2);
+ HDfree(buf2_data);
+
HDexit(EXIT_SUCCESS);
error:
+
+ HDfree(buf1);
+ HDfree(buf1_data);
+ HDfree(buf2);
+ HDfree(buf2_data);
+
HDprintf("*** One or more extend tests failed ***\n");
HDexit(EXIT_FAILURE);
} /* end main() */
diff --git a/test/fheap.c b/test/fheap.c
index 2cd2be3..b8c54d6 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -7617,7 +7617,8 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
H5F_t *f = NULL; /* Internal file object pointer */
H5HF_t *fh = NULL; /* Fractal heap wrapper */
haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */
+ unsigned char **heap_id = NULL;
+ unsigned char *heap_id_data = NULL;
struct a_type_t1 {
char a[10];
char b[40];
@@ -7629,6 +7630,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ /* Set up data array */
+ if(NULL == (heap_id_data = (unsigned char *)HDcalloc(100 * MAX_HEAP_ID_LEN, sizeof(unsigned char))))
+ TEST_ERROR;
+ if(NULL == (heap_id = (unsigned char **)HDcalloc(100, sizeof(heap_id_data))))
+ TEST_ERROR;
+ for (i = 0; i < 100; i++)
+ heap_id[i] = heap_id_data + (i * MAX_HEAP_ID_LEN);
+
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
@@ -7695,7 +7704,10 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
/* All tests passed */
PASSED()
- return(0);
+ HDfree(heap_id);
+ HDfree(heap_id_data);
+
+ return 0;
error:
H5E_BEGIN_TRY {
@@ -7703,7 +7715,11 @@ error:
H5HF_close(fh);
H5Fclose(file);
} H5E_END_TRY;
- return(1);
+
+ HDfree(heap_id);
+ HDfree(heap_id_data);
+
+ return 1;
} /* test_man_incr_insert_remove() */
#endif /* QAK */
diff --git a/test/th5s.c b/test/th5s.c
index 7e1e547..c60b1ff 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -2459,11 +2459,12 @@ test_h5s_compound_scalar_read(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_compound_scalar_read() */
+} /* end test_h5s_compound_scalar_read() */
-/* Data arrays for chunk test */
-double chunk_data_dbl[50000][3];
-float chunk_data_flt[50000][3];
+
+/* Data array sizes for chunk test */
+#define CHUNK_DATA_NX 50000
+#define CHUNK_DATA_NY 3
/****************************************************************
**
@@ -2481,22 +2482,41 @@ test_h5s_chunk(void)
hid_t space_id;
hsize_t dims[2];
hsize_t csize[2];
+ double **chunk_data_dbl = NULL;
+ double *chunk_data_dbl_data = NULL;
+ float **chunk_data_flt = NULL;
+ float *chunk_data_flt_data = NULL;
int i,j;
+ /* Allocate memory */
+ chunk_data_dbl_data = (double *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(double));
+ CHECK_PTR(chunk_data_dbl_data, "HDcalloc");
+ chunk_data_dbl = (double **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_dbl_data));
+ CHECK_PTR(chunk_data_dbl, "HDcalloc");
+ for (i = 0; i < CHUNK_DATA_NX; i++)
+ chunk_data_dbl[i] = chunk_data_dbl_data + (i * CHUNK_DATA_NY);
+
+ chunk_data_flt_data = (float *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(float));
+ CHECK_PTR(chunk_data_flt_data, "HDcalloc");
+ chunk_data_flt = (float **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_flt_data));
+ CHECK_PTR(chunk_data_flt, "HDcalloc");
+ for (i = 0; i < CHUNK_DATA_NX; i++)
+ chunk_data_flt[i] = chunk_data_flt_data + (i * CHUNK_DATA_NY);
+
fileID = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fileID, FAIL, "H5Fcreate");
plist_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plist_id, FAIL, "H5Pcreate");
- csize[0] = 50000;
- csize[1] = 3;
+ csize[0] = CHUNK_DATA_NX;
+ csize[1] = CHUNK_DATA_NY;
status = H5Pset_chunk(plist_id, 2, csize);
CHECK(status, FAIL, "H5Pset_chunk");
/* Create the dataspace */
- dims[0] = 50000;
- dims[1] = 3;
+ dims[0] = CHUNK_DATA_NX;
+ dims[1] = CHUNK_DATA_NY;
space_id = H5Screate_simple(2, dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
@@ -2504,11 +2524,11 @@ test_h5s_chunk(void)
CHECK(dsetID, FAIL, "H5Dcreate2");
/* Initialize float array */
- for(i = 0; i < 50000; i++)
- for(j = 0; j < 3; j++)
+ for(i = 0; i < CHUNK_DATA_NX; i++)
+ for(j = 0; j < CHUNK_DATA_NY; j++)
chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F;
- status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
+ status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data);
CHECK(status, FAIL, "H5Dwrite");
status = H5Pclose(plist_id);
@@ -2521,17 +2541,17 @@ test_h5s_chunk(void)
CHECK(status, FAIL, "H5Fclose");
/* Reset/initialize the data arrays to read in */
- HDmemset(chunk_data_dbl, 0, sizeof(double) * 50000 * 3);
- HDmemset(chunk_data_flt, 0, sizeof(float) * 50000 * 3);
+ HDmemset(chunk_data_dbl_data, 0, sizeof(double) * CHUNK_DATA_NX * CHUNK_DATA_NY);
+ HDmemset(chunk_data_flt_data, 0, sizeof(float) * CHUNK_DATA_NX * CHUNK_DATA_NY);
fileID = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fileID, FAIL, "H5Fopen");
dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT);
CHECK(dsetID, FAIL, "H5Dopen2");
- status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl);
+ status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl_data);
CHECK(status, FAIL, "H5Dread");
- status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
+ status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data);
CHECK(status, FAIL, "H5Dread");
status = H5Dclose(dsetID);
@@ -2539,13 +2559,18 @@ test_h5s_chunk(void)
status = H5Fclose(fileID);
CHECK(status, FAIL, "H5Fclose");
- for(i=0; i<50000; i++) {
- for(j=0; j<3; j++) {
+ for(i = 0; i < CHUNK_DATA_NX; i++) {
+ for(j = 0; j < CHUNK_DATA_NY; j++) {
/* Check if the two values are within 0.001% range. */
if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F))
TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]);
} /* end for */
} /* end for */
+
+ HDfree(chunk_data_dbl);
+ HDfree(chunk_data_dbl_data);
+ HDfree(chunk_data_flt);
+ HDfree(chunk_data_flt_data);
} /* test_h5s_chunk() */
/****************************************************************
diff --git a/test/unregister.c b/test/unregister.c
index ff116cf..db37f3e 100644
--- a/test/unregister.c
+++ b/test/unregister.c
@@ -95,11 +95,20 @@ test_unregister_filters(hid_t fapl_id)
char filename[FILENAME_BUF_SIZE];
const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
hsize_t dims[2];
- int data[DSET_DIM1][DSET_DIM2];
+ int **buf = NULL;
+ int *buf_data = NULL;
herr_t ret;
TESTING("Unregistering filter");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(DSET_DIM1, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ buf[i] = buf_data + (i * DSET_DIM2);
+
/* Create first file */
h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
@@ -176,7 +185,7 @@ test_unregister_filters(hid_t fapl_id)
/* Initialize the data for writing */
for(i = n = 0; i < DSET_DIM1; i++)
for(j = 0; j < DSET_DIM2; j++)
- data[i][j] = n++;
+ buf[i][j] = n++;
/* Create the dataspace */
dims[0] = DSET_DIM1;
@@ -189,7 +198,7 @@ test_unregister_filters(hid_t fapl_id)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
goto error;
/* Unregister the filter before closing the dataset. It should fail */
@@ -211,7 +220,7 @@ test_unregister_filters(hid_t fapl_id)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
goto error;
/* Close the dataset in the second file */
@@ -232,6 +241,9 @@ test_unregister_filters(hid_t fapl_id)
if(H5Fclose(fid2) < 0)
goto error;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return SUCCEED;
@@ -247,6 +259,9 @@ error:
H5Sclose(sid);
} H5E_END_TRY;
+ HDfree(buf);
+ HDfree(buf_data);
+
return FAIL;
}
diff --git a/test/vds.c b/test/vds.c
index f724e67..6994f1b 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -1134,11 +1134,11 @@ error:
static int
test_vds_prefix_first(unsigned config, hid_t fapl)
{
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- char vfilename[FILENAME_BUF_SIZE];
- char srcfilenamepct[FILENAME_BUF_SIZE];
- char srcfilenamepct_map[FILENAME_BUF_SIZE];
+ char *srcfilename = NULL;
+ char *srcfilename_map = NULL;
+ char *vfilename = NULL;
+ char *srcfilenamepct = NULL;
+ char *srcfilenamepct_map = NULL;
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
@@ -1158,11 +1158,22 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection")
- h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename);
- h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map);
- h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct);
- h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+ if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[8], fapl, srcfilename, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[10], fapl, srcfilenamepct, FILENAME_BUF_SIZE);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* create tmp directory and get current working directory path */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
@@ -1346,6 +1357,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
TEST_ERROR
dcpl = -1;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
PASSED();
return 0;
@@ -1369,6 +1386,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0)
TEST_ERROR
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
return 1;
} /* end test_vds_prefix */
@@ -1386,12 +1409,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
static int
test_basic_io(unsigned config, hid_t fapl)
{
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- char vfilename[FILENAME_BUF_SIZE];
- char vfilename2[FILENAME_BUF_SIZE];
- char srcfilenamepct[FILENAME_BUF_SIZE];
- char srcfilenamepct_map[FILENAME_BUF_SIZE];
+ char *srcfilename = NULL;
+ char *srcfilename_map = NULL;
+ char *vfilename = NULL;
+ char *vfilename2 = NULL;
+ char *srcfilenamepct = NULL;
+ char *srcfilenamepct_map = NULL;
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
@@ -1419,12 +1442,25 @@ test_basic_io(unsigned config, hid_t fapl)
TESTING("basic virtual dataset I/O")
- h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2);
- h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename);
- h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
- h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct);
- h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+ if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[1], fapl, vfilename2, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* Create DCPL */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -4227,6 +4263,13 @@ test_basic_io(unsigned config, hid_t fapl)
TEST_ERROR
dcpl = -1;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(vfilename2);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
PASSED();
return 0;
@@ -4247,6 +4290,13 @@ error:
H5Pclose(dcpl);
} H5E_END_TRY;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(vfilename2);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
return 1;
} /* end test_basic_io() */
@@ -7286,15 +7336,15 @@ error:
static int
test_printf(unsigned config, hid_t fapl)
{
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- char srcfilename2[FILENAME_BUF_SIZE];
- char srcfilename2_map[FILENAME_BUF_SIZE];
- char vfilename[FILENAME_BUF_SIZE];
- char printf_srcfilename_map[FILENAME_BUF_SIZE];
+ char *srcfilename = NULL;
+ char *srcfilename_map = NULL;
+ char *srcfilename2 = NULL;
+ char *srcfilename2_map = NULL;
+ char *vfilename = NULL;
+ char *printf_srcfilename_map = NULL;
+ char *srcfilenamepct = NULL;
+ char *srcfilenamepct_map = NULL;
const char *printf_srcfilename_map_orig = "vds_src_%b";
- char srcfilenamepct[FILENAME_BUF_SIZE];
- char srcfilenamepct_map[FILENAME_BUF_SIZE];
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
@@ -7322,14 +7372,31 @@ test_printf(unsigned config, hid_t fapl)
TESTING("virtual dataset I/O with printf source")
- h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename);
- h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
- h5_fixname(FILENAME[3], fapl, srcfilename2, sizeof srcfilename2);
- h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, sizeof srcfilename2_map);
- h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, sizeof printf_srcfilename_map);
- h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct);
- h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+ if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[3], fapl, srcfilename2, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, FILENAME_BUF_SIZE);
+ h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* Create DCPL */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -10940,6 +11007,15 @@ test_printf(unsigned config, hid_t fapl)
TEST_ERROR
memspace = -1;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(srcfilename2);
+ HDfree(srcfilename2_map);
+ HDfree(vfilename);
+ HDfree(printf_srcfilename_map);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
PASSED();
return 0;
@@ -10960,6 +11036,15 @@ error:
H5Pclose(dapl);
} H5E_END_TRY;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(srcfilename2);
+ HDfree(srcfilename2_map);
+ HDfree(vfilename);
+ HDfree(printf_srcfilename_map);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
return 1;
} /* end test_printf() */
diff --git a/test/vfd.c b/test/vfd.c
index 4fc61da..c033de5 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -842,8 +842,7 @@ error:
*
* Purpose: Tests the file handle interface for FAMILY driver
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Tuesday, Sept 24, 2002
@@ -861,12 +860,21 @@ test_family(void)
char dname[]="dataset";
unsigned int i, j;
int *fhandle=NULL, *fhandle2=NULL;
- int buf[FAMILY_NUMBER][FAMILY_SIZE];
+ int **buf = NULL;
+ int *buf_data = NULL;
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
hsize_t file_size;
TESTING("FAMILY file driver");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ buf[i] = buf_data + (i * FAMILY_SIZE);
+
/* Set property list and file name for FAMILY driver */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
@@ -890,7 +898,7 @@ test_family(void)
| H5FD_FEAT_AGGREGATE_SMALLDATA))
TEST_ERROR
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
@@ -905,7 +913,7 @@ test_family(void)
if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Check file size API */
@@ -917,7 +925,7 @@ test_family(void)
TEST_ERROR;
/* Create and write dataset */
- if((space=H5Screate_simple(2, dims, NULL)) < 0)
+ if((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@@ -932,14 +940,14 @@ test_family(void)
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
- if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
for(i = 0; i < FAMILY_NUMBER; i++)
for(j = 0; j < FAMILY_SIZE; j++)
buf[i][j] = (int)((i * 10000) + j);
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
/* check file handle API */
@@ -1004,8 +1012,11 @@ test_family(void)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1015,8 +1026,12 @@ error:
H5Pclose(fapl2);
H5Fclose(file);
} H5E_END_TRY;
- return -1;
-}
+
+ HDfree(buf);
+ HDfree(buf_data);
+
+ return FAIL;
+} /* end test_family() */
/*-------------------------------------------------------------------------
@@ -1136,8 +1151,7 @@ error:
*
* Purpose: Actually use the member fapl input to the member vfd.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Jacob Smith
* 21 May 2019
@@ -1147,108 +1161,91 @@ error:
static herr_t
test_family_member_fapl(void)
{
- hid_t file = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t memb_fapl_id = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t dset = H5I_INVALID_HID;
+ hid_t file = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t memb_fapl_id = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
char filename[1024];
- char dname[] = "dataset";
- unsigned i = 0;
- unsigned j = 0;
- int buf[FAMILY_NUMBER][FAMILY_SIZE];
- hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
+ char dname[] = "dataset";
+ unsigned i = 0;
+ unsigned j = 0;
+ int **buf = NULL;
+ int *buf_data = NULL;
+ hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
TESTING("Family member FAPL");
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == fapl_id) {
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
TEST_ERROR;
- }
- memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == memb_fapl_id) {
+ if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
TEST_ERROR;
- }
- if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) {
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ buf[i] = buf_data + (i * FAMILY_SIZE);
+
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
TEST_ERROR;
- }
- if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) {
+
+ if((memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
TEST_ERROR;
- }
+
+ if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL)
+ TEST_ERROR;
+ if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL)
+ TEST_ERROR;
+
h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename));
- file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if (H5I_INVALID_HID == file) {
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
TEST_ERROR;
- }
- space = H5Screate_simple(2, dims, NULL);
- if (H5I_INVALID_HID == space) {
+ if((space = H5Screate_simple(2, dims, NULL)) == H5I_INVALID_HID)
TEST_ERROR;
- }
/* Create and write to dataset, then close file.
*/
- dset = H5Dcreate2(
- file,
- dname,
- H5T_NATIVE_INT,
- space,
- H5P_DEFAULT,
- H5P_DEFAULT,
- H5P_DEFAULT);
- if (H5I_INVALID_HID == dset) {
+ if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
TEST_ERROR;
- }
+
for (i = 0; i < FAMILY_NUMBER; i++) {
for (j = 0; j < FAMILY_SIZE; j++) {
buf[i][j] = (int)((i * 10000) + j);
}
}
- if (H5Dwrite(dset,
- H5T_NATIVE_INT,
- H5S_ALL,
- H5S_ALL,
- H5P_DEFAULT,
- buf)
- == FAIL)
- {
+
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) == FAIL)
TEST_ERROR;
- }
- if (H5Dclose(dset) == FAIL) {
+
+ if (H5Dclose(dset) == FAIL)
TEST_ERROR;
- }
- if (H5Sclose(space) == FAIL) {
+ if (H5Sclose(space) == FAIL)
TEST_ERROR;
- }
- if (H5Fclose(file) == FAIL) {
+ if (H5Fclose(file) == FAIL)
TEST_ERROR;
- }
/* "Close" member FAPL at top level and re-open file.
* Should succeed, with library managing reference count properly
*/
- if (H5Pclose(memb_fapl_id) == FAIL) {
+ if (H5Pclose(memb_fapl_id) == FAIL)
TEST_ERROR;
- }
- file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
- if (H5I_INVALID_HID == file) {
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) == H5I_INVALID_HID)
TEST_ERROR;
- }
- if (H5Fclose(file) == FAIL) {
+ if (H5Fclose(file) == FAIL)
TEST_ERROR;
- }
h5_delete_test_file(FILENAME[2], fapl_id);
- if (H5Pclose(fapl_id) == FAIL) {
+ if (H5Pclose(fapl_id) == FAIL)
TEST_ERROR;
- }
+
+ HDfree(buf);
+ HDfree(buf_data);
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1259,7 +1256,10 @@ error:
H5Fclose(file);
} H5E_END_TRY;
- return -1;
+ HDfree(buf);
+ HDfree(buf_data);
+
+ return FAIL;
} /* end test_family_member_fapl() */
@@ -1337,10 +1337,19 @@ test_multi(void)
char dname[]="dataset";
char meta[] = "this is some metadata on this file";
int i, j;
- int buf[MULTI_SIZE][MULTI_SIZE];
+ int **buf = NULL;
+ int *buf_data = NULL;
TESTING("MULTI file driver");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < MULTI_SIZE; i++)
+ buf[i] = buf_data + (i * MULTI_SIZE);
+
/* Set file access property list for MULTI driver */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
@@ -1443,7 +1452,7 @@ test_multi(void)
for(i=0; i<MULTI_SIZE; i++)
for(j=0; j<MULTI_SIZE; j++)
buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -1521,6 +1530,9 @@ test_multi(void)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return SUCCEED;
@@ -1534,6 +1546,10 @@ error:
H5Fclose(file);
H5Aclose(attr);
} H5E_END_TRY;
+
+ HDfree(buf);
+ HDfree(buf_data);
+
return FAIL;
} /* end test_multi() */
@@ -1572,10 +1588,19 @@ test_multi_compat(void)
char sv[H5FD_MEM_NTYPES][32];
hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
int i, j;
- int buf[MULTI_SIZE][MULTI_SIZE];
+ int **buf = NULL;
+ int *buf_data = NULL;
TESTING("MULTI file driver backward compatibility");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < MULTI_SIZE; i++)
+ buf[i] = buf_data + (i * MULTI_SIZE);
+
/* Set file access property list for MULTI driver */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
@@ -1659,7 +1684,7 @@ test_multi_compat(void)
for(i=0; i<MULTI_SIZE; i++)
for(j=0; j<MULTI_SIZE; j++)
buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
if(H5Dclose(dset) < 0)
@@ -1697,9 +1722,12 @@ test_multi_compat(void)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1708,8 +1736,12 @@ error:
H5Pclose(fapl);
H5Fclose(file);
} H5E_END_TRY;
- return -1;
-}
+
+ HDfree(buf);
+ HDfree(buf_data);
+
+ return FAIL;
+} /* end test_multi_compat() */
/*-------------------------------------------------------------------------