summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-24 22:20:08 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-24 22:20:08 (GMT)
commita89057a2cd6e1f939a0021244832fa4f635790bb (patch)
treea9f91881bb59ec76945b6fac50910e999ea3bea5 /test
parent705900b05cf7fc35de51991cd904629e53c983e9 (diff)
downloadhdf5-a89057a2cd6e1f939a0021244832fa4f635790bb.zip
hdf5-a89057a2cd6e1f939a0021244832fa4f635790bb.tar.gz
hdf5-a89057a2cd6e1f939a0021244832fa4f635790bb.tar.bz2
[svn-r8741] *** empty log message ***
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in13
-rw-r--r--test/file_handle.c83
2 files changed, 91 insertions, 5 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index bdc5446..78e25d1 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -31,7 +31,14 @@ TEST_PROGS=testhdf5 lheap ohdr stab gheap hyperslab istore bittests dtypes
dsets cmpd_dset extend external links unlink big mtime fillval mount \
flush1 flush2 enum gass_write gass_read gass_append set_extent \
srb_write srb_append srb_read ttsafe stream_test getname file_handle \
- ntypes dangle error_test err_compat dtransform
+ ntypes dangle dtransform
+
+## Test programs for Error API. Only compile them but let testerror.sh run
+## them to compare the output error messages with standard ones. 'make check'
+## doesn't run them directly.
+ERR_PROGS=error_test err_compat
+
+PROGS=$(ERR_PROGS) $(TEST_PROGS)
TIMINGS=testmeta
@@ -101,10 +108,10 @@ timings _timings: $(TIMINGS)
## Programs have to be built before they can be tested!
##
-check test _test: $(TEST_PROGS)
+check test _test: $(PROGS)
## How to build the tests... They all depend on the test and hdf5 libraries.
-$(TEST_PROGS): $(LIB) $(LIBHDF5)
+$(PROGS): $(LIB) $(LIBHDF5)
TESTHDF5_OBJ=testhdf5.lo tarray.lo tattr.lo tconfig.lo tfile.lo \
tgenprop.lo th5s.lo theap.lo titerate.lo tmeta.lo ttime.lo trefer.lo \
diff --git a/test/file_handle.c b/test/file_handle.c
index cf255e8..8df8409 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,16 @@ 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. Why is this 4KB?
+ */
+ if(file_size<2*KB || file_size>6*KB)
+ goto error;
+
if(H5Fclose(file)<0)
goto error;
h5_cleanup(FILENAME, fapl);
@@ -177,6 +208,10 @@ error:
*
* Modifications:
*
+ * Raymond Lu
+ * Wednesday, June 23, 2004
+ * Added test for H5Fget_filesize.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -190,6 +225,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 +238,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 +285,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 +331,10 @@ error:
*
* Modifications:
*
+ * Raymond Lu
+ * Wednesday, June 23, 2004
+ * Added test for H5Fget_filesize.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -288,6 +344,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 +398,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 +434,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)