2003-04-01 01:59:04 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 01:59:04 +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. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/***********************************************************
|
2020-09-30 22:27:10 +08:00
|
|
|
*
|
|
|
|
* Test program: titerate
|
|
|
|
*
|
|
|
|
* Test the Group & Attribute functionality
|
|
|
|
*
|
|
|
|
*************************************************************/
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2001-04-04 02:09:16 +08:00
|
|
|
#include "testhdf5.h"
|
2019-01-24 23:42:19 +08:00
|
|
|
#include "H5srcdir.h"
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
#define DATAFILE "titerate.h5"
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Number of datasets for group iteration test */
|
|
|
|
#define NDATASETS 50
|
|
|
|
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Number of attributes for attribute iteration test */
|
2000-04-06 04:51:44 +08:00
|
|
|
#define NATTR 50
|
|
|
|
|
2000-04-12 23:44:48 +08:00
|
|
|
/* Number of groups for second group iteration test */
|
2002-08-10 05:55:44 +08:00
|
|
|
#define ITER_NGROUPS 150
|
2000-04-12 23:44:48 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* General maximum length of names used */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define NAMELEN 80
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2000-04-12 23:44:48 +08:00
|
|
|
/* 1-D dataset with fixed dimensions */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define SPACE1_RANK 1
|
|
|
|
#define SPACE1_DIM1 4
|
2000-04-12 23:44:48 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
typedef enum { RET_ZERO, RET_TWO, RET_CHANGE, RET_CHANGE2 } iter_enum;
|
2001-09-26 01:46:32 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Custom group iteration callback data */
|
|
|
|
typedef struct {
|
2020-09-30 22:27:10 +08:00
|
|
|
char name[NAMELEN]; /* The name of the object */
|
|
|
|
H5O_type_t type; /* The type of the object */
|
|
|
|
iter_enum command; /* The type of return value */
|
2000-04-06 04:51:44 +08:00
|
|
|
} iter_info;
|
|
|
|
|
2019-01-24 23:42:19 +08:00
|
|
|
/* Definition for test_corrupted_attnamelen */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define CORRUPTED_ATNAMELEN_FILE "memleak_H5O_dtype_decode_helper_H5Odtype.h5"
|
|
|
|
#define DSET_NAME "image"
|
2019-01-24 23:42:19 +08:00
|
|
|
typedef struct searched_err_t {
|
2021-01-08 06:16:00 +08:00
|
|
|
char message[256];
|
2020-12-24 23:12:01 +08:00
|
|
|
hbool_t found;
|
2019-01-24 23:42:19 +08:00
|
|
|
} searched_err_t;
|
|
|
|
|
|
|
|
/* Call back function for test_corrupted_attnamelen */
|
|
|
|
static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data);
|
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Local functions */
|
2020-09-30 22:27:10 +08:00
|
|
|
int iter_strcmp(const void *s1, const void *s2);
|
|
|
|
int iter_strcmp2(const void *s1, const void *s2);
|
|
|
|
static herr_t liter_cb(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);
|
|
|
|
static herr_t liter_cb2(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);
|
|
|
|
herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo, void *op_data);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** iter_strcmp(): String comparison routine for qsort
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-06 04:51:44 +08:00
|
|
|
****************************************************************/
|
2020-09-30 22:27:10 +08:00
|
|
|
H5_ATTR_PURE int
|
|
|
|
iter_strcmp(const void *s1, const void *s2)
|
2000-04-06 04:51:44 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
return (HDstrcmp(*(const char *const *)s1, *(const char *const *)s2));
|
2000-04-06 04:51:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
**
|
2007-08-31 04:03:37 +08:00
|
|
|
** liter_cb(): Custom link iteration callback routine.
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-06 04:51:44 +08:00
|
|
|
****************************************************************/
|
2007-08-31 04:03:37 +08:00
|
|
|
static herr_t
|
2020-01-17 05:29:34 +08:00
|
|
|
liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
|
2020-09-30 22:27:10 +08:00
|
|
|
void *op_data)
|
2000-04-06 04:51:44 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
iter_info *info = (iter_info *)op_data;
|
|
|
|
static int count = 0;
|
2006-10-02 18:24:03 +08:00
|
|
|
static int count2 = 0;
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
HDstrcpy(info->name, name);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
switch (info->command) {
|
2000-04-06 04:51:44 +08:00
|
|
|
case RET_ZERO:
|
2020-09-30 22:27:10 +08:00
|
|
|
return (0);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2003-06-23 21:25:06 +08:00
|
|
|
case RET_TWO:
|
2020-09-30 22:27:10 +08:00
|
|
|
return (2);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
case RET_CHANGE:
|
|
|
|
count++;
|
2020-09-30 22:27:10 +08:00
|
|
|
return (count > 10 ? 1 : 0);
|
2006-10-02 18:24:03 +08:00
|
|
|
|
|
|
|
case RET_CHANGE2:
|
|
|
|
count2++;
|
2020-09-30 22:27:10 +08:00
|
|
|
return (count2 > 10 ? 1 : 0);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
default:
|
2019-01-11 09:51:42 +08:00
|
|
|
HDprintf("invalid iteration command");
|
2020-09-30 22:27:10 +08:00
|
|
|
return (-1);
|
2000-04-06 04:51:44 +08:00
|
|
|
} /* end switch */
|
2007-08-31 04:03:37 +08:00
|
|
|
} /* end liter_cb() */
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** test_iter_group(): Test group iteration functionality
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-06 04:51:44 +08:00
|
|
|
****************************************************************/
|
2007-08-31 04:03:37 +08:00
|
|
|
static void
|
|
|
|
test_iter_group(hid_t fapl, hbool_t new_format)
|
2000-04-06 04:51:44 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t file; /* File ID */
|
|
|
|
hid_t dataset; /* Dataset ID */
|
|
|
|
hid_t datatype; /* Common datatype ID */
|
|
|
|
hid_t filespace; /* Common dataspace ID */
|
|
|
|
hid_t root_group, grp; /* Root group ID */
|
|
|
|
int i; /* counting variable */
|
|
|
|
hsize_t idx; /* Index in the group */
|
|
|
|
char name[NAMELEN]; /* temporary name buffer */
|
2022-07-27 05:45:46 +08:00
|
|
|
char *lnames[NDATASETS + 2]; /* Names of the links created */
|
2020-09-30 22:27:10 +08:00
|
|
|
char dataset_name[NAMELEN]; /* dataset name */
|
|
|
|
iter_info info; /* Custom iteration information */
|
|
|
|
H5G_info_t ginfo; /* Buffer for querying object's info */
|
|
|
|
herr_t ret; /* Generic return value */
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing Group Iteration Functionality\n"));
|
|
|
|
|
|
|
|
/* Create the test file with the datasets */
|
2006-10-02 18:24:03 +08:00
|
|
|
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(file, FAIL, "H5Fcreate");
|
|
|
|
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Test iterating over empty group */
|
2007-08-31 04:03:37 +08:00
|
|
|
info.command = RET_ZERO;
|
2020-09-30 22:27:10 +08:00
|
|
|
idx = 0;
|
|
|
|
ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, SUCCEED, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
datatype = H5Tcopy(H5T_NATIVE_INT);
|
|
|
|
CHECK(datatype, FAIL, "H5Tcopy");
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
filespace = H5Screate(H5S_SCALAR);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(filespace, FAIL, "H5Screate");
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < NDATASETS; i++) {
|
2022-06-23 02:58:18 +08:00
|
|
|
HDsnprintf(name, sizeof(name), "Dataset %d", i);
|
[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
|
|
|
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Keep a copy of the dataset names around for later */
|
2006-10-02 18:24:03 +08:00
|
|
|
lnames[i] = HDstrdup(name);
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(lnames[i], "strdup");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Dclose(dataset);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end for */
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
/* Create a group and named datatype under root group for testing */
|
2007-08-24 04:25:25 +08:00
|
|
|
grp = H5Gcreate2(file, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Gcreate2");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
lnames[NDATASETS] = HDstrdup("grp");
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(lnames[NDATASETS], "strdup");
|
2006-10-02 18:24:03 +08:00
|
|
|
|
[svn-r14156] Description:
Add API versioning to H5Tcommit()
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 2.6 (smirom) 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
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 10:50:31 +08:00
|
|
|
ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Tcommit2");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
lnames[NDATASETS + 1] = HDstrdup("dtype");
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(lnames[NDATASETS], "strdup");
|
2006-10-02 18:24:03 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Close everything up */
|
2007-09-14 02:26:12 +08:00
|
|
|
ret = H5Tclose(datatype);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
ret = H5Gclose(grp);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
ret = H5Sclose(filespace);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
ret = H5Fclose(file);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
/* Sort the dataset names */
|
2006-10-31 04:00:57 +08:00
|
|
|
HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Iterate through the datasets in the root group in various ways */
|
2006-10-02 18:24:03 +08:00
|
|
|
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(file, FAIL, "H5Fopen");
|
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
/* These two functions, H5Oget_info_by_idx and H5Lget_name_by_idx, actually
|
2002-11-26 01:59:14 +08:00
|
|
|
* iterate through B-tree for group members in internal library design.
|
|
|
|
*/
|
2007-09-14 01:04:36 +08:00
|
|
|
root_group = H5Gopen2(file, "/", H5P_DEFAULT);
|
|
|
|
CHECK(root_group, FAIL, "H5Gopen2");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
[svn-r14223] Description:
Change existing H5Gget_info -> H5Gget_info_by_name and add new version
of H5Gget_info, with simpler parameters, to better match new API 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-31 05:57:50 +08:00
|
|
|
ret = H5Gget_info(root_group, &ginfo);
|
2007-09-14 01:04:36 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gget_info");
|
|
|
|
VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < (int)ginfo.nlinks; i++) {
|
|
|
|
H5O_info2_t oinfo; /* Object info */
|
2003-07-08 03:02:46 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i,
|
|
|
|
dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
|
2007-09-14 01:04:36 +08:00
|
|
|
CHECK(ret, FAIL, "H5Lget_name_by_idx");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2021-01-08 06:16:00 +08:00
|
|
|
//! [H5Oget_info_by_idx3_snip]
|
2020-12-16 11:18:54 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
|
|
|
|
H5O_INFO_BASIC, H5P_DEFAULT);
|
2007-09-14 02:26:12 +08:00
|
|
|
CHECK(ret, FAIL, "H5Oget_info_by_idx");
|
2020-12-16 11:18:54 +08:00
|
|
|
|
2021-01-08 06:16:00 +08:00
|
|
|
//! [H5Oget_info_by_idx3_snip]
|
2020-12-16 11:18:54 +08:00
|
|
|
|
2007-09-14 01:04:36 +08:00
|
|
|
} /* end for */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret =
|
|
|
|
(herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3),
|
|
|
|
dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
|
|
|
|
}
|
|
|
|
H5E_END_TRY;
|
2007-09-14 01:04:36 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Lget_name_by_idx");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
2007-09-14 01:04:36 +08:00
|
|
|
ret = H5Gclose(root_group);
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
/* These two functions, H5Oget_info_by_idx and H5Lget_name_by_idx, actually
|
2003-08-22 21:50:01 +08:00
|
|
|
* iterate through B-tree for group members in internal library design.
|
|
|
|
* (Same as test above, but with the file ID instead of opening the root group)
|
|
|
|
*/
|
[svn-r14223] Description:
Change existing H5Gget_info -> H5Gget_info_by_name and add new version
of H5Gget_info, with simpler parameters, to better match new API 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-31 05:57:50 +08:00
|
|
|
ret = H5Gget_info(file, &ginfo);
|
2007-09-14 01:04:36 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gget_info");
|
|
|
|
VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info");
|
2003-08-22 21:50:01 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < (int)ginfo.nlinks; i++) {
|
|
|
|
H5O_info2_t oinfo; /* Object info */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name,
|
|
|
|
(size_t)NAMELEN, H5P_DEFAULT);
|
2007-09-14 01:04:36 +08:00
|
|
|
CHECK(ret, FAIL, "H5Lget_name_by_idx");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = H5Oget_info_by_idx3(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC,
|
|
|
|
H5P_DEFAULT);
|
2020-01-17 05:29:34 +08:00
|
|
|
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
|
2007-09-14 02:26:12 +08:00
|
|
|
} /* end for */
|
2003-08-22 21:50:01 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3),
|
|
|
|
dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
|
|
|
|
}
|
|
|
|
H5E_END_TRY;
|
2007-09-14 01:04:36 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Lget_name_by_idx");
|
|
|
|
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Test invalid indices for starting iteration */
|
2006-10-02 18:24:03 +08:00
|
|
|
info.command = RET_ZERO;
|
2020-09-30 22:27:10 +08:00
|
|
|
idx = (hsize_t)-1;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_END_TRY;
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
|
|
|
/* Test skipping exactly as many entries as in the group */
|
2006-10-02 18:24:03 +08:00
|
|
|
idx = NDATASETS + 2;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_END_TRY;
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
|
|
|
/* Test skipping more entries than are in the group */
|
2006-10-02 18:24:03 +08:00
|
|
|
idx = NDATASETS + 3;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_END_TRY;
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Test all objects in group, when callback always returns 0 */
|
2006-10-02 18:24:03 +08:00
|
|
|
info.command = RET_ZERO;
|
2020-09-30 22:27:10 +08:00
|
|
|
idx = 0;
|
|
|
|
if ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0)
|
2004-01-10 09:41:13 +08:00
|
|
|
TestErrPrintf("Group iteration function didn't return zero correctly!\n");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Test all objects in group, when callback always returns 1 */
|
|
|
|
/* This also tests the "restarting" ability, because the index changes */
|
2006-10-02 18:24:03 +08:00
|
|
|
info.command = RET_TWO;
|
2020-09-30 22:27:10 +08:00
|
|
|
i = 0;
|
|
|
|
idx = 0;
|
|
|
|
while ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) {
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Verify return value from iterator gets propagated correctly */
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, 2, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
/* Increment the number of times "2" is returned */
|
2000-04-06 04:51:44 +08:00
|
|
|
i++;
|
|
|
|
|
|
|
|
/* Verify that the index is the correct value */
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(idx, (hsize_t)i, "H5Literate2");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (idx > (NDATASETS + 2))
|
2006-10-02 18:24:03 +08:00
|
|
|
TestErrPrintf("Group iteration function walked too far!\n");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Verify that the correct name is retrieved */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
|
|
|
|
TestErrPrintf(
|
|
|
|
"Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n",
|
|
|
|
(unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end while */
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, -1, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (i != (NDATASETS + 2))
|
|
|
|
TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n",
|
|
|
|
__LINE__);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Test all objects in group, when callback changes return value */
|
|
|
|
/* This also tests the "restarting" ability, because the index changes */
|
2006-10-02 18:24:03 +08:00
|
|
|
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
|
2020-09-30 22:27:10 +08:00
|
|
|
i = 0;
|
|
|
|
idx = 0;
|
|
|
|
while ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) {
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Verify return value from iterator gets propagated correctly */
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, 1, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Increment the number of times "1" is returned */
|
|
|
|
i++;
|
|
|
|
|
|
|
|
/* Verify that the index is the correct value */
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(idx, (hsize_t)(i + 10), "H5Literate2");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (idx > (NDATASETS + 2))
|
2006-10-02 18:24:03 +08:00
|
|
|
TestErrPrintf("Group iteration function walked too far!\n");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Verify that the correct name is retrieved */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
|
|
|
|
TestErrPrintf(
|
|
|
|
"Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n",
|
|
|
|
(unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end while */
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(ret, -1, "H5Literate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (i != 42 || idx != 52)
|
|
|
|
TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n",
|
|
|
|
__LINE__);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Fclose(file);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
/* Free the dataset names */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < (NDATASETS + 2); i++)
|
2006-10-02 18:24:03 +08:00
|
|
|
HDfree(lnames[i]);
|
2000-04-06 04:51:44 +08:00
|
|
|
} /* test_iter_group() */
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** aiter_cb(): Custom group iteration callback routine.
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-06 04:51:44 +08:00
|
|
|
****************************************************************/
|
2006-10-02 18:24:03 +08:00
|
|
|
herr_t
|
2020-09-30 22:27:10 +08:00
|
|
|
aiter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *op_data)
|
2000-04-06 04:51:44 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
iter_info *info = (iter_info *)op_data;
|
|
|
|
static int count = 0;
|
2006-10-02 18:24:03 +08:00
|
|
|
static int count2 = 0;
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
HDstrcpy(info->name, name);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
switch (info->command) {
|
2000-04-06 04:51:44 +08:00
|
|
|
case RET_ZERO:
|
2020-09-30 22:27:10 +08:00
|
|
|
return (0);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2003-06-23 21:25:06 +08:00
|
|
|
case RET_TWO:
|
2020-09-30 22:27:10 +08:00
|
|
|
return (2);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
case RET_CHANGE:
|
|
|
|
count++;
|
2020-09-30 22:27:10 +08:00
|
|
|
return (count > 10 ? 1 : 0);
|
2006-10-02 18:24:03 +08:00
|
|
|
|
|
|
|
case RET_CHANGE2:
|
|
|
|
count2++;
|
2020-09-30 22:27:10 +08:00
|
|
|
return (count2 > 10 ? 1 : 0);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
default:
|
2019-08-16 05:46:00 +08:00
|
|
|
HDprintf("invalid iteration command");
|
2020-09-30 22:27:10 +08:00
|
|
|
return (-1);
|
2000-04-06 04:51:44 +08:00
|
|
|
} /* end switch */
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end aiter_cb() */
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** test_iter_attr(): Test attribute iteration functionality
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-06 04:51:44 +08:00
|
|
|
****************************************************************/
|
2020-09-30 22:27:10 +08:00
|
|
|
static void
|
|
|
|
test_iter_attr(hid_t fapl, hbool_t new_format)
|
2000-04-06 04:51:44 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t file; /* File ID */
|
|
|
|
hid_t dataset; /* Common Dataset ID */
|
|
|
|
hid_t filespace; /* Common dataspace ID */
|
|
|
|
hid_t attribute; /* Attribute ID */
|
|
|
|
int i; /* counting variable */
|
|
|
|
hsize_t idx; /* Index in the attribute list */
|
|
|
|
char name[NAMELEN]; /* temporary name buffer */
|
2022-07-27 05:45:46 +08:00
|
|
|
char *anames[NATTR]; /* Names of the attributes created */
|
2020-09-30 22:27:10 +08:00
|
|
|
iter_info info; /* Custom iteration information */
|
|
|
|
herr_t ret; /* Generic return value */
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing Attribute Iteration Functionality\n"));
|
|
|
|
|
|
|
|
/* Create the test file with the datasets */
|
2006-10-02 18:24:03 +08:00
|
|
|
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(file, FAIL, "H5Fcreate");
|
|
|
|
|
2007-10-04 23:06:28 +08:00
|
|
|
filespace = H5Screate(H5S_SCALAR);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(filespace, FAIL, "H5Screate");
|
|
|
|
|
[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
|
|
|
dataset = H5Dcreate2(file, "Dataset", H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < NATTR; i++) {
|
2022-06-23 02:58:18 +08:00
|
|
|
HDsnprintf(name, sizeof(name), "Attribute %02d", i);
|
[svn-r14218] Description:
Changed H5Acreate2 -> H5Acreate_by_name, to be more consistent with
other new API routines.
Re-added simpler form of H5Acreate2, which creates attributes directly
on an object.
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-31 02:13:48 +08:00
|
|
|
attribute = H5Acreate2(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT);
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
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-05 06:19:07 +08:00
|
|
|
CHECK(attribute, FAIL, "H5Acreate2");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Keep a copy of the attribute names around for later */
|
2007-10-04 23:06:28 +08:00
|
|
|
anames[i] = HDstrdup(name);
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(anames[i], "strdup");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2007-10-04 23:06:28 +08:00
|
|
|
ret = H5Aclose(attribute);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Aclose");
|
2007-10-04 23:06:28 +08:00
|
|
|
} /* end for */
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Close everything up */
|
2007-10-04 23:06:28 +08:00
|
|
|
ret = H5Dclose(dataset);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
2007-10-04 23:06:28 +08:00
|
|
|
ret = H5Sclose(filespace);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
2007-10-04 23:06:28 +08:00
|
|
|
ret = H5Fclose(file);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
/* Iterate through the attributes on the dataset in various ways */
|
2007-10-04 23:06:28 +08:00
|
|
|
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(file, FAIL, "H5Fopen");
|
|
|
|
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
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-09 03:59:36 +08:00
|
|
|
dataset = H5Dopen2(file, "Dataset", H5P_DEFAULT);
|
|
|
|
CHECK(dataset, FAIL, "H5Dopen2");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Test invalid indices for starting iteration */
|
2007-10-04 23:06:28 +08:00
|
|
|
info.command = RET_ZERO;
|
2003-06-23 21:25:06 +08:00
|
|
|
|
|
|
|
/* Test skipping exactly as many attributes as there are */
|
2007-10-04 23:06:28 +08:00
|
|
|
idx = NATTR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info);
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_END_TRY;
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Aiterate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
|
|
|
/* Test skipping more attributes than there are */
|
2007-10-04 23:06:28 +08:00
|
|
|
idx = NATTR + 1;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info);
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_END_TRY;
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Aiterate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Test all attributes on dataset, when callback always returns 0 */
|
2007-02-13 22:50:48 +08:00
|
|
|
info.command = RET_ZERO;
|
2020-09-30 22:27:10 +08:00
|
|
|
idx = 0;
|
|
|
|
if ((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0)
|
2004-01-10 09:41:13 +08:00
|
|
|
TestErrPrintf("Attribute iteration function didn't return zero correctly!\n");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Test all attributes on dataset, when callback always returns 1 */
|
|
|
|
/* This also tests the "restarting" ability, because the index changes */
|
2007-02-13 22:50:48 +08:00
|
|
|
info.command = RET_TWO;
|
2020-09-30 22:27:10 +08:00
|
|
|
i = 0;
|
|
|
|
idx = 0;
|
|
|
|
while ((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Verify return value from iterator gets propagated correctly */
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(ret, 2, "H5Aiterate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2006-12-07 06:19:52 +08:00
|
|
|
/* Increment the number of times "2" is returned */
|
2000-04-06 04:51:44 +08:00
|
|
|
i++;
|
|
|
|
|
|
|
|
/* Verify that the index is the correct value */
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(idx, (unsigned)i, "H5Aiterate2");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2007-03-09 04:10:12 +08:00
|
|
|
/* Don't check name when new format is used */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!new_format) {
|
2007-03-09 04:10:12 +08:00
|
|
|
/* Verify that the correct name is retrieved */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0)
|
|
|
|
TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = "
|
|
|
|
"'%s', anames[%u] = '%s'!\n",
|
|
|
|
__LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]);
|
2007-03-09 04:10:12 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end while */
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(ret, -1, "H5Aiterate2");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (i != 50 || idx != 50)
|
|
|
|
TestErrPrintf("%u: Attribute iteration function didn't perform multiple iterations correctly!\n",
|
|
|
|
__LINE__);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
/* Test all attributes on dataset, when callback changes return value */
|
|
|
|
/* This also tests the "restarting" ability, because the index changes */
|
2006-10-02 18:24:03 +08:00
|
|
|
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
|
2020-09-30 22:27:10 +08:00
|
|
|
i = 0;
|
|
|
|
idx = 0;
|
|
|
|
while ((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
|
2003-06-23 21:25:06 +08:00
|
|
|
/* Verify return value from iterator gets propagated correctly */
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(ret, 1, "H5Aiterate2");
|
2003-06-23 21:25:06 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Increment the number of times "1" is returned */
|
|
|
|
i++;
|
|
|
|
|
|
|
|
/* Verify that the index is the correct value */
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(idx, (unsigned)i + 10, "H5Aiterate2");
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2007-03-09 04:10:12 +08:00
|
|
|
/* Don't check name when new format is used */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!new_format) {
|
2007-03-09 04:10:12 +08:00
|
|
|
/* Verify that the correct name is retrieved */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0)
|
|
|
|
TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = "
|
|
|
|
"'%s', anames[%u] = '%s'!\n",
|
|
|
|
__LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]);
|
2007-03-09 04:10:12 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end while */
|
2007-10-04 23:06:28 +08:00
|
|
|
VERIFY(ret, -1, "H5Aiterate2");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (i != 40 || idx != 50)
|
|
|
|
TestErrPrintf("%u: Attribute iteration function didn't perform multiple iterations correctly!\n",
|
|
|
|
__LINE__);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = H5Fclose(file);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = H5Dclose(dataset);
|
2000-04-06 04:51:44 +08:00
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
/* Free the attribute names */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < NATTR; i++)
|
2004-01-10 09:41:13 +08:00
|
|
|
HDfree(anames[i]);
|
2000-04-06 04:51:44 +08:00
|
|
|
|
|
|
|
} /* test_iter_attr() */
|
|
|
|
|
2000-04-12 23:44:48 +08:00
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** iter_strcmp2(): String comparison routine for qsort
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-12 23:44:48 +08:00
|
|
|
****************************************************************/
|
2020-09-30 22:27:10 +08:00
|
|
|
H5_ATTR_PURE int
|
|
|
|
iter_strcmp2(const void *s1, const void *s2)
|
2000-04-12 23:44:48 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
return (HDstrcmp((const char *)s1, (const char *)s2));
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end iter_strcmp2() */
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
**
|
2007-08-31 04:03:37 +08:00
|
|
|
** liter_cb2(): Custom link iteration callback routine.
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-12 23:44:48 +08:00
|
|
|
****************************************************************/
|
2007-08-31 04:03:37 +08:00
|
|
|
static herr_t
|
2020-09-30 22:27:10 +08:00
|
|
|
liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *opdata)
|
2000-04-12 23:44:48 +08:00
|
|
|
{
|
2006-10-02 18:24:03 +08:00
|
|
|
const iter_info *test_info = (const iter_info *)opdata;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5O_info2_t oinfo;
|
|
|
|
herr_t ret; /* Generic return value */
|
2000-04-12 23:44:48 +08:00
|
|
|
|
2021-03-11 02:42:35 +08:00
|
|
|
if (HDstrcmp(name, test_info->name) != 0) {
|
2006-10-02 18:24:03 +08:00
|
|
|
TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name);
|
2020-09-30 22:27:10 +08:00
|
|
|
return (H5_ITER_ERROR);
|
2000-04-12 23:44:48 +08:00
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get type of the object and check it.
|
|
|
|
*/
|
2020-01-17 05:29:34 +08:00
|
|
|
ret = H5Oget_info_by_name3(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Oget_info_by_name3");
|
2000-04-12 23:44:48 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (test_info->type != oinfo.type) {
|
2007-09-13 23:44:56 +08:00
|
|
|
TestErrPrintf("test_info->type = %d, oinfo.type = %d\n", test_info->type, (int)oinfo.type);
|
2020-09-30 22:27:10 +08:00
|
|
|
return (H5_ITER_ERROR);
|
2000-04-12 23:44:48 +08:00
|
|
|
} /* end if */
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
return (H5_ITER_STOP);
|
2007-08-31 04:03:37 +08:00
|
|
|
} /* liter_cb2() */
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** test_iter_group_large(): Test group iteration functionality
|
|
|
|
** for groups with large #'s of objects
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-12 23:44:48 +08:00
|
|
|
****************************************************************/
|
2007-08-31 04:03:37 +08:00
|
|
|
static void
|
|
|
|
test_iter_group_large(hid_t fapl)
|
2000-04-12 23:44:48 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t file; /* HDF5 File IDs */
|
|
|
|
hid_t dataset; /* Dataset ID */
|
|
|
|
hid_t group; /* Group ID */
|
|
|
|
hid_t sid; /* Dataspace ID */
|
|
|
|
hid_t tid; /* Datatype ID */
|
|
|
|
hsize_t dims[] = {SPACE1_DIM1};
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
char gname[20]; /* Temporary group name */
|
|
|
|
iter_info *names; /* Names of objects in the root group */
|
|
|
|
iter_info *curr_name; /* Pointer to the current name in the root group */
|
|
|
|
int i;
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Compound datatype */
|
|
|
|
typedef struct s1_t {
|
|
|
|
unsigned int a;
|
|
|
|
unsigned int b;
|
2020-09-30 22:27:10 +08:00
|
|
|
float c;
|
2000-04-12 23:44:48 +08:00
|
|
|
} s1_t;
|
|
|
|
|
2016-09-28 01:29:16 +08:00
|
|
|
/* Allocate & initialize array */
|
|
|
|
names = (iter_info *)HDcalloc(sizeof(iter_info), (ITER_NGROUPS + 2));
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(names, "HDcalloc");
|
2000-05-19 00:40:20 +08:00
|
|
|
|
2000-04-12 23:44:48 +08:00
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing Large Group Iteration Functionality\n"));
|
|
|
|
|
|
|
|
/* Create file */
|
2006-10-02 18:24:03 +08:00
|
|
|
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
2000-04-12 23:44:48 +08:00
|
|
|
CHECK(file, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
/* Create dataspace for datasets */
|
|
|
|
sid = H5Screate_simple(SPACE1_RANK, dims, NULL);
|
|
|
|
CHECK(sid, FAIL, "H5Screate_simple");
|
|
|
|
|
|
|
|
/* Create a bunch of groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < ITER_NGROUPS; i++) {
|
2022-06-23 02:58:18 +08:00
|
|
|
HDsnprintf(gname, sizeof(gname), "Group_%d", i);
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Add the name to the list of objects in the root group */
|
2006-10-02 18:24:03 +08:00
|
|
|
HDstrcpy(names[i].name, gname);
|
[svn-r14154] Description:
Finish deprecating last H5G symbol (H5G_obj_t) - yay!
Lots of misc. library fixes to remove confusion between links and
objects. The tools could still use another pass, to remove h5trav_type_t type
and make the correct distinction between links & objects.
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 2.6 (smirom) 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
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 06:18:33 +08:00
|
|
|
names[i].type = H5O_TYPE_GROUP;
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Create a group */
|
2007-08-24 04:25:25 +08:00
|
|
|
group = H5Gcreate2(file, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(group, FAIL, "H5Gcreate2");
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Close a group */
|
|
|
|
ret = H5Gclose(group);
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end for */
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Create a dataset */
|
[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
|
|
|
dataset = H5Dcreate2(file, "Dataset1", H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Add the name to the list of objects in the root group */
|
2006-10-02 18:24:03 +08:00
|
|
|
HDstrcpy(names[ITER_NGROUPS].name, "Dataset1");
|
[svn-r14154] Description:
Finish deprecating last H5G symbol (H5G_obj_t) - yay!
Lots of misc. library fixes to remove confusion between links and
objects. The tools could still use another pass, to remove h5trav_type_t type
and make the correct distinction between links & objects.
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 2.6 (smirom) 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
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 06:18:33 +08:00
|
|
|
names[ITER_NGROUPS].type = H5O_TYPE_DATASET;
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
/* Close Dataspace */
|
|
|
|
ret = H5Sclose(sid);
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
|
|
/* Create a datatype */
|
2006-10-02 18:24:03 +08:00
|
|
|
tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
|
2000-04-12 23:44:48 +08:00
|
|
|
CHECK(tid, FAIL, "H5Tcreate");
|
|
|
|
|
|
|
|
/* Insert fields */
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Tinsert(tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
|
2000-04-12 23:44:48 +08:00
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Tinsert(tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
|
2000-04-12 23:44:48 +08:00
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Tinsert(tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
|
2000-04-12 23:44:48 +08:00
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
/* Save datatype for later */
|
[svn-r14156] Description:
Add API versioning to H5Tcommit()
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 2.6 (smirom) 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
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 10:50:31 +08:00
|
|
|
ret = H5Tcommit2(file, "Datatype1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Tcommit2");
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Add the name to the list of objects in the root group */
|
2006-10-02 18:24:03 +08:00
|
|
|
HDstrcpy(names[ITER_NGROUPS + 1].name, "Datatype1");
|
[svn-r14154] Description:
Finish deprecating last H5G symbol (H5G_obj_t) - yay!
Lots of misc. library fixes to remove confusion between links and
objects. The tools could still use another pass, to remove h5trav_type_t type
and make the correct distinction between links & objects.
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 2.6 (smirom) 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
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 06:18:33 +08:00
|
|
|
names[ITER_NGROUPS + 1].type = H5O_TYPE_NAMED_DATATYPE;
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Close datatype */
|
|
|
|
ret = H5Tclose(tid);
|
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
|
|
|
|
|
|
|
/* Need to sort the names in the root group, cause that's what the library does */
|
2006-10-31 04:00:57 +08:00
|
|
|
HDqsort(names, (size_t)(ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2);
|
2000-04-12 23:44:48 +08:00
|
|
|
|
|
|
|
/* Iterate through the file to see members of the root group */
|
2006-10-02 18:24:03 +08:00
|
|
|
curr_name = &names[0];
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name);
|
2020-01-17 05:29:34 +08:00
|
|
|
CHECK(ret, FAIL, "H5Literate2");
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 1; i < 100; i++) {
|
2016-08-13 17:23:53 +08:00
|
|
|
hsize_t idx = (hsize_t)i;
|
2007-08-31 04:03:37 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
curr_name = &names[i];
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name);
|
2020-01-17 05:29:34 +08:00
|
|
|
CHECK(ret, FAIL, "H5Literate2");
|
2000-04-12 23:44:48 +08:00
|
|
|
} /* end for */
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
ret = H5Fclose(file);
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
2016-09-28 01:29:16 +08:00
|
|
|
|
|
|
|
/* Release memory */
|
|
|
|
HDfree(names);
|
2000-04-12 23:44:48 +08:00
|
|
|
} /* test_iterate_group_large() */
|
|
|
|
|
2002-11-26 01:59:14 +08:00
|
|
|
/****************************************************************
|
|
|
|
**
|
2005-08-14 04:53:35 +08:00
|
|
|
** test_grp_memb_funcs(): Test group member information
|
2002-11-26 01:59:14 +08:00
|
|
|
** functionality
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2002-11-26 01:59:14 +08:00
|
|
|
****************************************************************/
|
2020-09-30 22:27:10 +08:00
|
|
|
static void
|
|
|
|
test_grp_memb_funcs(hid_t fapl)
|
2002-11-26 01:59:14 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t file; /* File ID */
|
|
|
|
hid_t dataset; /* Dataset ID */
|
|
|
|
hid_t datatype; /* Common datatype ID */
|
|
|
|
hid_t filespace; /* Common dataspace ID */
|
|
|
|
hid_t root_group, grp; /* Root group ID */
|
|
|
|
int i; /* counting variable */
|
|
|
|
char name[NAMELEN]; /* temporary name buffer */
|
2022-07-27 05:45:46 +08:00
|
|
|
char *dnames[NDATASETS + 2]; /* Names of the datasets created */
|
|
|
|
char *obj_names[NDATASETS + 2]; /* Names of the objects in group */
|
2020-09-30 22:27:10 +08:00
|
|
|
char dataset_name[NAMELEN]; /* dataset name */
|
|
|
|
ssize_t name_len; /* Length of object's name */
|
|
|
|
H5G_info_t ginfo; /* Buffer for querying object's info */
|
|
|
|
herr_t ret = SUCCEED; /* Generic return value */
|
2002-11-26 01:59:14 +08:00
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing Group Member Information Functionality\n"));
|
|
|
|
|
|
|
|
/* Create the test file with the datasets */
|
2006-10-02 18:24:03 +08:00
|
|
|
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(file, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
datatype = H5Tcopy(H5T_NATIVE_INT);
|
|
|
|
CHECK(datatype, FAIL, "H5Tcopy");
|
|
|
|
|
[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
|
|
|
filespace = H5Screate(H5S_SCALAR);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(filespace, FAIL, "H5Screate");
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < NDATASETS; i++) {
|
2022-06-23 02:58:18 +08:00
|
|
|
HDsnprintf(name, sizeof(name), "Dataset %d", i);
|
[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
|
|
|
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
|
|
|
/* Keep a copy of the dataset names around for later */
|
2006-10-02 18:24:03 +08:00
|
|
|
dnames[i] = HDstrdup(name);
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(dnames[i], "strdup");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Dclose(dataset);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end for */
|
2002-11-26 01:59:14 +08:00
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
/* Create a group and named datatype under root group for testing */
|
2007-08-24 04:25:25 +08:00
|
|
|
grp = H5Gcreate2(file, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Gcreate2");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
dnames[NDATASETS] = HDstrdup("grp");
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(dnames[NDATASETS], "strdup");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
[svn-r14156] Description:
Add API versioning to H5Tcommit()
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 2.6 (smirom) 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
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 10:50:31 +08:00
|
|
|
ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Tcommit2");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
dnames[NDATASETS + 1] = HDstrdup("dtype");
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(dnames[NDATASETS], "strdup");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2002-11-26 01:59:14 +08:00
|
|
|
/* Close everything up */
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Tclose(datatype);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Gclose(grp);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Sclose(filespace);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Fclose(file);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
/* Sort the dataset names */
|
2006-10-31 04:00:57 +08:00
|
|
|
HDqsort(dnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
|
2002-11-26 01:59:14 +08:00
|
|
|
|
|
|
|
/* Iterate through the datasets in the root group in various ways */
|
2006-10-02 18:24:03 +08:00
|
|
|
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(file, FAIL, "H5Fopen");
|
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
/* These two functions, H5Oget_info_by_idx and H5Lget_name_by_idx, actually
|
2002-11-26 01:59:14 +08:00
|
|
|
* iterate through B-tree for group members in internal library design.
|
|
|
|
*/
|
2007-08-28 23:02:54 +08:00
|
|
|
root_group = H5Gopen2(file, "/", H5P_DEFAULT);
|
|
|
|
CHECK(root_group, FAIL, "H5Gopen2");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
[svn-r14223] Description:
Change existing H5Gget_info -> H5Gget_info_by_name and add new version
of H5Gget_info, with simpler parameters, to better match new API 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-31 05:57:50 +08:00
|
|
|
ret = H5Gget_info(root_group, &ginfo);
|
2007-09-06 23:54:22 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gget_info");
|
|
|
|
VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < (int)ginfo.nlinks; i++) {
|
|
|
|
H5O_info2_t oinfo; /* Object info */
|
2003-07-08 03:02:46 +08:00
|
|
|
|
2003-08-27 02:35:37 +08:00
|
|
|
/* Test with NULL for name, to query length */
|
2020-09-30 22:27:10 +08:00
|
|
|
name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL,
|
|
|
|
(size_t)NAMELEN, H5P_DEFAULT);
|
2007-09-14 01:04:36 +08:00
|
|
|
CHECK(name_len, FAIL, "H5Lget_name_by_idx");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i,
|
|
|
|
dataset_name, (size_t)(name_len + 1), H5P_DEFAULT);
|
2007-09-14 01:04:36 +08:00
|
|
|
CHECK(ret, FAIL, "H5Lget_name_by_idx");
|
2003-08-27 02:35:37 +08:00
|
|
|
|
|
|
|
/* Double-check that the length is the same */
|
2007-09-14 01:04:36 +08:00
|
|
|
VERIFY(ret, name_len, "H5Lget_name_by_idx");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2002-11-26 01:59:14 +08:00
|
|
|
/* Keep a copy of the dataset names around for later */
|
2006-10-02 18:24:03 +08:00
|
|
|
obj_names[i] = HDstrdup(dataset_name);
|
2017-11-27 10:13:18 +08:00
|
|
|
CHECK_PTR(obj_names[i], "strdup");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
|
|
|
|
H5O_INFO_BASIC, H5P_DEFAULT);
|
2020-01-17 05:29:34 +08:00
|
|
|
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!HDstrcmp(dataset_name, "grp"))
|
2007-09-14 02:26:12 +08:00
|
|
|
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!HDstrcmp(dataset_name, "dtype"))
|
2007-09-14 02:26:12 +08:00
|
|
|
VERIFY(oinfo.type, H5O_TYPE_NAMED_DATATYPE, "H5Lget_name_by_idx");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!HDstrncmp(dataset_name, "Dataset", (size_t)7))
|
2007-09-14 02:26:12 +08:00
|
|
|
VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Lget_name_by_idx");
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end for */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret =
|
|
|
|
(herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3),
|
|
|
|
dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
|
|
|
|
}
|
|
|
|
H5E_END_TRY;
|
2007-09-14 01:04:36 +08:00
|
|
|
VERIFY(ret, FAIL, "H5Lget_name_by_idx");
|
2002-11-26 01:59:14 +08:00
|
|
|
|
|
|
|
/* Sort the dataset names */
|
2006-10-31 04:00:57 +08:00
|
|
|
HDqsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2002-11-26 01:59:14 +08:00
|
|
|
/* Compare object names */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < (int)ginfo.nlinks; i++) {
|
2002-11-26 01:59:14 +08:00
|
|
|
ret = HDstrcmp(dnames[i], obj_names[i]);
|
|
|
|
VERIFY(ret, 0, "HDstrcmp");
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end for */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2002-11-26 01:59:14 +08:00
|
|
|
ret = H5Gclose(root_group);
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Fclose(file);
|
2002-11-26 01:59:14 +08:00
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
/* Free the dataset names */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < (NDATASETS + 2); i++) {
|
2006-10-02 18:24:03 +08:00
|
|
|
HDfree(dnames[i]);
|
|
|
|
HDfree(obj_names[i]);
|
|
|
|
} /* end for */
|
2002-11-26 01:59:14 +08:00
|
|
|
} /* test_grp_memb_funcs() */
|
|
|
|
|
2004-06-23 05:08:56 +08:00
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** test_links(): Test soft and hard link iteration
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2004-06-23 05:08:56 +08:00
|
|
|
****************************************************************/
|
2020-09-30 22:27:10 +08:00
|
|
|
static void
|
|
|
|
test_links(hid_t fapl)
|
2004-06-23 05:08:56 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t file; /* File ID */
|
|
|
|
char obj_name[NAMELEN]; /* Names of the object in group */
|
|
|
|
ssize_t name_len; /* Length of object's name */
|
|
|
|
hid_t gid, gid1;
|
|
|
|
H5G_info_t ginfo; /* Buffer for querying object's info */
|
|
|
|
hsize_t i;
|
|
|
|
herr_t ret; /* Generic return value */
|
2004-06-23 05:08:56 +08:00
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality\n"));
|
|
|
|
|
|
|
|
/* Create the test file with the datasets */
|
2006-10-02 18:24:03 +08:00
|
|
|
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
2004-06-23 05:08:56 +08:00
|
|
|
CHECK(file, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
/* create groups */
|
2007-08-24 04:25:25 +08:00
|
|
|
gid = H5Gcreate2(file, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(gid, FAIL, "H5Gcreate2");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2007-08-24 04:25:25 +08:00
|
|
|
gid1 = H5Gcreate2(file, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(gid1, FAIL, "H5Gcreate2");
|
2004-06-23 05:08:56 +08:00
|
|
|
|
|
|
|
/* create soft and hard links to the group "/g1". */
|
2007-08-29 05:31:57 +08:00
|
|
|
ret = H5Lcreate_soft("something", gid, "softlink", H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Lcreate_soft");
|
2004-06-23 05:08:56 +08:00
|
|
|
|
2007-08-29 05:31:57 +08:00
|
|
|
ret = H5Lcreate_hard(gid, "/g1", H5L_SAME_LOC, "hardlink", H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Lcreate_hard");
|
2004-06-23 05:08:56 +08:00
|
|
|
|
[svn-r14223] Description:
Change existing H5Gget_info -> H5Gget_info_by_name and add new version
of H5Gget_info, with simpler parameters, to better match new API 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-31 05:57:50 +08:00
|
|
|
ret = H5Gget_info(gid, &ginfo);
|
2007-09-06 23:54:22 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gget_info");
|
|
|
|
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
|
2004-06-23 05:08:56 +08:00
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
/* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < ginfo.nlinks; i++) {
|
|
|
|
H5O_info2_t oinfo; /* Object info */
|
|
|
|
H5L_info2_t linfo; /* Link info */
|
2007-09-14 02:26:12 +08:00
|
|
|
|
|
|
|
/* Get link name */
|
2020-09-30 22:27:10 +08:00
|
|
|
name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN,
|
|
|
|
H5P_DEFAULT);
|
2007-09-14 01:04:36 +08:00
|
|
|
CHECK(name_len, FAIL, "H5Lget_name_by_idx");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
/* Get link type */
|
2020-01-17 05:29:34 +08:00
|
|
|
ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Lget_info_by_idx2");
|
2007-09-14 02:26:12 +08:00
|
|
|
|
|
|
|
/* Get object type */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (linfo.type == H5L_TYPE_HARD) {
|
|
|
|
ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
|
|
|
|
H5O_INFO_BASIC, H5P_DEFAULT);
|
2020-01-17 05:29:34 +08:00
|
|
|
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
|
2007-09-14 02:26:12 +08:00
|
|
|
} /* end if */
|
2004-06-23 05:08:56 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!HDstrcmp(obj_name, "g1.1"))
|
2007-09-14 02:26:12 +08:00
|
|
|
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (!HDstrcmp(obj_name, "hardlink"))
|
2007-09-14 02:26:12 +08:00
|
|
|
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (!HDstrcmp(obj_name, "softlink"))
|
2007-09-14 02:26:12 +08:00
|
|
|
VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx");
|
2004-06-23 05:08:56 +08:00
|
|
|
else
|
2021-03-25 00:25:50 +08:00
|
|
|
ERROR("unknown object name");
|
2007-09-14 02:26:12 +08:00
|
|
|
} /* end for */
|
2004-06-23 05:08:56 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Gclose(gid);
|
2004-06-23 05:08:56 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Gclose(gid1);
|
2004-06-23 05:08:56 +08:00
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
ret = H5Fclose(file);
|
2004-06-23 05:08:56 +08:00
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
} /* test_links() */
|
2004-07-17 04:48:40 +08:00
|
|
|
|
2019-01-24 23:42:19 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: find_err_msg_cb
|
|
|
|
*
|
|
|
|
* Purpose: Callback function to find the given error message.
|
|
|
|
* Helper function for test_corrupted_attnamelen().
|
|
|
|
*
|
|
|
|
* Return: H5_ITER_STOP when the message is found
|
|
|
|
* H5_ITER_CONT, otherwise
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2019-06-28 15:17:33 +08:00
|
|
|
find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_client_data)
|
2019-01-24 23:42:19 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
int status = H5_ITER_CONT;
|
2019-01-24 23:42:19 +08:00
|
|
|
searched_err_t *searched_err = (searched_err_t *)_client_data;
|
|
|
|
|
|
|
|
if (searched_err == NULL)
|
2019-03-10 11:41:38 +08:00
|
|
|
return H5_ITER_ERROR;
|
2019-07-31 01:39:20 +08:00
|
|
|
|
2019-01-24 23:42:19 +08:00
|
|
|
/* If the searched error message is found, stop the iteration */
|
2020-10-24 08:13:05 +08:00
|
|
|
if (err_desc->desc != NULL && HDstrcmp(err_desc->desc, searched_err->message) == 0) {
|
2020-12-24 23:12:01 +08:00
|
|
|
searched_err->found = TRUE;
|
2020-09-30 22:27:10 +08:00
|
|
|
status = H5_ITER_STOP;
|
2019-01-24 23:42:19 +08:00
|
|
|
}
|
2019-03-10 11:41:38 +08:00
|
|
|
|
2019-01-24 23:42:19 +08:00
|
|
|
return status;
|
|
|
|
} /* end find_err_msg_cb() */
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** test_corrupted_attnamelen(): Test the fix for the JIRA issue HDFFV-10588,
|
|
|
|
** where corrupted attribute's name length can be
|
|
|
|
** detected and invalid read can be avoided.
|
|
|
|
**
|
|
|
|
**************************************************************************/
|
2020-09-30 22:27:10 +08:00
|
|
|
static void
|
|
|
|
test_corrupted_attnamelen(void)
|
2019-01-24 23:42:19 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t fid = -1; /* File ID */
|
|
|
|
hid_t did = -1; /* Dataset ID */
|
|
|
|
searched_err_t err_caught; /* Data to be passed to callback func */
|
|
|
|
int err_status; /* Status returned by H5Aiterate2 */
|
|
|
|
herr_t ret; /* Return value */
|
Subfiling VFD (#1883)
* Added support for vector I/O calls to the VFD layer, and
associated test code. Note that this includes the optimization
to allow shortened sizes and types arrays to allow more space
efficient representations of vectors in which all entries are
of the same size and/or type. See the Selection I/o RFC for
further details.
Tested serial and parallel, debug and production on Charis.
serial and parallel debug only on Jelly.
* ran code formatter
quick serial build and test on jelly
* Add H5FD_read_selection() and H5FD_write_selection(). Currently only
translate to scalar calls. Fix const buf in H5FD_write_vector().
* Format source
* Fix comments
* Add selection I/O to chunk code, used when: not using chunk cache, no
datatype conversion, no I/O filters, no page buffer, not using collective
I/O. Requires global variable H5_use_selection_io_g be set to TRUE.
Implemented selection to vector I/O transaltion at the file driver
layer.
* Fix formatting unrelated to previous change to stop github from
complaining.
* Add full API support for selection I/O. Add tests for this.
* Implement selection I/O for contiguous datasets. Fix bug in selection
I/O translation. Add const qualifiers to some internal selection I/O
routines to maintain const-correctness while avoiding memcpys.
* Added vector read / write support to the MPIO VFD, with associated
test code (see testpar/t_vfd.c).
Note that this implementation does NOT support vector entries of
size greater than 2 GB. This must be repaired before release,
but it should be good enough for correctness testing.
As MPIO requires vector I/O requests to be sorted in increasing
address order, also added a vector sort utility in H5FDint.c This
function is tested in passing by the MPIO vector I/O extension.
In passing, repaired a bug in size / type vector extension management
in H5FD_read/write_vector()
Tested parallel debug and production on charis and Jelly.
* Ran source code formatter
* Add support for independent parallel I/O with selection I/O. Add
HDF5_USE_SELECTION_IO env var to control selection I/O (default off).
* Implement parallel collective support for selection I/O.
* Fix comments and run formatter.
* Update selection IO branch with develop (#1215)
Merged branch 'develop' into selection_io
* Sync with develop (#1262)
Updated the branch with develop changes.
* Implement big I/O support for vector I/O requests in the MPIO file
driver.
* Free arrays in H5FD__mpio_read/write_vector() as soon as they're not
needed, to cut down on memory usage during I/O.
* Address comments from code review. Fix const warnings with
H5S_SEL_ITER_INIT().
* Committing clang-format changes
* Feature/subfiling (#1464)
* Initial checkin of merged sub-filing VFD.
Passes regression tests (debug/shared/paralle) on Jelly.
However, bugs and many compiler warnings remain -- not suitable
for merge to develop.
* Minor mods to src/H5FDsubfile_mpi.c to address errors reported by autogen.sh
* Code formatting run -- no test
* Merged my subfiling code fixes into the new selection_io_branch
* Forgot to add the FindMERCURY.cmake file. This will probably disappear soon
* attempting to make a more reliable subfile file open which doesn't return errors. For some unknown reason, the regular posix open will occasionally fail to create a subfile. Some better error handling for file close has been added.
* added NULL option for H5FD_subfiling_config_t in H5Pset_fapl_subfiling (#1034)
* NULL option automatically stacks IOC VFD for subfiling and returns a valid fapl.
* added doxygen subfiling APIs
* Various fixes which allow the IOR benchmark to run correctly
* Lots of updates including the packaging up of the mercury_util source files to enable easier builds for our Benchmarking
* Interim checkin of selection_io_with_subfiling_vfd branch
Moddified testpar/t_vfd.c to test the subfiling vfd with default configuration.
Must update this code to run with a variety of configurations -- most particularly
multiple IO concentrators, and stripe depth small enough to test the other IO
concentrators.
testpar/t_vfd.c exposed a large number of race condidtions -- symtoms included:
1) Crashes (usually seg faults)
2) Heap corruption
3) Stack corruption
4) Double frees of heap space
5) Hangs
6) Out of order execution of I/O requests / violations of POSIX semantics
7) Swapped write requests
Items 1 - 4 turned out to be primarily caused by file close issues --
specifically, the main I/O concentrator thread and its pool of worker threads
were not being shut down properly on file close. Addressing this issue in
combination with some other minor fixes seems to have addressed these issues.
Items 5 & 6 appear to have been caused by issue of I/O requests to the
thread pool in an order that did not maintain POSIX semantics. A rewrite of
the I/O request dispatch code appears to have solved these issues.
Item 7 seems to have been caused by multiple write requests from a given
rank being read by the wrong worker thread. Code to issue "unique" tags for
each write request via the ACK message appears to have cleaned this up.
Note that the code is still in poor condtition. A partial list of known
defects includes:
a) Race condiditon on file close that allows superblock writes to arrive
at the I/O concentrator after it has been shutdown. This defect is
most evident when testpar/t_subfiling_vfd is run with 8 ranks.
b) No error reporting from I/O concentrators -- must design and implement
this. For now, mostly just asserts, which suggests that it should be
run in debug mode.
c) Much commented out and/or un-used code.
d) Code orgnaization
e) Build system with bits of Mercury is awkward -- think of shifting
to pthreads with our own thread pool code.
f) Need to add native support for vector and selection I/O to the subfiling
VFD.
g) Need to review, and posibly rework configuration code.
h) Need to store subfile configuration data in a superblock extension message,
and add code to use this data on file open.
i) Test code is inadequate -- expect more issues as it is extended.
In particular, there is no unit test code for the I/O request dispatch code.
While I think it is correct at present, we need test code to verify this.
Similarly, we need to test with multiple I/O concentrators and much smaller
stripe depth.
My actual code changes were limited to:
src/H5FDioc.c
src/H5FDioc_threads.c
src/H5FDsubfile_int.c
src/H5FDsubfile_mpi.c
src/H5FDsubfiling.c
src/H5FDsubfiling.h
src/H5FDsubfiling_priv.h
testpar/t_subfiling_vfd.c
testpar/t_vfd.c
I'm not sure what is going on with the deletions in src/mercury/src/util.
Tested parallel/debug on Charis and Jelly
* subfiling with selection IO (#1219)
Merged branch 'selection_io' into subfiling branch.
* Subfile name fixes (#1250)
* fixed subfiling naming convention, and added leading zero to rank names.
* Merge branch 'selection_io' into selection_io_with_subfiling_vfd (#1265)
* Added script to join subfiles into a single HDF5 file (#1350)
* Modified H5FD__subfiling_query() to report that the sub-filing VFD supports MPI
This exposed issues with truncate and get EOF in the sub-filing VFD.
I believe I have addressed these issues (get EOF not as fully tested as it should be), howeer,
it exposed race conditions resulting in hangs. As of this writing, I have not been able
to chase these down.
Note that the tests that expose these race conditions are in testpar/t_subfiling_vfd.c, and
are currently skipped. Unskip these tests to reproduce the race conditions.
tested (to the extent possible) debug/parallel on charis and jelly.
* Committing clang-format changes
* fixed H5MM_free
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Move Subfiling VFD components into H5FDsubfiling source directory
* Update Autotools build and add H5_HAVE_SUBFILING_VFD macro to H5pubconf.h
* Tidy up CMake build of subfiling sources
* Merge branch 'develop' into feature/subfiling (#1539)
Merge branch 'develop' into feature/subfiling
* Add VFD interface version field to Subfiling and IOC VFDs
* Merge branch 'develop' into feature/subfiling (#1557)
Merge branch 'develop' into feature/subfiling
* Merge branch 'develop' into feature/subfiling (#1563)
Merge branch 'develop' into feature/subfiling
* Tidy up merge artifacts after rebase on develop
* Fix incorrect variable in mirror VFD utils CMake
* Ensure VFD values are always defined
* Add subfiling to CMake VFD_LIST if built
* Mark MPI I/O driver self-initialization global as static
* Add Subfiling VFD to predefined VFDs for HDF5_DRIVER env. variable
* Initial progress towards separating private vs. public subfiling code
* include libgen.h in t_vfd tests for correct dirname/basename
* Committing clang-format changes
* removed mercury option, included subfiling header path (#1577)
Added subfiling status to configure output, installed h5fuse.sh to build directory for use in future tests.
* added check for stdatomic.h (#1578)
* added check for stdatomic.h with subfiling
* added H5_HAVE_SUBFILING_VFD for cmake
* fix old-style-definition warning (#1582)
* fix old-style-definition warning
* added test for enable parallel with subfiling VFD (#1586)
Fails if subfiling VFD is not used with parallel support.
* Subfiling/IOC VFD fixes and tidying (#1619)
* Rename CMake option for Subfiling VFD to be consistent with other VFDs
* Miscellaneous Subfiling fixes
Add error message for unset MPI communicator
Support dynamic loading of subfiling VFD with default configuration
* Temporary fix for subfile name issue
* Added subfile checks (#1634)
* added subfile checks
* Feature/subfiling (#1655)
* Subfiling/IOC VFD cleanup
Fix misuse of MPI_COMM_WORLD in IOC VFD
Propagate Subfiling FAPL MPI settings down to IOC FAPL in default
configuration case
Cleanup IOC VFD debugging code
Change sprintf to snprintf in a few places
* Major work on separating Subfiling and IOC VFDs from each other
* Re-write async_completion func to not overuse stack
* Replace usage of MPI_COMM_WORLD with file's actual MPI communicator
* Refactor H5FDsubfile_mpi.c
* Remove empty file H5FDsubfile_mpi.c
* Separate IOC VFD errors to its own error stack
* Committing clang-format changes
* Remove H5TRACE macros from H5FDioc.c
* Integrate H5FDioc_threads.c with IOC error stack
* Fix for subfile name generation
Use number of I/O concentrators from existing subfiling configuration file, if one exists
* Add temporary barrier in "Get EOF" operation to prevent races on EOF
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fix for retrieval of machine Host ID
* Default to MPI_COMM_WORLD if no MPI params set
* added libs rt and pthreads (#1673)
* added libs rt and pthreads
* Feature/subfiling (#1689)
* More tidying of IOC VFD and subfiling debug code
* Remove old unused log file code
* Clear FID from active file map on failure
* Fix bug in generation of subfile names when truncating file
* Change subfile names to start from 1 instead of 0
* Use long long for user-specified stripe size from environment variable
* Skip 0-sized I/Os in low-level IOC I/O routines
* Don't update EOF on read
* Convert printed warning about data size mismatch to assertion
* Don't add base file address to I/O addresses twice
Base address should already be applied as part of H5FDwrite/read_vector calls
* Account for 0-sized I/O vector entries in subfile write/read functions
* Rewrite init_indep_io for clarity
* Correction for IOC wraparound calculations
* Some corrections to iovec calculations
* Remove temporary barrier on EOF retrieval
* Complete work request queue entry on error instead of skipping over
* Account for stripe size wraparound for sf_col_offset calculation
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Re-write and fix bugs in I/O vector filling routines (#1703)
* Rewrite I/O vector filling routines for clarity
* Fix bug with iovec_fill_last when last I/O size is 0
* added subfiling_dir line read (#1714)
* added subfiling_dir line read and use it
* shellcheck fixes
* I/O request dispatch logic update (#1731)
Short-circuit I/O request dispatch when head of I/O queue is an
in-progress get EOF or truncate operation. This prevents an issue where
a write operation can be dispatched alongside a get EOF/truncate
operation, whereas all I/O requests are supposed to be ineligible for
dispatch until the get EOF/truncate is completed
* h5fuse.sh.in clean-up (#1757)
* Added command-line options
* Committing clang-format changes
* Align with changes from develop
* Mimic MPI I/O VFD for EOF handling
* Initialize context_id field for work request objects
* Use logfile for some debugging information
* Use atomic store to set IOC ready flag
* Use separate communicator for sending file EOF data
Minor IOC cleanup
* Use H5_subfile_fid_to_context to get context ID for file in Subfiling
VFD
* IOVEC calculation fixes
* Updates for debugging code
* Minor fixes for threaded code
* Committing clang-format changes
* Use separate MPI communicator for barrier operations
* Committing clang-format changes
* Rewrite EOF routine to use nonblocking MPI communication
* Committing clang-format changes
* Always dispatch I/O work requests in IOC main loop
* Return distinct MPI communicator to library when requested
* Minor warning cleanup
* Committing clang-format changes
* Generate h5fuse.sh from h5fuse.sh.in in CMake
* Send truncate messages to correct IOC rank
* Committing clang-format changes
* Miscellaneous cleanup
Post some MPI receives before sends
Free some duplicated MPI communicator/Info objects
Remove unnecessary extra MPI_Barrier
* Warning cleanup
* Fix for leaked MPI communicator
* Retrieve file EOF on single rank and bcast it
* Fixes for a few failure paths
* Cleanup of IOC file opens
* Committing clang-format changes
* Use plan MPI_Send for send of EOF messages
* Always check MPI thread support level during Subfiling init
* Committing clang-format changes
* Handle a hang on failure when IOCs can't open subfiles
* Committing clang-format changes
* Refactor file open status consensus check
* Committing clang-format changes
* Fix for MPI_Comm_free being called after MPI_Finalize
* Fix VFD test by setting MPI params before setting subfiling on FAPL
* Update Subfiling VFD error handling and error stack usage
* Improvements for Subfiling logfiles
* Remove prototypes for currently unused routines
* Disable I/O queue stat collecting by default
* Remove unused serialization mutex variable
* Update VFD testing to take subfiling VFD into account
* Fix usage of global subfiling application layout object
* Minor fixes for failure pathways
* Keep track of the number of failures in an IOC I/O queue
* Make sure not to exceed MPI_TAG_UB value for data communication messages
* Committing clang-format changes
* Update for rename of some H5FD 'ctl' opcodes
* Always include Subfiling's public header files in hdf5.h
* Remove old unused code and comments
* Implement support for per-file I/O queues
Allows the subfiling VFD to have multiple HDF5 files open simultaneously
* Use simple MPI_Iprobe over unnecessary MPI_Improbe
* Committing clang-format changes
* Update HDF5 testing to query driver for H5FD_FEAT_DEFAULT_VFD_COMPATIBLE
flag
* Fix a few bugs related to file multi-opens
* Avoid calling MPI routines if subfiling gets reinitialized
* Fix issue when files are closed in a random order
* Update HDF5 testing to query VFD for "using MPI" feature flag
* Register atexit handler in subfiling VFD to call MPI_Finalize after HDF5
closes
* Fail for collective I/O requests until support is implemented
* Correct VOL test function prototypes
* Minor cleanup of old code and comments
* Update mercury dependency
* Cleanup of subfiling configuration structure
* Committing clang-format changes
* Build system updates for Subfiling VFD
* Fix possible hang on failure in t_vfd tests caused by mismatched
MPI_Barrier calls
* Copy subfiling IOC fapl in "fapl get" method
* Mirror subfiling superblock writes to stub file for legacy POSIX-y HDF5
applications
* Allow collective I/O for MPI_BYTE types and rank 0 bcast strategy
* Committing clang-format changes
* Use different scheme for subfiling write message MPI tag calculations
* Committing clang-format changes
* Avoid performing fstat calls on all MPI ranks
* Add MPI_Barrier before finalizing IOC threads
* Use try_lock in I/O queue dispatch to minimize contention from worker threads
* Use simple Waitall for nonblocking I/O waits
* Add configurable IOC main thread delay and try_lock option to I/O queue dispatch
* Fix bug that could cause serialization of non-overlapping I/O requests
* Temporarily treat collective subfiling vector I/O calls as independent
* Removed unused mercury bits
* Add stubs for subfiling and IOC file delete callback
* Update VFD testing for Subfiling VFD
* Work around HDF5 metadata cache bug for Subfiling VFD when MPI Comm size
= 1
* Committing clang-format changes
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
2022-07-23 04:03:12 +08:00
|
|
|
hbool_t driver_is_default_compatible;
|
2022-07-27 05:45:46 +08:00
|
|
|
const char *testfile = H5_get_srcdir_filename(CORRUPTED_ATNAMELEN_FILE); /* Corrected test file name */
|
2019-01-24 23:42:19 +08:00
|
|
|
|
|
|
|
const char *err_message = "attribute name has different length than stored length";
|
2020-09-30 22:27:10 +08:00
|
|
|
/* the error message produced when the failure occurs */
|
2019-01-24 23:42:19 +08:00
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing the Handling of Corrupted Attribute's Name Length\n"));
|
|
|
|
|
Subfiling VFD (#1883)
* Added support for vector I/O calls to the VFD layer, and
associated test code. Note that this includes the optimization
to allow shortened sizes and types arrays to allow more space
efficient representations of vectors in which all entries are
of the same size and/or type. See the Selection I/o RFC for
further details.
Tested serial and parallel, debug and production on Charis.
serial and parallel debug only on Jelly.
* ran code formatter
quick serial build and test on jelly
* Add H5FD_read_selection() and H5FD_write_selection(). Currently only
translate to scalar calls. Fix const buf in H5FD_write_vector().
* Format source
* Fix comments
* Add selection I/O to chunk code, used when: not using chunk cache, no
datatype conversion, no I/O filters, no page buffer, not using collective
I/O. Requires global variable H5_use_selection_io_g be set to TRUE.
Implemented selection to vector I/O transaltion at the file driver
layer.
* Fix formatting unrelated to previous change to stop github from
complaining.
* Add full API support for selection I/O. Add tests for this.
* Implement selection I/O for contiguous datasets. Fix bug in selection
I/O translation. Add const qualifiers to some internal selection I/O
routines to maintain const-correctness while avoiding memcpys.
* Added vector read / write support to the MPIO VFD, with associated
test code (see testpar/t_vfd.c).
Note that this implementation does NOT support vector entries of
size greater than 2 GB. This must be repaired before release,
but it should be good enough for correctness testing.
As MPIO requires vector I/O requests to be sorted in increasing
address order, also added a vector sort utility in H5FDint.c This
function is tested in passing by the MPIO vector I/O extension.
In passing, repaired a bug in size / type vector extension management
in H5FD_read/write_vector()
Tested parallel debug and production on charis and Jelly.
* Ran source code formatter
* Add support for independent parallel I/O with selection I/O. Add
HDF5_USE_SELECTION_IO env var to control selection I/O (default off).
* Implement parallel collective support for selection I/O.
* Fix comments and run formatter.
* Update selection IO branch with develop (#1215)
Merged branch 'develop' into selection_io
* Sync with develop (#1262)
Updated the branch with develop changes.
* Implement big I/O support for vector I/O requests in the MPIO file
driver.
* Free arrays in H5FD__mpio_read/write_vector() as soon as they're not
needed, to cut down on memory usage during I/O.
* Address comments from code review. Fix const warnings with
H5S_SEL_ITER_INIT().
* Committing clang-format changes
* Feature/subfiling (#1464)
* Initial checkin of merged sub-filing VFD.
Passes regression tests (debug/shared/paralle) on Jelly.
However, bugs and many compiler warnings remain -- not suitable
for merge to develop.
* Minor mods to src/H5FDsubfile_mpi.c to address errors reported by autogen.sh
* Code formatting run -- no test
* Merged my subfiling code fixes into the new selection_io_branch
* Forgot to add the FindMERCURY.cmake file. This will probably disappear soon
* attempting to make a more reliable subfile file open which doesn't return errors. For some unknown reason, the regular posix open will occasionally fail to create a subfile. Some better error handling for file close has been added.
* added NULL option for H5FD_subfiling_config_t in H5Pset_fapl_subfiling (#1034)
* NULL option automatically stacks IOC VFD for subfiling and returns a valid fapl.
* added doxygen subfiling APIs
* Various fixes which allow the IOR benchmark to run correctly
* Lots of updates including the packaging up of the mercury_util source files to enable easier builds for our Benchmarking
* Interim checkin of selection_io_with_subfiling_vfd branch
Moddified testpar/t_vfd.c to test the subfiling vfd with default configuration.
Must update this code to run with a variety of configurations -- most particularly
multiple IO concentrators, and stripe depth small enough to test the other IO
concentrators.
testpar/t_vfd.c exposed a large number of race condidtions -- symtoms included:
1) Crashes (usually seg faults)
2) Heap corruption
3) Stack corruption
4) Double frees of heap space
5) Hangs
6) Out of order execution of I/O requests / violations of POSIX semantics
7) Swapped write requests
Items 1 - 4 turned out to be primarily caused by file close issues --
specifically, the main I/O concentrator thread and its pool of worker threads
were not being shut down properly on file close. Addressing this issue in
combination with some other minor fixes seems to have addressed these issues.
Items 5 & 6 appear to have been caused by issue of I/O requests to the
thread pool in an order that did not maintain POSIX semantics. A rewrite of
the I/O request dispatch code appears to have solved these issues.
Item 7 seems to have been caused by multiple write requests from a given
rank being read by the wrong worker thread. Code to issue "unique" tags for
each write request via the ACK message appears to have cleaned this up.
Note that the code is still in poor condtition. A partial list of known
defects includes:
a) Race condiditon on file close that allows superblock writes to arrive
at the I/O concentrator after it has been shutdown. This defect is
most evident when testpar/t_subfiling_vfd is run with 8 ranks.
b) No error reporting from I/O concentrators -- must design and implement
this. For now, mostly just asserts, which suggests that it should be
run in debug mode.
c) Much commented out and/or un-used code.
d) Code orgnaization
e) Build system with bits of Mercury is awkward -- think of shifting
to pthreads with our own thread pool code.
f) Need to add native support for vector and selection I/O to the subfiling
VFD.
g) Need to review, and posibly rework configuration code.
h) Need to store subfile configuration data in a superblock extension message,
and add code to use this data on file open.
i) Test code is inadequate -- expect more issues as it is extended.
In particular, there is no unit test code for the I/O request dispatch code.
While I think it is correct at present, we need test code to verify this.
Similarly, we need to test with multiple I/O concentrators and much smaller
stripe depth.
My actual code changes were limited to:
src/H5FDioc.c
src/H5FDioc_threads.c
src/H5FDsubfile_int.c
src/H5FDsubfile_mpi.c
src/H5FDsubfiling.c
src/H5FDsubfiling.h
src/H5FDsubfiling_priv.h
testpar/t_subfiling_vfd.c
testpar/t_vfd.c
I'm not sure what is going on with the deletions in src/mercury/src/util.
Tested parallel/debug on Charis and Jelly
* subfiling with selection IO (#1219)
Merged branch 'selection_io' into subfiling branch.
* Subfile name fixes (#1250)
* fixed subfiling naming convention, and added leading zero to rank names.
* Merge branch 'selection_io' into selection_io_with_subfiling_vfd (#1265)
* Added script to join subfiles into a single HDF5 file (#1350)
* Modified H5FD__subfiling_query() to report that the sub-filing VFD supports MPI
This exposed issues with truncate and get EOF in the sub-filing VFD.
I believe I have addressed these issues (get EOF not as fully tested as it should be), howeer,
it exposed race conditions resulting in hangs. As of this writing, I have not been able
to chase these down.
Note that the tests that expose these race conditions are in testpar/t_subfiling_vfd.c, and
are currently skipped. Unskip these tests to reproduce the race conditions.
tested (to the extent possible) debug/parallel on charis and jelly.
* Committing clang-format changes
* fixed H5MM_free
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Move Subfiling VFD components into H5FDsubfiling source directory
* Update Autotools build and add H5_HAVE_SUBFILING_VFD macro to H5pubconf.h
* Tidy up CMake build of subfiling sources
* Merge branch 'develop' into feature/subfiling (#1539)
Merge branch 'develop' into feature/subfiling
* Add VFD interface version field to Subfiling and IOC VFDs
* Merge branch 'develop' into feature/subfiling (#1557)
Merge branch 'develop' into feature/subfiling
* Merge branch 'develop' into feature/subfiling (#1563)
Merge branch 'develop' into feature/subfiling
* Tidy up merge artifacts after rebase on develop
* Fix incorrect variable in mirror VFD utils CMake
* Ensure VFD values are always defined
* Add subfiling to CMake VFD_LIST if built
* Mark MPI I/O driver self-initialization global as static
* Add Subfiling VFD to predefined VFDs for HDF5_DRIVER env. variable
* Initial progress towards separating private vs. public subfiling code
* include libgen.h in t_vfd tests for correct dirname/basename
* Committing clang-format changes
* removed mercury option, included subfiling header path (#1577)
Added subfiling status to configure output, installed h5fuse.sh to build directory for use in future tests.
* added check for stdatomic.h (#1578)
* added check for stdatomic.h with subfiling
* added H5_HAVE_SUBFILING_VFD for cmake
* fix old-style-definition warning (#1582)
* fix old-style-definition warning
* added test for enable parallel with subfiling VFD (#1586)
Fails if subfiling VFD is not used with parallel support.
* Subfiling/IOC VFD fixes and tidying (#1619)
* Rename CMake option for Subfiling VFD to be consistent with other VFDs
* Miscellaneous Subfiling fixes
Add error message for unset MPI communicator
Support dynamic loading of subfiling VFD with default configuration
* Temporary fix for subfile name issue
* Added subfile checks (#1634)
* added subfile checks
* Feature/subfiling (#1655)
* Subfiling/IOC VFD cleanup
Fix misuse of MPI_COMM_WORLD in IOC VFD
Propagate Subfiling FAPL MPI settings down to IOC FAPL in default
configuration case
Cleanup IOC VFD debugging code
Change sprintf to snprintf in a few places
* Major work on separating Subfiling and IOC VFDs from each other
* Re-write async_completion func to not overuse stack
* Replace usage of MPI_COMM_WORLD with file's actual MPI communicator
* Refactor H5FDsubfile_mpi.c
* Remove empty file H5FDsubfile_mpi.c
* Separate IOC VFD errors to its own error stack
* Committing clang-format changes
* Remove H5TRACE macros from H5FDioc.c
* Integrate H5FDioc_threads.c with IOC error stack
* Fix for subfile name generation
Use number of I/O concentrators from existing subfiling configuration file, if one exists
* Add temporary barrier in "Get EOF" operation to prevent races on EOF
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fix for retrieval of machine Host ID
* Default to MPI_COMM_WORLD if no MPI params set
* added libs rt and pthreads (#1673)
* added libs rt and pthreads
* Feature/subfiling (#1689)
* More tidying of IOC VFD and subfiling debug code
* Remove old unused log file code
* Clear FID from active file map on failure
* Fix bug in generation of subfile names when truncating file
* Change subfile names to start from 1 instead of 0
* Use long long for user-specified stripe size from environment variable
* Skip 0-sized I/Os in low-level IOC I/O routines
* Don't update EOF on read
* Convert printed warning about data size mismatch to assertion
* Don't add base file address to I/O addresses twice
Base address should already be applied as part of H5FDwrite/read_vector calls
* Account for 0-sized I/O vector entries in subfile write/read functions
* Rewrite init_indep_io for clarity
* Correction for IOC wraparound calculations
* Some corrections to iovec calculations
* Remove temporary barrier on EOF retrieval
* Complete work request queue entry on error instead of skipping over
* Account for stripe size wraparound for sf_col_offset calculation
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Re-write and fix bugs in I/O vector filling routines (#1703)
* Rewrite I/O vector filling routines for clarity
* Fix bug with iovec_fill_last when last I/O size is 0
* added subfiling_dir line read (#1714)
* added subfiling_dir line read and use it
* shellcheck fixes
* I/O request dispatch logic update (#1731)
Short-circuit I/O request dispatch when head of I/O queue is an
in-progress get EOF or truncate operation. This prevents an issue where
a write operation can be dispatched alongside a get EOF/truncate
operation, whereas all I/O requests are supposed to be ineligible for
dispatch until the get EOF/truncate is completed
* h5fuse.sh.in clean-up (#1757)
* Added command-line options
* Committing clang-format changes
* Align with changes from develop
* Mimic MPI I/O VFD for EOF handling
* Initialize context_id field for work request objects
* Use logfile for some debugging information
* Use atomic store to set IOC ready flag
* Use separate communicator for sending file EOF data
Minor IOC cleanup
* Use H5_subfile_fid_to_context to get context ID for file in Subfiling
VFD
* IOVEC calculation fixes
* Updates for debugging code
* Minor fixes for threaded code
* Committing clang-format changes
* Use separate MPI communicator for barrier operations
* Committing clang-format changes
* Rewrite EOF routine to use nonblocking MPI communication
* Committing clang-format changes
* Always dispatch I/O work requests in IOC main loop
* Return distinct MPI communicator to library when requested
* Minor warning cleanup
* Committing clang-format changes
* Generate h5fuse.sh from h5fuse.sh.in in CMake
* Send truncate messages to correct IOC rank
* Committing clang-format changes
* Miscellaneous cleanup
Post some MPI receives before sends
Free some duplicated MPI communicator/Info objects
Remove unnecessary extra MPI_Barrier
* Warning cleanup
* Fix for leaked MPI communicator
* Retrieve file EOF on single rank and bcast it
* Fixes for a few failure paths
* Cleanup of IOC file opens
* Committing clang-format changes
* Use plan MPI_Send for send of EOF messages
* Always check MPI thread support level during Subfiling init
* Committing clang-format changes
* Handle a hang on failure when IOCs can't open subfiles
* Committing clang-format changes
* Refactor file open status consensus check
* Committing clang-format changes
* Fix for MPI_Comm_free being called after MPI_Finalize
* Fix VFD test by setting MPI params before setting subfiling on FAPL
* Update Subfiling VFD error handling and error stack usage
* Improvements for Subfiling logfiles
* Remove prototypes for currently unused routines
* Disable I/O queue stat collecting by default
* Remove unused serialization mutex variable
* Update VFD testing to take subfiling VFD into account
* Fix usage of global subfiling application layout object
* Minor fixes for failure pathways
* Keep track of the number of failures in an IOC I/O queue
* Make sure not to exceed MPI_TAG_UB value for data communication messages
* Committing clang-format changes
* Update for rename of some H5FD 'ctl' opcodes
* Always include Subfiling's public header files in hdf5.h
* Remove old unused code and comments
* Implement support for per-file I/O queues
Allows the subfiling VFD to have multiple HDF5 files open simultaneously
* Use simple MPI_Iprobe over unnecessary MPI_Improbe
* Committing clang-format changes
* Update HDF5 testing to query driver for H5FD_FEAT_DEFAULT_VFD_COMPATIBLE
flag
* Fix a few bugs related to file multi-opens
* Avoid calling MPI routines if subfiling gets reinitialized
* Fix issue when files are closed in a random order
* Update HDF5 testing to query VFD for "using MPI" feature flag
* Register atexit handler in subfiling VFD to call MPI_Finalize after HDF5
closes
* Fail for collective I/O requests until support is implemented
* Correct VOL test function prototypes
* Minor cleanup of old code and comments
* Update mercury dependency
* Cleanup of subfiling configuration structure
* Committing clang-format changes
* Build system updates for Subfiling VFD
* Fix possible hang on failure in t_vfd tests caused by mismatched
MPI_Barrier calls
* Copy subfiling IOC fapl in "fapl get" method
* Mirror subfiling superblock writes to stub file for legacy POSIX-y HDF5
applications
* Allow collective I/O for MPI_BYTE types and rank 0 bcast strategy
* Committing clang-format changes
* Use different scheme for subfiling write message MPI tag calculations
* Committing clang-format changes
* Avoid performing fstat calls on all MPI ranks
* Add MPI_Barrier before finalizing IOC threads
* Use try_lock in I/O queue dispatch to minimize contention from worker threads
* Use simple Waitall for nonblocking I/O waits
* Add configurable IOC main thread delay and try_lock option to I/O queue dispatch
* Fix bug that could cause serialization of non-overlapping I/O requests
* Temporarily treat collective subfiling vector I/O calls as independent
* Removed unused mercury bits
* Add stubs for subfiling and IOC file delete callback
* Update VFD testing for Subfiling VFD
* Work around HDF5 metadata cache bug for Subfiling VFD when MPI Comm size
= 1
* Committing clang-format changes
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
2022-07-23 04:03:12 +08:00
|
|
|
ret = h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible);
|
|
|
|
CHECK(ret, FAIL, "h5_driver_is_default_vfd_compatible");
|
|
|
|
|
|
|
|
if (!driver_is_default_compatible) {
|
|
|
|
HDprintf("-- SKIPPED --\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-24 23:42:19 +08:00
|
|
|
fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
|
|
|
|
CHECK(fid, FAIL, "H5Fopen");
|
|
|
|
|
|
|
|
/* Open the dataset */
|
|
|
|
did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT);
|
|
|
|
CHECK(did, FAIL, "H5Dopen2");
|
|
|
|
|
|
|
|
/* Call H5Aiterate2 to trigger the failure in HDFFV-10588. Failure should
|
|
|
|
occur in the decoding stage, so some arguments are not needed. */
|
|
|
|
err_status = H5Aiterate2(did, H5_INDEX_NAME, H5_ITER_INC, NULL, NULL, NULL);
|
2019-03-10 11:41:38 +08:00
|
|
|
VERIFY(err_status, FAIL, "H5Aiterate2");
|
2019-01-24 23:42:19 +08:00
|
|
|
|
|
|
|
/* Make sure the intended error was caught */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (err_status == -1) {
|
2019-01-24 23:42:19 +08:00
|
|
|
/* Initialize client data */
|
|
|
|
HDstrcpy(err_caught.message, err_message);
|
2020-12-24 23:12:01 +08:00
|
|
|
err_caught.found = FALSE;
|
2019-01-24 23:42:19 +08:00
|
|
|
|
|
|
|
/* Look for the correct error message */
|
|
|
|
ret = H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, find_err_msg_cb, &err_caught);
|
|
|
|
CHECK(ret, FAIL, "H5Ewalk2");
|
|
|
|
|
|
|
|
/* Fail if the indicated message is not found */
|
2020-12-24 23:12:01 +08:00
|
|
|
CHECK(err_caught.found, FALSE, "test_corrupted_attnamelen: Expected error not found");
|
2019-01-24 23:42:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close the dataset and file */
|
|
|
|
ret = H5Dclose(did);
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
ret = H5Fclose(fid);
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
} /* test_corrupted_attnamelen() */
|
|
|
|
|
2020-01-17 05:29:34 +08:00
|
|
|
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** test_links_deprec(): Test soft and hard link iteration
|
|
|
|
**
|
|
|
|
****************************************************************/
|
2020-09-30 22:27:10 +08:00
|
|
|
static void
|
|
|
|
test_links_deprec(hid_t fapl)
|
2020-01-17 05:29:34 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t file; /* File ID */
|
|
|
|
char obj_name[NAMELEN]; /* Names of the object in group */
|
|
|
|
ssize_t name_len; /* Length of object's name */
|
|
|
|
hid_t gid, gid1;
|
|
|
|
H5G_info_t ginfo; /* Buffer for querying object's info */
|
|
|
|
hsize_t i;
|
|
|
|
herr_t ret; /* Generic return value */
|
2020-01-17 05:29:34 +08:00
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality Using Deprecated Routines\n"));
|
|
|
|
|
|
|
|
/* Create the test file with the datasets */
|
|
|
|
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
|
|
|
CHECK(file, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
/* create groups */
|
|
|
|
gid = H5Gcreate2(file, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(gid, FAIL, "H5Gcreate2");
|
|
|
|
|
|
|
|
gid1 = H5Gcreate2(file, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(gid1, FAIL, "H5Gcreate2");
|
|
|
|
|
|
|
|
/* create soft and hard links to the group "/g1". */
|
|
|
|
ret = H5Lcreate_soft("something", gid, "softlink", H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Lcreate_soft");
|
|
|
|
|
|
|
|
ret = H5Lcreate_hard(gid, "/g1", H5L_SAME_LOC, "hardlink", H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Lcreate_hard");
|
|
|
|
|
|
|
|
ret = H5Gget_info(gid, &ginfo);
|
|
|
|
CHECK(ret, FAIL, "H5Gget_info");
|
|
|
|
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
|
|
|
|
|
|
|
|
/* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < ginfo.nlinks; i++) {
|
|
|
|
H5O_info2_t oinfo; /* Object info */
|
|
|
|
H5L_info2_t linfo; /* Link info */
|
2020-01-17 05:29:34 +08:00
|
|
|
|
|
|
|
/* Get link name */
|
2020-09-30 22:27:10 +08:00
|
|
|
name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN,
|
|
|
|
H5P_DEFAULT);
|
2020-01-17 05:29:34 +08:00
|
|
|
CHECK(name_len, FAIL, "H5Lget_name_by_idx");
|
|
|
|
|
|
|
|
/* Get link type */
|
|
|
|
ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT);
|
|
|
|
CHECK(ret, FAIL, "H5Lget_info_by_idx1");
|
|
|
|
|
|
|
|
/* Get object type */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (linfo.type == H5L_TYPE_HARD) {
|
|
|
|
ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
|
|
|
|
H5O_INFO_BASIC, H5P_DEFAULT);
|
2020-01-17 05:29:34 +08:00
|
|
|
CHECK(ret, FAIL, "H5Oget_info_by_idx");
|
|
|
|
} /* end if */
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!HDstrcmp(obj_name, "g1.1"))
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (!HDstrcmp(obj_name, "hardlink"))
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (!HDstrcmp(obj_name, "softlink"))
|
2020-01-17 05:29:34 +08:00
|
|
|
VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx");
|
|
|
|
else
|
2021-03-25 00:25:50 +08:00
|
|
|
ERROR("unknown object name");
|
2020-01-17 05:29:34 +08:00
|
|
|
} /* end for */
|
|
|
|
|
|
|
|
ret = H5Gclose(gid);
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
|
|
ret = H5Gclose(gid1);
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
|
|
ret = H5Fclose(file);
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
} /* test_links_deprec() */
|
|
|
|
#endif
|
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/****************************************************************
|
|
|
|
**
|
|
|
|
** test_iterate(): Main iteration testing routine.
|
2005-08-14 04:53:35 +08:00
|
|
|
**
|
2000-04-06 04:51:44 +08:00
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
void
|
2000-04-06 04:51:44 +08:00
|
|
|
test_iterate(void)
|
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t fapl, fapl2; /* File access property lists */
|
|
|
|
unsigned new_format; /* Whether to use the new format or not */
|
|
|
|
herr_t ret; /* Generic return value */
|
2006-10-02 18:24:03 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* Output message about test being performed */
|
|
|
|
MESSAGE(5, ("Testing Iteration Operations\n"));
|
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
/* Get the default FAPL */
|
|
|
|
fapl = H5Pcreate(H5P_FILE_ACCESS);
|
|
|
|
CHECK(fapl, FAIL, "H5Pcreate");
|
|
|
|
|
|
|
|
/* Copy the file access property list */
|
|
|
|
fapl2 = H5Pcopy(fapl);
|
|
|
|
CHECK(fapl2, FAIL, "H5Pcopy");
|
|
|
|
|
[svn-r14362] Description:
Switched from "H5P[gs]et_latest_format" to "H5P[gs]et_format_bounds".
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
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-03 21:55:39 +08:00
|
|
|
/* Set the "use the latest version of the format" bounds for creating objects in the file */
|
[svn-r14413] Description:
Change H5P[gs]et_format_bounds() => H5P[gs]et_libver_bounds() and also
enumerated values H5F_FORMAT_{EARLIEST, LATEST} => H5F_LIBVER_{EARLIEST, LATEST}
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
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-15 07:49:12 +08:00
|
|
|
ret = H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
|
|
|
|
CHECK(ret, FAIL, "H5Pset_libver_bounds");
|
2006-10-02 18:24:03 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/* These next tests use the same file */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (new_format = FALSE; new_format <= TRUE; new_format++) {
|
2006-10-02 18:24:03 +08:00
|
|
|
test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */
|
2020-09-30 22:27:10 +08:00
|
|
|
test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
|
|
|
|
test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */
|
|
|
|
test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
|
|
|
|
test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
|
2020-01-17 05:29:34 +08:00
|
|
|
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
2020-09-30 22:27:10 +08:00
|
|
|
test_links_deprec(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
|
2020-01-17 05:29:34 +08:00
|
|
|
#endif
|
2006-10-02 18:24:03 +08:00
|
|
|
} /* end for */
|
|
|
|
|
Subfiling VFD (#1883)
* Added support for vector I/O calls to the VFD layer, and
associated test code. Note that this includes the optimization
to allow shortened sizes and types arrays to allow more space
efficient representations of vectors in which all entries are
of the same size and/or type. See the Selection I/o RFC for
further details.
Tested serial and parallel, debug and production on Charis.
serial and parallel debug only on Jelly.
* ran code formatter
quick serial build and test on jelly
* Add H5FD_read_selection() and H5FD_write_selection(). Currently only
translate to scalar calls. Fix const buf in H5FD_write_vector().
* Format source
* Fix comments
* Add selection I/O to chunk code, used when: not using chunk cache, no
datatype conversion, no I/O filters, no page buffer, not using collective
I/O. Requires global variable H5_use_selection_io_g be set to TRUE.
Implemented selection to vector I/O transaltion at the file driver
layer.
* Fix formatting unrelated to previous change to stop github from
complaining.
* Add full API support for selection I/O. Add tests for this.
* Implement selection I/O for contiguous datasets. Fix bug in selection
I/O translation. Add const qualifiers to some internal selection I/O
routines to maintain const-correctness while avoiding memcpys.
* Added vector read / write support to the MPIO VFD, with associated
test code (see testpar/t_vfd.c).
Note that this implementation does NOT support vector entries of
size greater than 2 GB. This must be repaired before release,
but it should be good enough for correctness testing.
As MPIO requires vector I/O requests to be sorted in increasing
address order, also added a vector sort utility in H5FDint.c This
function is tested in passing by the MPIO vector I/O extension.
In passing, repaired a bug in size / type vector extension management
in H5FD_read/write_vector()
Tested parallel debug and production on charis and Jelly.
* Ran source code formatter
* Add support for independent parallel I/O with selection I/O. Add
HDF5_USE_SELECTION_IO env var to control selection I/O (default off).
* Implement parallel collective support for selection I/O.
* Fix comments and run formatter.
* Update selection IO branch with develop (#1215)
Merged branch 'develop' into selection_io
* Sync with develop (#1262)
Updated the branch with develop changes.
* Implement big I/O support for vector I/O requests in the MPIO file
driver.
* Free arrays in H5FD__mpio_read/write_vector() as soon as they're not
needed, to cut down on memory usage during I/O.
* Address comments from code review. Fix const warnings with
H5S_SEL_ITER_INIT().
* Committing clang-format changes
* Feature/subfiling (#1464)
* Initial checkin of merged sub-filing VFD.
Passes regression tests (debug/shared/paralle) on Jelly.
However, bugs and many compiler warnings remain -- not suitable
for merge to develop.
* Minor mods to src/H5FDsubfile_mpi.c to address errors reported by autogen.sh
* Code formatting run -- no test
* Merged my subfiling code fixes into the new selection_io_branch
* Forgot to add the FindMERCURY.cmake file. This will probably disappear soon
* attempting to make a more reliable subfile file open which doesn't return errors. For some unknown reason, the regular posix open will occasionally fail to create a subfile. Some better error handling for file close has been added.
* added NULL option for H5FD_subfiling_config_t in H5Pset_fapl_subfiling (#1034)
* NULL option automatically stacks IOC VFD for subfiling and returns a valid fapl.
* added doxygen subfiling APIs
* Various fixes which allow the IOR benchmark to run correctly
* Lots of updates including the packaging up of the mercury_util source files to enable easier builds for our Benchmarking
* Interim checkin of selection_io_with_subfiling_vfd branch
Moddified testpar/t_vfd.c to test the subfiling vfd with default configuration.
Must update this code to run with a variety of configurations -- most particularly
multiple IO concentrators, and stripe depth small enough to test the other IO
concentrators.
testpar/t_vfd.c exposed a large number of race condidtions -- symtoms included:
1) Crashes (usually seg faults)
2) Heap corruption
3) Stack corruption
4) Double frees of heap space
5) Hangs
6) Out of order execution of I/O requests / violations of POSIX semantics
7) Swapped write requests
Items 1 - 4 turned out to be primarily caused by file close issues --
specifically, the main I/O concentrator thread and its pool of worker threads
were not being shut down properly on file close. Addressing this issue in
combination with some other minor fixes seems to have addressed these issues.
Items 5 & 6 appear to have been caused by issue of I/O requests to the
thread pool in an order that did not maintain POSIX semantics. A rewrite of
the I/O request dispatch code appears to have solved these issues.
Item 7 seems to have been caused by multiple write requests from a given
rank being read by the wrong worker thread. Code to issue "unique" tags for
each write request via the ACK message appears to have cleaned this up.
Note that the code is still in poor condtition. A partial list of known
defects includes:
a) Race condiditon on file close that allows superblock writes to arrive
at the I/O concentrator after it has been shutdown. This defect is
most evident when testpar/t_subfiling_vfd is run with 8 ranks.
b) No error reporting from I/O concentrators -- must design and implement
this. For now, mostly just asserts, which suggests that it should be
run in debug mode.
c) Much commented out and/or un-used code.
d) Code orgnaization
e) Build system with bits of Mercury is awkward -- think of shifting
to pthreads with our own thread pool code.
f) Need to add native support for vector and selection I/O to the subfiling
VFD.
g) Need to review, and posibly rework configuration code.
h) Need to store subfile configuration data in a superblock extension message,
and add code to use this data on file open.
i) Test code is inadequate -- expect more issues as it is extended.
In particular, there is no unit test code for the I/O request dispatch code.
While I think it is correct at present, we need test code to verify this.
Similarly, we need to test with multiple I/O concentrators and much smaller
stripe depth.
My actual code changes were limited to:
src/H5FDioc.c
src/H5FDioc_threads.c
src/H5FDsubfile_int.c
src/H5FDsubfile_mpi.c
src/H5FDsubfiling.c
src/H5FDsubfiling.h
src/H5FDsubfiling_priv.h
testpar/t_subfiling_vfd.c
testpar/t_vfd.c
I'm not sure what is going on with the deletions in src/mercury/src/util.
Tested parallel/debug on Charis and Jelly
* subfiling with selection IO (#1219)
Merged branch 'selection_io' into subfiling branch.
* Subfile name fixes (#1250)
* fixed subfiling naming convention, and added leading zero to rank names.
* Merge branch 'selection_io' into selection_io_with_subfiling_vfd (#1265)
* Added script to join subfiles into a single HDF5 file (#1350)
* Modified H5FD__subfiling_query() to report that the sub-filing VFD supports MPI
This exposed issues with truncate and get EOF in the sub-filing VFD.
I believe I have addressed these issues (get EOF not as fully tested as it should be), howeer,
it exposed race conditions resulting in hangs. As of this writing, I have not been able
to chase these down.
Note that the tests that expose these race conditions are in testpar/t_subfiling_vfd.c, and
are currently skipped. Unskip these tests to reproduce the race conditions.
tested (to the extent possible) debug/parallel on charis and jelly.
* Committing clang-format changes
* fixed H5MM_free
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Move Subfiling VFD components into H5FDsubfiling source directory
* Update Autotools build and add H5_HAVE_SUBFILING_VFD macro to H5pubconf.h
* Tidy up CMake build of subfiling sources
* Merge branch 'develop' into feature/subfiling (#1539)
Merge branch 'develop' into feature/subfiling
* Add VFD interface version field to Subfiling and IOC VFDs
* Merge branch 'develop' into feature/subfiling (#1557)
Merge branch 'develop' into feature/subfiling
* Merge branch 'develop' into feature/subfiling (#1563)
Merge branch 'develop' into feature/subfiling
* Tidy up merge artifacts after rebase on develop
* Fix incorrect variable in mirror VFD utils CMake
* Ensure VFD values are always defined
* Add subfiling to CMake VFD_LIST if built
* Mark MPI I/O driver self-initialization global as static
* Add Subfiling VFD to predefined VFDs for HDF5_DRIVER env. variable
* Initial progress towards separating private vs. public subfiling code
* include libgen.h in t_vfd tests for correct dirname/basename
* Committing clang-format changes
* removed mercury option, included subfiling header path (#1577)
Added subfiling status to configure output, installed h5fuse.sh to build directory for use in future tests.
* added check for stdatomic.h (#1578)
* added check for stdatomic.h with subfiling
* added H5_HAVE_SUBFILING_VFD for cmake
* fix old-style-definition warning (#1582)
* fix old-style-definition warning
* added test for enable parallel with subfiling VFD (#1586)
Fails if subfiling VFD is not used with parallel support.
* Subfiling/IOC VFD fixes and tidying (#1619)
* Rename CMake option for Subfiling VFD to be consistent with other VFDs
* Miscellaneous Subfiling fixes
Add error message for unset MPI communicator
Support dynamic loading of subfiling VFD with default configuration
* Temporary fix for subfile name issue
* Added subfile checks (#1634)
* added subfile checks
* Feature/subfiling (#1655)
* Subfiling/IOC VFD cleanup
Fix misuse of MPI_COMM_WORLD in IOC VFD
Propagate Subfiling FAPL MPI settings down to IOC FAPL in default
configuration case
Cleanup IOC VFD debugging code
Change sprintf to snprintf in a few places
* Major work on separating Subfiling and IOC VFDs from each other
* Re-write async_completion func to not overuse stack
* Replace usage of MPI_COMM_WORLD with file's actual MPI communicator
* Refactor H5FDsubfile_mpi.c
* Remove empty file H5FDsubfile_mpi.c
* Separate IOC VFD errors to its own error stack
* Committing clang-format changes
* Remove H5TRACE macros from H5FDioc.c
* Integrate H5FDioc_threads.c with IOC error stack
* Fix for subfile name generation
Use number of I/O concentrators from existing subfiling configuration file, if one exists
* Add temporary barrier in "Get EOF" operation to prevent races on EOF
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fix for retrieval of machine Host ID
* Default to MPI_COMM_WORLD if no MPI params set
* added libs rt and pthreads (#1673)
* added libs rt and pthreads
* Feature/subfiling (#1689)
* More tidying of IOC VFD and subfiling debug code
* Remove old unused log file code
* Clear FID from active file map on failure
* Fix bug in generation of subfile names when truncating file
* Change subfile names to start from 1 instead of 0
* Use long long for user-specified stripe size from environment variable
* Skip 0-sized I/Os in low-level IOC I/O routines
* Don't update EOF on read
* Convert printed warning about data size mismatch to assertion
* Don't add base file address to I/O addresses twice
Base address should already be applied as part of H5FDwrite/read_vector calls
* Account for 0-sized I/O vector entries in subfile write/read functions
* Rewrite init_indep_io for clarity
* Correction for IOC wraparound calculations
* Some corrections to iovec calculations
* Remove temporary barrier on EOF retrieval
* Complete work request queue entry on error instead of skipping over
* Account for stripe size wraparound for sf_col_offset calculation
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Re-write and fix bugs in I/O vector filling routines (#1703)
* Rewrite I/O vector filling routines for clarity
* Fix bug with iovec_fill_last when last I/O size is 0
* added subfiling_dir line read (#1714)
* added subfiling_dir line read and use it
* shellcheck fixes
* I/O request dispatch logic update (#1731)
Short-circuit I/O request dispatch when head of I/O queue is an
in-progress get EOF or truncate operation. This prevents an issue where
a write operation can be dispatched alongside a get EOF/truncate
operation, whereas all I/O requests are supposed to be ineligible for
dispatch until the get EOF/truncate is completed
* h5fuse.sh.in clean-up (#1757)
* Added command-line options
* Committing clang-format changes
* Align with changes from develop
* Mimic MPI I/O VFD for EOF handling
* Initialize context_id field for work request objects
* Use logfile for some debugging information
* Use atomic store to set IOC ready flag
* Use separate communicator for sending file EOF data
Minor IOC cleanup
* Use H5_subfile_fid_to_context to get context ID for file in Subfiling
VFD
* IOVEC calculation fixes
* Updates for debugging code
* Minor fixes for threaded code
* Committing clang-format changes
* Use separate MPI communicator for barrier operations
* Committing clang-format changes
* Rewrite EOF routine to use nonblocking MPI communication
* Committing clang-format changes
* Always dispatch I/O work requests in IOC main loop
* Return distinct MPI communicator to library when requested
* Minor warning cleanup
* Committing clang-format changes
* Generate h5fuse.sh from h5fuse.sh.in in CMake
* Send truncate messages to correct IOC rank
* Committing clang-format changes
* Miscellaneous cleanup
Post some MPI receives before sends
Free some duplicated MPI communicator/Info objects
Remove unnecessary extra MPI_Barrier
* Warning cleanup
* Fix for leaked MPI communicator
* Retrieve file EOF on single rank and bcast it
* Fixes for a few failure paths
* Cleanup of IOC file opens
* Committing clang-format changes
* Use plan MPI_Send for send of EOF messages
* Always check MPI thread support level during Subfiling init
* Committing clang-format changes
* Handle a hang on failure when IOCs can't open subfiles
* Committing clang-format changes
* Refactor file open status consensus check
* Committing clang-format changes
* Fix for MPI_Comm_free being called after MPI_Finalize
* Fix VFD test by setting MPI params before setting subfiling on FAPL
* Update Subfiling VFD error handling and error stack usage
* Improvements for Subfiling logfiles
* Remove prototypes for currently unused routines
* Disable I/O queue stat collecting by default
* Remove unused serialization mutex variable
* Update VFD testing to take subfiling VFD into account
* Fix usage of global subfiling application layout object
* Minor fixes for failure pathways
* Keep track of the number of failures in an IOC I/O queue
* Make sure not to exceed MPI_TAG_UB value for data communication messages
* Committing clang-format changes
* Update for rename of some H5FD 'ctl' opcodes
* Always include Subfiling's public header files in hdf5.h
* Remove old unused code and comments
* Implement support for per-file I/O queues
Allows the subfiling VFD to have multiple HDF5 files open simultaneously
* Use simple MPI_Iprobe over unnecessary MPI_Improbe
* Committing clang-format changes
* Update HDF5 testing to query driver for H5FD_FEAT_DEFAULT_VFD_COMPATIBLE
flag
* Fix a few bugs related to file multi-opens
* Avoid calling MPI routines if subfiling gets reinitialized
* Fix issue when files are closed in a random order
* Update HDF5 testing to query VFD for "using MPI" feature flag
* Register atexit handler in subfiling VFD to call MPI_Finalize after HDF5
closes
* Fail for collective I/O requests until support is implemented
* Correct VOL test function prototypes
* Minor cleanup of old code and comments
* Update mercury dependency
* Cleanup of subfiling configuration structure
* Committing clang-format changes
* Build system updates for Subfiling VFD
* Fix possible hang on failure in t_vfd tests caused by mismatched
MPI_Barrier calls
* Copy subfiling IOC fapl in "fapl get" method
* Mirror subfiling superblock writes to stub file for legacy POSIX-y HDF5
applications
* Allow collective I/O for MPI_BYTE types and rank 0 bcast strategy
* Committing clang-format changes
* Use different scheme for subfiling write message MPI tag calculations
* Committing clang-format changes
* Avoid performing fstat calls on all MPI ranks
* Add MPI_Barrier before finalizing IOC threads
* Use try_lock in I/O queue dispatch to minimize contention from worker threads
* Use simple Waitall for nonblocking I/O waits
* Add configurable IOC main thread delay and try_lock option to I/O queue dispatch
* Fix bug that could cause serialization of non-overlapping I/O requests
* Temporarily treat collective subfiling vector I/O calls as independent
* Removed unused mercury bits
* Add stubs for subfiling and IOC file delete callback
* Update VFD testing for Subfiling VFD
* Work around HDF5 metadata cache bug for Subfiling VFD when MPI Comm size
= 1
* Committing clang-format changes
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
2022-07-23 04:03:12 +08:00
|
|
|
/* Test the fix for issue HDFFV-10588 */
|
|
|
|
test_corrupted_attnamelen();
|
2019-01-24 23:42:19 +08:00
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
/* Close FAPLs */
|
|
|
|
ret = H5Pclose(fapl);
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
|
|
|
ret = H5Pclose(fapl2);
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* test_iterate() */
|
2018-02-15 01:14:26 +08:00
|
|
|
|
2000-04-06 04:51:44 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2018-02-15 01:14:26 +08:00
|
|
|
* Function: cleanup_iterate
|
2000-04-06 04:51:44 +08:00
|
|
|
*
|
2018-02-15 01:14:26 +08:00
|
|
|
* Purpose: Cleanup temporary test files
|
2000-04-06 04:51:44 +08:00
|
|
|
*
|
2018-02-15 01:14:26 +08:00
|
|
|
* Return: none
|
2000-04-06 04:51:44 +08:00
|
|
|
*
|
2018-02-15 01:14:26 +08:00
|
|
|
* Programmer: Quincey Koziol
|
2000-04-06 04:51:44 +08:00
|
|
|
* April 5, 2000
|
|
|
|
*
|
|
|
|
* Modifications:
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cleanup_iterate(void)
|
|
|
|
{
|
2019-01-11 09:51:42 +08:00
|
|
|
HDremove(DATAFILE);
|
2000-04-06 04:51:44 +08:00
|
|
|
}
|