summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2007-04-04 19:59:00 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2007-04-04 19:59:00 (GMT)
commit3431f74c438b25e7aeba9062ed1e948899457b46 (patch)
treeed7a1aa1282e74a0a4646762ce82f29b1749dbec /test
parentea63d5fb19e8b260178e6f76e8ed0504ded148a3 (diff)
downloadhdf5-3431f74c438b25e7aeba9062ed1e948899457b46.zip
hdf5-3431f74c438b25e7aeba9062ed1e948899457b46.tar.gz
hdf5-3431f74c438b25e7aeba9062ed1e948899457b46.tar.bz2
[svn-r13588] A support of files bigger than 2GB for STDIO driver. Configure will
check if fseeko is available. Using it instead of fseek can support big files because the offset is of type off_t not long int. Also added the test for STDIO in big.c.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am6
-rw-r--r--test/Makefile.in6
-rw-r--r--test/big.c50
-rw-r--r--test/vfd.c11
4 files changed, 46 insertions, 27 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index f52d63f..d32d856 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -106,13 +106,13 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \
extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2]\
links.h5 links[1-3].h5 big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
- dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 \
- unlink.h5 unicode.h5 \
+ stdio.h5 dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 tselect.h5 \
+ mtime.h5 unlink.h5 unicode.h5 \
fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \
trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 flush.h5 \
enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \
tmisc[0-9]*.h5 set_extent_read.h5 set_extent_create.h5 \
- getname.h5 getname[1-3].h5 sec2_file.h5 \
+ getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \
family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
diff --git a/test/Makefile.in b/test/Makefile.in
index e282369..59dea0b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -602,15 +602,15 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \
extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
dt_arith[1-2] links.h5 links[1-3].h5 big.data \
- big[0-9][0-9][0-9][0-9][0-9].h5 dtypes[1-8].h5 \
+ big[0-9][0-9][0-9][0-9][0-9].h5 stdio.h5 dtypes[1-8].h5 \
dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 unlink.h5 \
unicode.h5 fillval_[0-9].h5 fillval.raw mount_[0-9].h5 \
testmeta.h5 ttime.h5 trefer[1-3].h5 tvltypes.h5 tvlstr.h5 \
tvlstr2.h5 flush.h5 enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 \
tgenprop.h5 tmisc[0-9]*.h5 set_extent_read.h5 \
set_extent_create.h5 getname.h5 getname[1-3].h5 sec2_file.h5 \
- family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
- new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 \
+ direct_file.h5 family_file000[0-3][0-9].h5 multi_file-[rs].h5 \
+ core_file new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 \
err_compat.h5 dtransform.h5 test_filters.h5 get_file_name.h5 \
tstint[1-2].h5 unlink_chunked.h5 btree2.h5 objcopy_src.h5 \
objcopy_dst.h5 objcopy_ext.dat trefer1.h5 trefer2.h5
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 */
diff --git a/test/vfd.c b/test/vfd.c
index dd79e32..8f11364 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -22,7 +22,7 @@
#include "h5test.h"
-#define KB 1024
+#define KB 1024U
#define FAMILY_NUMBER 4
#define FAMILY_SIZE (1*KB)
#define FAMILY_SIZE2 (5*KB)
@@ -379,7 +379,7 @@ test_core(void)
/* Set property list and file name for CORE driver */
fapl = h5_fileaccess();
- if(H5Pset_fapl_core(fapl, CORE_INCREMENT, TRUE)<0)
+ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE)<0)
TEST_ERROR;
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
@@ -418,7 +418,7 @@ test_core(void)
/* Open the file with backing store off for read and write.
* Changes won't be saved in file. */
- if(H5Pset_fapl_core(fapl, CORE_INCREMENT, FALSE)<0)
+ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE)<0)
TEST_ERROR;
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
@@ -480,7 +480,7 @@ test_core(void)
/* Open the file with backing store on for read and write.
* Changes will be saved in file. */
- if(H5Pset_fapl_core(fapl, CORE_INCREMENT, TRUE)<0)
+ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE)<0)
TEST_ERROR;
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
@@ -660,7 +660,7 @@ test_family(void)
hid_t access_fapl = -1;
char filename[1024];
char dname[]="dataset";
- int i, j;
+ unsigned int i, j;
int *fhandle=NULL, *fhandle2=NULL;
int buf[FAMILY_NUMBER][FAMILY_SIZE];
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
@@ -719,6 +719,7 @@ test_family(void)
for(i=0; i<FAMILY_NUMBER; i++)
for(j=0; j<FAMILY_SIZE; j++)
buf[i][j] = i*10000+j;
+
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0)
TEST_ERROR;