From 55fbd2aaac6e51bcf292d105ed84f77935c2d747 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Tue, 7 Jun 2005 14:38:53 -0500 Subject: [svn-r10869] Purpose: A feature Description: For v1.7 library, family file driver has been changed. The family member size is saved in the superblock and compared to the size passed in through H5Pset_fapl_family(). Solution: Added test to check if we can open family file created with v1.7 library. Platforms tested: h5committest and fuss. Misc. update: MANIFEST --- test/dtypes.c | 2 +- test/family_v1.7_00000.h5 | Bin 0 -> 5120 bytes test/family_v1.7_00001.h5 | Bin 0 -> 5120 bytes test/family_v1.7_00002.h5 | Bin 0 -> 5120 bytes test/family_v1.7_00003.h5 | Bin 0 -> 4072 bytes test/file_handle.c | 72 ++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 test/family_v1.7_00000.h5 create mode 100644 test/family_v1.7_00001.h5 create mode 100644 test/family_v1.7_00002.h5 create mode 100644 test/family_v1.7_00003.h5 diff --git a/test/dtypes.c b/test/dtypes.c index 1b52cb3..627d6c3 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6144,7 +6144,7 @@ main(void) nerrors += test_conv_flt_1("sw", H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1("sw", H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #endif - + if (nerrors) { printf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); diff --git a/test/family_v1.7_00000.h5 b/test/family_v1.7_00000.h5 new file mode 100644 index 0000000..2d623dd Binary files /dev/null and b/test/family_v1.7_00000.h5 differ diff --git a/test/family_v1.7_00001.h5 b/test/family_v1.7_00001.h5 new file mode 100644 index 0000000..cc6c426 Binary files /dev/null and b/test/family_v1.7_00001.h5 differ diff --git a/test/family_v1.7_00002.h5 b/test/family_v1.7_00002.h5 new file mode 100644 index 0000000..a606e57 Binary files /dev/null and b/test/family_v1.7_00002.h5 differ diff --git a/test/family_v1.7_00003.h5 b/test/family_v1.7_00003.h5 new file mode 100644 index 0000000..ecb978d Binary files /dev/null and b/test/family_v1.7_00003.h5 differ diff --git a/test/file_handle.c b/test/file_handle.c index 1db5e14..b957b15 100644 --- a/test/file_handle.c +++ b/test/file_handle.c @@ -23,15 +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", + "family_v1.7_", NULL }; @@ -335,6 +337,71 @@ error: /*------------------------------------------------------------------------- + * Function: test_family_compat + * + * Purpose: Tests the forward compatibility for FAMILY driver. + * See if we can open files created with v1.7 library. + * The source file was created by the test/file_handle.c + * of the v1.7 library. Then tools/misc/h5repart.c was + * used to concantenated. The command was "h5repart -m 5k + * family_file%05d.h5 family_v1.7_%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 forward compatibility"); + + /* 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; +} + + +/*------------------------------------------------------------------------- * Function: test_multi * * Purpose: Tests the file handle interface for MUTLI driver @@ -515,6 +582,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; -- cgit v0.12