diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-01-14 16:29:10 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-01-14 16:29:10 (GMT) |
commit | 0894356a3c6e17b00c7911d8199b64eefca7aa3a (patch) | |
tree | 9e9ab954ab103b64aa6ba87da4fbe30127f4035f /test | |
parent | e0bb475838f0c31743018e5c1c770b30b9373440 (diff) | |
download | hdf5-0894356a3c6e17b00c7911d8199b64eefca7aa3a.zip hdf5-0894356a3c6e17b00c7911d8199b64eefca7aa3a.tar.gz hdf5-0894356a3c6e17b00c7911d8199b64eefca7aa3a.tar.bz2 |
[svn-r16311] Description:
Bring revisions 16280:16307 back from trunk.
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
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')
-rw-r--r-- | test/cache.c | 1609 | ||||
-rw-r--r-- | test/cache_common.c | 62 | ||||
-rw-r--r-- | test/links.c | 286 |
3 files changed, 1928 insertions, 29 deletions
diff --git a/test/cache.c b/test/cache.c index bc89102..24c1f6c 100644 --- a/test/cache.c +++ b/test/cache.c @@ -23,6 +23,12 @@ #include "H5Iprivate.h" #include "H5ACprivate.h" #include "cache_common.h" +#include <sys/types.h> +#include <time.h> +#include <unistd.h> +#include <stdio.h> +#include <math.h> + /* private function declarations: */ @@ -2987,6 +2993,7 @@ static void check_flush_cache(void) { const char * fcn_name = "check_flush_cache"; + hbool_t show_progress = FALSE; H5C_t * cache_ptr = NULL; TESTING("H5C_flush_cache() functionality"); @@ -3000,6 +3007,11 @@ check_flush_cache(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: reseting entries.\n", fcn_name); + } + reset_entries(); cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), @@ -3012,6 +3024,12 @@ check_flush_cache(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: calling check_flush_cache__empty_cache().\n", + fcn_name); + } + check_flush_cache__empty_cache(cache_ptr); } @@ -3021,21 +3039,45 @@ check_flush_cache(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: calling check_flush_cache__single_entry().\n", + fcn_name); + } + check_flush_cache__single_entry(cache_ptr); } if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: calling check_flush_cache__multi_entry().\n", + fcn_name); + } + check_flush_cache__multi_entry(cache_ptr); } if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: calling check_flush_cache__flush_ops().\n", + fcn_name); + } + check_flush_cache__flush_ops(cache_ptr); } if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: calling takedown_cache().\n", + fcn_name); + } + takedown_cache(cache_ptr, FALSE, FALSE); } @@ -9211,9 +9253,12 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, int check_size, struct fo_flush_entry_check check[]) { - /* const char * fcn_name = "check_flush_cache__flush_op_test"; */ + const char * fcn_name = "check_flush_cache__flush_op_test"; static char msg[128]; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; herr_t result; + int target_test = -1; int i; int j; test_entry_t * base_addr; @@ -9224,6 +9269,17 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, test_num); #endif + if ( ( target_test > 0 ) && ( test_num != target_test ) ) { + + show_progress = FALSE; + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(1).\n", + fcn_name, test_num, (int)pass); + } + if ( cache_ptr == NULL ) { pass = FALSE; @@ -9251,6 +9307,12 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, failure_mssg = msg; } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(2).\n", + fcn_name, test_num, (int)pass); + } + i = 0; while ( ( pass ) && ( i < spec_size ) ) { @@ -9273,6 +9335,12 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, i++; } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(3).\n", + fcn_name, test_num, (int)pass); + } + i = 0; while ( ( pass ) && ( i < check_size ) ) { @@ -9310,18 +9378,54 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, i++; } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Setting up the test.\n", + fcn_name, test_num, (int)pass); + } + i = 0; while ( ( pass ) && ( i < spec_size ) ) { if ( spec[i].insert_flag ) { + if ( show_progress ) { + + HDfprintf(stdout, + "%s:%d: Inserting entry(%d,%d) with flags 0x%x.\n", + fcn_name, test_num, + (int)(spec[i].entry_type), + (int)(spec[i].entry_index), + (unsigned)spec[i].flags); + } + insert_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, TRUE, spec[i].flags); } else { + if ( show_progress ) { + + HDfprintf(stdout, + "%s:%d: Protecting entry(%d,%d).\n", + fcn_name, test_num, + (int)(spec[i].entry_type), + (int)(spec[i].entry_index)); + } + protect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index); + if ( show_progress ) { + + HDfprintf(stdout, + "%s:%d: Unprotecting entry(%d,%d) with flags 0x%x ns = %d.\n", + fcn_name, test_num, + (int)(spec[i].entry_type), + (int)(spec[i].entry_index), + (unsigned)spec[i].flags, + (int)(spec[i].new_size)); + } + unprotect_entry_with_size_change(cache_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags, spec[i].new_size); @@ -9363,6 +9467,12 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, } } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Running the test.\n", + fcn_name, test_num, (int)pass); + } + if ( pass ) { result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); @@ -9377,6 +9487,11 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, } } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Checking test results(1).\n", + fcn_name, test_num, (int)pass); + } i = 0; while ( ( pass ) && ( i < spec_size ) ) @@ -9415,6 +9530,12 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, i++; } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Checking test results(2).\n", + fcn_name, test_num, (int)pass); + } + if ( pass ) { i = 0; @@ -9533,6 +9654,12 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, } } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Checking test results(3).\n", + fcn_name, test_num, (int)pass); + } + if ( pass ) { if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) @@ -9561,6 +9688,13 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, } /* clean up the cache to prep for the next test */ + + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(1).\n", + fcn_name, test_num, (int)pass); + } + if ( pass ) { result = H5C_flush_cache(NULL, -1, -1, cache_ptr, @@ -9575,17 +9709,35 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, failure_mssg = msg; } else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->clean_index_size != 0 ) || + ( cache_ptr->dirty_index_size != 0 ) ) { pass = FALSE; + + if ( verbose ) { + + HDfprintf(stdout, "%s:%d: il/is/cis/dis = %lld/%lld/%lld/%lld.\n", + fcn_name, test_num, + (long long)(cache_ptr->index_len), + (long long)(cache_ptr->index_size), + (long long)(cache_ptr->clean_index_size), + (long long)(cache_ptr->dirty_index_size)); + } HDsnprintf(msg, (size_t)128, - "Unexpected cache len/size after cleanup in flush op test #%d.", + "Unexpected cache len/size/cs/ds after cleanup in flush op test #%d.", test_num); failure_mssg = msg; } } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(2).\n", + fcn_name, test_num, (int)pass); + } + i = 0; while ( ( pass ) && ( i < spec_size ) ) { @@ -9602,6 +9754,12 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, i++; } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(3).\n", + fcn_name, test_num, (int)pass); + } + i = 0; while ( ( pass ) && ( i < check_size ) ) { @@ -9618,6 +9776,11 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, i++; } + if ( show_progress ) { + + HDfprintf(stdout, "%s:%d:%d: Done.\n", fcn_name, test_num, (int)pass); + } + return; } /* check_flush_cache__flush_op_test() */ @@ -9716,30 +9879,34 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) { LARGE_ENTRY_TYPE, 13, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE } }; - if ( cache_ptr == NULL ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "cache_ptr NULL on entry to flush ops test."; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { + if ( cache_ptr == NULL ) { - pass = FALSE; - failure_mssg = "cache not empty at start of flush ops eviction test."; - } - else if ( ( cache_ptr->max_cache_size != (2 * 1024 * 1024 ) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024 ) ) ) { + pass = FALSE; + failure_mssg = "cache_ptr NULL on entry to flush ops test."; + } + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - pass = FALSE; - failure_mssg = "unexpected cache config at start of flush op eviction test."; + pass = FALSE; + failure_mssg = "cache not empty at start of flush ops eviction test."; + } + else if ( ( cache_ptr->max_cache_size != (2 * 1024 * 1024 ) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024 ) ) ) { - } else { + pass = FALSE; + failure_mssg = + "unexpected cache config at start of flush op eviction test."; - /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + } else { + + /* set min clean size to zero for this test as it simplifies + * computing the expected cache size after each operation. + */ - cache_ptr->min_clean_size = 0; + cache_ptr->min_clean_size = 0; + } } if ( pass ) { @@ -10793,7 +10960,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) static void check_flush_cache__single_entry(H5C_t * cache_ptr) { - /* const char * fcn_name = "check_flush_cache__single_entry"; */ + const char * fcn_name = "check_flush_cache__single_entry"; + hbool_t show_progress = FALSE; if ( cache_ptr == NULL ) { @@ -10809,6 +10977,10 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 1); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10824,10 +10996,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 2); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10843,10 +11023,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 3); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10862,10 +11050,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 4); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10881,10 +11077,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 5); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10900,10 +11104,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 6); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10919,10 +11131,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 7); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10938,10 +11158,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 8); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10957,10 +11185,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 9); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10977,10 +11213,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 10); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -10997,10 +11241,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 11); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11017,10 +11269,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 12); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11037,10 +11297,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 13); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11057,10 +11325,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 14); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11077,10 +11353,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 15); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11098,10 +11382,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 16); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11119,10 +11411,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 17); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11138,10 +11438,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 18); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11157,10 +11465,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 19); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11176,10 +11492,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 20); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11195,10 +11519,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 21); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11214,10 +11546,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 22); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11233,10 +11573,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 23); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11252,10 +11600,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 24); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11271,10 +11627,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 25); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11291,10 +11655,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 26); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11311,10 +11683,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 27); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11331,10 +11711,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 28); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11351,10 +11739,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 29); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11371,10 +11767,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 30); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11391,10 +11795,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 31); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11412,10 +11824,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 32); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11433,10 +11853,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 33); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11452,10 +11880,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 34); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11471,10 +11907,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 35); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11490,10 +11934,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 36); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11509,10 +11961,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 37); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11528,10 +11988,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 38); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11547,10 +12015,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 39); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11566,10 +12042,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 40); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11585,10 +12069,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 41); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11605,10 +12097,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 42); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11625,10 +12125,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 43); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11645,10 +12153,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 44); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11665,10 +12181,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 45); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11685,10 +12209,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 46); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11705,10 +12237,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 47); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11726,10 +12266,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 48); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11747,10 +12295,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 49); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11766,10 +12322,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 50); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11785,10 +12349,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 51); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11804,10 +12376,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 52); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11823,10 +12403,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 53); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11842,10 +12430,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 54); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11861,10 +12457,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 55); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11880,10 +12484,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 56); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11899,10 +12511,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 57); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11919,10 +12539,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 58); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11939,10 +12567,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 59); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11959,10 +12595,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 60); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11979,10 +12623,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 61); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -11999,10 +12651,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 62); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -12019,10 +12679,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 63); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -12040,10 +12708,18 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } if ( pass ) { + if ( show_progress ) { + HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 64); + } + check_flush_cache__single_entry_test ( /* cache_ptr */ cache_ptr, @@ -12061,6 +12737,10 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); + + if ( show_progress ) { + HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); + } } @@ -12409,6 +13089,11 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) i = 0; while ( ( pass ) && ( i < 256 ) ) { + + if ( show_progress ) { + HDfprintf(stdout, "%s: running pinned test %d.\n", fcn_name, i); + } + check_flush_cache__pinned_single_entry_test ( /* cache_ptr */ cache_ptr, @@ -15967,7 +16652,7 @@ static void check_duplicate_insert_err(void) { const char * fcn_name = "check_duplicate_insert_err"; - herr_t result; + herr_t result = -1; H5C_t * cache_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -28154,6 +28839,878 @@ check_auto_cache_resize_aux_fcns(void) /*------------------------------------------------------------------------- + * Function: check_metadata_blizzard_absence() + * + * Purpose: Test to verify that a 'metadata blizzard' can not occur + * upon insertion into the cache. + * + * A 'metadata blizzard' in this context occurs when the cache + * gets completely filled with all dirty entries. Upon needing + * to make space in the cache, the cache then has no clean + * entries ready to evict, and must clean every dirty entry + * in the cache first, due to the second chance replacement + * policy. (i.e. after cleaning an entry, it is bumped to the + * top of the LRU to make a second pass before eviction). + * The massive amount of sequential writes to disk while + * flushing the entire cache is what constitutes a 'metadata + * blizzard'. + * + * Return: void + * + * Programmer: Mike McGreevy + * <mamcgree@hdfgroup.org> + * 12/16/08 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +static void +check_metadata_blizzard_absence(hbool_t fill_via_insertion) +{ + const char * fcn_name = "check_metadata_blizzard_absence"; + int entry_type = HUGE_ENTRY_TYPE; + size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */ + H5C_t * cache_ptr = NULL; + hbool_t show_progress = FALSE; + int32_t checkpoint = 0; + int32_t entry_idx = 0; + int32_t i; + + /* Expected loaded status of entries depends on how they get into + * the cache. Insertions = not loaded, protect/unprotect = loaded. + */ + hbool_t loaded = !(fill_via_insertion); + + /* Set up the expected array. This is used to maintain a table of the + * expected status of every entry used in this test. + */ + struct expected_entry_status expected[150] = + { + /* entry entry in at main */ + /* type: index: size: cache: addr: dirty: prot: pinned: loaded: clrd: flshd: dest: */ + { entry_type, 0, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 1, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 2, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 3, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 4, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 5, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 6, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 7, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 8, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 9, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 10, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 11, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 12, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 13, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 14, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 15, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 16, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 17, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 18, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 19, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 20, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 21, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 22, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 23, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 24, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 25, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 26, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 27, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 28, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 29, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 30, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 31, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 32, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 33, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 34, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 35, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 36, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 37, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 38, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 39, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 40, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 41, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 42, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 43, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 44, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 45, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 46, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 47, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 48, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 49, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 50, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 51, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 52, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 53, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 54, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 55, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 56, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 57, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 58, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 59, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 60, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 61, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 62, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 63, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 64, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 65, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 66, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 67, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 68, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 69, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 70, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 71, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 72, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 73, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 74, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 75, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 76, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 77, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 78, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 79, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 80, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 81, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 82, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 83, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 84, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 85, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 86, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 87, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 88, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 89, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 90, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 91, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 92, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 93, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 94, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 95, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 96, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 97, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 98, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 99, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 100, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 101, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 102, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 103, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 104, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 105, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 106, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 107, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 108, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 109, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 110, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 111, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 112, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 113, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 114, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 115, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 116, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 117, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 118, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 119, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 120, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 121, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 122, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 123, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 124, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 125, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 126, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 127, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 128, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 129, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 130, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 131, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 132, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 133, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 134, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 135, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 136, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 137, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 138, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 139, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 140, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 141, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 142, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 143, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 144, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 145, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 146, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 147, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 148, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, + { entry_type, 149, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE } + }; + + pass = TRUE; + + if (fill_via_insertion) { + + TESTING("to ensure metadata blizzard absence when inserting"); + + } else { + + TESTING("to ensure metadata blizzard absence on protect/unprotect"); + } + + if ( show_progress) /* 0 */ + HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Set up the cache. + * + * The max_cache_size should have room for 50 entries. + * The min_clean_size is half of that, or 25 entries. + */ + cache_ptr = setup_cache((size_t)(50 * entry_size), /* max_cache_size */ + (size_t)(25 * entry_size)); /* min_clean_size */ + + if ( cache_ptr == NULL) { + + pass = FALSE; + failure_mssg = "bad return from cache intialization.\n"; + } + } + + if ( show_progress) /* 1 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + /* ======================================================================== + * ======================================================================== + * Phase 1: + * + * Inserting dirty entries into an empty cache, until the cache + * violates the min_clean_size requirement. The expected result is + * that none of the inserted entries during this phase will get + * flushed or evicted. + * + * This verifies that while maintaining min_clean_size, we don't go + * overboard and flush entries that we don't need to flush. + * + * ======================================================================== + * ======================================================================== + */ + + if ( pass ) { + + /* Insert 26 entries (indexes 0 through 25) into the cache. + * + * Note that we are inserting 26 entries, and not 25, because the cache + * will only try to adhere to the min_clean_size if it's currently + * being violated. Thus, on insertion of the 26th entry, since the + * min_clean_size will not be violated, it will accept the insertion + * without having to make clean space. + */ + + for (entry_idx = 0; entry_idx < 26; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* Change expected values, and verify the status of the entries + * after each insertion + */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].loaded = loaded; + + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + } + } + + if ( show_progress) /* 2 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + /* ======================================================================== + * ======================================================================== + * Phase 2: + * + * Inserting entries into a cache that violates the min_clean_size, + * until the cache is full. The expected result is that each insertion + * will result in the flushing of a dirty entry in the cache. + * + * This verifies that we maintain the min_clean_size. By doing so, we + * prevent building the situation in which a 'metadata blizzard' would + * occur (i.e., the cache being completely filled with dirty entries). + * + * ======================================================================== + * ======================================================================== + */ + + if ( pass ) { + + /* Insert the 27th entry (index = 26) into the cache. + * + * This should cause the cache to flush its least recently used entry + * before the insertion because it doesn't satisfy the min_clean_size + * constraint. + */ + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* Verify the status of the entries. + * + * Expected status is that there are 27 entries in the cache, and + * entry number 0 has been cleaned. + * + * Changes from last entry verification: + * - entry w/ index 0 has now been flushed and is now clean. + * - entry w/ index 26 is now in the cache and dirty. + */ + + /* entry w/ index 0 has now been flushed and is now clean. */ + expected[0].flushed = TRUE; + expected[0].is_dirty = FALSE; + + /* entry w/ index 26 is now in the cache and dirty. */ + expected[26].in_cache = TRUE; + expected[26].is_dirty = TRUE; + expected[26].loaded = loaded; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 26, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + if ( show_progress) /* 3 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Insert the 28th entry (index = 27) into the cache. + * + * This should, once again, cause the cache to flush its least + * recently used entry before the insertion as it again does not + * satisfy the min_clean_size constraint. + */ + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* Verify the status of the entries. + * + * Expected status is that there are 28 entries in the cache, and + * entry numbers 0 and 1 have been cleaned. + * + * Changes from last entry verification: + * - entry w/ index 1 has now been flushed and is now clean. + * - entry w/ index 27 is now in the cache and dirty. + */ + + /* entry w/ index 1 has now been flushed and is now clean. */ + expected[1].flushed = TRUE; + expected[1].is_dirty = FALSE; + + /* entry w/ index 27 is now in the cache and dirty. */ + expected[27].in_cache = TRUE; + expected[27].is_dirty = TRUE; + expected[27].loaded = loaded; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 27, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + if ( show_progress) /* 4 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Fill out the rest of the cache with entries */ + /* Verify expected status of entries after each insertion */ + for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* Expected staus is that after each insertion, the entry + * inserted 26 insertions ago has been flushed, and the + * entry currently getting inserted is now in the cache and + * dirty. + */ + expected[entry_idx - 26].flushed = TRUE; + expected[entry_idx - 26].is_dirty = FALSE; + + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].loaded = loaded; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + /* Verify that the cache is now full */ + if ( cache_ptr->cache_full != TRUE ) { + + pass = FALSE; + failure_mssg = "cache not completely filled.\n"; + } + } + + if ( show_progress) /* 5 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + /* ======================================================================== + * ======================================================================== + * Phase 3: + * + * Inserting entries into a cache that is completely full. Insertions + * of new entries will force evictions of old entries, but since the + * min_clean_size has been maintained, doing so will not result in + * the entire cache getting flushed in order to evict a single entry, + * as a clean entry will be available to flush reasonably close to + * the bottom of the LRU. + * + * This verifies that with a maintained min_clean_size, a metadata + * blizzard does not occur on insertion. + * + * ======================================================================== + * ======================================================================== + */ + + if ( pass ) { + + /* Insert the 51st entry (index = 50) into the cache. + * + * The cache is full prior to the insertion, so it will + * have to evict in order to make room for the new entry. + */ + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* Verify the status of the entries. + * + * Changes from last entry verification: + * - entry w/ index 0 has been evicted. + * - entries w/ indices 24,25 have now been flushed and are clean. + * - entry w/ index 50 is now in the cache and dirty. + */ + + /* entry w/ index 0 has been evicted. */ + expected[0].in_cache = FALSE; + expected[0].destroyed = TRUE; + + /* entries w/ indices 24,25 have now been flushed and are clean. */ + expected[24].flushed = TRUE; + expected[24].is_dirty = FALSE; + expected[25].flushed = TRUE; + expected[25].is_dirty = FALSE; + + /* entry w/ index 50 is now in the cache and dirty */ + expected[50].in_cache = TRUE; + expected[50].is_dirty = TRUE; + expected[50].loaded = loaded; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 50, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + if ( show_progress) /* 6 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + + if ( pass ) { + + /* Insert 49 more entries (indices 51-99) into the cache. + * + * The cache will be flushing an entry on each insertion, and + * evicting an entry on each insertion. + * + * After each insertion, verify the expected status of the + * entries in the cache. + */ + for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* This past inserted entry is now in the cache and dirty */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].loaded = loaded; + + /* The entry inserted 50 insertions ago has been evicted */ + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; + + /* If the newly inserted entry is among the first 24 + * insertions in this loop, then the insertion will + * have resulted in a flush of the entry inserted + * 25 insertions ago. */ + if (entry_idx < 75) { + + expected[entry_idx - 25].flushed = TRUE; + expected[entry_idx - 25].is_dirty = FALSE; + } + /* If the newly inserted entry is among the last + * 25 insertions in this loop, then the insertion will + * have resulted in a flush of the entry inserted 26 + * insertions ago. This switch is because there was two + * consecutive clean entries in the cache (due to 51/49 + * dirty/clean ratio when full), so instead of + * flush-then-evict, it switches to evict-then-flush. */ + else { + + expected[entry_idx - 26].flushed = TRUE; + expected[entry_idx - 26].is_dirty = FALSE; + } + + /* Verify this expected status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + } + + if ( show_progress) /* 7 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + /* ======================================================================== + * ======================================================================== + * Phase 4: + * + * Flushing the entire cache, and then inserting entries into a cache + * that is completely full, but all clean. + * + * Phases 1 and 2 are then repeated. Rather than inserting dirty entries + * into an empty cache, we're inserting into a full cache that's all + * clean, thus an eviction occurs before each insertion. + * + * When the cache finally hits the point of violating the + * min_clean_size, the bottom half of the LRU will be filled with + * clean entries and the top half will be filled with recently inserted + * dirty entries. We'll then verify that an insertion will only evict + * one entry and flush one entry, and no more. + * + * ======================================================================== + * ======================================================================== + */ + + if ( pass ) { + + /* Flush the cache. + * + * We're doing this so we can repeat the above insertions, but + * starting from a cache filled with clean entries as opposed + * to an empty cache. + */ + + flush_cache(cache_ptr, /* H5C_t * cache_ptr */ + FALSE, /* hbool_t destory_entries */ + FALSE, /* hbool_t dump_stats */ + FALSE); /* hbool_t dump_detailed_stats */ + + /* Verify that the cache is clean */ + verify_clean(); + + /* Verify the status of the entries. + * + * Changes from last entry verification: + * - entries w/ indices 74-99 have been flushed. + */ + + /* entries w/ indices 74-99 have been flushed. */ + for (i = 74; i < 100; i++) { + + expected[i].flushed = TRUE; + expected[i].is_dirty = FALSE; + } + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 0, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + if ( show_progress) /* 8 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Insert 26 entries (indexes 100 through 125) into the cache. + * + * The cache will evict 26 entries since it's currently full with + * all clean entries. None of the entries we're inserting now + * will get cleaned, however. + */ + + for (entry_idx = 100; entry_idx < 126; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* This past inserted entry is now in the cache and dirty */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].loaded = loaded; + + /* The entry with ID minus 50 will have been evicted */ + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + } + } + + if ( show_progress) /* 9 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Insert the 127th entry (index = 126) into the cache. */ + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* Verify the status of the entries. + * + * Changes from last entry verification: + * - entry w/ index 76 is evicted. + * - entry w/ index 100 is cleaned. + * - entry w/ index 126 is now in the cache and dirty. + */ + + /* entry w/ index 76 has been evicted. */ + expected[76].in_cache = FALSE; + expected[76].destroyed = TRUE; + + /* entry w/ index 100 has now been flushed and is now clean. */ + expected[100].flushed = TRUE; + expected[100].is_dirty = FALSE; + + /* entry w/ index 26 is now in the cache and dirty. */ + expected[126].in_cache = TRUE; + expected[126].is_dirty = TRUE; + expected[126].loaded = loaded; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 126, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + if ( show_progress) /* 10 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Insert entries w/ indices 127 through 149 into the cache */ + for (entry_idx = 127; entry_idx < 150; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* hbool_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + + } else { + protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + TRUE, /* int321_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } + + /* This past inserted entry is now in the cache and dirty */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].loaded = loaded; + + /* The entry with ID minus 50 will have been evicted */ + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; + + /* The entry with ID minus 26 will now be clean */ + expected[entry_idx - 26].flushed = TRUE; + expected[entry_idx - 26].is_dirty = FALSE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + } + + } + + if ( show_progress) /* 11 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* We're done with testing. We can take down the cache. */ + takedown_cache(cache_ptr, FALSE, FALSE); + reset_entries(); + } + + if ( show_progress) /* 12 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + return; + +} /* check_metadata_blizzard_absence() */ + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Run tests on the cache code contained in H5C.c @@ -28231,7 +29788,7 @@ main(void) check_auto_cache_resize_epoch_markers(); check_auto_cache_resize_input_errs(); check_auto_cache_resize_aux_fcns(); - + check_metadata_blizzard_absence(TRUE); + check_metadata_blizzard_absence(FALSE); return(0); - -} /* main() */ +} diff --git a/test/cache_common.c b/test/cache_common.c index c2ce274..39131bf 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1133,7 +1133,7 @@ variable_size(H5F_t * f, void * thing, size_t * size_ptr) /*------------------------------------------------------------------------- * Function: add_flush_op * - * Purpose: Do noting if pass is FALSE on entry. + * Purpose: Do nothing if pass is FALSE on entry. * * Otherwise, add the specified flush operation to the * target instance of test_entry_t. @@ -1199,7 +1199,7 @@ add_flush_op(int target_type, /*------------------------------------------------------------------------- * Function: create_pinned_entry_dependency * - * Purpose: Do noting if pass is FALSE on entry. + * Purpose: Do nothing if pass is FALSE on entry. * * Otherwise, set up a pinned entry dependency so we can * test the pinned entry modifications to the flush routine. @@ -2339,7 +2339,9 @@ flush_cache(H5C_t * cache_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats) { + const char * fcn_name = "flush_cache()"; herr_t result = 0; + hbool_t verbose = FALSE; HDassert(cache_ptr); @@ -2369,6 +2371,26 @@ flush_cache(H5C_t * cache_ptr, pass = FALSE; failure_mssg = "error in H5C_flush_cache()."; } + else if ( ( destroy_entries ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->clean_index_size != 0 ) || + ( cache_ptr->dirty_index_size != 0 ) ) ) { + + if ( verbose ) { + HDfprintf(stdout, + "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", + fcn_name, + (long long)(cache_ptr->index_len), + (long long)(cache_ptr->index_size), + (long long)(cache_ptr->clean_index_size), + (long long)(cache_ptr->dirty_index_size)); + } + pass = FALSE; + failure_mssg = + "non zero index len/sizes after H5C_flush_cache() with invalidate."; + } + return; @@ -3229,12 +3251,13 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr, unsigned int flags, size_t new_size) { - /* const char * fcn_name = "unprotect_entry_with_size_change()"; */ + const char * fcn_name = "unprotect_entry_with_size_change()"; herr_t result; hbool_t dirty_flag_set; hbool_t pin_flag_set; hbool_t unpin_flag_set; hbool_t size_changed_flag_set; + hbool_t verbose = FALSE; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -3285,6 +3308,39 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr, ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { + if ( verbose ) { + + if ( result < 0 ) { + HDfprintf(stdout, "%s: H5C_unprotect() failed.\n", fcn_name); + } + + if ( entry_ptr->header.is_protected ) { + HDfprintf(stdout, "%s: entry still protected?!?.\n", + fcn_name); + } + + if ( entry_ptr->header.type != &(types[type]) ) { + HDfprintf(stdout, + "%s: entry has bad type after unprotect.\n", + fcn_name); + } + + if ( entry_ptr->size != entry_ptr->header.size ) { + HDfprintf(stdout, + "%s: bad entry size after unprotect. e/a = %d/%d\n", + fcn_name, + (int)(entry_ptr->size), + (int)(entry_ptr->header.size)); + } + + if ( entry_ptr->addr != entry_ptr->header.addr ) { + HDfprintf(stdout, + "%s: bad entry addr after unprotect. e/a = 0x%llx/0x%llx\n", + fcn_name, + (long long)(entry_ptr->addr), + (long long)(entry_ptr->header.addr)); + } + } pass = FALSE; failure_mssg = "error in H5C_unprotect()."; diff --git a/test/links.c b/test/links.c index 433e9f8..d807352 100644 --- a/test/links.c +++ b/test/links.c @@ -76,6 +76,10 @@ const char *FILENAME[] = { "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ "extlinks16B", /* 38: */ "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ NULL }; @@ -112,6 +116,8 @@ const char *FILENAME[] = { #define LE_FILENAME "le_extlink1.h5" #define BE_FILENAME "be_extlink1.h5" +#define ELINK_CB_FAM_SIZE (hsize_t) 100 + #define H5L_DIM1 100 #define H5L_DIM2 100 @@ -3947,6 +3953,284 @@ external_set_elink_fapl3(hbool_t new_format) } /* end external_set_elink_fapl3() */ +/*------------------------------------------------------------------------- + * Function: external_set_elink_acc_flags + * + * Purpose: Verify functionality of H5P_set/get_elink_acc_flags + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Jan. 5, 2009 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) +{ + hid_t file1, file2, group, subgroup, gapl; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; + unsigned flags; + + if(new_format) + TESTING("H5Pset/get_elink_acc_flags() (w/new group format)") + else + TESTING("H5Pset/get_elink_acc_flags()") + + /* Create parent and target files, and external link */ + h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[41], fapl, filename2, sizeof filename2); + if ((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if ((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if (H5Lcreate_external(filename2, "/", file1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close file2, leave file1 open (should be read-write) */ + if (H5Fclose(file2) < 0) TEST_ERROR + + /* Create new gapl, and set elink access flags to be H5F_ACC_RDONLY */ + if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) TEST_ERROR + + /* Verify "get" routine functionality */ + if (H5Pget_elink_acc_flags(gapl, &flags) < 0) TEST_ERROR + if (flags != H5F_ACC_RDONLY) TEST_ERROR + + /* Attempt to create a group through the external link using gapl (should fail) */ + H5E_BEGIN_TRY { + group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); + } H5E_END_TRY; + if (group != FAIL) TEST_ERROR + + /* Close file1 and reopen with read only access */ + if (H5Fclose(file1) < 0) TEST_ERROR + if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR */ + if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) TEST_ERROR + + /* Create a group through the external link using gapl (should succeed) */ + if ((group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR + + /* Unset elink access flags on gapl */ + if (H5Pset_elink_acc_flags(gapl, H5F_ACC_DEFAULT) < 0) TEST_ERROR + + /* Attempt to create a group through the external link using gapl (should fail) */ + H5E_BEGIN_TRY { + subgroup = H5Gcreate2(file1, "/ext_link/group/subgroup", H5P_DEFAULT, H5P_DEFAULT, gapl); + } H5E_END_TRY; + if (subgroup != FAIL) TEST_ERROR + + /* Close file1 and group */ + if (H5Gclose(group) < 0) TEST_ERROR + if (H5Fclose(file1) < 0) TEST_ERROR + + /* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */ + H5E_BEGIN_TRY { + file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if (file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if (file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; + if (file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; + if (file1 != FAIL) TEST_ERROR + + /* Close gapl */ + if (H5Pclose(gapl) < 0) TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose(group); + H5Gclose(subgroup); + H5Fclose(file1); + H5Fclose(file2); + H5Pclose(gapl); + } H5E_END_TRY; + return -1; +} /* end external_set_elink_acc_flags() */ + + +/*------------------------------------------------------------------------- + * Function: external_set_elink_cb + * + * Purpose: Verify functionality of H5P_set/get_elink_cb + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Jan. 5, 2009 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + /* User data structure for callback function */ +typedef struct { + const char *parent_file; /* Expected parent file name */ + const char *target_file; /* Expected target file name */ + hid_t base_fapl; /* Base fapl for family driver */ + hsize_t fam_size; /* Size of family files */ + int code; /* Code to control the actions taken by the callback */ +} set_elink_cb_t; + +/* Callback function */ +static herr_t +external_set_elink_cb_cb(const char *parent_file, const char *parent_group, + const char *target_file, const char *target_obj, unsigned *flags, + hid_t fapl, void *_op_data) +{ + set_elink_cb_t *op_data = (set_elink_cb_t *)_op_data; + + /* Verify file and object names are correct */ + if (HDstrcmp(parent_file, op_data->parent_file)) return FAIL; + if (HDstrcmp(parent_group, "/group1")) return FAIL; + if (HDstrcmp(target_file, op_data->target_file)) return FAIL; + if (HDstrcmp(target_obj, "/")) return FAIL; + + /* Set flags to be read-write */ + *flags = (*flags & ~H5F_ACC_RDONLY) | H5F_ACC_RDWR; + + /* Set family file driver on fapl */ + if (H5Pset_fapl_family(fapl, op_data->fam_size, op_data->base_fapl) < 0) return FAIL; + + /* Codes to cause an invalid condition (and verify that an error is issued */ + if (op_data->code == 1) + return FAIL; + if (op_data->code == 2) + *flags = H5F_ACC_DEFAULT; + + return 0; +} + +/* Main test function */ +static int +external_set_elink_cb(hid_t fapl, hbool_t new_format) +{ + hid_t file1, file2, group, gapl, fam_fapl, ret_fapl, base_driver; + set_elink_cb_t op_data, + *op_data_p; + H5L_elink_traverse_t cb; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; + unsigned flags; + + if(new_format) + TESTING("H5Pset/get_elink_cb() (w/new group format)") + else + TESTING("H5Pset/get_elink_cb()") + + /* Build user data for callback */ + op_data.parent_file = filename1; + op_data.target_file = filename2; + /* Core file driver has issues when used as the member file driver for a family file */ + /* Family file driver cannot be used with family or multi drivers for member files */ + /* Also disable parellel member drivers, because IS_H5FD_MPI whould report FALSE, causing problems */ + base_driver = H5Pget_driver(fapl); + op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI + || base_driver == H5FD_MPIO || base_driver == H5FD_MPIPOSIX + || base_driver == H5FD_CORE) ? H5P_DEFAULT : fapl; + op_data.fam_size = ELINK_CB_FAM_SIZE; + op_data.code = 0; + + /* Create family fapl */ + if ((fam_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR + if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR + + /* Create parent and target files, group, and external link */ + h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[41], fam_fapl, filename2, sizeof filename2); + if ((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if ((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR + if ((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if (H5Lcreate_external(filename2, "/", group, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close files and group */ + if (H5Fclose(file1) < 0) TEST_ERROR + if (H5Fclose(file2) < 0) TEST_ERROR + if (H5Gclose(group) < 0) TEST_ERROR + + /* Create new gapl, and set elink callback */ + if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if (H5Pset_elink_cb(gapl, external_set_elink_cb_cb, &op_data) < 0) TEST_ERROR + + /* Verify "get" routine functionality */ + if (H5Pget_elink_cb(gapl, &cb, (void **) &op_data_p) < 0) TEST_ERROR + if (cb != external_set_elink_cb_cb) TEST_ERROR + if (op_data_p != &op_data) TEST_ERROR + + /* Open file1 with read only access */ + if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Create a group through the external link using gapl */ + if ((group = H5Gcreate2(file1, "/group1/ext_link/group2", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR + + /* Verify that the correct parameters have been set on file2 (somewhat + * redundant as the library would be unable to create the group otherwise) + */ + if ((file2 = H5Iget_file_id(group)) < 0) TEST_ERROR + if (H5Fget_intent(file2, &flags) < 0) TEST_ERROR + if (!(flags & H5F_ACC_RDWR)) TEST_ERROR + if ((ret_fapl = H5Fget_access_plist(file2)) < 0) TEST_ERROR + if (H5FD_FAMILY != H5Pget_driver(ret_fapl)) TEST_ERROR + + if (H5Gclose(group) < 0) TEST_ERROR + if (H5Fclose(file2) < 0) TEST_ERROR + if (H5Pclose(ret_fapl) < 0) TEST_ERROR + if (H5Pclose(fam_fapl) < 0) TEST_ERROR + + /* Modify the user data structure to cause the callback to fail next time */ + op_data.code = 1; + + /* Attempt to reopen group2 (should fail) */ + H5E_BEGIN_TRY { + group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); + } H5E_END_TRY; + if (group != FAIL) TEST_ERROR + + /* Modify the user data structure to cause the callback to return invalid flags */ + op_data.code = 2; + + /* Attempt to reopen group2 (should fail) */ + H5E_BEGIN_TRY { + group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); + } H5E_END_TRY; + if (group != FAIL) TEST_ERROR + + /* Close */ + if (H5Fclose(file1) < 0) TEST_ERROR + if (H5Pclose(gapl) < 0) TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose(group); + H5Fclose(file1); + H5Fclose(file2); + H5Pclose(gapl); + H5Pclose(ret_fapl); + H5Pclose(fam_fapl); + } H5E_END_TRY; + return -1; +} /* end external_set_elink_cb() */ + + #ifdef H5_HAVE_WINDOW_PATH /*------------------------------------------------------------------------- @@ -12342,6 +12626,8 @@ main(void) nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; |