2006-01-29 10:34:14 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2006-01-29 10:34:14 +08:00
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
2017-04-18 03:32:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:04 +08:00
|
|
|
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2006-01-29 10:34:14 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
2023-06-29 21:33:49 +08:00
|
|
|
/*
|
2019-08-16 05:46:00 +08:00
|
|
|
* This file contains tests for the API calls associated
|
|
|
|
* with the cache implemented in H5C.c
|
2006-01-29 10:34:14 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cache_common.h"
|
|
|
|
|
2015-06-18 08:58:49 +08:00
|
|
|
/* extern declarations */
|
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
/* global variable declarations: */
|
|
|
|
|
2023-06-19 13:13:38 +08:00
|
|
|
static const char *FILENAME[] = {"cache_api_test", NULL};
|
2019-12-12 05:58:59 +08:00
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
/* macro definitions */
|
|
|
|
|
|
|
|
/* private function declarations: */
|
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
static bool check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id);
|
|
|
|
static bool check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id);
|
|
|
|
static bool mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id);
|
2020-09-30 22:27:10 +08:00
|
|
|
static H5AC_cache_config_t *init_invalid_configs(void);
|
2023-09-06 04:11:52 +08:00
|
|
|
static bool check_fapl_mdc_api_errs(void);
|
|
|
|
static bool check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id);
|
2019-08-16 05:46:00 +08:00
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
/********************************* tests: *********************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2016-05-24 22:46:42 +08:00
|
|
|
* Function: check_fapl_mdc_api_calls()
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Purpose: Verify that the file access property list related
|
|
|
|
* metadata cache related API calls are functioning
|
|
|
|
* correctly.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Since we have tested the H5C code elsewhere, it should
|
|
|
|
* be sufficient to verify that the desired configuration
|
|
|
|
* data is getting to the cache.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2023-09-06 04:11:52 +08:00
|
|
|
* Return: Test pass status (true/false)
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2023-09-06 04:11:52 +08:00
|
|
|
static bool
|
2017-03-14 12:30:37 +08:00
|
|
|
check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
|
2006-01-29 10:34:14 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename[512];
|
|
|
|
herr_t result;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fapl_id = H5I_INVALID_HID;
|
|
|
|
hid_t test_fapl_id = H5I_INVALID_HID;
|
|
|
|
hid_t file_id = H5I_INVALID_HID;
|
2022-07-27 05:45:46 +08:00
|
|
|
H5F_t *file_ptr = NULL;
|
|
|
|
H5C_t *cache_ptr = NULL;
|
2006-01-29 10:34:14 +08:00
|
|
|
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5AC_cache_config_t mod_config = {
|
|
|
|
/* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ false,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ (1 * 1024 * 1024 + 1),
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.2,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ (16 * 1024 * 1024 + 1),
|
|
|
|
/* size_t min_size = */ (1 * 1024 * 1024 + 1),
|
|
|
|
/* long int epoch_length = */ 50001,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.91,
|
|
|
|
/* double increment = */ 2.1,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ (4 * 1024 * 1024 + 1),
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 2.0,
|
|
|
|
/* double flash_threshold = */ 0.5,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.998,
|
|
|
|
/* double decrement = */ 0.91,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
|
|
|
|
/* int epochs_before_eviction = */ 4,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ true,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double empty_reserve = */ 0.05,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
2006-01-29 10:34:14 +08:00
|
|
|
H5AC_cache_config_t scratch;
|
|
|
|
H5C_auto_size_ctl_t default_auto_size_ctl;
|
|
|
|
H5C_auto_size_ctl_t mod_auto_size_ctl;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (paged)
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC/FAPL related API calls for paged aggregation strategy");
|
2017-03-14 12:30:37 +08:00
|
|
|
else
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC/FAPL related API calls");
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = true;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
XLATE_EXT_TO_INT_MDC_CONFIG(default_auto_size_ctl, default_config)
|
|
|
|
XLATE_EXT_TO_INT_MDC_CONFIG(mod_auto_size_ctl, mod_config)
|
|
|
|
|
|
|
|
/* Create a FAPL and verify that it contains the default
|
|
|
|
* initial mdc configuration
|
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fapl_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
|
|
|
|
|
|
|
result = H5Pget_mdc_config(fapl_id, &scratch);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pget_mdc_config() failed.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-09-06 04:11:52 +08:00
|
|
|
else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, true, true)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "retrieved config doesn't match default.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modify the initial mdc configuration in a FAPL, and verify that
|
|
|
|
* the changes can be read back
|
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
result = H5Pset_mdc_config(fapl_id, &mod_config);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pset_mdc_config() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
|
|
|
|
|
|
|
result = H5Pget_mdc_config(fapl_id, &scratch);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pget_mdc_config() failed.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-09-06 04:11:52 +08:00
|
|
|
else if (!CACHE_CONFIGS_EQUAL(mod_config, scratch, true, true)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "retrieved config doesn't match mod config.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(fapl_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pclose() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open a file using the default FAPL. Verify that the resulting
|
|
|
|
* metadata cache uses the default configuration as well. Get a
|
|
|
|
* copy of the FAPL from the file, and verify that it contains the
|
|
|
|
* default initial meta data cache configuration. Close and delete
|
|
|
|
* the file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* setup the file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "h5_fixname() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create the file using the default FAPL */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2017-03-14 12:30:37 +08:00
|
|
|
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (file_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fcreate() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get a pointer to the files internal data structure */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2018-10-10 23:10:15 +08:00
|
|
|
file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (file_ptr == NULL) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "Can't get file_ptr.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
cache_ptr = file_ptr->shared->cache;
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that we can access the internal version of the cache config */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-05-16 02:54:58 +08:00
|
|
|
if (cache_ptr == NULL || cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "Can't access cache resize_ctl.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-04 00:01:28 +08:00
|
|
|
/* compare the cache's internal configuration with the expected value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
if (!resize_configs_are_equal(&default_auto_size_ctl, &cache_ptr->resize_ctl, true)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
[svn-r18917] Description:
Bring r18911 (plus some adaptions to match the code on the trunk)
from the metadata journaling "merging" branch to the trunk:
More general changes to align trunk with eventual changes from
metadata journaling branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.3 (amazon) in debug mode
Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2010-05-28 04:27:13 +08:00
|
|
|
failure_mssg = "Unexpected value(s) in cache resize_ctl 1.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get a copy of the files FAPL */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
fapl_id = H5Fget_access_plist(file_id);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fapl_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_access_plist() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compare the initial cache config from the copy of the file's FAPL
|
|
|
|
* to the expected value. If all goes well, close the copy of the FAPL.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
|
|
|
|
|
|
|
result = H5Pget_mdc_config(fapl_id, &scratch);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pget_mdc_config() failed.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-09-06 04:11:52 +08:00
|
|
|
else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, true, true)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "config retrieved from file doesn't match default.";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else if (H5Pclose(fapl_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pclose() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the file and delete it */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Fclose() failed.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2021-09-30 02:28:12 +08:00
|
|
|
else if (H5Fdelete(filename, H5P_DEFAULT) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2021-09-30 02:28:12 +08:00
|
|
|
failure_mssg = "H5Fdelete() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open a file using a FAPL with a modified initial metadata cache
|
|
|
|
* configuration. Verify that the resulting metadata cache uses the
|
|
|
|
* modified configuration as well. Get a copy of the FAPL from the
|
|
|
|
* file, and verify that it contains the modified initial meta data
|
|
|
|
* cache configuration. Close and delete the file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Create a FAPL */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fapl_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Modify the initial mdc configuration in the FAPL. */
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
result = H5Pset_mdc_config(fapl_id, &mod_config);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pset_mdc_config() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup the file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "h5_fixname() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create the file using the modified FAPL */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2017-03-14 12:30:37 +08:00
|
|
|
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (file_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fcreate() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get a pointer to the files internal data structure */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2018-10-10 23:10:15 +08:00
|
|
|
file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (file_ptr == NULL) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "Can't get file_ptr.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
cache_ptr = file_ptr->shared->cache;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that we can access the internal version of the cache config */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-05-16 02:54:58 +08:00
|
|
|
if (cache_ptr == NULL || cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "Can't access cache resize_ctl.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-04 00:01:28 +08:00
|
|
|
/* compare the cache's internal configuration with the expected value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
if (!resize_configs_are_equal(&mod_auto_size_ctl, &cache_ptr->resize_ctl, true)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
[svn-r18917] Description:
Bring r18911 (plus some adaptions to match the code on the trunk)
from the metadata journaling "merging" branch to the trunk:
More general changes to align trunk with eventual changes from
metadata journaling branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.3 (amazon) in debug mode
Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2010-05-28 04:27:13 +08:00
|
|
|
failure_mssg = "Unexpected value(s) in cache resize_ctl 2.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get a copy of the files FAPL */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
test_fapl_id = H5Fget_access_plist(file_id);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (test_fapl_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_access_plist() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compare the initial cache config from the copy of the file's FAPL
|
|
|
|
* to the expected value. If all goes well, close the copy of the FAPL.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
|
|
|
|
|
|
|
result = H5Pget_mdc_config(test_fapl_id, &scratch);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pget_mdc_config() failed.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-09-06 04:11:52 +08:00
|
|
|
else if (!CACHE_CONFIGS_EQUAL(mod_config, scratch, true, true)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "config retrieved from file doesn't match.";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else if (H5Pclose(test_fapl_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Pclose() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-30 02:28:12 +08:00
|
|
|
/* close the file and delete it */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-09-30 02:28:12 +08:00
|
|
|
if (H5Fclose(file_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2021-09-30 02:28:12 +08:00
|
|
|
failure_mssg = "H5Fclose() failed.\n";
|
|
|
|
}
|
|
|
|
else if (H5Fdelete(filename, fapl_id) < 0) {
|
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2021-09-30 02:28:12 +08:00
|
|
|
failure_mssg = "H5Fdelete() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-30 02:28:12 +08:00
|
|
|
/* close the fapl used to create the file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-09-30 02:28:12 +08:00
|
|
|
if (H5Pclose(fapl_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2021-09-30 02:28:12 +08:00
|
|
|
failure_mssg = "H5Pclose() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
PASSED();
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
H5_FAILED();
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-25 02:03:53 +08:00
|
|
|
return pass;
|
2015-05-15 10:16:09 +08:00
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
} /* check_fapl_mdc_api_calls() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2016-05-24 22:46:42 +08:00
|
|
|
* Function: check_file_mdc_api_calls()
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Purpose: Verify that the file related metadata cache API calls are
|
|
|
|
* functioning correctly.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Since we have tested the H5C code elsewhere, it should
|
|
|
|
* be sufficient to verify that the desired configuration
|
|
|
|
* data is getting in and out of the cache. Similarly,
|
|
|
|
* we need only verify that the cache monitoring calls
|
|
|
|
* return the data that the cache thinks they should return.
|
|
|
|
* We shouldn't need to verify data correctness beyond that
|
|
|
|
* point.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2023-09-06 04:11:52 +08:00
|
|
|
* Return: Test pass status (true/false)
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2023-09-06 04:11:52 +08:00
|
|
|
static bool
|
2017-03-14 12:30:37 +08:00
|
|
|
check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
|
2006-01-29 10:34:14 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename[512];
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file_id = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
size_t max_size;
|
|
|
|
size_t min_clean_size;
|
|
|
|
size_t cur_size;
|
|
|
|
int cur_num_entries;
|
|
|
|
double hit_rate;
|
2006-01-29 10:34:14 +08:00
|
|
|
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5AC_cache_config_t mod_config_1 = {
|
|
|
|
/* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ false,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ (1 * 1024 * 1024 + 1),
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.2,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ (16 * 1024 * 1024 + 1),
|
|
|
|
/* size_t min_size = */ (1 * 1024 * 1024 + 1),
|
|
|
|
/* long int epoch_length = */ 50001,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.91,
|
|
|
|
/* double increment = */ 2.1,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ (4 * 1024 * 1024 + 1),
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 2.0,
|
|
|
|
/* double flash_threshold = */ 0.5,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.998,
|
|
|
|
/* double decrement = */ 0.91,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
|
|
|
|
/* int epochs_before_eviction = */ 4,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ true,
|
2021-10-08 10:59:10 +08:00
|
|
|
/* double empty_reserve = */ 0.05,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
|
|
|
H5AC_cache_config_t mod_config_2 = {
|
|
|
|
/* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ true,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ (512 * 1024),
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.1,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ (8 * 1024 * 1024),
|
|
|
|
/* size_t min_size = */ (512 * 1024),
|
|
|
|
/* long int epoch_length = */ 25000,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.9,
|
|
|
|
/* double increment = */ 2.0,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ (2 * 1024 * 1024),
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 1.5,
|
|
|
|
/* double flash_threshold = */ 0.4,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.9995,
|
|
|
|
/* double decrement = */ 0.95,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ (512 * 1024),
|
|
|
|
/* int epochs_before_eviction = */ 4,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ true,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double empty_reserve = */ 0.05,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
|
|
|
H5AC_cache_config_t mod_config_3 = {
|
|
|
|
/* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ false,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ (1 * 1024 * 1024),
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.2,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ (16 * 1024 * 1024),
|
|
|
|
/* size_t min_size = */ (1 * 1024 * 1024),
|
|
|
|
/* long int epoch_length = */ 50000,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.90,
|
|
|
|
/* double increment = */ 2.0,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ (4 * 1024 * 1024),
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 2.1,
|
|
|
|
/* double flash_threshold = */ 0.6,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.999,
|
|
|
|
/* double decrement = */ 0.9,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
|
|
|
|
/* int epochs_before_eviction = */ 3,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ false,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double empty_reserve = */ 0.05,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
|
|
|
H5AC_cache_config_t mod_config_4 = {
|
|
|
|
/* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ false,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ (1 * 1024 * 1024),
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.15,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ (20 * 1024 * 1024),
|
|
|
|
/* size_t min_size = */ (1 * 1024 * 1024),
|
|
|
|
/* long int epoch_length = */ 75000,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.9,
|
|
|
|
/* double increment = */ 2.0,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ (2 * 1024 * 1024),
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 1.1,
|
|
|
|
/* double flash_threshold = */ 0.3,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */
|
|
|
|
H5C_decr__age_out_with_threshold,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.999,
|
|
|
|
/* double decrement = */ 0.9,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ (1 * 1024 * 1024),
|
|
|
|
/* int epochs_before_eviction = */ 3,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ true,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double empty_reserve = */ 0.1,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
|
|
|
|
|
|
|
if (paged)
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC/FILE related API calls for paged aggregation strategy");
|
2017-03-14 12:30:37 +08:00
|
|
|
else
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC/FILE related API calls");
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = true;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* Open a file with the default FAPL. Verify that the cache is
|
|
|
|
* configured as per the default both by looking at its internal
|
|
|
|
* configuration, and via the H5Fget_mdc_config() call.
|
|
|
|
*
|
2021-12-07 22:27:29 +08:00
|
|
|
* Then set several different configurations, and verify that
|
2006-01-29 10:34:14 +08:00
|
|
|
* they took as per above.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* setup the file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "h5_fixname() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create the file using the default FAPL */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2017-03-14 12:30:37 +08:00
|
|
|
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (file_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fcreate() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is set to the default config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &default_config, true, 1);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* set alternate config 1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fset_mdc_config(file_id, &mod_config_1) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() failed 1.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is now set to the alternate config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &mod_config_1, true, 2);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* set alternate config 2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fset_mdc_config(file_id, &mod_config_2) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() failed 2.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is now set to the alternate config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &mod_config_2, true, 3);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* set alternate config 3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fset_mdc_config(file_id, &mod_config_3) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() failed 3.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is now set to the alternate config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &mod_config_3, true, 4);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* set alternate config 4 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fset_mdc_config(file_id, &mod_config_4) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() failed 4.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is now set to the alternate config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &mod_config_4, true, 5);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* Run some quick smoke checks on the cache status monitoring
|
|
|
|
* calls -- no interesting data as the cache hasn't had a
|
|
|
|
* chance to do much yet.
|
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fget_mdc_hit_rate(file_id, &hit_rate) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_hit_rate() failed 1.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2021-05-08 00:45:05 +08:00
|
|
|
else if (!H5_DBL_ABS_EQUAL(hit_rate, 0.0)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_hit_rate() returned unexpected hit rate.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fget_mdc_size(file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_size() failed 1.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else if ((mod_config_4.initial_size != max_size) ||
|
|
|
|
(min_clean_size != (size_t)((double)max_size * mod_config_4.min_clean_fraction))) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the file and delete it */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Fclose() failed.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2021-09-30 02:28:12 +08:00
|
|
|
else if (H5Fdelete(filename, H5P_DEFAULT) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2021-09-30 02:28:12 +08:00
|
|
|
failure_mssg = "H5Fdelete() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
PASSED();
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
H5_FAILED();
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!pass) {
|
2019-08-16 05:46:00 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-25 02:03:53 +08:00
|
|
|
return pass;
|
2015-05-15 10:16:09 +08:00
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
} /* check_file_mdc_api_calls() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: mdc_api_call_smoke_check()
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Purpose: Initial basic functional test to see if there are problems
|
|
|
|
* with the cache API calls.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* NOTE: This test takes some time to run and checks the
|
2022-05-18 00:54:05 +08:00
|
|
|
* testing express level value.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2023-09-06 04:11:52 +08:00
|
|
|
* Return: Test pass status (true/false)
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
#define CHUNK_SIZE 2
|
|
|
|
#define DSET_SIZE (200 * CHUNK_SIZE)
|
|
|
|
#define NUM_DSETS 6
|
|
|
|
#define NUM_RANDOM_ACCESSES 200000
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
static bool
|
2017-03-14 12:30:37 +08:00
|
|
|
mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
|
2006-01-29 10:34:14 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename[512];
|
2023-09-06 04:11:52 +08:00
|
|
|
bool valid_chunk;
|
|
|
|
bool dump_hit_rate = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
int64_t min_accesses = 1000;
|
2021-05-08 00:45:05 +08:00
|
|
|
double min_hit_rate = 0.90;
|
2023-09-06 04:11:52 +08:00
|
|
|
bool dump_cache_size = false;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file_id = H5I_INVALID_HID;
|
|
|
|
hid_t dataspace_id = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t filespace_ids[NUM_DSETS];
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t memspace_id = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t dataset_ids[NUM_DSETS];
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t properties = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
char dset_name[64];
|
|
|
|
int i, j, k, l, m, n;
|
|
|
|
herr_t status;
|
|
|
|
hsize_t dims[2];
|
|
|
|
hsize_t a_size[2];
|
|
|
|
hsize_t offset[2];
|
|
|
|
hsize_t chunk_size[2];
|
|
|
|
int data_chunk[CHUNK_SIZE][CHUNK_SIZE];
|
2006-01-29 10:34:14 +08:00
|
|
|
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5AC_cache_config_t mod_config_1 = {
|
|
|
|
/* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ false,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ 500000,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.1,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ 16000000,
|
|
|
|
/* size_t min_size = */ 250000,
|
|
|
|
/* long int epoch_length = */ 50000,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.95,
|
|
|
|
/* double increment = */ 2.0,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ 4000000,
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 2.0,
|
|
|
|
/* double flash_threshold = */ 0.5,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.999,
|
|
|
|
/* double decrement = */ 0.9,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ 1000000,
|
|
|
|
/* int epochs_before_eviction = */ 2,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ true,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double empty_reserve = */ 0.05,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
|
|
|
H5AC_cache_config_t mod_config_2 = {
|
|
|
|
/* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ false,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ 12000000,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.1,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ 16000000,
|
|
|
|
/* size_t min_size = */ 250000,
|
|
|
|
/* long int epoch_length = */ 50000,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.95,
|
|
|
|
/* double increment = */ 2.0,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ 4000000,
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 2.0,
|
|
|
|
/* double flash_threshold = */ 0.5,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.999,
|
|
|
|
/* double decrement = */ 0.9,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ 1000000,
|
|
|
|
/* int epochs_before_eviction = */ 2,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ true,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double empty_reserve = */ 0.05,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
|
|
|
H5AC_cache_config_t mod_config_3 = {
|
|
|
|
/* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool rpt_fcn_enabled = */ false,
|
|
|
|
/* bool open_trace_file = */ false,
|
|
|
|
/* bool close_trace_file = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* char trace_file_name[] = */ "",
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool evictions_enabled = */ true,
|
|
|
|
/* bool set_initial_size = */ true,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t initial_size = */ 2000000,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double min_clean_fraction = */ 0.1,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_size = */ 16000000,
|
|
|
|
/* size_t min_size = */ 250000,
|
|
|
|
/* long int epoch_length = */ 50000,
|
|
|
|
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double lower_hr_threshold = */ 0.95,
|
|
|
|
/* double increment = */ 2.0,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_increment = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_increment = */ 4000000,
|
|
|
|
/* enum H5C_cache_flash_incr_mode */
|
|
|
|
/* flash_incr_mode = */ H5C_flash_incr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double flash_multiple = */ 2.0,
|
|
|
|
/* double flash_threshold = */ 0.5,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double upper_hr_threshold = */ 0.999,
|
|
|
|
/* double decrement = */ 0.9,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_max_decrement = */ false,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* size_t max_decrement = */ 1000000,
|
|
|
|
/* int epochs_before_eviction = */ 2,
|
2023-09-06 04:11:52 +08:00
|
|
|
/* bool apply_empty_reserve = */ true,
|
2021-05-08 00:45:05 +08:00
|
|
|
/* double empty_reserve = */ 0.05,
|
2020-09-30 22:27:10 +08:00
|
|
|
/* int dirty_bytes_threshold = */ (256 * 1024),
|
|
|
|
/* int metadata_write_strategy = */
|
|
|
|
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
|
|
|
|
|
|
|
|
if (paged)
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC API smoke check for paged aggregation strategy");
|
2017-03-14 12:30:37 +08:00
|
|
|
else
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC API smoke check");
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = true;
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (express_test > 0) {
|
2008-01-20 13:01:29 +08:00
|
|
|
|
|
|
|
SKIPPED();
|
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " Long tests disabled.\n");
|
2008-01-20 13:01:29 +08:00
|
|
|
|
2016-05-25 02:03:53 +08:00
|
|
|
return pass;
|
2008-01-20 13:01:29 +08:00
|
|
|
}
|
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
/* Open a file with the default FAPL. Verify that the cache is
|
|
|
|
* configured as per the default both by looking at its internal
|
|
|
|
* configuration, and via the H5Fget_mdc_config() call.
|
|
|
|
*
|
|
|
|
* Then set the cache to mod_config_1, which fixes cache size at
|
|
|
|
* 500000 bytes, and turns off automatic cache resize.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* setup the file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "h5_fixname() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create the file using the default FAPL */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2017-03-14 12:30:37 +08:00
|
|
|
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (file_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fcreate() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is set to the default config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &default_config, true, 1);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* set alternate config 1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fset_mdc_config(file_id, &mod_config_1) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() failed 1.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is now set to the alternate config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &mod_config_1, true, 2);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* create the datasets */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (i < NUM_DSETS)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
/* create a dataspace for the chunked dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
dims[0] = DSET_SIZE;
|
|
|
|
dims[1] = DSET_SIZE;
|
2006-01-29 10:34:14 +08:00
|
|
|
dataspace_id = H5Screate_simple(2, dims, NULL);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (dataspace_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Screate_simple() failed.";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the dataset creation plist to specify that the raw data is
|
2021-12-07 22:27:29 +08:00
|
|
|
* to be partitioned into 10X10 element chunks.
|
2006-01-29 10:34:14 +08:00
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
chunk_size[0] = CHUNK_SIZE;
|
|
|
|
chunk_size[1] = CHUNK_SIZE;
|
2020-09-30 22:27:10 +08:00
|
|
|
properties = H5Pcreate(H5P_DATASET_CREATE);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (properties < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pcreate() failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_chunk(properties, 2, chunk_size) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pset_chunk() failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create the dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-16 06:13:18 +08:00
|
|
|
snprintf(dset_name, sizeof(dset_name), "/dset%03d", i);
|
2020-09-30 22:27:10 +08:00
|
|
|
dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT,
|
|
|
|
properties, H5P_DEFAULT);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (dataset_ids[i] < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
failure_mssg = "H5Dcreate2() failed.";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the file space ID */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
filespace_ids[i] = H5Dget_space(dataset_ids[i]);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (filespace_ids[i] < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Dget_space() failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create the mem space to be used to read and write chunks */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
dims[0] = CHUNK_SIZE;
|
|
|
|
dims[1] = CHUNK_SIZE;
|
2006-01-29 10:34:14 +08:00
|
|
|
memspace_id = H5Screate_simple(2, dims, NULL);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (memspace_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Screate_simple() failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* select in memory hyperslab */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
offset[0] = 0; /*offset of hyperslab in memory*/
|
2006-01-29 10:34:14 +08:00
|
|
|
offset[1] = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
|
2006-01-29 10:34:14 +08:00
|
|
|
a_size[1] = CHUNK_SIZE;
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL, a_size, NULL);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Sselect_hyperslab() failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize all datasets on a round robin basis */
|
|
|
|
i = 0;
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (i < DSET_SIZE)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
j = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (j < DSET_SIZE)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
m = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (m < NUM_DSETS)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
/* initialize the slab */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (k = 0; k < CHUNK_SIZE; k++) {
|
|
|
|
for (l = 0; l < CHUNK_SIZE; l++) {
|
|
|
|
data_chunk[k][l] = (DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l;
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* select on disk hyperslab */
|
2015-06-16 00:07:38 +08:00
|
|
|
offset[0] = (hsize_t)i; /*offset of hyperslab in file*/
|
|
|
|
offset[1] = (hsize_t)j;
|
2020-09-30 22:27:10 +08:00
|
|
|
a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
|
2006-01-29 10:34:14 +08:00
|
|
|
a_size[1] = CHUNK_SIZE;
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "disk H5Sselect_hyperslab() failed.";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write the chunk to file */
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
|
|
|
|
data_chunk);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Dwrite() failed.";
|
|
|
|
}
|
|
|
|
m++;
|
|
|
|
}
|
|
|
|
j += CHUNK_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check the cache hit rate, and reset the counters.
|
|
|
|
* Hit rate should be just about unity here, so we will just
|
|
|
|
* get the data and (possibly) print it without checking it
|
|
|
|
* beyond ensuring that it agrees with the cache internal
|
|
|
|
* data structures.
|
|
|
|
*
|
|
|
|
* similarly, check cache size.
|
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((pass) && (i % (DSET_SIZE / 4) == 0)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, min_accesses, min_hit_rate);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, dump_cache_size);
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
i += CHUNK_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set alternate config 2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fset_mdc_config(file_id, &mod_config_2) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() failed 2.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is now set to the alternate config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &mod_config_2, true, 3);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* do random reads on all datasets */
|
|
|
|
n = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (n < NUM_RANDOM_ACCESSES)) {
|
2024-04-08 06:15:25 +08:00
|
|
|
m = rand() % NUM_DSETS;
|
|
|
|
i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
|
|
|
|
j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* select on disk hyperslab */
|
2015-06-16 00:07:38 +08:00
|
|
|
offset[0] = (hsize_t)i; /*offset of hyperslab in file*/
|
|
|
|
offset[1] = (hsize_t)j;
|
2020-09-30 22:27:10 +08:00
|
|
|
a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
|
2006-01-29 10:34:14 +08:00
|
|
|
a_size[1] = CHUNK_SIZE;
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
failure_mssg = "disk hyperslab create failed.";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* read the chunk from file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
|
|
|
|
data_chunk);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
failure_mssg = "disk hyperslab create failed.";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* validate the slab */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
valid_chunk = true;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (k = 0; k < CHUNK_SIZE; k++) {
|
|
|
|
for (l = 0; l < CHUNK_SIZE; l++) {
|
|
|
|
if (data_chunk[k][l] != ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l)) {
|
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
valid_chunk = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!valid_chunk) {
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "slab validation failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((pass) && (n % (NUM_RANDOM_ACCESSES / 4) == 0)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, min_accesses, min_hit_rate);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, dump_cache_size);
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the file spaces we are done with */
|
|
|
|
i = 1;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (i < NUM_DSETS)) {
|
|
|
|
if (H5Sclose(filespace_ids[i]) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Sclose() failed.";
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the datasets we are done with */
|
|
|
|
i = 1;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (i < NUM_DSETS)) {
|
|
|
|
if (H5Dclose(dataset_ids[i]) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Dclose() failed.";
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set alternate config 3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fset_mdc_config(file_id, &mod_config_3) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() failed 3.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that the cache is now set to the alternate config */
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &mod_config_3, true, 4);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* do random reads on data set 0 only */
|
|
|
|
m = 0;
|
|
|
|
n = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (n < NUM_RANDOM_ACCESSES)) {
|
2024-04-08 06:15:25 +08:00
|
|
|
i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
|
|
|
|
j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* select on disk hyperslab */
|
2015-06-16 00:07:38 +08:00
|
|
|
offset[0] = (hsize_t)i; /*offset of hyperslab in file*/
|
|
|
|
offset[1] = (hsize_t)j;
|
2020-09-30 22:27:10 +08:00
|
|
|
a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
|
2006-01-29 10:34:14 +08:00
|
|
|
a_size[1] = CHUNK_SIZE;
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
failure_mssg = "disk hyperslab create failed.";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* read the chunk from file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
|
|
|
|
data_chunk);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
failure_mssg = "disk hyperslab create failed.";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* validate the slab */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
valid_chunk = true;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (k = 0; k < CHUNK_SIZE; k++) {
|
|
|
|
for (l = 0; l < CHUNK_SIZE; l++) {
|
|
|
|
if (data_chunk[k][l] != ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l)) {
|
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
valid_chunk = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!valid_chunk) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "slab validation failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((pass) && (n % (NUM_RANDOM_ACCESSES / 4) == 0)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, min_accesses, min_hit_rate);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, dump_cache_size);
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
n++;
|
2006-07-14 01:59:39 +08:00
|
|
|
}
|
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
/* close file space 0 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(filespace_ids[0]) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Sclose(filespace_ids[0]) failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the data space */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(dataspace_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Sclose(dataspace) failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the mem space */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(memspace_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Sclose(memspace_id) failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close dataset 0 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dataset_ids[0]) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Dclose(dataset_ids[0]) failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the file and delete it */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "H5Fclose() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
2021-09-30 02:28:12 +08:00
|
|
|
else if (H5Fdelete(filename, H5P_DEFAULT) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2021-09-30 02:28:12 +08:00
|
|
|
failure_mssg = "H5Fdelete() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2019-08-16 05:46:00 +08:00
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
PASSED();
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
H5_FAILED();
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!pass) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-25 02:03:53 +08:00
|
|
|
return pass;
|
2015-05-15 10:16:09 +08:00
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
} /* mdc_api_call_smoke_check() */
|
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: init_invalid_configs()
|
|
|
|
*
|
|
|
|
* Purpose: Initialize an array of invalid external MDC configurations
|
|
|
|
* that will be used to test error rejection in the MDC-
|
|
|
|
* related API calls.
|
|
|
|
*
|
|
|
|
* Note: It is assumed that boolean parameters are only set
|
2023-09-06 04:11:52 +08:00
|
|
|
* to true/false.
|
2015-06-13 11:40:33 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Return: Success: Pointer to an array of cache configurations.
|
|
|
|
* Failure: NULL
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
2006-01-29 10:34:14 +08:00
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
#define NUM_INVALID_CONFIGS 36
|
|
|
|
static H5AC_cache_config_t *invalid_configs = NULL;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
static H5AC_cache_config_t *
|
2020-09-30 22:27:10 +08:00
|
|
|
init_invalid_configs(void)
|
|
|
|
{
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
int i;
|
|
|
|
H5AC_cache_config_t *configs = NULL;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
/* Allocate memory */
|
2023-06-29 06:48:12 +08:00
|
|
|
if (NULL == (configs = (H5AC_cache_config_t *)calloc(NUM_INVALID_CONFIGS, sizeof(H5AC_cache_config_t)))) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set defaults for all configs */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < NUM_INVALID_CONFIGS; i++) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[i].version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
2023-09-06 04:11:52 +08:00
|
|
|
configs[i].rpt_fcn_enabled = false;
|
|
|
|
configs[i].open_trace_file = false;
|
|
|
|
configs[i].close_trace_file = false;
|
2016-05-24 22:46:42 +08:00
|
|
|
/* trace file name set to all ASCII NUL by calloc() */
|
2023-09-06 04:11:52 +08:00
|
|
|
configs[i].evictions_enabled = true;
|
|
|
|
configs[i].set_initial_size = true;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[i].initial_size = (1 * 1024 * 1024);
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[i].min_clean_fraction = 0.25;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[i].max_size = (16 * 1024 * 1024);
|
|
|
|
configs[i].min_size = (1 * 1024 * 1024);
|
|
|
|
configs[i].epoch_length = 50000;
|
|
|
|
configs[i].incr_mode = H5C_incr__threshold;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[i].lower_hr_threshold = 0.9;
|
|
|
|
configs[i].increment = 2.0;
|
2023-09-06 04:11:52 +08:00
|
|
|
configs[i].apply_max_increment = true;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[i].max_increment = (4 * 1024 * 1024);
|
|
|
|
configs[i].flash_incr_mode = H5C_flash_incr__off;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[i].flash_multiple = 2.0;
|
|
|
|
configs[i].flash_threshold = 0.5;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[i].decr_mode = H5C_decr__age_out_with_threshold;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[i].upper_hr_threshold = 0.999;
|
|
|
|
configs[i].decrement = 0.9;
|
2023-09-06 04:11:52 +08:00
|
|
|
configs[i].apply_max_decrement = true;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[i].max_decrement = (1 * 1024 * 1024);
|
|
|
|
configs[i].epochs_before_eviction = 3;
|
2023-09-06 04:11:52 +08:00
|
|
|
configs[i].apply_empty_reserve = true;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[i].empty_reserve = 0.1;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[i].dirty_bytes_threshold = (256 * 1024);
|
|
|
|
configs[i].metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set badness for each config */
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* 0 -- bad version */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[0].version = -1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
/* 1 -- open_trace_file == true and empty trace_file_name */
|
|
|
|
configs[1].open_trace_file = true;
|
2016-05-24 22:46:42 +08:00
|
|
|
/* trace file name set to all ASCII NUL by calloc() */
|
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 2 -- max_size too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[2].max_size = H5C__MAX_MAX_CACHE_SIZE + 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 3 -- min_size too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[3].min_size = H5C__MIN_MAX_CACHE_SIZE - 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 4 -- min_size > max_size */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[4].max_size = (16 * 1024 * 1024);
|
|
|
|
configs[4].min_size = (16 * 1024 * 1024 + 1);
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 5 -- initial size out of range (too big) */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[5].initial_size = (16 * 1024 * 1024 + 1);
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 6 -- initial_size out of range (too small) */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[6].initial_size = (1 * 1024 * 1024 - 1);
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 7 -- min_clean_fraction too big */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[7].min_clean_fraction = 1.000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 8 -- min_clean_fraction too small */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[8].min_clean_fraction = -0.00000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 9 -- epoch_length too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[9].epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 10 -- epoch_length too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[10].epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 11 -- invalid incr_mode */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[11].incr_mode = (enum H5C_cache_incr_mode) - 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 12 -- lower_hr_threshold too small */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[12].lower_hr_threshold = -0.000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 13 -- lower_hr_threshold too big */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[13].lower_hr_threshold = 1.00000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 14 -- increment too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[14].increment = 0.999999999999;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 15 -- invalid flash_incr_mode */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[15].flash_incr_mode = (enum H5C_cache_flash_incr_mode) - 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 16 -- flash_multiple too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[16].flash_incr_mode = H5C_flash_incr__add_space;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[16].flash_multiple = 0.09;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 17 -- flash_multiple too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[17].flash_incr_mode = H5C_flash_incr__add_space;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[17].flash_multiple = 10.001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 18 -- flash_threshold too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[18].flash_incr_mode = H5C_flash_incr__add_space;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[18].flash_threshold = 0.099;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 19 -- flash_threshold too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[19].flash_incr_mode = H5C_flash_incr__add_space;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[19].flash_threshold = 1.001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 20 -- bad decr_mode */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[20].decr_mode = (enum H5C_cache_decr_mode) - 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 21 -- upper_hr_threshold too big */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[21].upper_hr_threshold = 1.00001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 22 -- decrement too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[22].decr_mode = H5C_decr__threshold;
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[22].decrement = -0.0000000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 23 -- decrement too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[23].decr_mode = H5C_decr__threshold;
|
|
|
|
configs[23].decrement = 1.0000000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 24 -- epochs_before_eviction too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[24].epochs_before_eviction = 0;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 25 -- epochs_before_eviction too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[25].epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 26 -- empty_reserve too small */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[26].empty_reserve = -0.0000000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 27 -- empty_reserve too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[27].empty_reserve = 1.00000000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 28 -- upper_hr_threshold too small */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[28].upper_hr_threshold = -0.000000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 29 -- upper_hr_threshold too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[29].upper_hr_threshold = 1.00000001;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 30 -- upper_hr_threshold <= lower_hr_threshold */
|
2021-05-08 00:45:05 +08:00
|
|
|
configs[30].lower_hr_threshold = 0.9;
|
|
|
|
configs[30].upper_hr_threshold = 0.9;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 31 -- dirty_bytes_threshold too small */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[31].dirty_bytes_threshold = (H5C__MIN_MAX_CACHE_SIZE / 2) - 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 32 -- dirty_bytes_threshold too big */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[32].dirty_bytes_threshold = (H5C__MAX_MAX_CACHE_SIZE / 4) + 1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 33 -- attempt to disable evictions when auto incr enabled */
|
2023-09-06 04:11:52 +08:00
|
|
|
configs[33].evictions_enabled = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[33].decr_mode = H5C_decr__off;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 34 -- attempt to disable evictions when auto decr enabled */
|
2023-09-06 04:11:52 +08:00
|
|
|
configs[34].evictions_enabled = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[34].decr_mode = H5C_decr__age_out;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2015-10-20 14:28:17 +08:00
|
|
|
/* 35 -- unknown metadata write strategy */
|
2020-09-30 22:27:10 +08:00
|
|
|
configs[35].metadata_write_strategy = -1;
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
return configs;
|
|
|
|
|
|
|
|
} /* initialize_invalid_configs() */
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2016-05-24 22:46:42 +08:00
|
|
|
* Function: check_fapl_mdc_api_errs()
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Purpose: Verify that the FAPL related MDC API calls reject input
|
|
|
|
* errors gracefully.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2023-09-06 04:11:52 +08:00
|
|
|
* Return: Test pass status (true/false)
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2023-09-06 04:11:52 +08:00
|
|
|
static bool
|
2006-01-29 10:34:14 +08:00
|
|
|
check_fapl_mdc_api_errs(void)
|
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
static char msg[128];
|
|
|
|
int i;
|
|
|
|
herr_t result;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fapl_id = H5I_INVALID_HID;
|
2006-01-29 10:34:14 +08:00
|
|
|
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
|
|
|
|
H5AC_cache_config_t scratch;
|
|
|
|
|
|
|
|
TESTING("MDC/FAPL related API input errors");
|
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = true;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* first test H5Pget_mdc_config().
|
|
|
|
*/
|
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
result = H5Pget_mdc_config((hid_t)H5I_INVALID_HID, &scratch);
|
2021-03-17 23:25:39 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pget_mdc_config() accepted invalid plist_id.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-14 01:59:39 +08:00
|
|
|
/* Create a FAPL for test purposes, and verify that it contains the
|
2006-01-29 10:34:14 +08:00
|
|
|
* default MDC configuration.
|
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fapl_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((pass) && ((H5Pget_mdc_config(fapl_id, &scratch) < 0) ||
|
2023-09-06 04:11:52 +08:00
|
|
|
(!CACHE_CONFIGS_EQUAL(default_config, scratch, true, true)))) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "New FAPL has unexpected metadata cache config?!?!?.\n";
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Pget_mdc_config(fapl_id, NULL);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pget_mdc_config() accepted NULL config_ptr.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* one last test for H5Pget_mdc_config() */
|
|
|
|
|
|
|
|
scratch.version = -1; /* a convenient, invalid value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Pget_mdc_config(fapl_id, &scratch);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pget_mdc_config() accepted bad config version.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now test H5Pset_mdc_config()
|
|
|
|
*/
|
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
result = H5Pset_mdc_config((hid_t)H5I_INVALID_HID, &default_config);
|
2021-03-17 23:25:39 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pset_mdc_config() accepted bad invalid plist_id.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Pset_mdc_config(fapl_id, NULL);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Pset_mdc_config() accepted NULL config_ptr.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (i < NUM_INVALID_CONFIGS)) {
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Pset_mdc_config(fapl_id, &(invalid_configs[i]));
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2023-09-16 06:13:18 +08:00
|
|
|
snprintf(msg, (size_t)128, "H5Pset_mdc_config() accepted invalid_configs[%d].", i);
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = msg;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that none of the above calls to H5Pset_mdc_config() changed
|
|
|
|
* the configuration in the FAPL.
|
|
|
|
*/
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((pass) && ((H5Pget_mdc_config(fapl_id, &scratch) < 0) ||
|
2023-09-06 04:11:52 +08:00
|
|
|
(!CACHE_CONFIGS_EQUAL(default_config, scratch, true, true)))) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "FAPL metadata cache config changed???.\n";
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
PASSED();
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
H5_FAILED();
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!pass) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-25 02:03:53 +08:00
|
|
|
return pass;
|
2015-05-15 10:16:09 +08:00
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
} /* check_fapl_mdc_api_errs() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2016-05-24 22:46:42 +08:00
|
|
|
* Function: check_file_mdc_api_errs()
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Purpose: Verify that the file related MDC API calls reject input
|
|
|
|
* errors gracefully.
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2023-09-06 04:11:52 +08:00
|
|
|
* Return: Test pass status (true/false)
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2023-09-06 04:11:52 +08:00
|
|
|
static bool
|
2017-03-14 12:30:37 +08:00
|
|
|
check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
|
2006-01-29 10:34:14 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename[512];
|
|
|
|
static char msg[128];
|
2023-09-06 04:11:52 +08:00
|
|
|
bool show_progress = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
int i;
|
|
|
|
herr_t result;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file_id = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
size_t max_size;
|
|
|
|
size_t min_clean_size;
|
|
|
|
size_t cur_size;
|
|
|
|
int cur_num_entries;
|
|
|
|
double hit_rate;
|
2006-01-29 10:34:14 +08:00
|
|
|
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
|
|
|
|
H5AC_cache_config_t scratch;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (paged)
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC/FILE related API input errors for paged aggregation strategy");
|
2017-03-14 12:30:37 +08:00
|
|
|
else
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("MDC/FILE related API input errors");
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = true;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2021-12-07 22:27:29 +08:00
|
|
|
/* Create a file for test purposes, and verify that its metadata cache
|
2006-01-29 10:34:14 +08:00
|
|
|
* set to the default MDC configuration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* setup the file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: calling h5_fixname().\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "h5_fixname() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: calling H5Fcreate().\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2017-03-14 12:30:37 +08:00
|
|
|
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (file_id < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fcreate() failed.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &default_config, true, 1);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* test H5Fget_mdc_config(). */
|
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
result = H5Fget_mdc_config((hid_t)H5I_INVALID_HID, &scratch);
|
2021-03-17 23:25:39 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_config() accepted invalid file_id.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Fget_mdc_config(file_id, NULL);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_config() accepted NULL config_ptr.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scratch.version = -1; /* a convenient, invalid value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Fget_mdc_config(file_id, &scratch);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_config() accepted bad config version.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* test H5Fset_mdc_config() */
|
|
|
|
|
|
|
|
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
result = H5Fset_mdc_config((hid_t)H5I_INVALID_HID, &default_config);
|
2021-03-17 23:25:39 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() accepted bad invalid file_id.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Fset_mdc_config(file_id, NULL);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fset_mdc_config() accepted NULL config_ptr.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
while ((pass) && (i < NUM_INVALID_CONFIGS)) {
|
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fset_mdc_config() with invalid config %d.\n", __func__, i);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Fset_mdc_config(file_id, &(invalid_configs[i]));
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2023-09-16 06:13:18 +08:00
|
|
|
snprintf(msg, (size_t)128, "H5Fset_mdc_config() accepted invalid_configs[%d].", i);
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = msg;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* verify that none of the above calls to H5Fset_mdc_config() changed
|
|
|
|
* the configuration in the FAPL.
|
|
|
|
*/
|
2023-09-06 04:11:52 +08:00
|
|
|
validate_mdc_config(file_id, &default_config, true, 2);
|
2006-01-29 10:34:14 +08:00
|
|
|
|
|
|
|
/* test H5Fget_mdc_hit_rate() */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
result = H5Fget_mdc_hit_rate((hid_t)H5I_INVALID_HID, &hit_rate);
|
2021-03-17 23:25:39 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_hit_rate() accepted bad file_id.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
result = H5Fget_mdc_hit_rate(file_id, NULL);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_hit_rate() accepted NULL hit_rate_ptr.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* test H5Freset_mdc_hit_rate_stats() */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
result = H5Freset_mdc_hit_rate_stats((hid_t)H5I_INVALID_HID);
|
2021-03-17 23:25:39 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2020-09-30 22:27:10 +08:00
|
|
|
failure_mssg = "H5Freset_mdc_hit_rate_stats() accepted bad file_id.";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* test H5Fget_mdc_size() */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
result = H5Fget_mdc_size((hid_t)H5I_INVALID_HID, &max_size, &min_clean_size, &cur_size,
|
|
|
|
&cur_num_entries);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (result >= 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_size() accepted bad file_id.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((H5Fget_mdc_size(file_id, &max_size, NULL, NULL, NULL) < 0) ||
|
|
|
|
(H5Fget_mdc_size(file_id, NULL, &min_clean_size, NULL, NULL) < 0) ||
|
|
|
|
(H5Fget_mdc_size(file_id, NULL, NULL, &cur_size, NULL) < 0) ||
|
|
|
|
(H5Fget_mdc_size(file_id, NULL, NULL, NULL, &cur_num_entries) < 0) ||
|
|
|
|
(H5Fget_mdc_size(file_id, NULL, NULL, NULL, NULL) < 0)) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fget_mdc_size() failed to handle NULL params.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the file and delete it */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (show_progress) {
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: cleaning up from tests.\n", __func__);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-07-14 01:59:39 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file_id) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2006-01-29 10:34:14 +08:00
|
|
|
failure_mssg = "H5Fclose() failed.\n";
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2021-09-30 02:28:12 +08:00
|
|
|
else if (H5Fdelete(filename, H5P_DEFAULT) < 0) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
pass = false;
|
2021-09-30 02:28:12 +08:00
|
|
|
failure_mssg = "H5Fdelete() failed.\n";
|
2006-01-29 10:34:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (pass) {
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
PASSED();
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
|
|
|
H5_FAILED();
|
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!pass) {
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2016-05-24 22:46:42 +08:00
|
|
|
}
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2016-05-25 02:03:53 +08:00
|
|
|
return pass;
|
2015-05-15 10:16:09 +08:00
|
|
|
|
2006-01-29 10:34:14 +08:00
|
|
|
} /* check_file_mdc_api_errs() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2016-05-24 22:46:42 +08:00
|
|
|
* Function: main
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Purpose: Run tests on the cache code contained in H5C.c
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
2016-05-24 22:46:42 +08:00
|
|
|
* Return: EXIT_SUCCESS/EXIT_FAILURE
|
2006-01-29 10:34:14 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
2015-05-15 10:16:09 +08:00
|
|
|
unsigned nerrs = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
int express_test;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fcpl_id = H5I_INVALID_HID;
|
|
|
|
hid_t fcpl2_id = H5I_INVALID_HID;
|
2017-03-14 12:30:37 +08:00
|
|
|
unsigned paged;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2008-01-20 13:01:29 +08:00
|
|
|
H5open();
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2008-01-20 13:01:29 +08:00
|
|
|
express_test = GetTestExpress();
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2023-06-28 23:31:32 +08:00
|
|
|
printf("===================================\n");
|
|
|
|
printf("Cache API tests\n");
|
|
|
|
printf(" express_test = %d\n", express_test);
|
|
|
|
printf("===================================\n");
|
2015-05-15 10:16:09 +08:00
|
|
|
|
2016-05-24 22:46:42 +08:00
|
|
|
/* Initialize invalid configurations.
|
|
|
|
*/
|
|
|
|
invalid_configs = init_invalid_configs();
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == invalid_configs) {
|
2016-05-24 22:46:42 +08:00
|
|
|
failure_mssg = "Unable to allocate memory for invalid configs.";
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2016-05-24 22:46:42 +08:00
|
|
|
return EXIT_FAILURE;
|
2017-03-14 12:30:37 +08:00
|
|
|
} /* end if */
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) {
|
2017-03-14 12:30:37 +08:00
|
|
|
failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2017-03-14 12:30:37 +08:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
} /* end if */
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2017-03-14 12:30:37 +08:00
|
|
|
/* Set file space strategy to default or paged aggregation strategy */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fcpl2_id = H5Pcopy(fcpl_id)) < 0) {
|
2017-03-14 12:30:37 +08:00
|
|
|
failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2017-03-14 12:30:37 +08:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
} /* end if */
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_file_space_strategy(fcpl2_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0) {
|
2017-03-14 12:30:37 +08:00
|
|
|
failure_mssg = "H5Pset_file_space_strategy() failed.\n";
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2017-03-14 12:30:37 +08:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
} /* end if */
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2017-03-14 12:30:37 +08:00
|
|
|
/* Test with paged aggregation enabled or not */
|
2021-12-07 22:27:29 +08:00
|
|
|
/* The "my_fcpl" passed to each test has the paged or non-paged strategy set up accordingly */
|
2023-09-06 04:11:52 +08:00
|
|
|
for (paged = false; paged <= true; paged++) {
|
2017-03-14 12:30:37 +08:00
|
|
|
hid_t my_fcpl = fcpl_id;
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2021-09-30 02:28:12 +08:00
|
|
|
if (paged) {
|
|
|
|
/* Only run paged aggregation tests with sec2/default driver */
|
|
|
|
if (!h5_using_default_driver(NULL))
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
my_fcpl = fcpl2_id;
|
|
|
|
}
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!check_fapl_mdc_api_calls(paged, my_fcpl))
|
2017-03-14 12:30:37 +08:00
|
|
|
nerrs += 1;
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!check_file_mdc_api_calls(paged, my_fcpl))
|
2017-03-14 12:30:37 +08:00
|
|
|
nerrs += 1;
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!mdc_api_call_smoke_check(express_test, paged, my_fcpl))
|
2017-03-14 12:30:37 +08:00
|
|
|
nerrs += 1;
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!check_file_mdc_api_errs(paged, my_fcpl))
|
2017-03-14 12:30:37 +08:00
|
|
|
nerrs += 1;
|
|
|
|
} /* end for paged */
|
2016-05-25 02:03:53 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!check_fapl_mdc_api_errs())
|
2016-05-24 22:46:42 +08:00
|
|
|
nerrs += 1;
|
2006-01-29 10:34:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (invalid_configs)
|
2023-06-29 06:48:12 +08:00
|
|
|
free(invalid_configs);
|
2016-05-24 22:46:42 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(fcpl_id) < 0) {
|
2017-03-14 12:30:37 +08:00
|
|
|
failure_mssg = "H5Pclose() failed.\n";
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg);
|
2017-03-14 12:30:37 +08:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
} /* end if */
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (nerrs > 0)
|
2016-05-24 22:46:42 +08:00
|
|
|
return EXIT_FAILURE;
|
2017-02-28 13:45:55 +08:00
|
|
|
else
|
2016-05-24 22:46:42 +08:00
|
|
|
return EXIT_SUCCESS;
|
2006-01-29 10:34:14 +08:00
|
|
|
} /* main() */
|