summaryrefslogtreecommitdiffstats
path: root/test/big.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/big.c')
-rw-r--r--test/big.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/test/big.c b/test/big.c
index 990e0b1..aabc7b7 100644
--- a/test/big.c
+++ b/test/big.c
@@ -21,6 +21,7 @@
const char *FILENAME[] = {
"big",
+ "stdio",
NULL
};
@@ -122,7 +123,7 @@ is_sparse(void)
if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0;
if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
- if (5!=HDwrite(fd, "hello", 5)) return 0;
+ if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
if (HDclose(fd)<0) return 0;
if (HDstat("x.h5", &sb)<0) return 0;
if (HDunlink("x.h5")<0) return 0;
@@ -176,7 +177,7 @@ enough_room(hid_t fapl)
if ((off_t)size != HDlseek(fd[i], (off_t)size, SEEK_SET)) {
goto done;
}
- if (1!=HDwrite(fd[i], "X", 1)) {
+ if (1!=HDwrite(fd[i], "X", (size_t)1)) {
goto done;
}
}
@@ -213,17 +214,16 @@ enough_room(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-writer (hid_t fapl, int wrt_n)
+writer (char* filename, hid_t fapl, int wrt_n)
{
hsize_t size1[4] = {8, 1024, 1024, 1024};
hsize_t size2[1] = {GB8LL};
hsize_t hs_start[1];
hsize_t hs_size[1];
hid_t file=-1, space1=-1, space2=-1, mem_space=-1, d1=-1, d2=-1;
- int *buf = malloc (sizeof(int) * WRT_SIZE);
+ int *buf = (int*)malloc (sizeof(int) * WRT_SIZE);
int i, j;
FILE *out = fopen(DNAME, "w");
- char filename[1024];
hid_t dcpl;
TESTING("large dataset write");
@@ -232,7 +232,6 @@ writer (hid_t fapl, int wrt_n)
* We might be on a machine that has 32-bit files, so create an HDF5 file
* which is a family of files. Each member of the family will be 1GB
*/
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) {
goto error;
}
@@ -324,22 +323,20 @@ writer (hid_t fapl, int wrt_n)
*-------------------------------------------------------------------------
*/
static int
-reader (hid_t fapl)
+reader (char *filename, hid_t fapl)
{
FILE *script = NULL;
hid_t file=-1, mspace=-1, fspace=-1, d2=-1;
char ln[128], *s;
hsize_t hs_offset[1];
hsize_t hs_size[1] = {WRT_SIZE};
- int *buf = malloc (sizeof(int) * WRT_SIZE);
+ int *buf = (int*)malloc (sizeof(int) * WRT_SIZE);
int i, j, zero, wrong, nerrors=0;
- char filename[1024];
/* Open script file */
script = fopen (DNAME, "r");
/* Open HDF5 file */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error;
/* Open the dataset */
@@ -350,7 +347,7 @@ reader (hid_t fapl)
if ((mspace = H5Screate_simple (1, hs_size, hs_size))<0) goto error;
/* Read each region */
- while (fgets (ln, sizeof(ln), script)) {
+ while (fgets (ln, (int)sizeof(ln), script)) {
if ('#'!=ln[0]) break;
i = (int)strtol (ln+1, &s, 10);
hs_offset[0] = HDstrtoll (s, NULL, 0);
@@ -463,6 +460,7 @@ main (int ac, char **av)
hsize_t family_size_def; /* default family file size */
double family_size_def_dbl; /* default family file size */
int cflag=1; /* check file system before test */
+ char filename[1024];
/* parameters setup */
family_size_def = FAMILY_SIZE;
@@ -501,7 +499,8 @@ main (int ac, char **av)
h5_reset();
fapl = h5_fileaccess();
- /* The file driver must be the family driver */
+ /* Test big file with the family driver */
+ puts("Testing big file with the Family Driver ");
if (H5FD_FAMILY!=H5Pget_driver(fapl)) {
HDfprintf(stdout,
"Changing file drivers to the family driver, %Hu bytes each\n",
@@ -546,10 +545,29 @@ main (int ac, char **av)
}
}
- /* Do the test */
- if (writer(fapl, WRT_N)) goto error;
- if (reader(fapl)) goto error;
- puts("All big tests passed.");
+ /* Do the test with the Family Driver */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if (writer(filename, fapl, WRT_N)) goto error;
+ if (reader(filename, fapl)) goto error;
+
+ /* Clean up the test file */
+ if (h5_cleanup(FILENAME, fapl)) remove(DNAME);
+ puts("Test passed with the Family Driver.");
+
+
+ /* Test big file with the STDIO driver */
+ puts("\nTesting big file with the STDIO Driver ");
+
+ fapl = h5_fileaccess();
+ if(H5Pset_fapl_stdio(fapl)<0)
+
+ HDmemset(filename, 0, sizeof(filename));
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+
+ if (writer(filename, fapl, WRT_N)) goto error;
+ if (reader(filename, fapl)) goto error;
+ puts("Test passed with the STDIO Driver.");
quit:
/* End with normal exit code */