summaryrefslogtreecommitdiffstats
path: root/test/file_handle.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-11-16 16:38:28 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-11-16 16:38:28 (GMT)
commit22a72b911eda2f413691eed0ef2862025827a858 (patch)
tree9241588c45829e4431aa8979b6c5d39a7014e9ed /test/file_handle.c
parentb950cebd9ec030b0f13c6fc9f17ea381c3afa2a6 (diff)
downloadhdf5-22a72b911eda2f413691eed0ef2862025827a858.zip
hdf5-22a72b911eda2f413691eed0ef2862025827a858.tar.gz
hdf5-22a72b911eda2f413691eed0ef2862025827a858.tar.bz2
[svn-r9531] Purpose: Bug fix(#213)
Description: H5Pset_fapl_family sets family member size only for creating new file. The file doesn't keep this size information. When the file is re-opened, the size of first member file is used as the member size. Solution: Assume user knows the original member size and sets it through H5Pset_fapl_family. That will be the member size. User can pass in value 0 as member size if he doesn't know the original member size. Library will choose the size of current first member size as the member file size. Platforms tested: h5committest and fuss.
Diffstat (limited to 'test/file_handle.c')
-rw-r--r--test/file_handle.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/test/file_handle.c b/test/file_handle.c
index d090fce..c50a749 100644
--- a/test/file_handle.c
+++ b/test/file_handle.c
@@ -23,7 +23,7 @@
#define KB 1024
#define FAMILY_NUMBER 4
-#define FAMILY_SIZE 128
+#define FAMILY_SIZE 1024
#define MULTI_SIZE 128
#define CORE_INCREMENT 4096
@@ -226,6 +226,7 @@ test_family(void)
int buf[FAMILY_NUMBER][FAMILY_SIZE];
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
hsize_t file_size;
+ herr_t ret;
TESTING("FAMILY file driver");
@@ -238,12 +239,29 @@ test_family(void)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
+ if((ret=H5Fclose(file))<0)
+ goto error;
+
+ /* Tries to reopen the file with member file size smaller than
+ * actual 1st member file size(976 bytes). Supposed to fail. */
+ if(H5Pset_fapl_family(fapl, (hsize_t)512, H5P_DEFAULT)<0)
+ goto error;
+ H5E_BEGIN_TRY {
+ H5Fopen(filename, H5F_ACC_RDWR, fapl);
+ } H5E_END_TRY;
+
+ /* Reopen the file with original member file size */
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0)
+ goto error;
+ if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
+ goto error;
+
/* Check file size API */
if(H5Fget_filesize(file, &file_size) < 0)
goto error;
- /* The file size is supposed to be 2KB right now. */
- if(file_size<1*KB || file_size>4*KB)
+ /* The file size is supposed to be 976 bytes right now. */
+ if(file_size<KB/2 || file_size>4*KB)
goto error;
/* Create and write dataset */
@@ -289,10 +307,15 @@ test_family(void)
if(H5Fget_filesize(file, &file_size) < 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;
-
+ /* Some data has been written. The file size should be bigger(18KB+976 bytes if int size is 4 bytes) now. */
+ if(sizeof(int)<=4) {
+ if(file_size<18*KB || file_size>20*KB)
+ goto error;
+ } else if(sizeof(int)>=8) {
+ if(file_size<32*KB || file_size>40*KB)
+ goto error;
+ }
+
if(H5Sclose(space)<0)
goto error;
if(H5Dclose(dset)<0)