summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-25 15:16:15 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-25 15:16:15 (GMT)
commit9b84be1422c1455fc0414e5619b9ee142a84cd82 (patch)
tree132046bb11567ffcef104807fb943cf29af25d41 /test
parentc95b683457c1b47f7095e7a9804db7ce84f8e39b (diff)
downloadhdf5-9b84be1422c1455fc0414e5619b9ee142a84cd82.zip
hdf5-9b84be1422c1455fc0414e5619b9ee142a84cd82.tar.gz
hdf5-9b84be1422c1455fc0414e5619b9ee142a84cd82.tar.bz2
[svn-r8743] *** empty log message ***
Diffstat (limited to 'test')
-rw-r--r--test/file_handle.c84
-rw-r--r--test/titerate.c4
2 files changed, 86 insertions, 2 deletions
diff --git a/test/file_handle.c b/test/file_handle.c
index cf255e8..1616bb0 100644
--- a/test/file_handle.c
+++ b/test/file_handle.c
@@ -21,6 +21,7 @@
#include "h5test.h"
+#define KB 1024
#define FAMILY_NUMBER 4
#define FAMILY_SIZE 128
#define MULTI_SIZE 128
@@ -49,6 +50,10 @@ const char *FILENAME[] = {
*
* Modifications:
*
+ * Raymond Lu
+ * Wednesday, June 23, 2004
+ * Added test for H5Fget_filesize.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -57,7 +62,8 @@ test_sec2(void)
hid_t file=(-1), fapl, access_fapl = -1;
char filename[1024];
int *fhandle=NULL;
-
+ haddr_t file_size;
+
TESTING("SEC2 file driver");
/* Set property list and file name for SEC2 driver. */
@@ -83,6 +89,16 @@ test_sec2(void)
if(*fhandle<0)
goto error;
+ /* Check file size API */
+ if((file_size = H5Fget_filesize(file)) <= 0)
+ goto error;
+
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable. It's 2KB right now.
+ */
+ if(file_size<1*KB || file_size>4*KB)
+ goto error;
+
if(H5Fclose(file)<0)
goto error;
h5_cleanup(FILENAME, fapl);
@@ -111,6 +127,10 @@ error:
* Tuesday, Sept 24, 2002
*
* Modifications:
+ *
+ * Raymond Lu
+ * Wednesday, June 23, 2004
+ * Added test for H5Fget_filesize.
*
*-------------------------------------------------------------------------
*/
@@ -120,6 +140,7 @@ test_core(void)
hid_t file=(-1), fapl, access_fapl = -1;
char filename[1024];
void *fhandle=NULL;
+ haddr_t file_size;
TESTING("CORE file driver");
@@ -148,6 +169,17 @@ test_core(void)
goto error;
}
+ /* Check file size API */
+ if((file_size = H5Fget_filesize(file)) <= 0)
+ goto error;
+
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable. Currently, this file size
+ * is 976.
+ */
+ if(file_size<KB/2 || file_size>1*KB)
+ goto error;
+
if(H5Fclose(file)<0)
goto error;
h5_cleanup(FILENAME, fapl);
@@ -177,6 +209,10 @@ error:
*
* Modifications:
*
+ * Raymond Lu
+ * Wednesday, June 23, 2004
+ * Added test for H5Fget_filesize.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -190,6 +226,7 @@ test_family(void)
int *fhandle=NULL, *fhandle2=NULL;
int buf[FAMILY_NUMBER][FAMILY_SIZE];
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
+ haddr_t file_size;
TESTING("FAMILY file driver");
@@ -202,6 +239,14 @@ test_family(void)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
+ /* Check file size API */
+ if((file_size = H5Fget_filesize(file)) <= 0)
+ goto error;
+
+ /* The file size is supposed to be 2KB right now. */
+ if(file_size<1*KB || file_size>4*KB)
+ goto error;
+
/* Create and write dataset */
if((space=H5Screate_simple(2, dims, NULL))<0)
goto error;
@@ -241,6 +286,14 @@ test_family(void)
if(*fhandle2<0)
goto error;
+ /* Check file size API */
+ if((file_size = H5Fget_filesize(file)) <= 0)
+ goto error;
+
+ /* Some data has been written. The file size should be bigger(4KB) now. */
+ if(file_size<2*KB || file_size>6*KB)
+ goto error;
+
if(H5Sclose(space)<0)
goto error;
if(H5Dclose(dset)<0)
@@ -279,6 +332,10 @@ error:
*
* Modifications:
*
+ * Raymond Lu
+ * Wednesday, June 23, 2004
+ * Added test for H5Fget_filesize.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -288,6 +345,7 @@ test_multi(void)
hid_t access_fapl = -1;
char filename[1024];
int *fhandle2=NULL, *fhandle=NULL;
+ haddr_t file_size;
H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
haddr_t memb_addr[H5FD_MEM_NTYPES];
@@ -341,9 +399,20 @@ test_multi(void)
if (H5Pclose(access_fapl) < 0)
goto error;
+ /* Check file size API */
+ if((file_size = H5Fget_filesize(file)) <= 0)
+ goto error;
+
+ /* Before any data is written, the raw data file is empty. So
+ * the file size is only the size of metadata file. It's supposed
+ * to be 2KB.
+ */
+ if(file_size<1*KB || file_size>4*KB)
+ goto error;
+
if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0)
goto error;
-
+
for(i=0; i<MULTI_SIZE; i++)
for(j=0; j<MULTI_SIZE; j++)
buf[i][j] = i*10000+j;
@@ -366,6 +435,17 @@ test_multi(void)
if(*fhandle2<0)
goto error;
+ /* Check file size API */
+ if((file_size = H5Fget_filesize(file)) <= 0)
+ goto error;
+
+ /* After the data is written, the file size is huge because the
+ * beginning of raw data file is set at HADDR_MAX/2. It's supposed
+ * to be (HADDR_MAX/2 + 128*128*4)
+ */
+ if(file_size < HADDR_MAX/2 || file_size > HADDR_MAX)
+ goto error;
+
if(H5Sclose(space)<0)
goto error;
if(H5Dclose(dset)<0)
diff --git a/test/titerate.c b/test/titerate.c
index 4cb3f0c..aea951e 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -859,7 +859,11 @@ static void test_links(void)
herr_t ret; /* Generic return value */
hid_t gid, gid1;
int i;
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ int obj_type; /* Type of object */
+#else /*H5_WANT_H5_V1_4_COMPAT*/
H5G_obj_t obj_type; /* Type of object */
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
hsize_t nobjs; /* Number of objects */
/* Output message about test being performed */