diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-11-15 02:55:39 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-11-15 02:55:39 (GMT) |
commit | a1708eb023f2c8f8ac6c2c17bf1e598c8dff956e (patch) | |
tree | 34c87a3753b36c4c8d689d58bf456eaf261cd235 /test/vfd.c | |
parent | bea1e576c5ef5500678f7ce913d835341b625e8f (diff) | |
download | hdf5-a1708eb023f2c8f8ac6c2c17bf1e598c8dff956e.zip hdf5-a1708eb023f2c8f8ac6c2c17bf1e598c8dff956e.tar.gz hdf5-a1708eb023f2c8f8ac6c2c17bf1e598c8dff956e.tar.bz2 |
[svn-r11712] Purpose:
New feature
Description:
Check in baseline for compact group revisions, which radically revises the
source code for managing groups and object headers.
WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!!
WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!!
This initiates the "unstable" phase of the 1.7.x branch, leading up
to the 1.8.0 release. Please test this code, but do _NOT_ keep files created
with it - the format will change again before the release and you will not
be able to read your old files!!!
WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!!
WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!!
Solution:
There's too many changes to really describe them all, but some of them
include:
- Stop abusing the H5G_entry_t structure and split it into two separate
structures for non-symbol table node use within the library: H5O_loc_t
for object locations in a file and H5G_name_t to store the path to
an opened object. H5G_entry_t is now only used for storing symbol
table entries on disk.
- Retire H5G_namei() in favor of a more general mechanism for traversing
group paths and issuing callbacks on objects located. This gets us out
of the business of hacking H5G_namei() for new features, generally.
- Revised H5O* routines to take a H5O_loc_t instead of H5G_entry_t
- Lots more...
Platforms tested:
h5committested and maybe another dozen configurations.... :-)
Diffstat (limited to 'test/vfd.c')
-rw-r--r-- | test/vfd.c | 174 |
1 files changed, 88 insertions, 86 deletions
@@ -72,38 +72,38 @@ test_sec2(void) /* Set property list and file name for SEC2 driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_sec2(fapl)<0) - goto error; + TEST_ERROR; h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) - goto error; + TEST_ERROR; /* Retrieve the access property list... */ if ((access_fapl = H5Fget_access_plist(file)) < 0) - goto error; + TEST_ERROR; /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) - goto error; + TEST_ERROR; /* Check file handle API */ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle)<0) - goto error; + TEST_ERROR; if(*fhandle<0) - goto error; + TEST_ERROR; /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) - goto error; + TEST_ERROR; /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. It's 2KB right now. */ if(file_size<1*KB || file_size>4*KB) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -150,40 +150,40 @@ test_core(void) /* Set property list and file name for CORE driver */ fapl = h5_fileaccess(); if(H5Pset_fapl_core(fapl, CORE_INCREMENT, TRUE)<0) - goto error; + TEST_ERROR; h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) - goto error; + TEST_ERROR; /* Retrieve the access property list... */ if ((access_fapl = H5Fget_access_plist(file)) < 0) - goto error; + TEST_ERROR; /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) - goto error; + TEST_ERROR; if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle)<0) - goto error; + TEST_ERROR; if(fhandle==NULL) { printf("fhandle==NULL\n"); - goto error; + TEST_ERROR; } /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) - goto error; + TEST_ERROR; /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. Why is this 4KB? */ if(file_size<2*KB || file_size>6*KB) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -235,7 +235,7 @@ test_family_opens(char *fname, hid_t fa_pl) /* Case 3: reopen file with wrong member size */ if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT)<0) - goto error; + TEST_ERROR; H5E_BEGIN_TRY { file=H5Fopen(fname, H5F_ACC_RDWR, fa_pl); @@ -251,7 +251,7 @@ test_family_opens(char *fname, hid_t fa_pl) } if(H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0) - goto error; + TEST_ERROR; H5E_BEGIN_TRY { file=H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); @@ -307,111 +307,111 @@ test_family(void) fapl = h5_fileaccess(); if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0) - goto error; + TEST_ERROR; h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; /* Test different wrong ways to reopen family files where there's only * one member file existing. */ if(test_family_opens(filename, fapl)<0) - goto error; + TEST_ERROR; /* Reopen the file with default member file size */ if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT)<0) - goto error; + TEST_ERROR; if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0) - goto error; + TEST_ERROR; /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) - goto error; + TEST_ERROR; - /* The file size is supposed to be about 1024 bytes right now. */ - if(file_size<KB/2 || file_size>4*KB) - goto error; + /* The file size is supposed to be about 300 bytes right now. */ + if(file_size<KB/4 || file_size>4*KB) + TEST_ERROR; /* Create and write dataset */ if((space=H5Screate_simple(2, dims, NULL))<0) - goto error; + TEST_ERROR; /* Retrieve the access property list... */ if ((access_fapl = H5Fget_access_plist(file)) < 0) - goto error; + TEST_ERROR; /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) - goto error; + TEST_ERROR; if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0) - goto error; + TEST_ERROR; for(i=0; i<FAMILY_NUMBER; i++) for(j=0; j<FAMILY_SIZE; j++) buf[i][j] = i*10000+j; if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0) - goto error; + TEST_ERROR; /* check file handle API */ if((fapl2=H5Pcreate(H5P_FILE_ACCESS))<0) - goto error; + TEST_ERROR; if(H5Pset_family_offset(fapl2, (hsize_t)0)<0) - goto error; + TEST_ERROR; if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle)<0) - goto error; + TEST_ERROR; if(*fhandle<0) - goto error; + TEST_ERROR; if(H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE*2))<0) - goto error; + TEST_ERROR; if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2)<0) - goto error; + TEST_ERROR; if(*fhandle2<0) - goto error; + TEST_ERROR; /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) - goto error; + TEST_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; + TEST_ERROR; } else if(sizeof(int)>=8) { if(file_size<32*KB || file_size>40*KB) - goto error; + TEST_ERROR; } if(H5Sclose(space)<0) - goto error; + TEST_ERROR; if(H5Dclose(dset)<0) - goto error; + TEST_ERROR; if(H5Pclose(fapl2)<0) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; /* Test different wrong ways to reopen family files when there're multiple * member files existing. */ if(test_family_opens(filename, fapl)<0) - goto error; + TEST_ERROR; /* Reopen the file with correct member file size. */ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0) - goto error; + TEST_ERROR; if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; h5_cleanup(FILENAME, fapl); PASSED(); @@ -469,7 +469,7 @@ test_family_compat(void) fapl = h5_fileaccess(); if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT)<0) - goto error; + TEST_ERROR; h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename); @@ -482,13 +482,13 @@ test_family_compat(void) strcat(pathname, filename); if((file=H5Fopen(pathname, H5F_ACC_RDONLY, fapl))<0) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; if(H5Pclose(fapl)<0) - goto error; + TEST_ERROR; PASSED(); return 0; @@ -519,7 +519,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_multi_opens(char *fname, hid_t fa_pl) +test_multi_opens(char *fname) { hid_t file; char super_name[1024]; /*name string "%%s-s.h5"*/ @@ -600,90 +600,92 @@ test_multi(void) memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE)<0) - goto error; + TEST_ERROR; h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; /* Test wrong ways to reopen multi files */ - if(test_multi_opens(filename, fapl)<0) - goto error; + if(test_multi_opens(filename)<0) + TEST_ERROR; /* Reopen the file */ if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0) - goto error; + TEST_ERROR; /* Create and write data set */ if((space=H5Screate_simple(2, dims, NULL))<0) - goto error; + TEST_ERROR; /* Retrieve the access property list... */ if ((access_fapl = H5Fget_access_plist(file)) < 0) - goto error; + TEST_ERROR; /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) - goto error; + TEST_ERROR; /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) - goto error; + TEST_ERROR; /* Before any data is written, the raw data file is empty. So * the file size is only the size of metadata file. It's supposed - * to be 2KB. + * to be 400 bytes. */ - if(file_size<1*KB || file_size>4*KB) - goto error; + if(file_size<(KB/4) || file_size>4*KB) + TEST_ERROR; if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0) - goto error; + TEST_ERROR; for(i=0; i<MULTI_SIZE; i++) for(j=0; j<MULTI_SIZE; j++) buf[i][j] = i*10000+j; if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0) - goto error; + TEST_ERROR; if((fapl2=H5Pcreate(H5P_FILE_ACCESS))<0) - goto error; + TEST_ERROR; if(H5Pset_multi_type(fapl2, H5FD_MEM_SUPER)<0) - goto error; + TEST_ERROR; if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle)<0) - goto error; + TEST_ERROR; if(*fhandle<0) - goto error; + TEST_ERROR; if(H5Pset_multi_type(fapl2, H5FD_MEM_DRAW)<0) - goto error; + TEST_ERROR; if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2)<0) - goto error; + TEST_ERROR; if(*fhandle2<0) - goto error; + TEST_ERROR; /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) - goto error; + TEST_ERROR; /* After the data is written, the file size is huge because the * beginning of raw data file is set at HADDR_MAX/2. It's supposed * to be (HADDR_MAX/2 + 128*128*4) */ +#ifdef H5_HAVE_LARGE_HSIZET if(file_size < HADDR_MAX/2 || file_size > HADDR_MAX) - goto error; + TEST_ERROR; +#endif /* H5_HAVE_LARGE_HSIZET */ if(H5Sclose(space)<0) - goto error; + TEST_ERROR; if(H5Dclose(dset)<0) - goto error; + TEST_ERROR; if(H5Pclose(fapl2)<0) - goto error; + TEST_ERROR; if(H5Fclose(file)<0) - goto error; + TEST_ERROR; h5_cleanup(FILENAME, fapl); PASSED(); |