summaryrefslogtreecommitdiffstats
path: root/test/file_handle.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-05-20 21:51:05 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-05-20 21:51:05 (GMT)
commit2ae072bb309d9866ca7b074c685243fe54e89bb0 (patch)
treec103d0c423ef18b8eae7e19ea85a81afda52e5fa /test/file_handle.c
parent02ca8127867a11ed57cfb8da11ab9cea6dd4b516 (diff)
downloadhdf5-2ae072bb309d9866ca7b074c685243fe54e89bb0.zip
hdf5-2ae072bb309d9866ca7b074c685243fe54e89bb0.tar.gz
hdf5-2ae072bb309d9866ca7b074c685243fe54e89bb0.tar.bz2
[svn-r10779] Purpose: Bug fix
Description: Description: See details from Bug #213. Family member file size wasn't saved anywhere in file. When family file is opened, the first member size determine the member size. Solution: This is the second step of fixing this bug. Multi driver is checked against the driver name saved in superblock. Wrong driver will result in a failure with an error message indicating multi driver should be used. This change includes split driver because it's a special case for multi driver. In the first step of checkin. Family member size and name template(unused at this stage) are saved in file superblock. When file is reopened,the size passed in thrin superblock. A different size will trigger a failure with an error message indicating the right size. Wrong driver to open family file will cause a failure, too. Test program tries to reopen a multi file with default sec2 driver. The third step will be changing h5repart to let it change family member size in the superblock if user uses it to change member file size. Platforms tested: h5committest and fuss.
Diffstat (limited to 'test/file_handle.c')
-rw-r--r--test/file_handle.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/test/file_handle.c b/test/file_handle.c
index 90a8109..6a57cb4 100644
--- a/test/file_handle.c
+++ b/test/file_handle.c
@@ -489,6 +489,17 @@ test_multi(void)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
+ if(H5Fclose(file)<0)
+ goto error;
+
+ /* Test wrong ways to reopen multi files */
+ if(test_multi_opens(filename, fapl)<0)
+ goto error;
+
+ /* Reopen the file */
+ if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
+ goto error;
+
/* Create and write data set */
if((space=H5Screate_simple(2, dims, NULL))<0)
goto error;
@@ -571,7 +582,44 @@ error:
H5Fclose(file);
} H5E_END_TRY;
return -1;
-}
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_multi_opens
+ *
+ * Purpose: Private function for test_multi() to tests wrong ways of
+ * reopening multi file.
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * Thursday, May 19, 2005
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_multi_opens(char *fname, hid_t fa_pl)
+{
+ hid_t file;
+ char super_name[1024]; /*name string "%%s-s.h5"*/
+ char sf_name[1024]; /*name string "multi_file-s.h5"*/
+
+ /* Case: reopen with the name of super file and default property list */
+ sprintf(super_name, "%%s-%c.h5", 's');
+ sprintf(sf_name, super_name, fname);
+
+ H5E_BEGIN_TRY {
+ file=H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ return 0;
+error:
+ return -1;
+}
/*-------------------------------------------------------------------------