summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-06-06 22:19:14 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-06-06 22:19:14 (GMT)
commit6f0519748879a5c4fce7014fcb03228a86739e71 (patch)
treeb883c5089c92d1ff463468a7b497e4d75f7e8eae /test
parent643443a512ec3b253cdd24250e05269e5e733ee0 (diff)
downloadhdf5-6f0519748879a5c4fce7014fcb03228a86739e71.zip
hdf5-6f0519748879a5c4fce7014fcb03228a86739e71.tar.gz
hdf5-6f0519748879a5c4fce7014fcb03228a86739e71.tar.bz2
[svn-r10862] 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 fifth step of checkin. Backward compatibility with v1.6 is tested. A family file created was created with the v1.6 library and opened with this version of the library. In the fourth step of checkin, a test suit is added for h5repart, including a program to generate the test files, a script file to run h5repart, and a program to verify repartitioned files can be opened by the library. There's a change from the first step of checkin. Family name template is no longer saved in the superblock because different pathname can make the name different. In 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: MANIFEST
Diffstat (limited to 'test')
-rw-r--r--test/family_v1.6_00000.h5bin0 -> 5120 bytes
-rw-r--r--test/family_v1.6_00001.h5bin0 -> 5120 bytes
-rw-r--r--test/family_v1.6_00002.h5bin0 -> 5120 bytes
-rw-r--r--test/family_v1.6_00003.h5bin0 -> 4048 bytes
-rw-r--r--test/file_handle.c80
5 files changed, 76 insertions, 4 deletions
diff --git a/test/family_v1.6_00000.h5 b/test/family_v1.6_00000.h5
new file mode 100644
index 0000000..5b69c93
--- /dev/null
+++ b/test/family_v1.6_00000.h5
Binary files differ
diff --git a/test/family_v1.6_00001.h5 b/test/family_v1.6_00001.h5
new file mode 100644
index 0000000..bf55b32
--- /dev/null
+++ b/test/family_v1.6_00001.h5
Binary files differ
diff --git a/test/family_v1.6_00002.h5 b/test/family_v1.6_00002.h5
new file mode 100644
index 0000000..9bd0891
--- /dev/null
+++ b/test/family_v1.6_00002.h5
Binary files differ
diff --git a/test/family_v1.6_00003.h5 b/test/family_v1.6_00003.h5
new file mode 100644
index 0000000..fedce2a
--- /dev/null
+++ b/test/family_v1.6_00003.h5
Binary files differ
diff --git a/test/file_handle.c b/test/file_handle.c
index ba54947..0951ede 100644
--- a/test/file_handle.c
+++ b/test/file_handle.c
@@ -23,17 +23,17 @@
#define KB 1024
#define FAMILY_NUMBER 4
-#define FAMILY_SIZE 1024
+#define FAMILY_SIZE (1*KB)
+#define FAMILY_SIZE2 (5*KB)
#define MULTI_SIZE 128
-#define CORE_INCREMENT 4096
+#define CORE_INCREMENT (4*KB)
const char *FILENAME[] = {
"sec2_file",
"core_file",
"family_file",
"multi_file",
- "fst_family",
- "scd_family",
+ "family_v1.6_",
NULL
};
@@ -428,6 +428,77 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_family_compat
+ *
+ * Purpose: Tests the backward compatibility for FAMILY driver.
+ * See if we can open files created with v1.6 library.
+ * The source file was created by the test/file_handle.c
+ * of the v1.6 library. Then tools/misc/h5repart.c was
+ * used to concantenated. The command was "h5repart -m 5k
+ * family_file%05d.h5 family_v1.6_%05d.h5".
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * June 3, 2005
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_family_compat(void)
+{
+ hid_t file=(-1), fapl;
+ char filename[1024];
+ char pathname[1024];
+ char *srcdir = getenv("srcdir"); /*where the src code is located*/
+
+ TESTING("FAMILY file driver backward compatibility");
+
+#ifndef H5_WANT_H5_V1_6_COMPAT
+ SKIPPED();
+ return 0;
+#else /*H5_WANT_H5_V1_6_COMPAT*/
+
+ /* Set property list and file name for FAMILY driver */
+ fapl = h5_fileaccess();
+
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT)<0)
+ goto error;
+
+ h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+
+ /* Generate correct name for test file by prepending the source path */
+ if(srcdir && ((strlen(srcdir) + strlen(filename) + 1) < sizeof(pathname))) {
+ strcpy(pathname, srcdir);
+ strcat(pathname, "/");
+ }
+ strcat(pathname, filename);
+
+ if((file=H5Fopen(pathname, H5F_ACC_RDONLY, fapl))<0)
+ goto error;
+
+ if(H5Fclose(file)<0)
+ goto error;
+
+ if(H5Pclose(fapl)<0)
+ goto error;
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+#endif /*H5_WANT_H5_V1_6_COMPAT*/
+}
+
+
+/*-------------------------------------------------------------------------
* Function: test_multi_opens
*
* Purpose: Private function for test_multi() to tests wrong ways of
@@ -654,6 +725,7 @@ main(void)
nerrors += test_sec2()<0 ?1:0;
nerrors += test_core()<0 ?1:0;
nerrors += test_family()<0 ?1:0;
+ nerrors += test_family_compat()<0 ?1:0;
nerrors += test_multi()<0 ?1:0;
if (nerrors) goto error;