diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 18:16:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 18:16:54 (GMT) |
commit | bbe430429dd0f922578a566a6873160ac3dfa518 (patch) | |
tree | e72ffb1860a479024419dfaa28138d00767add64 /test/cache.c | |
parent | eb070568b0b396797eb66a894c596c2fba7a0c9f (diff) | |
download | hdf5-bbe430429dd0f922578a566a6873160ac3dfa518.zip hdf5-bbe430429dd0f922578a566a6873160ac3dfa518.tar.gz hdf5-bbe430429dd0f922578a566a6873160ac3dfa518.tar.bz2 |
[svn-r16618] Description:
Modify metadata cache flush dependency feature to allow it to work
with entries that are pinned through the cache API calls.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'test/cache.c')
-rw-r--r-- | test/cache.c | 195 |
1 files changed, 145 insertions, 50 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") |