diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 18:31:00 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 18:31:00 (GMT) |
commit | 505b31ee08bfd3efc62df84e00602a9fd6c46a4f (patch) | |
tree | 77c1e8cd2a59bfb655f789fd6ddac4e74b4fe5c9 /test | |
parent | 5f2e591745df8a05950c07e4c86de00d6678828e (diff) | |
download | hdf5-505b31ee08bfd3efc62df84e00602a9fd6c46a4f.zip hdf5-505b31ee08bfd3efc62df84e00602a9fd6c46a4f.tar.gz hdf5-505b31ee08bfd3efc62df84e00602a9fd6c46a4f.tar.bz2 |
[svn-r16619] Description:
Bring r16606:16618 from trunk to the revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty)
h5committest not necessary on this branch
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 195 | ||||
-rw-r--r-- | test/cache_common.c | 42 | ||||
-rw-r--r-- | test/cache_common.h | 4 | ||||
-rw-r--r-- | test/family_v16_00000.h5 | bin | 5120 -> 5120 bytes | |||
-rw-r--r-- | test/mount.c | 1 | ||||
-rw-r--r-- | test/tfile.c | 120 | ||||
-rw-r--r-- | test/vfd.c | 25 |
7 files changed, 322 insertions, 65 deletions
diff --git a/test/cache.c b/test/cache.c index 65a6719..c3e5ee0 100644 --- a/test/cache.c +++ b/test/cache.c @@ -31214,6 +31214,145 @@ check_flush_deps(void) if ( !pass ) CACHE_ERROR("verify_entry_status failed") } +/* Test Case #6a - Make certain that flush dependency relationship with parent + * already pinned works (unpin ater destroying flush dependency) + */ + + /* Create flush dependency between entries 0 (child) & 1 (parent) */ + { + protect_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + pin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("pin_entry failed") + + create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type = entry_type; + expected[0].flush_dep_par_idx = 1; + expected[1].is_protected = TRUE; + expected[1].is_pinned = TRUE; + expected[1].child_flush_dep_height_rc[0] = 1; + expected[1].flush_dep_height = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + + /* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */ + { + destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + unpin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("unpin_entry failed") + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + 1, /* int32_t idx */ + FALSE, /* int32_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Change expected values, and verify the status of the entries + * after destroy flush dependency + */ + expected[0].flush_dep_par_type = -1; + expected[0].flush_dep_par_idx = -1; + expected[1].is_protected = FALSE; + expected[1].is_pinned = FALSE; + expected[1].child_flush_dep_height_rc[0] = 0; + expected[1].flush_dep_height = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + +/* Test Case #6b - Make certain that flush dependency relationship with parent + * already pinned works (unpin before destroying flush dependency) + */ + + /* Create flush dependency between entries 0 (child) & 1 (parent) */ + { + protect_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + pin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("pin_entry failed") + + create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type = entry_type; + expected[0].flush_dep_par_idx = 1; + expected[1].is_protected = TRUE; + expected[1].is_pinned = TRUE; + expected[1].child_flush_dep_height_rc[0] = 1; + expected[1].flush_dep_height = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + + /* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */ + { + unpin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("unpin_entry failed") + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + 1, /* int32_t idx */ + FALSE, /* int32_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Change expected values, and verify the status of the entries + * after destroy flush dependency + */ + expected[0].flush_dep_par_type = -1; + expected[0].flush_dep_par_idx = -1; + expected[1].is_protected = FALSE; + expected[1].is_pinned = FALSE; + expected[1].child_flush_dep_height_rc[0] = 0; + expected[1].flush_dep_height = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + done: if(cache_ptr) @@ -31257,7 +31396,7 @@ check_flush_deps_err(void) /* Loop over test cases, check for various errors in configuring flush * dependencies. Verify that all performs as expected. */ - for(test_count = 0; test_count < 11; test_count++) { + for(test_count = 0; test_count < 9; test_count++) { unsigned u; /* Local index variable */ herr_t result; /* Generic return value */ @@ -31421,36 +31560,14 @@ check_flush_deps_err(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") break; - /* Verify that parent entry isn't already pinned */ - case 4: - protect_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - pin_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("pin_entry failed") - - result = H5C_create_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); - if( result != FAIL ) CACHE_ERROR("Creating dependency when parent is pinned") - - unpin_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("unpin_entry failed") - - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ - entry_type, /* int32_t type */ - 0, /* int32_t idx */ - FALSE, /* int32_t dirty */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - break; - /* Verify that parent entry must be protected */ - case 5: + case 4: result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); if( result != FAIL ) CACHE_ERROR("Destroying [non-existant] dependency when parent isn't protected") break; /* Verify that parent entry has flush dependency */ - case 6: + case 5: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -31465,30 +31582,8 @@ check_flush_deps_err(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") break; - /* Verify that parent entry is still pinned */ - case 7: - protect_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - unpin_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("unpin_entry failed") - - result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); - if( result != FAIL ) CACHE_ERROR("Destroying dependency when parent isn't in relationship") - - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ - entry_type, /* int32_t type */ - 0, /* int32_t idx */ - FALSE, /* int32_t dirty */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - break; - /* Verify that child entry is in flush dependency relationship */ - case 8: + case 6: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -31510,7 +31605,7 @@ check_flush_deps_err(void) break; /* Verify that parent has child entries at this height */ - case 9: + case 7: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -31565,7 +31660,7 @@ check_flush_deps_err(void) /* Verify that child entry is child of parent */ - case 10: + case 8: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") diff --git a/test/cache_common.c b/test/cache_common.c index 7f8a458..c0ec7c8 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1663,6 +1663,8 @@ reset_entries(void) for ( k = 0; k < H5C__NUM_FLUSH_DEP_HEIGHTS; k++ ) base_addr[j].child_flush_dep_height_rc[k] = 0; base_addr[j].flush_dep_height = 0; + base_addr[j].pinned_from_client = FALSE; + base_addr[j].pinned_from_cache = FALSE; base_addr[j].flush_order = 0; @@ -2279,8 +2281,6 @@ verify_entry_status(H5C_t * cache_ptr, i++; } /* while */ -if(!pass) - HDfprintf(stderr, "failure_mssg = '%s'\n", failure_mssg); return; @@ -2680,14 +2680,15 @@ insert_entry(H5C_t * cache_ptr, if ( insert_pinned ) { HDassert( entry_ptr->header.is_pinned ); - entry_ptr->is_pinned = TRUE; } else { HDassert( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; } + entry_ptr->is_pinned = insert_pinned; + entry_ptr->pinned_from_client = insert_pinned; + HDassert( entry_ptr->header.is_dirty ); HDassert( ((entry_ptr->header).type)->id == type ); } @@ -3201,7 +3202,7 @@ pin_entry(H5C_t * cache_ptr, HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); HDassert( entry_ptr->is_protected ); - HDassert( !(entry_ptr->is_pinned) ); + HDassert( !(entry_ptr->pinned_from_client) ); result = H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr); @@ -3217,7 +3218,9 @@ pin_entry(H5C_t * cache_ptr, } else { + entry_ptr->pinned_from_client = TRUE; entry_ptr->is_pinned = TRUE; + } } /* end if */ @@ -3269,12 +3272,15 @@ unpin_entry(H5C_t * cache_ptr, HDassert( entry_ptr == entry_ptr->self ); HDassert( entry_ptr->cache_ptr == cache_ptr ); HDassert( entry_ptr->header.is_pinned ); + HDassert( entry_ptr->header.pinned_from_client ); HDassert( entry_ptr->is_pinned ); + HDassert( entry_ptr->pinned_from_client ); result = H5C_unpin_entry(cache_ptr, (void *)entry_ptr); if ( ( result < 0 ) || - ( entry_ptr->header.is_pinned ) || + ( entry_ptr->header.pinned_from_client ) || + ( entry_ptr->header.is_pinned && !entry_ptr->header.pinned_from_cache ) || ( entry_ptr->header.type != &(types[type]) ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -3284,7 +3290,9 @@ unpin_entry(H5C_t * cache_ptr, } - entry_ptr->is_pinned = FALSE; + entry_ptr->pinned_from_client = FALSE; + + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; HDassert( ((entry_ptr->header).type)->id == type ); @@ -3430,12 +3438,14 @@ unprotect_entry(H5C_t * cache_ptr, if ( pin_flag_set ) { HDassert ( entry_ptr->header.is_pinned ); + entry_ptr->pinned_from_client = TRUE; entry_ptr->is_pinned = TRUE; } else if ( unpin_flag_set ) { - HDassert ( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; + HDassert ( entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache ); + entry_ptr->pinned_from_client = FALSE; + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; } } @@ -3592,12 +3602,14 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr, if ( pin_flag_set ) { HDassert ( entry_ptr->header.is_pinned ); + entry_ptr->pinned_from_client = TRUE; entry_ptr->is_pinned = TRUE; } else if ( unpin_flag_set ) { - HDassert ( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; + HDassert ( entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache ); + entry_ptr->pinned_from_client = FALSE; + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; } } @@ -4979,6 +4991,7 @@ create_flush_dependency(H5C_t * cache_ptr, chd_entry_ptr->flush_dep_par_type = par_type; chd_entry_ptr->flush_dep_par_idx = par_idx; par_entry_ptr->child_flush_dep_height_rc[chd_entry_ptr->flush_dep_height]++; + par_entry_ptr->pinned_from_cache = TRUE; if( !par_is_pinned ) par_entry_ptr->is_pinned = TRUE; @@ -5051,6 +5064,7 @@ destroy_flush_dependency(H5C_t * cache_ptr, HDassert( par_entry_ptr->index == par_idx ); HDassert( par_entry_ptr->type == par_type ); HDassert( par_entry_ptr->is_pinned ); + HDassert( par_entry_ptr->pinned_from_cache ); HDassert( par_entry_ptr->flush_dep_height > 0 ); HDassert( par_entry_ptr == par_entry_ptr->self ); @@ -5089,8 +5103,10 @@ destroy_flush_dependency(H5C_t * cache_ptr, if((unsigned)(i + 1) < prev_par_flush_dep_height) { par_entry_ptr->flush_dep_height = (unsigned)(i + 1); - if(i < 0) - par_entry_ptr->is_pinned = FALSE; + if(i < 0) { + par_entry_ptr->pinned_from_cache = FALSE; + par_entry_ptr->is_pinned = par_entry_ptr->pinned_from_client; + } /* end if */ /* Check for parent entry being in flush dependency relationship */ if(par_entry_ptr->flush_dep_par_idx >= 0) { diff --git a/test/cache_common.h b/test/cache_common.h index 1284ea3..37e9e0c 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -35,7 +35,7 @@ #include "h5test.h" /* Macro to make error reporting easier */ -#define CACHE_ERROR(s) {failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s ; goto done;} +#define CACHE_ERROR(s) {failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s ; pass = FALSE; goto done;} #define NO_CHANGE -1 @@ -306,6 +306,8 @@ typedef struct test_entry_t * dependency children */ unsigned flush_dep_height; /* flush dependency height of entry */ + hbool_t pinned_from_client; /* entry was pinned by client call */ + hbool_t pinned_from_cache; /* entry was pinned by cache internally */ unsigned flush_order; /* Order that entry was flushed in */ } test_entry_t; diff --git a/test/family_v16_00000.h5 b/test/family_v16_00000.h5 Binary files differindex 5b69c93..bf1a711 100644 --- a/test/family_v16_00000.h5 +++ b/test/family_v16_00000.h5 diff --git a/test/mount.c b/test/mount.c index 14ab346..f358634 100644 --- a/test/mount.c +++ b/test/mount.c @@ -502,6 +502,7 @@ test_assoc(hid_t fapl) * of file2. */ if(H5Oget_info_by_name(file1, "/mnt1", &oi2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); puts(" Association failed."); diff --git a/test/tfile.c b/test/tfile.c index 2afade3..724ad4a 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -79,6 +79,8 @@ #define TESTA_NX 4 #define TESTA_NY 5 +#define USERBLOCK_SIZE ((hsize_t) 512) + static void create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *); static void @@ -1855,6 +1857,122 @@ test_file_double_datatype_open(void) /**************************************************************** ** +** test_userblock_file_size(): low-level file test routine. +** This test checks that the presence of a userblock +** affects the file size in the expected manner, and that +** the filesize is not changed by reopening the file. It +** creates two files which are identical except that one +** contains a userblock, and verifies that their file sizes +** differ exactly by the userblock size. +** +*****************************************************************/ +static void +test_userblock_file_size(void) +{ + hid_t file1_id, file2_id; + hid_t group1_id, group2_id; + hid_t dset1_id, dset2_id; + hid_t space_id; + hid_t fcpl2_id; + hsize_t dims[2] = {3, 4}; + hsize_t filesize1, filesize2, filesize; + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing file size with user block\n")); + + /* Create property list with userblock size set */ + fcpl2_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl2_id, FAIL, "H5Pcreate"); + ret = H5Pset_userblock(fcpl2_id, USERBLOCK_SIZE); + CHECK(ret, FAIL, "H5Pset_userblock"); + + /* Create files. Onyl file2 with have a userblock. */ + file1_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file1_id, FAIL, "H5Fcreate"); + file2_id = H5Fcreate(FILE2, H5F_ACC_TRUNC, fcpl2_id, H5P_DEFAULT); + CHECK(file2_id, FAIL, "H5Fcreate"); + + /* Create groups */ + group1_id = H5Gcreate2(file1_id, GROUP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(group1_id, FAIL, "H5Gcreate2"); + group2_id = H5Gcreate2(file2_id, GROUP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(group2_id, FAIL, "H5Gcreate2"); + + /* Create dataspace */ + space_id = H5Screate_simple(2, dims, NULL); + CHECK(space_id, FAIL, "H5Screate_simple"); + + /* Create datasets */ + dset1_id = H5Dcreate2(file1_id, DSET2, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset1_id, FAIL, "H5Dcreate2"); + dset2_id = H5Dcreate2(file2_id, DSET2, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset2_id, FAIL, "H5Dcreate2"); + + /* Close IDs */ + ret = H5Dclose(dset1_id); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Dclose(dset2_id); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(space_id); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Gclose(group1_id); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Gclose(group2_id); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Pclose(fcpl2_id); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close files */ + ret = H5Fclose(file1_id); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(file2_id); + CHECK(ret, FAIL, "H5Fclose"); + + /* Reopen files */ + file1_id = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Fopen"); + file2_id = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Fopen"); + + /* Check file sizes */ + ret = H5Fget_filesize(file1_id, &filesize1); + CHECK(ret, FAIL, "H5Fget_filesize"); + ret = H5Fget_filesize(file2_id, &filesize2); + CHECK(ret, FAIL, "H5Fget_filesize"); + + /* Verify that the file sizes differ exactly by the userblock size */ + VERIFY(filesize2, filesize1 + USERBLOCK_SIZE, "H5Fget_filesize"); + + /* Close files */ + ret = H5Fclose(file1_id); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(file2_id); + CHECK(ret, FAIL, "H5Fclose"); + + /* Reopen files */ + file1_id = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Fopen"); + file2_id = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Fopen"); + + /* Verify file sizes did not change */ + ret = H5Fget_filesize(file1_id, &filesize); + CHECK(ret, FAIL, "H5Fget_filesize"); + VERIFY(filesize, filesize1, "H5Fget_filesize"); + ret = H5Fget_filesize(file2_id, &filesize); + CHECK(ret, FAIL, "H5Fget_filesize"); + VERIFY(filesize, filesize2, "H5Fget_filesize"); + + /* Close files */ + ret = H5Fclose(file1_id); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(file2_id); + CHECK(ret, FAIL, "H5Fclose"); +} /* end test_userblock_file_size() */ + +/**************************************************************** +** ** test_file(): Main low-level file I/O test routine. ** ****************************************************************/ @@ -1884,6 +2002,7 @@ test_file(void) test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ #endif /*H5_CANNOT_OPEN_TWICE*/ + test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ } /* test_file() */ @@ -1909,3 +2028,4 @@ cleanup_file(void) HDremove(FILE3); HDremove(FILE4); } + @@ -802,6 +802,8 @@ static herr_t test_family_compat(void) { hid_t file = (-1), fapl; + hid_t dset; + char dname[]="dataset"; char filename[1024]; char pathname[1024]; char *srcdir = getenv("srcdir"); /*where the src code is located*/ @@ -824,7 +826,28 @@ test_family_compat(void) } HDstrcat(pathname, filename); - if((file = H5Fopen(pathname, H5F_ACC_RDONLY, fapl)) < 0) + /* Make sure we can open the file. Use the read and write mode to flush the + * superblock. */ + if((file = H5Fopen(pathname, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dset) < 0) + TEST_ERROR; + + if(H5Fclose(file) < 0) + TEST_ERROR; + + /* Open the file again to make sure it isn't corrupted. */ + if((file = H5Fopen(pathname, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) |