/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 COPYING file, which can be found at the root of the source code * * distribution tree, or in https://www.hdfgroup.org/licenses. * * 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 "cache_common.h" #include "H5MFprivate.h" H5C_t *saved_cache = NULL; /* store the pointer to the instance of * of H5C_t created by H5Fcreate() * here between test cache setup and * shutdown. */ haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the * space allocated for cache items in the file between * cache setup & takedown */ hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between * cache setup and takedown. Note * that if saved_fapl_id == H5P_DEFAULT, * we assume that there is no fapl to * close. */ hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between * cache setup and takedown. Note * that if saved_fcpl_id == H5P_DEFAULT, * we assume that there is no fcpl to * close. */ hid_t saved_fid = -1; /* store the file id here between cache setup * and takedown. */ hbool_t write_permitted = TRUE; hbool_t try_core_file_driver = FALSE; hbool_t core_file_driver_failed = FALSE; /* global variable declarations: */ const char *FILENAME[] = {"cache_test", NULL}; /* 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_pinned; hbool_t is_protected; }; /* private function declarations: */ static unsigned smoke_check_1(int express_test, unsigned paged); static unsigned smoke_check_2(int express_test, unsigned paged); static unsigned smoke_check_3(int express_test, unsigned paged); static unsigned smoke_check_4(int express_test, unsigned paged); static unsigned smoke_check_5(int express_test, unsigned paged); static unsigned smoke_check_6(int express_test, unsigned paged); static unsigned smoke_check_7(int express_test, unsigned paged); static unsigned smoke_check_8(int express_test, unsigned paged); static unsigned smoke_check_9(int express_test, unsigned paged); static unsigned smoke_check_10(int express_test, unsigned paged); static unsigned write_permitted_check(int express_test, unsigned paged); static unsigned check_insert_entry(unsigned paged); static unsigned check_flush_cache(unsigned paged); 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, unsigned 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, unsigned 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, const struct fo_flush_cache_test_spec spec[], unsigned init_expected_index_len, size_t init_expected_index_size, unsigned 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(unsigned paged); static unsigned check_expunge_entry(unsigned paged); static unsigned check_multiple_read_protect(unsigned paged); static unsigned check_move_entry(unsigned paged); static void check_move_entry__run_test(H5F_t *file_ptr, unsigned test_num, struct move_entry_test_spec *spec_ptr); static unsigned check_pin_protected_entry(unsigned paged); static unsigned check_resize_entry(unsigned paged); static unsigned check_evictions_enabled(unsigned paged); static unsigned check_flush_protected_err(unsigned paged); static unsigned check_destroy_pinned_err(unsigned paged); static unsigned check_destroy_protected_err(unsigned paged); static unsigned check_duplicate_insert_err(unsigned paged); static unsigned check_double_pin_err(unsigned paged); static unsigned check_double_unpin_err(unsigned paged); static unsigned check_pin_entry_errs(unsigned paged); static unsigned check_double_protect_err(unsigned paged); static unsigned check_double_unprotect_err(unsigned paged); static unsigned check_mark_entry_dirty_errs(unsigned paged); static unsigned check_expunge_entry_errs(unsigned paged); static unsigned check_move_entry_errs(unsigned paged); static unsigned check_resize_entry_errs(unsigned paged); static unsigned check_unprotect_ro_dirty_err(unsigned paged); static unsigned check_protect_ro_rw_err(unsigned paged); static unsigned check_protect_retries(unsigned paged); static unsigned check_check_evictions_enabled_err(unsigned paged); static unsigned check_auto_cache_resize(hbool_t cork_ageout, unsigned paged); static unsigned check_auto_cache_resize_disable(unsigned paged); static unsigned check_auto_cache_resize_epoch_markers(unsigned paged); static unsigned check_auto_cache_resize_input_errs(unsigned paged); static unsigned check_auto_cache_resize_aux_fcns(unsigned paged); static unsigned check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged); static unsigned check_flush_deps(unsigned paged); static unsigned check_flush_deps_err(unsigned paged); static unsigned check_flush_deps_order(unsigned paged); static unsigned check_notify_cb(unsigned paged); static unsigned check_metadata_cork(hbool_t fill_via_insertion, unsigned paged); static unsigned check_entry_deletions_during_scans(unsigned paged); 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(unsigned paged); #if H5C_COLLECT_CACHE_STATS static void check_stats__smoke_check_1(H5F_t *file_ptr); #endif /* H5C_COLLECT_CACHE_STATS */ static H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged); static void takedown_cache(H5F_t *file_ptr, hbool_t dump_stats, hbool_t dump_detailed_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, unsigned paged) { 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; if (paged) TESTING("smoke check #1P -- all clean, ins, dest, ren, 4/2 MB cache") else TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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; if (paged) TESTING("smoke check #2P -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache") else TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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; if (paged) TESTING("smoke check #3P -- all clean, ins, dest, ren, 2/1 KB cache") else TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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; if (paged) TESTING("smoke check #4P -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache") else TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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.1, /* 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.75, /* double increment = */ 2.0, /* 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.0, /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.995, /* double decrement = */ 0.9, /* 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.5 }; if (paged) TESTING("smoke check #5P -- all clean, ins, prot, unprot, AR cache 1") else TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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.1, /* 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.75, /* double increment = */ 2.0, /* 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.0, /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.995, /* double decrement = */ 0.9, /* 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.05 }; if (paged) TESTING("smoke check #6P -- ~1/2 dirty, ins, prot, unprot, AR cache 1") else TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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.1, /* 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.75, /* double increment = */ 2.0, /* 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.0, /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.995, /* double decrement = */ 0.9, /* 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.1 }; if (paged) TESTING("smoke check #7P -- all clean, ins, prot, unprot, AR cache 2") else TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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.1, /* 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.75, /* double increment = */ 2.0, /* 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.0, /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.995, /* double decrement = */ 0.9, /* 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.1 }; if (paged) TESTING("smoke check #8P -- ~1/2 dirty, ins, prot, unprot, AR cache 2") else TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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; if (paged) TESTING("smoke check #9P -- all clean, ins, dest, ren, 4/2 MB, corked") else TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { 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; if (paged) TESTING("smoke check #10P -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked") else TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked") if (paged && (express_test > 0)) { SKIPPED(); return (0); } 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), paged); 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, unsigned paged) { #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 */ if (paged) TESTING("write permitted check -- 1/0 MB cache (paged aggregation)") else 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, paged); 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_