summaryrefslogtreecommitdiffstats
path: root/test/file_handle.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-05-24 21:21:35 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-05-24 21:21:35 (GMT)
commit8ed5f2349226a268d8cf84b640ecdff3e3eded2d (patch)
tree16e1df1e93afc399713e2d39a92ea84e276b7284 /test/file_handle.c
parent38b33b83308d00f6d882bba87069e2b77fd95443 (diff)
downloadhdf5-8ed5f2349226a268d8cf84b640ecdff3e3eded2d.zip
hdf5-8ed5f2349226a268d8cf84b640ecdff3e3eded2d.tar.gz
hdf5-8ed5f2349226a268d8cf84b640ecdff3e3eded2d.tar.bz2
[svn-r10796] Purpose: Bug fix
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 third step of checkin. h5repart has been modified. If h5repart is used to change the size of family member file, the new size(actual member size) is saved in the superblock. In the second step of checkin, 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. Platforms tested: h5committest and fuss Misc. update: RELEASE.txt
Diffstat (limited to 'test/file_handle.c')
-rw-r--r--test/file_handle.c152
1 files changed, 76 insertions, 76 deletions
diff --git a/test/file_handle.c b/test/file_handle.c
index 701d2b0..6a57cb4 100644
--- a/test/file_handle.c
+++ b/test/file_handle.c
@@ -195,72 +195,6 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_family_opens
- *
- * Purpose: Private function for test_family() to tests wrong ways of
- * reopening family file.
- *
- * Return: Success: exit(0)
- *
- * Failure: exit(1)
- *
- * Programmer: Raymond Lu
- * Thursday, May 19, 2005
- *
- * Modifications:
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_family_opens(char *fname, hid_t fa_pl)
-{
- hid_t file;
- char first_name[1024];
- char wrong_name[1024];
- int i;
-
- /* Case 1: reopen file with 1st member file name and default property list */
- sprintf(first_name, fname, 0);
-
- H5E_BEGIN_TRY {
- file=H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* Case 2: reopen file with correct name template but default property list */
- H5E_BEGIN_TRY {
- file=H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* Case 3: reopen file with wrong member size */
- if(H5Pset_fapl_family(fa_pl, 128, H5P_DEFAULT)<0)
- goto error;
-
- H5E_BEGIN_TRY {
- file=H5Fopen(fname, H5F_ACC_RDWR, fa_pl);
- } H5E_END_TRY;
-
- /* Case 4: reopen file with wrong name template */
- strcpy(wrong_name, fname);
- for(i=0; i<1024; i++) {
- if(wrong_name[i] == '5') {
- wrong_name[i] = '4';
- break;
- }
- }
-
- if(H5Pset_fapl_family(fa_pl, FAMILY_SIZE, H5P_DEFAULT)<0)
- goto error;
-
- H5E_BEGIN_TRY {
- file=H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl);
- } H5E_END_TRY;
-
- return 0;
-error:
- return -1;
-}
-
-
-/*-------------------------------------------------------------------------
* Function: test_family
*
* Purpose: Tests the file handle interface for FAMILY driver
@@ -421,10 +355,10 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_multi_opens
+ * Function: test_family_opens
*
- * Purpose: Private function for test_multi() to tests wrong ways of
- * reopening multi file.
+ * Purpose: Private function for test_family() to tests wrong ways of
+ * reopening family file.
*
* Return: Success: exit(0)
*
@@ -437,18 +371,47 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_multi_opens(char *fname, hid_t fa_pl)
+test_family_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"*/
+ char first_name[1024];
+ char wrong_name[1024];
+ int i;
- /* 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);
+ /* Case 1: reopen file with 1st member file name and default property list */
+ sprintf(first_name, fname, 0);
+
+ H5E_BEGIN_TRY {
+ file=H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT);
+ } H5E_END_TRY;
+ /* Case 2: reopen file with correct name template but default property list */
H5E_BEGIN_TRY {
- file=H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT);
+ file=H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ /* Case 3: reopen file with wrong member size */
+ if(H5Pset_fapl_family(fa_pl, 128, H5P_DEFAULT)<0)
+ goto error;
+
+ H5E_BEGIN_TRY {
+ file=H5Fopen(fname, H5F_ACC_RDWR, fa_pl);
+ } H5E_END_TRY;
+
+ /* Case 4: reopen file with wrong name template */
+ strcpy(wrong_name, fname);
+ for(i=0; i<1024; i++) {
+ if(wrong_name[i] == '5') {
+ wrong_name[i] = '4';
+ break;
+ }
+ }
+
+ if(H5Pset_fapl_family(fa_pl, FAMILY_SIZE, H5P_DEFAULT)<0)
+ goto error;
+
+ H5E_BEGIN_TRY {
+ file=H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl);
} H5E_END_TRY;
return 0;
@@ -623,6 +586,43 @@ error:
/*-------------------------------------------------------------------------
+ * 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;
+}
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Tests the file handle interface(H5Fget_vfd_handle and