Skip to content

Commit

Permalink
Remove const from testing parameters in testframe framework (#5214)
Browse files Browse the repository at this point in the history
Makes testing parameters specified with AddTest non-const again when
passed to test functions. This allows test functions to update their
parameters during execution and is particularly useful for tests
which use those parameters to accumulate statistics, error counts,
etc. without resorting to global variables.
  • Loading branch information
jhendersonHDF authored Jan 8, 2025
1 parent 6db7030 commit af0b231
Show file tree
Hide file tree
Showing 90 changed files with 934 additions and 936 deletions.
2 changes: 1 addition & 1 deletion c++/test/dsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ test_read_string(H5File &file)
*-------------------------------------------------------------------------
*/
extern "C" void
test_dset(const void *params)
test_dset(void *params)
{
hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
Expand Down
28 changes: 14 additions & 14 deletions c++/test/h5cpputil.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,20 @@ verify_val(Type1 x, Type2 value, float epsilon, const char *msg, int line, const
#ifdef __cplusplus
extern "C" {
#endif
void test_array(const void *params);
void test_attr(const void *params);
void test_compound(const void *params);
void test_dsproplist(const void *params);
void test_file(const void *params);
void test_filters(const void *params);
void test_links(const void *params);
void test_h5s(const void *params);
void test_iterate(const void *params);
void test_object(const void *params);
void test_reference(const void *params);
void test_types(const void *params);
void test_vlstrings(const void *params);
void test_dset(const void *params);
void test_array(void *params);
void test_attr(void *params);
void test_compound(void *params);
void test_dsproplist(void *params);
void test_file(void *params);
void test_filters(void *params);
void test_links(void *params);
void test_h5s(void *params);
void test_iterate(void *params);
void test_object(void *params);
void test_reference(void *params);
void test_types(void *params);
void test_vlstrings(void *params);
void test_dset(void *params);

/* Prototypes for the cleanup routines */
void cleanup_array(void *params);
Expand Down
2 changes: 1 addition & 1 deletion c++/test/tarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ test_array_info()
*-------------------------------------------------------------------------
*/
extern "C" void
test_array(const void *params)
test_array(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/tattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl)
*-------------------------------------------------------------------------
*/
extern "C" void
test_attr(const void *params)
test_attr(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/tcompound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ test_compound_set_size()
*-------------------------------------------------------------------------
*/
extern "C" void
test_compound(const void *params)
test_compound(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/tdspl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ test_transfplist()
*-------------------------------------------------------------------------
*/
extern "C" void
test_dsproplist(const void *params)
test_dsproplist(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/tfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ test_file_info()
*-------------------------------------------------------------------------
*/
extern "C" void
test_file(const void *params)
test_file(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/tfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ test_szip_filter(H5File &file1)
*/
const H5std_string FILE1("tfilters.h5");
extern "C" void
test_filters(const void *params)
test_filters(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/th5s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ test_h5s_compound_scalar_read()
*-------------------------------------------------------------------------
*/
extern "C" void
test_h5s(const void *params)
test_h5s(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/titerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ test_HDFFV_9920()
*-------------------------------------------------------------------------
*/
extern "C" void
test_iterate(const void *params)
test_iterate(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/tlinks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ test_visit(hid_t fapl_id, hbool_t new_format)
*-------------------------------------------------------------------------
*/
extern "C" void
test_links(const void *params)
test_links(void *params)
{
hid_t fapl_id, fapl2_id; /* File access property lists */
unsigned new_format; /* Whether to use the new format or not */
Expand Down
2 changes: 1 addition & 1 deletion c++/test/tobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ test_intermediate_groups()
*-------------------------------------------------------------------------
*/
extern "C" void
test_object(const void *params)
test_object(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/trefer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ test_reference_region_1D()
*-------------------------------------------------------------------------
*/
extern "C" void
test_reference(const void *params)
test_reference(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/ttypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ test_operators()
*-------------------------------------------------------------------------
*/
extern "C" void
test_types(const void *params)
test_types(void *params)
{
(void)params;

Expand Down
2 changes: 1 addition & 1 deletion c++/test/tvlstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ test_vl_rewrite()
*-------------------------------------------------------------------------
*/
extern "C" void
test_vlstrings(const void *params)
test_vlstrings(void *params)
{
(void)params;

Expand Down
60 changes: 30 additions & 30 deletions test/API/H5_api_async_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

#include "H5_api_async_test.h"

static void print_async_test_header(const void *params);
static void print_async_test_header(void *params);

static void
print_async_test_header(const void H5_ATTR_UNUSED *params)
print_async_test_header(void H5_ATTR_UNUSED *params)
{
printf("\n");
printf("**********************************************\n");
Expand All @@ -31,20 +31,20 @@ print_async_test_header(const void H5_ATTR_UNUSED *params)

#ifdef H5_API_TEST_HAVE_ASYNC

static void test_one_dataset_io(const void *params);
static void test_multi_dataset_io(const void *params);
static void test_multi_file_dataset_io(const void *params);
static void test_multi_file_grp_dset_io(const void *params);
static void test_set_extent(const void *params);
static void test_attribute_exists(const void *params);
static void test_attribute_io(const void *params);
static void test_attribute_io_tconv(const void *params);
static void test_attribute_io_compound(const void *params);
static void test_group(const void *params);
static void test_link(const void *params);
static void test_ocopy_orefresh(const void *params);
static void test_file_reopen(const void *params);
static void test_file_cleanup(const void *params);
static void test_one_dataset_io(void *params);
static void test_multi_dataset_io(void *params);
static void test_multi_file_dataset_io(void *params);
static void test_multi_file_grp_dset_io(void *params);
static void test_set_extent(void *params);
static void test_attribute_exists(void *params);
static void test_attribute_io(void *params);
static void test_attribute_io_tconv(void *params);
static void test_attribute_io_compound(void *params);
static void test_group(void *params);
static void test_link(void *params);
static void test_ocopy_orefresh(void *params);
static void test_file_reopen(void *params);
static void test_file_cleanup(void *params);

/* Highest "printf" file created (starting at 0) */
int max_printf_file = -1;
Expand All @@ -53,7 +53,7 @@ int max_printf_file = -1;
* Create file and dataset, write to dataset
*/
static void
test_one_dataset_io(const void H5_ATTR_UNUSED *params)
test_one_dataset_io(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t dset_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -320,7 +320,7 @@ test_one_dataset_io(const void H5_ATTR_UNUSED *params)
* Create file and multiple datasets, write to them and read from them
*/
static void
test_multi_dataset_io(const void H5_ATTR_UNUSED *params)
test_multi_dataset_io(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t dset_id[5] = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID};
Expand Down Expand Up @@ -575,7 +575,7 @@ test_multi_dataset_io(const void H5_ATTR_UNUSED *params)
* from them
*/
static void
test_multi_file_dataset_io(const void H5_ATTR_UNUSED *params)
test_multi_file_dataset_io(void H5_ATTR_UNUSED *params)
{
hid_t file_id[5] = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID};
hid_t dset_id[5] = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID};
Expand Down Expand Up @@ -885,7 +885,7 @@ test_multi_file_dataset_io(const void H5_ATTR_UNUSED *params)
* and read from them
*/
static void
test_multi_file_grp_dset_io(const void H5_ATTR_UNUSED *params)
test_multi_file_grp_dset_io(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t grp_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -1193,7 +1193,7 @@ test_multi_file_grp_dset_io(const void H5_ATTR_UNUSED *params)
* Create file and dataset, write to dataset
*/
static void
test_set_extent(const void H5_ATTR_UNUSED *params)
test_set_extent(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t dset_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -1408,7 +1408,7 @@ test_set_extent(const void H5_ATTR_UNUSED *params)
* Test H5Aexists()
*/
static void
test_attribute_exists(const void H5_ATTR_UNUSED *params)
test_attribute_exists(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t dset_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -1529,7 +1529,7 @@ test_attribute_exists(const void H5_ATTR_UNUSED *params)
* Create file, dataset, and attribute, write to attribute
*/
static void
test_attribute_io(const void H5_ATTR_UNUSED *params)
test_attribute_io(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t dset_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -1673,7 +1673,7 @@ test_attribute_io(const void H5_ATTR_UNUSED *params)
* Create file, dataset, and attribute, write to attribute with type conversion
*/
static void
test_attribute_io_tconv(const void H5_ATTR_UNUSED *params)
test_attribute_io_tconv(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t attr_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -1814,7 +1814,7 @@ typedef struct tattr_cmpd_t {
} tattr_cmpd_t;

static void
test_attribute_io_compound(const void H5_ATTR_UNUSED *params)
test_attribute_io_compound(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t attr_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -2124,7 +2124,7 @@ test_attribute_io_compound(const void H5_ATTR_UNUSED *params)
* Test group interfaces
*/
static void
test_group(const void H5_ATTR_UNUSED *params)
test_group(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t parent_group_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -2292,7 +2292,7 @@ test_group(const void H5_ATTR_UNUSED *params)
* Test link interfaces
*/
static void
test_link(const void H5_ATTR_UNUSED *params)
test_link(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t parent_group_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -2489,7 +2489,7 @@ test_link(const void H5_ATTR_UNUSED *params)
* Test H5Ocopy() and H5Orefresh()
*/
static void
test_ocopy_orefresh(const void H5_ATTR_UNUSED *params)
test_ocopy_orefresh(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t parent_group_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -2604,7 +2604,7 @@ test_ocopy_orefresh(const void H5_ATTR_UNUSED *params)
* Test H5Freopen()
*/
static void
test_file_reopen(const void H5_ATTR_UNUSED *params)
test_file_reopen(void H5_ATTR_UNUSED *params)
{
hid_t file_id = H5I_INVALID_HID;
hid_t reopened_file_id = H5I_INVALID_HID;
Expand Down Expand Up @@ -2676,7 +2676,7 @@ test_file_reopen(const void H5_ATTR_UNUSED *params)
* Cleanup temporary test files
*/
static void
test_file_cleanup(const void H5_ATTR_UNUSED *params)
test_file_cleanup(void H5_ATTR_UNUSED *params)
{
char file_name[64];
int i;
Expand Down
Loading

0 comments on commit af0b231

Please sign in to comment.