/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Programmer: John Mainzer
* 6/9/04
*
* This file contains tests for the cache implemented in
* H5C.c
*/
#include "h5test.h"
#include "H5Iprivate.h"
#include "H5ACprivate.h"
#include "cache_common.h"
/* private typedef declarations: */
struct flush_cache_test_spec
{
int entry_num;
int entry_type;
int entry_index;
hbool_t insert_flag;
unsigned int flags;
hbool_t expected_deserialized;
hbool_t expected_serialized;
hbool_t expected_destroyed;
};
struct pe_flush_cache_test_spec
{
int entry_num;
int entry_type;
int entry_index;
hbool_t insert_flag;
unsigned int flags;
int num_pins;
int pin_type[MAX_PINS];
int pin_idx[MAX_PINS];
hbool_t expected_deserialized;
hbool_t expected_serialized;
hbool_t expected_destroyed;
};
struct fo_flush_entry_check
{
int entry_num;
int entry_type;
int entry_index;
size_t expected_size;
hbool_t in_cache;
hbool_t at_main_addr;
hbool_t is_dirty;
hbool_t is_protected;
hbool_t is_pinned;
hbool_t expected_deserialized;
hbool_t expected_serialized;
hbool_t expected_destroyed;
};
struct fo_flush_cache_test_spec
{
int entry_num;
int entry_type;
int entry_index;
hbool_t insert_flag;
unsigned int flags;
hbool_t resize_flag;
size_t new_size;
int num_pins;
int pin_type[MAX_PINS];
int pin_idx[MAX_PINS];
int num_flush_ops;
struct flush_op flush_ops[MAX_FLUSH_OPS];
hbool_t expected_deserialized;
hbool_t expected_serialized;
hbool_t expected_destroyed;
};
struct move_entry_test_spec
{
int entry_type;
int entry_index;
hbool_t is_dirty;
hbool_t is_pinned;
};
/* private function declarations: */
static unsigned smoke_check_1(int express_test);
static unsigned smoke_check_2(int express_test);
static unsigned smoke_check_3(int express_test);
static unsigned smoke_check_4(int express_test);
static unsigned smoke_check_5(int express_test);
static unsigned smoke_check_6(int express_test);
static unsigned smoke_check_7(int express_test);
static unsigned smoke_check_8(int express_test);
static unsigned smoke_check_9(int express_test);
static unsigned smoke_check_10(int express_test);
static unsigned write_permitted_check(int express_test);
static unsigned check_insert_entry(void);
static unsigned check_flush_cache(void);
static void check_flush_cache__empty_cache(H5F_t * file_ptr);
static void check_flush_cache__multi_entry(H5F_t * file_ptr);
static void check_flush_cache__multi_entry_test(H5F_t * file_ptr,
int test_num,
unsigned int flush_flags,
int spec_size,
struct flush_cache_test_spec spec[]);
static void check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
int test_num,
unsigned int flush_flags,
int spec_size,
struct pe_flush_cache_test_spec spec[]);
static void check_flush_cache__single_entry(H5F_t * file_ptr);
static void check_flush_cache__single_entry_test(H5F_t * file_ptr,
int test_num,
int entry_type,
int entry_idx,
hbool_t insert_flag,
unsigned int flags,
unsigned int flush_flags,
hbool_t expected_deserialized,
hbool_t expected_serialized,
hbool_t expected_destroyed);
static void check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
int test_num,
int entry_type,
int entry_idx,
hbool_t unprot_dirty_flag,
hbool_t mark_dirty,
hbool_t pop_mark_dirty_prot,
hbool_t pop_mark_dirty_pinned,
hbool_t unprotect_unpin,
unsigned int flags,
unsigned int flush_flags,
hbool_t expected_serialized,
hbool_t expected_destroyed);
static void check_flush_cache__flush_ops(H5F_t * file_ptr);
static void check_flush_cache__flush_op_test(H5F_t * file_ptr,
int test_num,
unsigned int flush_flags,
int spec_size,
struct fo_flush_cache_test_spec spec[],
int init_expected_index_len,
size_t init_expected_index_size,
int expected_index_len,
size_t expected_index_size,
int check_size,
struct fo_flush_entry_check check[]);
static void check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr);
static unsigned check_get_entry_status(void);
static unsigned check_expunge_entry(void);
static unsigned check_multiple_read_protect(void);
static unsigned check_move_entry(void);
static void check_move_entry__run_test(H5F_t * file_ptr, int test_num,
struct move_entry_test_spec * spec_ptr);
static unsigned check_pin_protected_entry(void);
static unsigned check_resize_entry(void);
static unsigned check_evictions_enabled(void);
static unsigned check_flush_protected_err(void);
static unsigned check_destroy_pinned_err(void);
static unsigned check_destroy_protected_err(void);
static unsigned check_duplicate_insert_err(void);
static unsigned check_move_err(void);
static unsigned check_double_pin_err(void);
static unsigned check_double_unpin_err(void);
static unsigned check_pin_entry_errs(void);
static unsigned check_double_protect_err(void);
static unsigned check_double_unprotect_err(void);
static unsigned check_mark_entry_dirty_errs(void);
static unsigned check_expunge_entry_errs(void);
static unsigned check_resize_entry_errs(void);
static unsigned check_unprotect_ro_dirty_err(void);
static unsigned check_protect_ro_rw_err(void);
static unsigned check_check_evictions_enabled_err(void);
static unsigned check_auto_cache_resize(void);
static unsigned check_auto_cache_resize_disable(void);
static unsigned check_auto_cache_resize_epoch_markers(void);
static unsigned check_auto_cache_resize_input_errs(void);
static unsigned check_auto_cache_resize_aux_fcns(void);
static unsigned check_metadata_blizzard_absence(hbool_t fill_via_insertion);
static unsigned check_flush_deps(void);
static unsigned check_flush_deps_err(void);
static unsigned check_flush_deps_order(void);
static unsigned check_notify_cb(void);
static unsigned check_entry_deletions_during_scans(void);
static void cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr);
static void cedds__H5C_make_space_in_cache(H5F_t * file_ptr);
static void cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr);
static void cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr);
static unsigned check_stats(void);
#if H5C_COLLECT_CACHE_STATS
static void check_stats__smoke_check_1(H5F_t * file_ptr);
#endif /* H5C_COLLECT_CACHE_STATS */
/**************************************************************************/
/**************************************************************************/
/********************************* tests: *********************************/
/**************************************************************************/
/**************************************************************************/
/*-------------------------------------------------------------------------
* Function: smoke_check_1()
*
* Purpose: A basic functional test, inserts, destroys, and moves in
* the mix, along with repeated protects and unprotects.
* All entries are marked as clean.
*
* Return: void
*
* Programmer: John Mainzer
* 6/16/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_1(int express_test)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
int dirty_destroys = FALSE;
hbool_t display_stats = FALSE;
int32_t lag = 10;
int32_t max_index = (10 * 1024) - 1;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
(size_t)(2 * 1024 * 1024));
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_1() */
/*-------------------------------------------------------------------------
* Function: smoke_check_2()
*
* Purpose: A basic functional test, with inserts, destroys, and
* moves in the mix, along with some repeated protects
* and unprotects. About half the entries are marked as
* dirty.
*
* Return: void
*
* Programmer: John Mainzer
* 6/24/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_2(int express_test)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = TRUE;
int dirty_destroys = TRUE;
hbool_t display_stats = FALSE;
int32_t max_index = (10 * 1024) - 1;
int32_t lag = 10;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
(size_t)(2 * 1024 * 1024));
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_2() */
/*-------------------------------------------------------------------------
* Function: smoke_check_3()
*
* Purpose: A basic functional test on a tiny cache, with inserts,
* destroys, and moves in the mix, along with repeated
* protects and unprotects. All entries are marked as clean.
*
* Return: void
*
* Programmer: John Mainzer
* 6/16/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_3(int express_test)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
int dirty_destroys = FALSE;
hbool_t display_stats = FALSE;
int32_t max_index = (10 * 1024) - 1;
int32_t lag = 10;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024),
(size_t)(1 * 1024));
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_3() */
/*-------------------------------------------------------------------------
* Function: smoke_check_4()
*
* Purpose: A basic functional test on a tiny cache, with inserts,
* destroys, and moves in the mix, along with repeated
* protects and unprotects. About half the entries are
* marked as dirty.
*
* Return: void
*
* Programmer: John Mainzer
* 6/24/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_4(int express_test)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = TRUE;
int dirty_destroys = TRUE;
hbool_t display_stats = FALSE;
int32_t max_index = (10 * 1024) - 1;
int32_t lag = 10;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024),
(size_t)(1 * 1024));
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_4() */
/*-------------------------------------------------------------------------
* Function: smoke_check_5()
*
* Purpose: A basic functional test on a cache with automatic cache
* resizing enabled, with inserts in the mix, along with
* repeated protects and unprotects. All entries are marked
* as clean.
*
* Return: void
*
* Programmer: John Mainzer
* 10/14/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_5(int express_test)
{
herr_t result;
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
hbool_t display_stats = FALSE;
int32_t max_index = 1024;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
H5C_auto_size_ctl_t auto_size_ctl =
{
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
#else
/* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn,
#endif
/* hbool_t set_initial_size = */ TRUE,
/* size_t initial_size = */ (2 * 1024 * 1024),
/* double min_clean_fraction = */ 0.1f,
/* size_t max_size = */ (32 * 1024 * 1025),
/* size_t min_size = */ (512 * 1024),
/* int64_t epoch_length = */ 50000,
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
/* double increment = */ 2.0f,
/* hbool_t apply_max_increment = */ TRUE,
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
/* double flash_multiple = */ 2.0f,
/* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
/* double upper_hr_threshold = */ 0.995f,
/* double decrement = */ 0.9f,
/* hbool_t apply_max_decrement = */ TRUE,
/* size_t max_decrement = */ (1 * 1024 * 1024),
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
/* double empty_reserve = */ 0.5f
};
TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024),
(size_t)(1 * 1024));
cache_ptr = file_ptr->shared->cache;
if ( pass ) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
if ( result != SUCCEED ) {
pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_5() */
/*-------------------------------------------------------------------------
* Function: smoke_check_6()
*
* Purpose: A basic functional test on a cache with automatic cache
* resizing enabled, with inserts in the mix, along with
* repeated protects and unprotects. About one half of all
* entries are marked as dirty.
*
* Return: void
*
* Programmer: John Mainzer
* 10/25/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_6(int express_test)
{
herr_t result;
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
hbool_t display_stats = FALSE;
int mile_stone = 1;
int32_t max_index = 1024;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
H5C_auto_size_ctl_t auto_size_ctl =
{
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
#else
/* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn,
#endif
/* hbool_t set_initial_size = */ TRUE,
/* size_t initial_size = */ (2 * 1024 * 1024),
/* double min_clean_fraction = */ 0.1f,
/* size_t max_size = */ (32 * 1024 * 1025),
/* size_t min_size = */ (512 * 1024),
/* int64_t epoch_length = */ 50000,
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
/* double increment = */ 2.0f,
/* hbool_t apply_max_increment = */ TRUE,
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
/* double flash_multiple = */ 2.0f,
/* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
/* double upper_hr_threshold = */ 0.995f,
/* double decrement = */ 0.9f,
/* hbool_t apply_max_decrement = */ TRUE,
/* size_t max_decrement = */ (1 * 1024 * 1024),
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
/* double empty_reserve = */ 0.05f
};
TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1");
pass = TRUE;
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024),
(size_t)(1 * 1024));
cache_ptr = file_ptr->shared->cache;
if ( pass ) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
if ( result != SUCCEED ) {
pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_6() */
/*-------------------------------------------------------------------------
* Function: smoke_check_7()
*
* Purpose: A basic functional test on a cache with automatic cache
* resizing enabled, with inserts in the mix, along with
* repeated protects and unprotects. All entries are marked
* as clean.
*
* Return: void
*
* Programmer: John Mainzer
* 12/2/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_7(int express_test)
{
herr_t result;
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
hbool_t display_stats = FALSE;
int mile_stone = 1;
int32_t max_index = 1024;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
H5C_auto_size_ctl_t auto_size_ctl =
{
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
#else
/* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn,
#endif
/* hbool_t set_initial_size = */ TRUE,
/* size_t initial_size = */ (2 * 1024 * 1024),
/* double min_clean_fraction = */ 0.1f,
/* size_t max_size = */ (32 * 1024 * 1025),
/* size_t min_size = */ (512 * 1024),
/* int64_t epoch_length = */ 100000,
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
/* double increment = */ 2.0f,
/* hbool_t apply_max_increment = */ TRUE,
/* size_t max_increment = */ (8 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
/* double flash_multiple = */ 2.0f,
/* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */
H5C_decr__age_out_with_threshold,
/* double upper_hr_threshold = */ 0.995f,
/* double decrement = */ 0.9f,
/* hbool_t apply_max_decrement = */ TRUE,
/* size_t max_decrement = */ (1 * 1024 * 1024),
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
/* double empty_reserve = */ 0.1f
};
TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024),
(size_t)(1 * 1024));
cache_ptr = file_ptr->shared->cache;
if ( pass ) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
if ( result != SUCCEED ) {
pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_7() */
/*-------------------------------------------------------------------------
* Function: smoke_check_8()
*
* Purpose: A basic functional test on a cache with automatic cache
* resizing enabled, with inserts in the mix, along with
* repeated protects and unprotects. About one half of all
* entries are marked as dirty.
*
* Return: void
*
* Programmer: John Mainzer
* 10/25/04
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_8(int express_test)
{
herr_t result;
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
hbool_t display_stats = FALSE;
int mile_stone = 1;
int32_t max_index = 1024;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
H5C_auto_size_ctl_t auto_size_ctl =
{
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
#else
/* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn,
#endif
/* hbool_t set_initial_size = */ TRUE,
/* size_t initial_size = */ (2 * 1024 * 1024),
/* double min_clean_fraction = */ 0.1f,
/* size_t max_size = */ (32 * 1024 * 1025),
/* size_t min_size = */ (512 * 1024),
/* int64_t epoch_length = */ 100000,
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
/* double increment = */ 2.0f,
/* hbool_t apply_max_increment = */ TRUE,
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
/* double flash_multiple = */ 2.0f,
/* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */
H5C_decr__age_out_with_threshold,
/* double upper_hr_threshold = */ 0.995f,
/* double decrement = */ 0.9f,
/* hbool_t apply_max_decrement = */ TRUE,
/* size_t max_decrement = */ (1 * 1024 * 1024),
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
/* double empty_reserve = */ 0.1f
};
TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
cache_ptr = file_ptr->shared->cache;
if ( pass ) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
if ( result != SUCCEED ) {
pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_8() */
/*-------------------------------------------------------------------------
* Function: smoke_check_9()
*
* Purpose: A repeat of smoke check 1, only with the cache corked
* part of the time.
*
* Recall that smoke check 1 is a basic functional test,
* with inserts, destroys, and moves in the mix, along
* with repeated protects and unprotects. All entries are
* marked as clean.
*
* Return: void
*
* Programmer: John Mainzer
* 8/1/07
*
* Modifications:
*
* None.
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_9(int express_test)
{
herr_t result;
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
int dirty_destroys = FALSE;
hbool_t display_stats = FALSE;
hbool_t display_detailed_stats = FALSE;
int32_t max_index = (10 * 1024) - 1;
int32_t lag = 10;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
(size_t)(2 * 1024 * 1024));
cache_ptr = file_ptr->shared->cache;
/* disable evictions */
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 1.\n";
}
}
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
/* enable evictions */
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't enable evictions 1.\n";
}
}
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n",
FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 2.\n";
}
}
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled \n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't enable evictions 2.\n";
}
}
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 3.\n";
}
}
if ( show_progress ) /* 12 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 13 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 14 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't enable evictions 3.\n";
}
}
if ( show_progress ) /* 15 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 16 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 4.\n";
}
}
if ( show_progress ) /* 17 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 18 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_9() */
/*-------------------------------------------------------------------------
* Function: smoke_check_10()
*
* Purpose: A repeat of smoke check 2, only with the cache corked
* part of the time.
*
* Recall that smoke check 2 is a basic functional test,
* with inserts, destroys, and moves in the mix, along
* with some repeated protects and unprotects. About half
* the entries are marked as dirty.
*
* Return: void
*
* Programmer: John Mainzer
* 8/1/07
*
* Modifications:
*
* None.
*
*-------------------------------------------------------------------------
*/
static unsigned
smoke_check_10(int express_test)
{
herr_t result;
hbool_t show_progress = FALSE;
int dirty_unprotects = TRUE;
int dirty_destroys = TRUE;
hbool_t display_stats = FALSE;
hbool_t display_detailed_stats = FALSE;
int32_t max_index = (10 * 1024) - 1;
int32_t lag = 10;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked");
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
(size_t)(2 * 1024 * 1024));
cache_ptr = file_ptr->shared->cache;
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 1.\n";
}
}
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't enable evictions 1.\n";
}
}
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 2.\n";
}
}
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't enable evictions 2.\n";
}
}
if ( show_progress ) /* 11 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 12 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 3.\n";
}
}
if ( show_progress ) /* 13 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 14 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't enable evictions 3.\n";
}
}
if ( show_progress ) /* 15 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ display_detailed_stats,
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
if ( show_progress ) /* 16 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "can't disable evictions 4.\n";
}
}
if ( show_progress ) /* 17 */
HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 18 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_10() */
/*-------------------------------------------------------------------------
* Function: write_permitted_check()
*
* Purpose: A basic test of the write permitted function. In essence,
* we load the cache up with dirty entryies, set
* write_permitted to FALSE, and then protect a bunch of
* entries. If there are any writes while write_permitted is
* FALSE, the test will fail.
*
* Return: void
*
* Programmer: John Mainzer
* 6/24/04
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
write_permitted_check(int
#if !H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
H5_ATTR_UNUSED
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
express_test)
{
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
hbool_t show_progress = FALSE;
hbool_t display_stats = FALSE;
int32_t max_index = (10 * 1024) - 1;
int32_t lag = 10;
int mile_stone = 1;
H5F_t * file_ptr = NULL;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
TESTING("write permitted check -- 1/0 MB cache");
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
switch ( express_test )
{
case 0:
max_index = (10 * 1024) - 1;
break;
case 1:
max_index = (1 * 1024) - 1;
break;
case 2:
max_index = (512) - 1;
break;
default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
return 0; /* <========== note return */
break;
}
pass = TRUE;
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
reset_entries();
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(1 * 1024 * 1024),
(size_t)(0));
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ TRUE,
/* dirty_unprotects */ TRUE);
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
write_permitted = FALSE;
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ FALSE,
/* dirty_unprotects */ NO_CHANGE);
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
write_permitted = TRUE;
row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
/* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ TRUE,
/* dirty_unprotects */ TRUE);
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ TRUE,
/* dirty_unprotects */ TRUE);
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
write_permitted = FALSE;
col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
/* display_detailed_stats */ TRUE,
/* do_inserts */ FALSE,
/* dirty_unprotects */ NO_CHANGE);
write_permitted = TRUE;
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
SKIPPED();
HDfprintf(stdout, " Clean and dirty LRU lists disabled.\n");
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
return (unsigned)!pass;
} /* write_permitted_check() */
/*-------------------------------------------------------------------------
* Function: check_insert_entry()
*
* Purpose: Verify that H5C_insert_entry behaves as expected.
* Test the behaviour with different flags.
*
* This test was added primarily to test basic insert
* pinned entry functionallity, but I through in explicit
* tests for other functionallity that is tested implicitly
* elsewhere.
*
* Return: void
*
* Programmer: John Mainzer
* 8/10/06
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
check_insert_entry(void)
{
int entry_type = PICO_ENTRY_TYPE;
int i;
herr_t result;
hbool_t in_cache;
hbool_t is_dirty;
hbool_t is_protected;
hbool_t is_pinned;
size_t entry_size;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
struct H5C_cache_entry_t * search_ptr;
TESTING("H5C_insert_entry() functionality");
pass = TRUE;
/* Allocate a cache, and insert entries into it using all
* combinations of flags. Verify that the entries are inserted,
* and that the flags have the desired effects.
*
* Note that the dirty parameter in insert_entry is no longer
* used, as we have decided that all inserted entries are
* dirty by definition. (Which sounds very reasonable, but didn't
* used to be the case.)
*/
if ( pass ) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
(size_t)(1 * 1024 * 1024));
cache_ptr = file_ptr->shared->cache;
}
if ( pass ) {
insert_entry(file_ptr, entry_type, 0, H5C__NO_FLAGS_SET);
insert_entry(file_ptr, entry_type, 1, H5C__SET_FLUSH_MARKER_FLAG);
insert_entry(file_ptr, entry_type, 2, H5C__PIN_ENTRY_FLAG);
insert_entry(file_ptr, entry_type, 3, (H5C__SET_FLUSH_MARKER_FLAG | H5C__PIN_ENTRY_FLAG));
}
/* Verify that the entries are inserted as desired. */
i = 0;
base_addr = entries[0];
while ( ( pass ) && ( i < 4 ) )
{
entry_ptr = &(base_addr[i]);
/* Start by checking everything we can via H5C_get_entry_status() */
result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
&in_cache, &is_dirty, &is_protected,
&is_pinned, NULL, NULL);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "H5C_get_entry_status() reports failure.";
}
if ( pass ) {
/* check the universals */
if ( ( ! in_cache ) || ( ! is_dirty ) || ( is_protected ) ||
( entry_size != entry_sizes[entry_type] ) ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 1.";
}
}
if ( pass ) {
/* verify that the pinned flag got set correctly */
if ( ( i == 2 ) || ( i == 3 ) ) {
if ( ! is_pinned ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 2.";
}
} else if ( is_pinned ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 3.";
} else if ( is_pinned != ((entry_ptr->header).is_pinned) ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 4.";
}
}
/* Thats all we can get from H5C_get_entry_status().
* Now start looking at the cache data structures directly.
*/
if ( pass ) {
/* Verify that the flush marker got set correctly */
if ( ( i == 1 ) || ( i == 3 ) ) {
if ( ! ((entry_ptr->header).flush_marker) ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 5.";
}
} else if ( (entry_ptr->header).flush_marker ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 6.";
}
}
if ( pass ) {
/* Verify that pinned entries are in the pinned entry list */
if ( (entry_ptr->header).is_pinned ) {
search_ptr = cache_ptr->pel_head_ptr;
while ( ( search_ptr != NULL ) &&
( search_ptr !=
(struct H5C_cache_entry_t *)entry_ptr ) )
{
search_ptr = search_ptr->next;
}
if ( search_ptr == NULL ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 7.";
}
}
}
if ( pass ) {
/* Verify that unpinned entries are in the LRU list */
if ( ! ((entry_ptr->header).is_pinned) ) {
search_ptr = cache_ptr->LRU_head_ptr;
while ( ( search_ptr != NULL ) &&
( search_ptr !=
(struct H5C_cache_entry_t *)entry_ptr ) )
{
search_ptr = search_ptr->next;
}
if ( search_ptr == NULL ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 8.";
}
}
}
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
if ( pass ) {
/* Verify that unpinned entries are in the dirty LRU list */
if ( ! ((entry_ptr->header).is_pinned) ) {
search_ptr = cache_ptr->dLRU_head_ptr;
while ( ( search_ptr != NULL ) &&
( search_ptr !=
(struct H5C_cache_entry_t *)entry_ptr ) )
{
search_ptr = search_ptr->aux_next;
}
if ( search_ptr == NULL ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 9.";
}
}
}
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
i++;
} /* while */
/* So much for looking at the individual entries. Now verify
* that the various counts and sized in the cache header are
* as expected.
*/
if ( pass ) {
if ( ( cache_ptr->index_len != 4 ) ||
( cache_ptr->index_size != 4 * entry_sizes[entry_type] ) ||
( cache_ptr->slist_len != 4 ) ||
( cache_ptr->slist_size != 4 * entry_sizes[entry_type] ) ||
( cache_ptr->pl_len != 0 ) ||
( cache_ptr->pl_size != (size_t)0 ) ||
( cache_ptr->pel_len != 2 ) ||
( cache_ptr->pel_size != 2 * entry_sizes[entry_type] ) ||
( cache_ptr->LRU_list_len != 2 ) ||
( cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type] ) ||
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
( cache_ptr->dLRU_list_len != 2 ) ||
( cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type] ) ||
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
( cache_ptr->cLRU_list_len != 0 ) ||
( cache_ptr->cLRU_list_size != (size_t)0 ) ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 10.";
}
}
/* Finally, if stats collection is enabled, verify that the expected
* stats are collected.
*/
#if H5C_COLLECT_CACHE_STATS
if ( pass ) {
if ( ( cache_ptr->insertions[entry_type] != 4 ) ||
( cache_ptr->pinned_insertions[entry_type] != 2 ) ||
( cache_ptr->pins[entry_type] != 2 ) ||
( cache_ptr->unpins[entry_type] != 0 ) ||
( cache_ptr->dirty_pins[entry_type] != 0 ) ||
( cache_ptr->max_index_len != 4 ) ||
( cache_ptr->max_index_size != 4 * entry_sizes[entry_type] ) ||
( cache_ptr->max_slist_len != 4 ) ||
( cache_ptr->max_slist_size != 4 * entry_sizes[entry_type] ) ||
( cache_ptr->max_pl_len != 0 ) ||
( cache_ptr->max_pl_size != (size_t)0 ) ||
( cache_ptr->max_pel_len != 2 ) ||
( cache_ptr->max_pel_size != 2 * entry_sizes[entry_type] ) ) {
pass = FALSE;
failure_mssg = "Unexpected insert results 11.";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
/* Unpin the pinned entries so we can take down the cache cleanly. */
if ( pass ) {
unpin_entry(entry_type, 2);
unpin_entry(entry_type, 3);
}
if ( pass ) {
takedown_cache(file_ptr, FALSE, FALSE);
}
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_insert_entry() */
/*-------------------------------------------------------------------------
* Function: check_flush_cache()
*
* Purpose: Verify that flush_cache behaves as expected. In particular,
* test the behaviour with different flags.
*
* Return: void
*
* Programmer: John Mainzer
* 1/10/05
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
check_flush_cache(void)
{
H5F_t * file_ptr = NULL;
TESTING("H5C_flush_cache() functionality");
pass = TRUE;
/* allocate a cache, and flush it under various circumstances.
* To the extent possible, verify that the desired actions took
* place.
*/
if ( pass ) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
(size_t)(1 * 1024 * 1024));
}
/* first test behaviour on an empty cache. Can't do much sanity
* checking in this case, so simply check the return values.
*/
if ( pass ) {
check_flush_cache__empty_cache(file_ptr);
}
/* now do a series of similar tests with a cache with a single entry.
* Start with a clean entry, with no flags set.
*/
if ( pass ) {
check_flush_cache__single_entry(file_ptr);
}
if ( pass ) {
check_flush_cache__multi_entry(file_ptr);
}
if ( pass ) {
check_flush_cache__flush_ops(file_ptr);
}
if ( pass ) {
takedown_cache(file_ptr, FALSE, FALSE);
}
if ( pass ) { PASSED(); } else { H5_FAILED(); }
if ( ! pass ) {
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_flush_cache() */
/*-------------------------------------------------------------------------
* Function: check_flush_cache__empty_cache()
*
* Purpose: Verify that flush_cache behaves as expected with an empty
* cache.
*
* Return: void
*
* Programmer: John Mainzer
* 1/12/05
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
check_flush_cache__empty_cache(H5F_t * file_ptr)
{
H5C_t * cache_ptr = file_ptr->shared->cache;
herr_t result;
if ( cache_ptr == NULL ) {
pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to empty cache case.";
}
else if ( ( cache_ptr->index_len != 0 ) ||
( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
failure_mssg = "cache not empty at beginning of empty cache case.";
}
/* Test behaviour on an empty cache. Can't do much sanity
* checking in this case, so simply check the return values.
*/
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__NO_FLAGS_SET);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "flush with flags = 0x00 failed on empty cache.\n";
}
}
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "flush with flags = 0x04 failed on empty cache.\n";
}
}
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__FLUSH_CLEAR_ONLY_FLAG);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "flush with flags = 0x08 failed on empty cache.\n";
}
}
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__FLUSH_MARKED_ENTRIES_FLAG);
if ( result < 0 ) {
pass = FALSE;
failure_mssg = "flush with flags = 0x10 failed on empty cache.\n";
}
}
} /* check_flush_cache__empty_cache() */
/*-------------------------------------------------------------------------
* Function: check_flush_cache__multi_entry()
*
* Purpose: Verify that flush_cache behaves as expected when the cache
* contains multiple elements.
*
* Return: void
*
* Programmer: John Mainzer
* 1/14/05
*
* Modifications:
*
* JRM -- 4/5/06
* Added pinned entry tests.
*
*-------------------------------------------------------------------------
*/
static void
check_flush_cache__multi_entry(H5F_t * file_ptr)
{
H5C_t *cache_ptr = file_ptr->shared->cache;
if ( cache_ptr == NULL ) {
pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to multi entry case.";
}
else if ( ( cache_ptr->index_len != 0 ) ||
( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
failure_mssg = "cache not empty at beginning of multi entry case.";
}
if ( pass )
{
int test_num = 1;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 2;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 3;
unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 4;
unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 5;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
H5C__FLUSH_CLEAR_ONLY_FLAG;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 6;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
H5C__FLUSH_MARKED_ENTRIES_FLAG;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 7;
unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG |
H5C__FLUSH_MARKED_ENTRIES_FLAG;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 8;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
H5C__FLUSH_CLEAR_ONLY_FLAG |
H5C__FLUSH_MARKED_ENTRIES_FLAG;
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
/* verify that all other flags are ignored */
if ( pass )
{
int test_num = 9;
unsigned int flush_flags = (unsigned)
~(H5C__FLUSH_INVALIDATE_FLAG |
H5C__FLUSH_CLEAR_ONLY_FLAG |
H5C__FLUSH_MARKED_ENTRIES_FLAG);
int spec_size = 8;
struct flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
/* Now do pinned entry tests:
*
* For the most part, this test is directed at testing the ability
* of the flush routine to unravel collections of pinned entries.
*/
if ( pass )
{
int test_num = 1;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 8;
struct pe_flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 2,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 3,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 4,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
-1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 5,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
-1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 6,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
-1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 7,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
-1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, 30, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 2;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 8;
struct pe_flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 2,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 3,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE,
-1, -1, -1, -1 -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {10, -1, -1, -1 -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 2,
/* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {10, 20, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 3,
/* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
MONSTER_ENTRY_TYPE,
-1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {10, 20, 30, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 3;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
H5C__FLUSH_CLEAR_ONLY_FLAG;
int spec_size = 8;
struct pe_flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 4;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
H5C__FLUSH_MARKED_ENTRIES_FLAG;
int spec_size = 8;
struct pe_flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* num_pins = */ 4,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
-1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 4,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
PICO_ENTRY_TYPE,
-1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
if ( pass )
{
int test_num = 5;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
H5C__FLUSH_CLEAR_ONLY_FLAG |
H5C__FLUSH_MARKED_ENTRIES_FLAG;
int spec_size = 8;
struct pe_flush_cache_test_spec spec[8] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 0,
/* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 75,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 25,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 6,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 30,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 7,
/* entry_type = */ MONSTER_ENTRY_TYPE,
/* entry_index = */ 40,
/* insert_flag = */ TRUE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* num_pins = */ 1,
/* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
-1, -1, -1, -1, -1, -1, -1},
/* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
flush_flags, spec_size, spec);
}
return;
} /* check_flush_cache__multi_entry() */
/*-------------------------------------------------------------------------
* Function: check_flush_cache__multi_entry_test()
*
* Purpose: Run a multi entry flush cache test.
*
* Return: void
*
* Programmer: John Mainzer
* 1/13/05
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
check_flush_cache__multi_entry_test(H5F_t * file_ptr,
int test_num,
unsigned int flush_flags,
int spec_size,
struct flush_cache_test_spec spec[])
{
H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
herr_t result;
int i;
size_t total_entry_size = 0;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
#if 0 /* JRM */
/* This gets used a lot, so lets leave it in. */
HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n",
test_num);
#endif /* JRM */
if ( cache_ptr == NULL ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"cache_ptr NULL on entry to single entry test #%d.",
test_num);
failure_mssg = msg;
}
else if ( ( cache_ptr->index_len != 0 ) ||
( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"cache not empty at beginning of multi entry test #%d.",
test_num);
failure_mssg = msg;
}
else if ( ( spec_size < 1 ) || ( spec == NULL ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"missing/bad test spec on entry to multi entry test #%d.",
test_num);
failure_mssg = msg;
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
if ( ( spec[i].entry_num != i ) ||
( spec[i].entry_type < 0 ) ||
( spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
( spec[i].entry_index < 0 ) ||
( spec[i].entry_index > max_indices[spec[i].entry_type] ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"bad data in spec[%d] on entry to multi entry test #%d.",
i, test_num);
failure_mssg = msg;
}
i++;
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
if ( spec[i].insert_flag ) {
insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
spec[i].flags);
} else {
protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index);
unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
spec[i].flags);
}
total_entry_size += entry_sizes[spec[i].entry_type];
i++;
}
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, flush_flags);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"flush with flags 0x%x failed in multi entry test #%d.",
flush_flags, test_num);
failure_mssg = msg;
}
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
base_addr = entries[spec[i].entry_type];
entry_ptr = &(base_addr[spec[i].entry_index]);
if ( ( entry_ptr->deserialized != spec[i].expected_deserialized ) ||
( entry_ptr->serialized != spec[i].expected_serialized ) ||
( entry_ptr->destroyed != spec[i].expected_destroyed ) ) {
#if 0 /* This is useful debugging code. Lets keep it around. */
HDfprintf(stdout,
"deslzd = %d(%d), slzd = %d(%d), dest = %d(%d)\n",
(int)(entry_ptr->deserialized),
(int)(spec[i].expected_deserialized),
(int)(entry_ptr->serialized),
(int)(spec[i].expected_serialized),
(int)(entry_ptr->destroyed),
(int)(spec[i].expected_destroyed));
#endif
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Bad status on entry %d after flush in multi entry test #%d.",
i, test_num);
failure_mssg = msg;
}
i++;
}
if ( pass ) {
if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 )
&&
( ( cache_ptr->index_len != spec_size )
||
( cache_ptr->index_size != total_entry_size )
)
)
||
( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
&&
( ( cache_ptr->index_len != 0 )
||
( cache_ptr->index_size != 0 )
)
)
) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Unexpected cache len/size after flush in multi entry test #%d.",
test_num);
failure_mssg = msg;
}
}
/* clean up the cache to prep for the next test */
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Flush failed on cleanup in multi entry test #%d.",
test_num);
failure_mssg = msg;
}
else if ( ( cache_ptr->index_len != 0 ) ||
( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Unexpected cache len/size after cleanup in multi entry test #%d.",
test_num);
failure_mssg = msg;
}
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
base_addr = entries[spec[i].entry_type];
entry_ptr = &(base_addr[spec[i].entry_index]);
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
entry_ptr->destroyed = FALSE;
i++;
}
return;
} /* check_flush_cache__multi_entry_test() */
/*-------------------------------------------------------------------------
* Function: check_flush_cache__pe_multi_entry_test()
*
* Purpose: Run a multi entry flush cache test.
*
* Return: void
*
* Programmer: John Mainzer
* 4/5/06
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
int test_num,
unsigned int flush_flags,
int spec_size,
struct pe_flush_cache_test_spec spec[])
{
H5C_t *cache_ptr = file_ptr->shared->cache;
static char msg[128];
herr_t result;
int i;
int j;
size_t total_entry_size = 0;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
#if 0 /* JRM */
/* This is useful debugging code. Leave it in for now. */
HDfprintf(stdout, "check_flush_cache__pe_multi_entry_test: test %d\n",
test_num);
#endif /* JRM */
if ( cache_ptr == NULL ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"cache_ptr NULL on entry to pe multi entry test #%d.",
test_num);
failure_mssg = msg;
}
else if ( ( cache_ptr->index_len != 0 ) ||
( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"cache not empty at beginning of pe multi entry test #%d.",
test_num);
failure_mssg = msg;
}
else if ( ( spec_size < 1 ) || ( spec == NULL ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"missing/bad test spec on entry to pe multi entry test #%d.",
test_num);
failure_mssg = msg;
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
if ( ( spec[i].entry_num != i ) ||
( spec[i].entry_type < 0 ) ||
( spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
( spec[i].entry_index < 0 ) ||
( spec[i].entry_index > max_indices[spec[i].entry_type] ) ||
( spec[i].num_pins < 0 ) ||
( spec[i].num_pins > MAX_PINS ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"bad data in spec[%d] on entry to pe multi entry test #%d.",
i, test_num);
failure_mssg = msg;
}
i++;
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
if ( spec[i].insert_flag ) {
insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
spec[i].flags);
} else {
protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index);
unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
spec[i].flags);
}
total_entry_size += entry_sizes[spec[i].entry_type];
for ( j = 0; j < spec[i].num_pins; j++ )
{
create_pinned_entry_dependency(file_ptr,
spec[i].entry_type,
spec[i].entry_index,
spec[i].pin_type[j],
spec[i].pin_idx[j]);
}
i++;
}
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, flush_flags);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"flush with flags 0x%x failed in pe multi entry test #%d.",
flush_flags, test_num);
failure_mssg = msg;
}
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
base_addr = entries[spec[i].entry_type];
entry_ptr = &(base_addr[spec[i].entry_index]);
if ( ( entry_ptr->deserialized != spec[i].expected_deserialized ) ||
( entry_ptr->serialized != spec[i].expected_serialized ) ||
( entry_ptr->destroyed != spec[i].expected_destroyed ) ) {
#if 0 /* This is useful debugging code. Lets keep it around. */
HDfprintf(stdout,
"desrlzd = %d(%d), srlzd = %d(%d), dest = %d(%d)\n",
(int)(entry_ptr->deserialized),
(int)(spec[i].expected_deserialized),
(int)(entry_ptr->serialized),
(int)(spec[i].expected_serialized),
(int)(entry_ptr->destroyed),
(int)(spec[i].expected_destroyed));
#endif
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Bad status on entry %d after flush in pe multi entry test #%d.",
i, test_num);
failure_mssg = msg;
}
i++;
}
if ( pass ) {
if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 )
&&
( ( cache_ptr->index_len != spec_size )
||
( cache_ptr->index_size != total_entry_size )
)
)
||
( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
&&
( ( cache_ptr->index_len != 0 )
||
( cache_ptr->index_size != 0 )
)
)
) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Unexpected cache len/size after flush in pe multi entry test #%d.",
test_num);
failure_mssg = msg;
}
}
/* clean up the cache to prep for the next test */
if ( pass ) {
result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Flush failed on cleanup in pe multi entry test #%d.",
test_num);
failure_mssg = msg;
}
else if ( ( cache_ptr->index_len != 0 ) ||
( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Unexpected cache len/size after cleanup in pe multi entry test #%d.",
test_num);
failure_mssg = msg;
}
}
i = 0;
while ( ( pass ) && ( i < spec_size ) )
{
base_addr = entries[spec[i].entry_type];
entry_ptr = &(base_addr[spec[i].entry_index]);
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
entry_ptr->destroyed = FALSE;
i++;
}
return;
} /* check_flush_cache__pe_multi_entry_test() */
/*-------------------------------------------------------------------------
* Function: check_flush_cache__flush_ops()
*
* Purpose: Run the flush ops cache tests.
*
* These are tests that test the cache's ability to handle
* the case in which the flush callback dirties, resizes,
* and/or moves entries.
*
* Do nothing if pass is FALSE on entry.
*
* Return: void
*
* Programmer: John Mainzer
* 9/3/06
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
check_flush_cache__flush_ops(H5F_t * file_ptr)
{
H5C_t *cache_ptr = file_ptr->shared->cache;
if ( cache_ptr == NULL ) {
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 = "cache not empty at beginning of flush ops test.";
}
if ( pass ) /* test #1 */
{
/* start with a very simple test, in which there are two entries
* resident in cache, and the second entry dirties the first in
* the flush callback. No size changes, and no flush flags.
*/
int test_num = 1;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 2;
int init_expected_index_len = 2;
size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE;
int expected_index_len = 2;
size_t expected_index_size = 2 * PICO_ENTRY_SIZE;
struct fo_flush_cache_test_spec spec[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ 0,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #2 */
{
/* Same as test 1, only this time set the flush invalidate flag.
* Note that we must repeat all tests with the flush invalidate flag
* as this triggers a different set of code to execute the flush.
*
* Create two entries resident in cache, and have the second entry
* dirty the first in the flush callback.
*/
int test_num = 2;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 2;
int init_expected_index_len = 2;
size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE;
int expected_index_len = 0;
size_t expected_index_size = 0;
struct fo_flush_cache_test_spec spec[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr*/
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #3 */
{
/* Single entry test verifying that the cache can handle the case in
* which the call back function resizes the entry for which it has
* been called.
*/
int test_num = 3;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4;
int expected_index_len = 1;
size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ TRUE,
/* new_size = */ VARIABLE_ENTRY_SIZE / 4,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr:*/
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #4 */
{
/* Repeat test #4 with the flush invalidate flag.
*
* Single entry test verifying that the cache can handle the case in
* which the call back function resizes the entry for which it has
* been called.
*/
int test_num = 4;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4;
int expected_index_len = 0;
size_t expected_index_size = 0;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ TRUE,
/* new_size = */ VARIABLE_ENTRY_SIZE / 4,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #5 & #6 */
{
/* Single entry test verifying that the cache can handle the case in
* which the call back function first resizes and then moves the
* entry for which it has been called.
*
* Run this entry twice, as the first run moves the entry to its
* alternate address, and the second moves it back.
*
* 10/8/07 -- JRM
* Added a resize operation to this test to satisfy the new
* requiremnt that any resize of an entry on flush will always
* be accompanied by a resize. Note that as a result, this
* test becomes redundant with later tests.
*/
int test_num = 5; /* and 6 */
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = VARIABLE_ENTRY_SIZE;
int expected_index_len = 1;
size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 2,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
/* this change forces the move to move the target entry back to its
* main address. The first test moved it to its alternate address.
*
* Note that these two tests are not the same, as in the first test,
* the moved entry is moved forward in the slist. In the second
* it is moved backwards.
*
* Since there is only one entry in the cache, this doesn't really
* matter in this case. But we will do similar tests later with
* other entries in the cache.
*/
if ( pass ) {
spec[0].flush_ops[1].flag = TRUE;
test_num = 6;
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
}
if ( pass ) /* test #7 & #8 */
{
/* Run tests 5 & 6 again, using the flush invalidate flag on the
* second test.
*
* Single entry test verifying that the cache can handle the case in
* which the call back function moves the entry for which it has
* been called.
*
* Run this entry twice, as the first run moves the entry to its
* alternate address, and the second moves it back.
*
* 10/8/07 -- JRM
* Added a resize operation to this test to satisfy the new
* requiremnt that any resize of an entry on flush will always
* be accompanied by a resize. Note that as a result, this
* test becomes redundant with later tests.
*/
int test_num = 7; /* and 8 */
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = VARIABLE_ENTRY_SIZE;
int expected_index_len = 1;
size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 2,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
/* this change forces the move to move the target entry back to its
* main address. The first test moved it to its alternate address.
*
* Note that these two tests are not the same, as in the first test,
* the moved entry is moved forward in the slist. In the second
* it is moved backwards.
*
* Since there is only one entry in the cache, this doesn't really
* matter in this case. But we will do similar tests later with
* other entries in the cache.
*/
if ( pass ) {
test_num = 8;
flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
expected_index_len = 0;
expected_index_size = 0;
spec[0].flush_ops[1].flag = TRUE;
spec[0].expected_destroyed = TRUE;
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
}
if ( pass ) /* test #9 & #10 */
{
/* Single entry test verifying that the cache can handle the case in
* which the call back function both resizes and moves the entry
* for which it has been called.
*
* Again, we run this entry twice, as the first run moves the entry
* to its alternate address, and the second moves it back.
*/
int test_num = 9; /* and 10 */
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2;
int expected_index_len = 1;
size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ TRUE,
/* new_size = */ VARIABLE_ENTRY_SIZE / 2,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 2,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
/* this change forces the move to move the target entry back to its
* main address. The first test moved it to its alternate address.
*
* Note that these two tests are not the same, as in the first test,
* the moved entry is moved forward in the slist. In the second
* it is moved backwards.
*
* Since there is only one entry in the cache, this doesn't really
* matter in this case. But we will do similar tests later with
* other entries in the cache.
*/
if ( pass ) {
spec[0].flush_ops[1].flag = TRUE;
test_num = 10;
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
}
if ( pass ) /* test #11 & #12 */
{
/* Repeat the previous test with the flush invalidate flag on the
* second test.
*
* Single entry test verifying that the cache can handle the case in
* which the call back function both resizes and moves the entry
* for which it has been called.
*
* Again, we run this entry twice, as the first run moves the entry to its
* alternate address, and the second moves it back.
*/
int test_num = 11; /* and 12 */
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2;
int expected_index_len = 1;
size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ TRUE,
/* new_size = */ VARIABLE_ENTRY_SIZE / 2,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 2,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
/* this change forces the move to move the target entry back to its
* main address. The first test moved it to its alternate address.
*
* Note that these two tests are not the same, as in the first test,
* the moved entry is moved forward in the slist. In the second
* it is moved backwards.
*
* Since there is only one entry in the cache, this doesn't really
* matter in this case. But we will do similar tests later with
* other entries in the cache.
*/
if ( pass ) {
test_num = 12;
flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
expected_index_len = 0;
expected_index_size = 0;
spec[0].flush_ops[1].flag = TRUE;
spec[0].expected_destroyed = TRUE;
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
}
if ( pass ) /* test #13 */
{
/* Test the ability of the cache to handle the case in which
* the flush function of an entry that is resident in cache
* dirties two entries that are not in cache. No size
* changes.
*
* At present, I am assured that this case will never occur, but
* lets make sure we can handle it regardless.
*/
int test_num = 13;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE;
int expected_index_len = 3;
size_t expected_index_size = 3 * PICO_ENTRY_SIZE;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 2,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 2;
struct fo_flush_entry_check checks[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ PICO_ENTRY_SIZE,
/* in_cache = */ TRUE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ PICO_ENTRY_SIZE,
/* in_cache = */ TRUE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #14 */
{
/* Repeat previous test with the flush invalidate flag.
*
* Test the ability of the cache to handle the case in which
* the flush function of an entry that is resident in cache
* dirties two entries that are not in cache. No size
* changes.
*
* At present, I am assured that this case will never occur, but
* lets make sure we can handle it regardless.
*/
int test_num = 14;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE;
int expected_index_len = 0;
size_t expected_index_size = (size_t)0;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 2,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
int check_size = 2;
struct fo_flush_entry_check checks[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ PICO_ENTRY_SIZE,
/* in_cache = */ FALSE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ PICO_ENTRY_SIZE,
/* in_cache = */ FALSE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #15 */
{
/* Test the ability of the cache to handle the case in which
* the flush function of an entry that is resident in cache
* resizes and dirties two entries that are not in cache.
*
* At present, I am assured that this case will never occur, but
* lets make sure we can handle it regardless.
*/
int test_num = 15;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
int expected_index_len = 3;
size_t expected_index_size = VARIABLE_ENTRY_SIZE +
(VARIABLE_ENTRY_SIZE / 4) +
(VARIABLE_ENTRY_SIZE / 2);
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 4,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 2;
struct fo_flush_entry_check checks[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ TRUE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ TRUE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #16 */
{
/* Repeat previous test with the flush invalidate flag.
*
* Test the ability of the cache to handle the case in which
* the flush function of an entry that is resident in cache
* resizes and dirties two entries that are not in cache.
*
* At present, I am assured that this case will never occur, but
* lets make sure we can handle it regardless.
*/
int test_num = 16;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
int expected_index_len = 0;
size_t expected_index_size = (size_t)0;
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 4,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
int check_size = 2;
struct fo_flush_entry_check checks[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ FALSE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ FALSE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #17 & #18 */
{
/* Test the ability of the cache to handle the case in which
* the flush function of an entry that is resident in cache
* resizes, dirties, and moves two entries that are not in cache.
*
* At present, I am assured that this case will never occur, but
* lets make sure we can handle it regardless.
*/
int test_num = 17; /* and 18 */
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
int expected_index_len = 3;
size_t expected_index_size = VARIABLE_ENTRY_SIZE +
(VARIABLE_ENTRY_SIZE / 4) +
(VARIABLE_ENTRY_SIZE / 2);
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 2;
struct fo_flush_entry_check checks[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
/* this change forces the moves to move the target entries back to
* their main address. The first test moved them to their alternate
* address.
*
* Note that these two tests are not the same, as in the first test,
* the moved entries are moved forward in the slist. In the second
* they are moved backwards.
*/
if ( pass ) {
test_num = 18;
spec[0].flush_ops[2].flag = TRUE;
spec[0].flush_ops[5].flag = TRUE;
checks[0].at_main_addr = TRUE;
checks[1].at_main_addr = TRUE;
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
}
if ( pass ) /* test #19 & #20 */
{
/* Repeat the above test with the flush invalidate flag on the
* second test.
*
* Test the ability of the cache to handle the case in which
* the flush function of an entry that is resident in cache
* resizes, dirties, and moves two entries that are not in cache.
*
* At present, I am assured that this case will never occur, but
* lets make sure we can handle it regardless.
*/
int test_num = 19; /* and 20 */
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 1;
int init_expected_index_len = 1;
size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
int expected_index_len = 3;
size_t expected_index_size = VARIABLE_ENTRY_SIZE +
(VARIABLE_ENTRY_SIZE / 4) +
(VARIABLE_ENTRY_SIZE / 2);
struct fo_flush_cache_test_spec spec[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 2;
struct fo_flush_entry_check checks[2] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
/* this change forces the moves to move the target entries back to
* their main address. The first test moved them to their alternate
* address.
*
* Note that these two tests are not the same, as in the first test,
* the moved entries are moved forward in the slist. In the second
* they are moved backwards.
*/
if ( pass ) {
test_num = 20;
flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
expected_index_len = 0;
expected_index_size = (size_t)0;
spec[0].expected_destroyed = TRUE;
spec[0].flush_ops[2].flag = TRUE;
spec[0].flush_ops[5].flag = TRUE;
checks[0].at_main_addr = TRUE;
checks[0].in_cache = FALSE;
checks[0].expected_destroyed = TRUE;
checks[1].at_main_addr = TRUE;
checks[1].in_cache = FALSE;
checks[1].expected_destroyed = TRUE;
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
}
if ( pass ) /* test #21 */
{
/* Now mix things up a bit.
*
* Load several entries, two of which have flush functions that
* resize, dirty, and move two entries that are not in the
* cache. Mark only one of these entries, and then flush the
* cache with the flush marked entries flag.
*
* This is the only test in which we test the
* H5C__FLUSH_MARKED_ENTRIES_FLAG. The hope is that since
* we test the two features extensively by themselves, so
* it should be sufficient to verify that they play together
* as expected.
*/
int test_num = 21;
unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG;
int spec_size = 4;
int init_expected_index_len = 4;
size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE);
int expected_index_len = 6;
size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) +
(VARIABLE_ENTRY_SIZE / 4) +
(VARIABLE_ENTRY_SIZE / 2) +
(2 * PICO_ENTRY_SIZE);
struct fo_flush_cache_test_spec spec[4] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 11,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 4;
struct fo_flush_entry_check checks[4] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ TRUE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ TRUE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 10,
/* expected_size = */ VARIABLE_ENTRY_SIZE,
/* in_cache = */ FALSE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 12,
/* expected_size = */ VARIABLE_ENTRY_SIZE,
/* in_cache = */ FALSE,
/* at_main_addr = */ TRUE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
reset_entries();
}
if ( pass ) /* test #22 */
{
/* Mix things up some more.
*
* Load lots of entries, some of which have flush functions that
* resize, dirty, and move two entries that are not in the
* cache.
*
* Also load entries that have flush ops on entries that are in
* cache.
*/
int test_num = 22;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 6;
int init_expected_index_len = 6;
size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE);
int expected_index_len = 10;
size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) +
(2 * (VARIABLE_ENTRY_SIZE / 4)) +
(2 * (VARIABLE_ENTRY_SIZE / 2)) +
(4 * PICO_ENTRY_SIZE);
struct fo_flush_cache_test_spec spec[6] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 11,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 4,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 5,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 4;
struct fo_flush_entry_check checks[4] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 10,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 3,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 12,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ TRUE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
reset_entries();
}
if ( pass ) /* test #23 */
{
/* Repeat test #23 with the flush invalidate flag set.
*
* Mix things up some more.
*
* Load lots of entries, some of which have flush functions that
* resize, dirty, and move two entries that are not in the
* cache.
*
* Also load entries that have flush ops on entries that are in
* cache.
*/
int test_num = 23;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 6;
int init_expected_index_len = 6;
size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE);
int expected_index_len = 0;
size_t expected_index_size = 0;
struct fo_flush_cache_test_spec spec[6] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 11,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 6,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
{ FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
{ FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
{ FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 0,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 1,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 4,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 10,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 5,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 20,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
int check_size = 4;
struct fo_flush_entry_check checks[4] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 0,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 10,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 3,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 12,
/* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
reset_entries();
}
/* So much for tests involving only flush operations.
*
* Now create some tests mixing flush ops and pins.
*/
if ( pass ) /* test #24 */
{
/* Pico entries 50 and 150 pin pico entry 100, and also dirty
* pico entry 100 on flush.
*/
int test_num = 24;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 3;
int init_expected_index_len = 3;
size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE;
int expected_index_len = 3;
size_t expected_index_size = 3 * PICO_ENTRY_SIZE;
struct fo_flush_cache_test_spec spec[3] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 1,
/* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 150,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 1,
/* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
{ FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #25 */
{
/* Repeat the previous test with the flush invalidate flag.
*
* Pico entries 50 and 150 pin pico entry 100, and also dirty
* pico entry 100 on flush.
*/
int test_num = 25;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
int spec_size = 3;
int init_expected_index_len = 3;
size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE;
int expected_index_len = 0;
size_t expected_index_size = (size_t)0;
struct fo_flush_cache_test_spec spec[3] =
{
{
/* entry_num = */ 0,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 1,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 50,
/* insert_flag = */ FALSE,
/* flags = */ H5C__DIRTIED_FLAG,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 1,
/* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
},
{
/* entry_num = */ 2,
/* entry_type = */ PICO_ENTRY_TYPE,
/* entry_index = */ 150,
/* insert_flag = */ TRUE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 1,
/* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 1,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
{ FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ TRUE
}
};
int check_size = 0;
struct fo_flush_entry_check checks[1] =
{
{
/* entry_num = */ 0,
/* entry_type = */ 0,
/* entry_index = */ 0,
/* expected_size = */ (size_t)0,
/* in_cache = */ FALSE,
/* at_main_addr = */ FALSE,
/* is_dirty = */ FALSE,
/* is_protected = */ FALSE,
/* is_pinned = */ FALSE,
/* expected_deserialized = */ FALSE,
/* expected_serialized = */ FALSE,
/* expected_destroyed = */ FALSE
}
};
check_flush_cache__flush_op_test(file_ptr,
test_num,
flush_flags,
spec_size,
spec,
init_expected_index_len,
init_expected_index_size,
expected_index_len,
expected_index_size,
check_size,
checks);
}
if ( pass ) /* test #26 */
{
/* This one is complex.
*
* In the following overvies table, VET stands for
* VARIABLE_ENTRY_TYPE.
*
* In trying to follow what happens when we flush the
* set of entries constructed below, recall that each
* flush operation is executed the first time the
* entry is flushed, and then not executed again.
* This may be a weakness in the tests, but that
* is the way it is for now.
*
* After thinking about it for a while, I'm not sure that
* the interaction between pins and flush operations needs
* all that much testing, as the two are essentially
* orthoginal. Thus this is a bit of a smoke check to
* verify that we get the expected results.
*
* (VET, 100) initially not resident in cache
*
* (VET, 200) initially clean and resident in cache
*
* (VET, 300) initially not resident in cache
*
* (VET, 2100) initially clean and resident in cache
*
* (VET, 2200) initially not resident in cache
*
* (VET, 2300) initially clean and resident in cache
*
* (VET, 1000) initially clean, and in cache
* dirties (VET, 100)
* resizes (VET, 200)
* dirty (VET, 300) -- dirty first to bring into cache.
* moves (VET, 300)
*
* (VET, 2000) initially clean, and in cache
* dirties (VET, 2100)
* resizes (VET, 2200)
* moves (VET, 2300)
*
* (VET, 350) initially clean, and in cache
* pins (VET, 1000)
* dirties (VET, 1000)
* resizes (VET, 350)
* pins (VET, 2000)
* dirties (VET, 2000)
*
* (VET, 450) initially dirty, and in cache
* pins (VET, 1000)
* dirties (VET, 1000)
* moves (VET, 450)
* pins (VET, 2000)
* dirties (VET, 2000)
*
* (VET, 650) initially clean, and in cache
* pins (VET, 1000)
* dirties (VET, 1000)
* resizes (VET, 650)
* pins (VET, 2000)
* dirties (VET, 2000)
*
* (VET, 750) initially dirty, and in cache
* pins (VET, 1000)
* dirties (VET, 1000)
* resizes (VET, 750)
* pins (VET, 2000)
* dirties (VET, 2000)
*
* (VET, 500) initially dirty, and in cache
* dirties (VET, 350)
* dirties (VET, 450)
* dirties (VET, 650)
* dirties (VET, 750)
*/
int test_num = 26;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
int spec_size = 10;
int init_expected_index_len = 10;
size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE;
int expected_index_len = 13;
size_t expected_index_size = 9 * VARIABLE_ENTRY_SIZE;
struct fo_flush_cache_test_spec spec[10] =
{
{
/* entry_num = */ 0,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 200,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
/* entry_num = */ 1,
/* entry_type = */ VARIABLE_ENTRY_TYPE,
/* entry_index = */ 2100,
/* insert_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* resize_flag = */ FALSE,
/* new_size = */ 0,
/* num_pins = */ 0,
/* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
/* num_flush_ops = */ 0,
/* flush_ops = */
/* op_code: type: idx: flag: size: order_ptr: */
{ { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
{ FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
/* expected_deserialized = */ TRUE,
/* expected_serialized = */ TRUE,
|