diff --git a/bin/process_source.sh b/bin/process_source.sh new file mode 100755 index 00000000000..728857578af --- /dev/null +++ b/bin/process_source.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the LICENSE file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +# A convenience script to process HDF5 source. This recreates some header files +# from their input files and runs the trace script to update the H5ARG_TRACE +# macros. +# +# This does NOT regenerate the parser code in the high-level library, since +# that would probably generate a lot of churn due to different flex, etc. +# versions. If you want to regenerate that code, use the genparser script +# from the bin directory. + +echo +echo "******************************" +echo "* HDF5 process source script *" +echo "******************************" +echo +echo "*** NOTE: Must be run from the source root! ***" +echo + +# Run trace script +# The trace script updates H5ARG_TRACE macros in library source files. +echo "Running arg trace script:" +bin/trace src/H5*.c || exit 1 +echo + +# Run make_err +# make_err automatically generates the H5E headers that create error message +# types for HDF5. +echo "Running error generation script:" +bin/make_err src/H5err.txt || exit 1 +echo + +# Run make_vers +# make_vers automatically generates the public headers that define the API version +# macros for HDF5. +echo "Running API version generation script:" +bin/make_vers src/H5vers.txt || exit 1 +echo + +# Run make_overflow +# make_overflow automatically generates macros for detecting overflows for type +# conversion. +echo "Running overflow macro generation script:" +bin/make_overflow src/H5overflow.txt || exit 1 +echo + +echo "*** SUCCESS ***" + +echo +exit 0 diff --git a/test/API/CMakeLists.txt b/test/API/CMakeLists.txt index 3813539d433..c953c865d88 100644 --- a/test/API/CMakeLists.txt +++ b/test/API/CMakeLists.txt @@ -403,10 +403,6 @@ if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) foreach (api_test_extra ${HDF5_API_TESTS_EXTRA}) if (TARGET ${api_test_extra}) - set_target_properties (${api_test_extra} - PROPERTIES - OUTPUT_NAME "h5_api_test_${api_test_extra}" - ) install ( TARGETS ${api_test_extra} EXPORT ${HDF5_EXPORTED_TARGETS} diff --git a/test/API/H5_api_async_test.c b/test/API/H5_api_async_test.c index 7646a24cac9..04b604f0761 100644 --- a/test/API/H5_api_async_test.c +++ b/test/API/H5_api_async_test.c @@ -12,40 +12,39 @@ #include "H5_api_async_test.h" -#ifdef H5ESpublic_H - -static int test_one_dataset_io(void); -static int test_multi_dataset_io(void); -static int test_multi_file_dataset_io(void); -static int test_multi_file_grp_dset_io(void); -static int test_set_extent(void); -static int test_attribute_exists(void); -static int test_attribute_io(void); -static int test_attribute_io_tconv(void); -static int test_attribute_io_compound(void); -static int test_group(void); -static int test_link(void); -static int test_ocopy_orefresh(void); -static int test_file_reopen(void); +static void print_async_test_header(const void *params); -/* - * The array of async tests to be performed. - */ -static int (*async_tests[])(void) = { - test_one_dataset_io, - test_multi_dataset_io, - test_multi_file_dataset_io, - test_multi_file_grp_dset_io, - test_set_extent, - test_attribute_exists, - test_attribute_io, - test_attribute_io_tconv, - test_attribute_io_compound, - test_group, - test_link, - test_ocopy_orefresh, - test_file_reopen, -}; +static void +print_async_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Async Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + +#ifndef H5_API_TEST_HAVE_ASYNC + printf("SKIPPED due to no async support\n"); +#endif +} + +#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); /* Highest "printf" file created (starting at 0) */ int max_printf_file = -1; @@ -53,8 +52,8 @@ int max_printf_file = -1; /* * Create file and dataset, write to dataset */ -static int -test_one_dataset_io(void) +static void +test_one_dataset_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -70,11 +69,12 @@ test_one_dataset_io(void) TESTING_MULTIPART("single dataset I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, dataset, or flush aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -300,7 +300,7 @@ test_one_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -313,14 +313,14 @@ test_one_dataset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_one_dataset_io() */ /* * Create file and multiple datasets, write to them and read from them */ -static int -test_multi_dataset_io(void) +static void +test_multi_dataset_io(const 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}; @@ -337,11 +337,12 @@ test_multi_dataset_io(void) TESTING_MULTIPART("multi dataset I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, dataset, or flush aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -552,7 +553,7 @@ test_multi_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -566,15 +567,15 @@ test_multi_dataset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_multi_dataset_io() */ /* * Create multiple files, each with a single dataset, write to them and read * from them */ -static int -test_multi_file_dataset_io(void) +static void +test_multi_file_dataset_io(const 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}; @@ -591,11 +592,12 @@ test_multi_file_dataset_io(void) TESTING_MULTIPART("multi file dataset I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, dataset, or flush aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -860,7 +862,7 @@ test_multi_file_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -875,15 +877,15 @@ test_multi_file_dataset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_multi_file_dataset_io() */ /* * Create multiple files, each with a single group and dataset, write to them * and read from them */ -static int -test_multi_file_grp_dset_io(void) +static void +test_multi_file_grp_dset_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t grp_id = H5I_INVALID_HID; @@ -901,11 +903,11 @@ test_multi_file_grp_dset_io(void) TESTING_MULTIPART("multi file dataset I/O with groups"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1170,7 +1172,7 @@ test_multi_file_grp_dset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1184,14 +1186,14 @@ test_multi_file_grp_dset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_multi_file_grp_dset_io() */ /* * Create file and dataset, write to dataset */ -static int -test_set_extent(void) +static void +test_set_extent(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -1217,12 +1219,13 @@ test_set_extent(void) TESTING("H5Dset_extent() and H5Dget_space()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, or flush aren't supported with " "this connector\n"); - return 0; + return; } /* Create file dataspace */ @@ -1380,7 +1383,7 @@ test_set_extent(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1398,14 +1401,14 @@ test_set_extent(void) } H5E_END_TRY - return 1; + return; } /* end test_set_extent() */ /* * Test H5Aexists() */ -static int -test_attribute_exists(void) +static void +test_attribute_exists(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -1421,12 +1424,13 @@ test_attribute_exists(void) TESTING("H5Aexists()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, attribute, or flush aren't " "supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -1504,7 +1508,7 @@ test_attribute_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1518,14 +1522,14 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io() */ /* * Create file, dataset, and attribute, write to attribute */ -static int -test_attribute_io(void) +static void +test_attribute_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -1542,12 +1546,13 @@ test_attribute_io(void) TESTING("attribute I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, attribute, or flush aren't " "supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -1647,7 +1652,7 @@ test_attribute_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1661,14 +1666,14 @@ test_attribute_io(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io() */ /* * Create file, dataset, and attribute, write to attribute with type conversion */ -static int -test_attribute_io_tconv(void) +static void +test_attribute_io_tconv(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t attr_id = H5I_INVALID_HID; @@ -1684,12 +1689,12 @@ test_attribute_io_tconv(void) TESTING("attribute I/O with type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf( " API functions for basic file, attribute, or flush aren't supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -1783,7 +1788,7 @@ test_attribute_io_tconv(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1796,7 +1801,7 @@ test_attribute_io_tconv(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io_tconv() */ /* @@ -1808,8 +1813,8 @@ typedef struct tattr_cmpd_t { int b; } tattr_cmpd_t; -static int -test_attribute_io_compound(void) +static void +test_attribute_io_compound(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t attr_id = H5I_INVALID_HID; @@ -1830,12 +1835,12 @@ test_attribute_io_compound(void) TESTING("attribute I/O with compound type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf( " API functions for basic file, attribute, or flush aren't supported with this connector\n"); - return 0; + return; } /* Create datatype */ @@ -2095,7 +2100,7 @@ test_attribute_io_compound(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2112,14 +2117,14 @@ test_attribute_io_compound(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io_compound() */ /* * Test group interfaces */ -static int -test_group(void) +static void +test_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID; @@ -2136,12 +2141,13 @@ test_group(void) TESTING("group operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, group, or group more aren't supported " "with this connector\n"); - return 0; + return; } /* Create GCPL */ @@ -2264,7 +2270,7 @@ test_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2279,14 +2285,14 @@ test_group(void) } H5E_END_TRY - return 1; + return; } /* end test_group() */ /* * Test link interfaces */ -static int -test_link(void) +static void +test_link(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID; @@ -2305,14 +2311,14 @@ test_link(void) TESTING("link operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { SKIPPED(); printf(" API functions for basic file, link, hard link, soft link, flush, or creation order " "aren't supported with this connector\n"); - return 0; + return; } /* Create GCPL */ @@ -2462,7 +2468,7 @@ test_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2476,14 +2482,14 @@ test_link(void) } H5E_END_TRY - return 1; + return; } /* end test_link() */ /* * Test H5Ocopy() and H5Orefresh() */ -static int -test_ocopy_orefresh(void) +static void +test_ocopy_orefresh(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID; @@ -2497,13 +2503,13 @@ test_ocopy_orefresh(void) TESTING("H5Ocopy() and H5Orefresh()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, group, dataset, object more, flush, or refresh aren't " "supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -2578,7 +2584,7 @@ test_ocopy_orefresh(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2591,14 +2597,14 @@ test_ocopy_orefresh(void) } H5E_END_TRY - return 1; + return; } /* end test_ocopy_orefresh() */ /* * Test H5Freopen() */ -static int -test_file_reopen(void) +static void +test_file_reopen(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t reopened_file_id = H5I_INVALID_HID; @@ -2609,10 +2615,11 @@ test_file_reopen(void) TESTING("H5Freopen()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { SKIPPED(); printf(" API functions for basic file or file more aren't supported with this connector\n"); - return 0; + return; } /* Create event stack */ @@ -2650,7 +2657,7 @@ test_file_reopen(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2662,14 +2669,14 @@ test_file_reopen(void) } H5E_END_TRY - return 1; + return; } /* end test_file_reopen() */ /* * Cleanup temporary test files */ static void -cleanup_files(void) +test_file_cleanup(const void H5_ATTR_UNUSED *params) { char file_name[64]; int i; @@ -2679,54 +2686,46 @@ cleanup_files(void) for (i = 0; i <= max_printf_file; i++) { snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); remove_test_file(NULL, file_name); - } /* end for */ + } } -int -H5_api_async_test(void) +void +H5_api_async_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC)) { - SKIPPED(); - printf(" Async APIs aren't supported with this connector\n"); - return 0; - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(async_tests); i++) { - nerrors += (*async_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header", print_async_test_header, NULL, NULL, NULL, 0, + "Prints header for async tests"); + + AddTest("test_one_dataset_io", test_one_dataset_io, NULL, NULL, NULL, 0, "single dataset I/O"); + AddTest("test_multi_dataset_io", test_multi_dataset_io, NULL, NULL, NULL, 0, "multi dataset I/O"); + AddTest("test_multi_file_dataset_io", test_multi_file_dataset_io, NULL, NULL, NULL, 0, + "multi file dataset I/O"); + AddTest("test_multi_file_grp_dset_io", test_multi_file_grp_dset_io, NULL, NULL, NULL, 0, + "multi file dataset I/O with groups"); + AddTest("test_set_extent", test_set_extent, NULL, NULL, NULL, 0, "H5Dset_extent() and H5Dget_space()"); + AddTest("test_attribute_exists", test_attribute_exists, NULL, NULL, NULL, 0, "H5Aexists()"); + AddTest("test_attribute_io", test_attribute_io, NULL, NULL, NULL, 0, "attribute I/O"); + AddTest("test_attribute_io_tconv", test_attribute_io_tconv, NULL, NULL, NULL, 0, + "attribute I/O with type conversion"); + AddTest("test_attribute_io_compound", test_attribute_io_compound, NULL, NULL, NULL, 0, + "attribute I/O with compound type conversion"); + AddTest("test_group", test_group, NULL, NULL, NULL, 0, "group operations"); + AddTest("test_link", test_link, NULL, NULL, NULL, 0, "link operations"); + AddTest("test_ocopy_orefresh", test_ocopy_orefresh, NULL, NULL, NULL, 0, "H5Ocopy() and H5Orefresh()"); + AddTest("test_file_reopen", test_file_reopen, NULL, NULL, NULL, 0, "H5Freopen()"); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_file_cleanup", test_file_cleanup, NULL, NULL, NULL, 0, "cleanup test files"); } -#else /* H5ESpublic_H */ +#else /* H5_API_TEST_HAVE_ASYNC */ -int -H5_api_async_test(void) +void +H5_api_async_test_add(void) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - printf("SKIPPED due to no async support in HDF5 library\n"); - - return 0; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header", print_async_test_header, NULL, NULL, NULL, 0, + "Prints header for async tests"); } -#endif /* H5ESpublic_H */ +#endif /* H5_API_TEST_HAVE_ASYNC */ diff --git a/test/API/H5_api_async_test.h b/test/API/H5_api_async_test.h index f3139f8ba37..99571efa1a5 100644 --- a/test/API/H5_api_async_test.h +++ b/test/API/H5_api_async_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_async_test(void); +void H5_api_async_test_add(void); /************************************************ * * diff --git a/test/API/H5_api_attribute_test.c b/test/API/H5_api_attribute_test.c index 0e5aee07648..d508889ae31 100644 --- a/test/API/H5_api_attribute_test.c +++ b/test/API/H5_api_attribute_test.c @@ -20,104 +20,71 @@ * order value gets reset when all attributes are removed. */ -static int test_create_attribute_on_root(void); -static int test_create_attribute_on_dataset(void); -static int test_create_attribute_on_datatype(void); -static int test_create_attribute_with_null_space(void); -static int test_create_attribute_with_scalar_space(void); -static int test_create_attribute_with_space_in_name(void); -static int test_create_attribute_invalid_params(void); -static int test_open_attribute(void); -static int test_open_attribute_invalid_params(void); -static int test_write_attribute(void); -static int test_write_attribute_invalid_params(void); -static int test_read_attribute(void); -static int test_read_attribute_invalid_params(void); -static int test_read_empty_attribute(void); -static int test_close_attribute_invalid_id(void); -static int test_get_attribute_space_and_type(void); -static int test_get_attribute_space_and_type_invalid_params(void); -static int test_attribute_property_lists(void); -static int test_get_attribute_name(void); -static int test_get_attribute_name_invalid_params(void); -static int test_get_attribute_storage_size(void); -static int test_get_attribute_info(void); -static int test_get_attribute_info_invalid_params(void); -static int test_rename_attribute(void); -static int test_rename_attribute_invalid_params(void); -static int test_attribute_iterate_group(void); -static int test_attribute_iterate_dataset(void); -static int test_attribute_iterate_datatype(void); -static int test_attribute_iterate_index_saving(void); -static int test_attribute_iterate_invalid_params(void); -static int test_attribute_iterate_0_attributes(void); -static int test_attribute_compound_subset(void); -static int test_attribute_string_encodings(void); -static int test_delete_attribute(void); -static int test_delete_attribute_invalid_params(void); -static int test_attribute_exists(void); -static int test_attribute_exists_invalid_params(void); -static int test_attribute_many(void); -static int test_attribute_duplicate_id(void); -static int test_get_number_attributes(void); -static int test_attr_shared_dtype(void); +static void print_attribute_test_header(const void *params); +static void test_create_attribute_on_root(const void *params); +static void test_create_attribute_on_dataset(const void *params); +static void test_create_attribute_on_datatype(const void *params); +static void test_create_attribute_with_null_space(const void *params); +static void test_create_attribute_with_scalar_space(const void *params); +static void test_create_attribute_with_space_in_name(const void *params); +static void test_create_attribute_invalid_params(const void *params); +static void test_open_attribute(const void *params); +static void test_open_attribute_invalid_params(const void *params); +static void test_write_attribute(const void *params); +static void test_write_attribute_invalid_params(const void *params); +static void test_read_attribute(const void *params); +static void test_read_attribute_invalid_params(const void *params); +static void test_read_empty_attribute(const void *params); +static void test_close_attribute_invalid_id(const void *params); +static void test_get_attribute_space_and_type(const void *params); +static void test_get_attribute_space_and_type_invalid_params(const void *params); +static void test_attribute_property_lists(const void *params); +static void test_get_attribute_name(const void *params); +static void test_get_attribute_name_invalid_params(const void *params); +static void test_get_attribute_storage_size(const void *params); +static void test_get_attribute_info(const void *params); +static void test_get_attribute_info_invalid_params(const void *params); +static void test_rename_attribute(const void *params); +static void test_rename_attribute_invalid_params(const void *params); +static void test_attribute_iterate_group(const void *params); +static void test_attribute_iterate_dataset(const void *params); +static void test_attribute_iterate_datatype(const void *params); +static void test_attribute_iterate_index_saving(const void *params); +static void test_attribute_iterate_invalid_params(const void *params); +static void test_attribute_iterate_0_attributes(const void *params); +static void test_attribute_compound_subset(const void *params); +static void test_attribute_string_encodings(const void *params); +static void test_delete_attribute(const void *params); +static void test_delete_attribute_invalid_params(const void *params); +static void test_attribute_exists(const void *params); +static void test_attribute_exists_invalid_params(const void *params); +static void test_attribute_many(const void *params); +static void test_attribute_duplicate_id(const void *params); +static void test_get_number_attributes(const void *params); +static void test_attr_shared_dtype(const void *params); static herr_t attr_iter_callback1(hid_t location_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data); static herr_t attr_iter_callback2(hid_t location_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data); -/* - * The array of attribute tests to be performed. - */ -static int (*attribute_tests[])(void) = {test_create_attribute_on_root, - test_create_attribute_on_dataset, - test_create_attribute_on_datatype, - test_create_attribute_with_null_space, - test_create_attribute_with_scalar_space, - test_create_attribute_with_space_in_name, - test_create_attribute_invalid_params, - test_open_attribute, - test_open_attribute_invalid_params, - test_write_attribute, - test_write_attribute_invalid_params, - test_read_attribute, - test_read_attribute_invalid_params, - test_read_empty_attribute, - test_close_attribute_invalid_id, - test_get_attribute_space_and_type, - test_get_attribute_space_and_type_invalid_params, - test_attribute_property_lists, - test_get_attribute_name, - test_get_attribute_name_invalid_params, - test_get_attribute_storage_size, - test_get_attribute_info, - test_get_attribute_info_invalid_params, - test_rename_attribute, - test_rename_attribute_invalid_params, - test_attribute_iterate_group, - test_attribute_iterate_dataset, - test_attribute_iterate_datatype, - test_attribute_iterate_index_saving, - test_attribute_iterate_invalid_params, - test_attribute_iterate_0_attributes, - test_attribute_compound_subset, - test_attribute_string_encodings, - test_delete_attribute, - test_delete_attribute_invalid_params, - test_attribute_exists, - test_attribute_exists_invalid_params, - test_attribute_duplicate_id, - test_attribute_many, - test_get_number_attributes, - test_attr_shared_dtype}; +static void +print_attribute_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Attribute Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that an attribute can be created on * the root group. */ -static int -test_create_attribute_on_root(void) +static void +test_create_attribute_on_root(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -131,7 +98,7 @@ test_create_attribute_on_root(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -232,7 +199,7 @@ test_create_attribute_on_root(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -246,15 +213,15 @@ test_create_attribute_on_root(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be created on * a dataset. */ -static int -test_create_attribute_on_dataset(void) +static void +test_create_attribute_on_dataset(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -275,7 +242,7 @@ test_create_attribute_on_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or attribute aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -412,7 +379,7 @@ test_create_attribute_on_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -431,15 +398,15 @@ test_create_attribute_on_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be created on * a committed datatype. */ -static int -test_create_attribute_on_datatype(void) +static void +test_create_attribute_on_datatype(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -459,7 +426,7 @@ test_create_attribute_on_datatype(void) SKIPPED(); printf(" API functions for basic file, group, stored datatype, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -589,7 +556,7 @@ test_create_attribute_on_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -606,15 +573,15 @@ test_create_attribute_on_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating an attribute with a * NULL dataspace is not problematic. */ -static int -test_create_attribute_with_null_space(void) +static void +test_create_attribute_with_null_space(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -631,7 +598,7 @@ test_create_attribute_with_null_space(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -703,7 +670,7 @@ test_create_attribute_with_null_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -717,15 +684,15 @@ test_create_attribute_with_null_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating an attribute with a * scalar dataspace is not problematic. */ -static int -test_create_attribute_with_scalar_space(void) +static void +test_create_attribute_with_scalar_space(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -742,7 +709,7 @@ test_create_attribute_with_scalar_space(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -814,7 +781,7 @@ test_create_attribute_with_scalar_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -828,15 +795,15 @@ test_create_attribute_with_scalar_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a space in an attribute's name * is not problematic. */ -static int -test_create_attribute_with_space_in_name(void) +static void +test_create_attribute_with_space_in_name(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -855,7 +822,7 @@ test_create_attribute_with_space_in_name(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -919,7 +886,7 @@ test_create_attribute_with_space_in_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -934,15 +901,15 @@ test_create_attribute_with_space_in_name(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can't be created when * H5Acreate is passed invalid parameters. */ -static int -test_create_attribute_invalid_params(void) +static void +test_create_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -958,7 +925,7 @@ test_create_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1364,7 +1331,7 @@ test_create_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1378,14 +1345,14 @@ test_create_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aopen(_by_idx). */ -static int -test_open_attribute(void) +static void +test_open_attribute(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1402,7 +1369,7 @@ test_open_attribute(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1766,7 +1733,7 @@ test_open_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1781,15 +1748,15 @@ test_open_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can't be opened when * H5Aopen(_by_name/_by_idx) is passed invalid parameters. */ -static int -test_open_attribute_invalid_params(void) +static void +test_open_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1805,7 +1772,7 @@ test_open_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2282,7 +2249,7 @@ test_open_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2296,15 +2263,15 @@ test_open_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a simple write to an attribute * can be made. */ -static int -test_write_attribute(void) +static void +test_write_attribute(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_WRITE_TEST_SPACE_RANK]; size_t i, data_size; @@ -2324,7 +2291,7 @@ test_write_attribute(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or file flush aren't supported with " "this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2410,7 +2377,7 @@ test_write_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2425,15 +2392,15 @@ test_write_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that writing an attribute fails when * H5Awrite is passed invalid parameters. */ -static int -test_write_attribute_invalid_params(void) +static void +test_write_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_WRITE_INVALID_PARAMS_TEST_SPACE_RANK]; size_t i, data_size; @@ -2454,7 +2421,7 @@ test_write_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2599,7 +2566,7 @@ test_write_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2614,7 +2581,7 @@ test_write_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -2622,8 +2589,8 @@ test_write_attribute_invalid_params(void) * and verified after it has been written to an * attribute. */ -static int -test_read_attribute(void) +static void +test_read_attribute(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_READ_TEST_SPACE_RANK]; size_t i, data_size; @@ -2644,7 +2611,7 @@ test_read_attribute(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2753,7 +2720,7 @@ test_read_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2770,15 +2737,15 @@ test_read_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that reading an attribute fails when * H5Aread is passed invalid parameters. */ -static int -test_read_attribute_invalid_params(void) +static void +test_read_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_READ_INVALID_PARAMS_TEST_SPACE_RANK]; size_t i, data_size; @@ -2800,7 +2767,7 @@ test_read_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2967,7 +2934,7 @@ test_read_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2984,14 +2951,14 @@ test_read_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * Test reading an empty attribute is ok */ -static int -test_read_empty_attribute(void) +static void +test_read_empty_attribute(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_READ_EMPTY_SPACE_RANK]; size_t i, data_size; @@ -3011,7 +2978,7 @@ test_read_empty_attribute(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3096,7 +3063,7 @@ test_read_empty_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3111,14 +3078,14 @@ test_read_empty_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Aclose fails when it is passed * an invalid attribute ID. */ -static int -test_close_attribute_invalid_id(void) +static void +test_close_attribute_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -3129,7 +3096,7 @@ test_close_attribute_invalid_id(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3155,7 +3122,7 @@ test_close_attribute_invalid_id(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3164,7 +3131,7 @@ test_close_attribute_invalid_id(void) } H5E_END_TRY - return 1; + return; } /* @@ -3172,8 +3139,8 @@ test_close_attribute_invalid_id(void) * dataspace and datatype can be retrieved with * H5Aget_space and H5Aget_type, respectively. */ -static int -test_get_attribute_space_and_type(void) +static void +test_get_attribute_space_and_type(const void H5_ATTR_UNUSED *params) { hsize_t attr_dims[ATTRIBUTE_GET_SPACE_TYPE_TEST_SPACE_RANK]; size_t i; @@ -3195,7 +3162,7 @@ test_get_attribute_space_and_type(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or attribute aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3453,7 +3420,7 @@ test_get_attribute_space_and_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3469,7 +3436,7 @@ test_get_attribute_space_and_type(void) } H5E_END_TRY - return 1; + return; } /* @@ -3477,8 +3444,8 @@ test_get_attribute_space_and_type(void) * can't be retrieved when H5Aget_space and H5Aget_type are passed * invalid parameters, respectively. */ -static int -test_get_attribute_space_and_type_invalid_params(void) +static void +test_get_attribute_space_and_type_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -3498,7 +3465,7 @@ test_get_attribute_space_and_type_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3614,7 +3581,7 @@ test_get_attribute_space_and_type_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3630,7 +3597,7 @@ test_get_attribute_space_and_type_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -3638,8 +3605,8 @@ test_get_attribute_space_and_type_invalid_params(void) * can be persisted and that a valid copy of that ACPL can * be retrieved later with a call to H5Aget_create_plist. */ -static int -test_attribute_property_lists(void) +static void +test_attribute_property_lists(const void H5_ATTR_UNUSED *params) { H5T_cset_t encoding = H5T_CSET_UTF8; htri_t attr_exists; @@ -3658,7 +3625,7 @@ test_attribute_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3897,7 +3864,7 @@ test_attribute_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3915,7 +3882,7 @@ test_attribute_property_lists(void) } H5E_END_TRY - return 1; + return; } /* @@ -3923,8 +3890,8 @@ test_attribute_property_lists(void) * correctly retrieved with H5Aget_name and * H5Aget_name_by_idx. */ -static int -test_get_attribute_name(void) +static void +test_get_attribute_name(const void H5_ATTR_UNUSED *params) { ssize_t name_buf_size; htri_t attr_exists; @@ -3945,7 +3912,7 @@ test_get_attribute_name(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4395,7 +4362,7 @@ test_get_attribute_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4412,7 +4379,7 @@ test_get_attribute_name(void) } H5E_END_TRY - return 1; + return; } /* @@ -4420,8 +4387,8 @@ test_get_attribute_name(void) * retrieved when H5Aget_name(_by_idx) is passed invalid * parameters. */ -static int -test_get_attribute_name_invalid_params(void) +static void +test_get_attribute_name_invalid_params(const void H5_ATTR_UNUSED *params) { ssize_t name_buf_size; htri_t attr_exists; @@ -4441,7 +4408,7 @@ test_get_attribute_name_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4754,7 +4721,7 @@ test_get_attribute_name_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4770,27 +4737,27 @@ test_get_attribute_name_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aget_storage_size. */ -static int -test_get_attribute_storage_size(void) +static void +test_get_attribute_storage_size(const void H5_ATTR_UNUSED *params) { TESTING("H5Aget_storage_size"); SKIPPED(); - return 0; + return; } /* * A test to check the functionality of H5Aget_info(_by_idx). */ -static int -test_get_attribute_info(void) +static void +test_get_attribute_info(const void H5_ATTR_UNUSED *params) { H5A_info_t attr_info; htri_t attr_exists; @@ -4810,7 +4777,7 @@ test_get_attribute_info(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5415,7 +5382,7 @@ test_get_attribute_info(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5430,15 +5397,15 @@ test_get_attribute_info(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Aget_info(_by_name/_by_idx) * doesn't succeed when passed invalid parameters. */ -static int -test_get_attribute_info_invalid_params(void) +static void +test_get_attribute_info_invalid_params(const void H5_ATTR_UNUSED *params) { H5A_info_t attr_info; htri_t attr_exists; @@ -5458,7 +5425,7 @@ test_get_attribute_info_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5878,7 +5845,7 @@ test_get_attribute_info_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5892,15 +5859,15 @@ test_get_attribute_info_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be renamed * with H5Arename and H5Arename_by_name. */ -static int -test_rename_attribute(void) +static void +test_rename_attribute(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -5918,7 +5885,7 @@ test_rename_attribute(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6094,7 +6061,7 @@ test_rename_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6109,15 +6076,15 @@ test_rename_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can't be renamed * when H5Arename(_by_name) is passed invalid parameters. */ -static int -test_rename_attribute_invalid_params(void) +static void +test_rename_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; herr_t err_ret = -1; @@ -6136,7 +6103,7 @@ test_rename_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6463,7 +6430,7 @@ test_rename_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6478,7 +6445,7 @@ test_rename_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -6488,8 +6455,8 @@ test_rename_attribute_invalid_params(void) * order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_group(void) +static void +test_attribute_iterate_group(const void H5_ATTR_UNUSED *params) { size_t link_counter; size_t i; @@ -6509,7 +6476,7 @@ test_attribute_iterate_group(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or iterate aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6855,7 +6822,7 @@ test_attribute_iterate_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6870,7 +6837,7 @@ test_attribute_iterate_group(void) } H5E_END_TRY - return 1; + return; } /* @@ -6880,8 +6847,8 @@ test_attribute_iterate_group(void) * order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_dataset(void) +static void +test_attribute_iterate_dataset(const void H5_ATTR_UNUSED *params) { size_t link_counter; size_t i; @@ -6905,7 +6872,7 @@ test_attribute_iterate_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, attribute, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7276,7 +7243,7 @@ test_attribute_iterate_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7294,7 +7261,7 @@ test_attribute_iterate_dataset(void) } H5E_END_TRY - return 1; + return; } /* @@ -7304,8 +7271,8 @@ test_attribute_iterate_dataset(void) * decreasing order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_datatype(void) +static void +test_attribute_iterate_datatype(const void H5_ATTR_UNUSED *params) { size_t link_counter; size_t i; @@ -7327,7 +7294,7 @@ test_attribute_iterate_datatype(void) SKIPPED(); printf(" API functions for basic file, group, stored datatype, attribute, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7693,7 +7660,7 @@ test_attribute_iterate_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7709,7 +7676,7 @@ test_attribute_iterate_datatype(void) } H5E_END_TRY - return 1; + return; } /* @@ -7719,14 +7686,14 @@ test_attribute_iterate_datatype(void) * order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_index_saving(void) +static void +test_attribute_iterate_index_saving(const void H5_ATTR_UNUSED *params) { TESTING("attribute iteration index saving capability"); SKIPPED(); - return 1; + return; } /* @@ -7734,8 +7701,8 @@ test_attribute_iterate_index_saving(void) * be iterated over when H5Aiterate(_by_name) is * passed invalid parameters. */ -static int -test_attribute_iterate_invalid_params(void) +static void +test_attribute_iterate_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t attr_exists; @@ -7754,7 +7721,7 @@ test_attribute_iterate_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or iterate aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8130,7 +8097,7 @@ test_attribute_iterate_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8147,7 +8114,7 @@ test_attribute_iterate_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -8155,8 +8122,8 @@ test_attribute_iterate_invalid_params(void) * on an object with no attributes attached to it is * not problematic. */ -static int -test_attribute_iterate_0_attributes(void) +static void +test_attribute_iterate_0_attributes(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -8173,7 +8140,7 @@ test_attribute_iterate_0_attributes(void) SKIPPED(); printf(" API functions for basic file, group, dataset, attribute, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8320,7 +8287,7 @@ test_attribute_iterate_0_attributes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8334,7 +8301,7 @@ test_attribute_iterate_0_attributes(void) } H5E_END_TRY - return 1; + return; } /* A compound type for test_attribute_compound_subset */ @@ -8347,8 +8314,8 @@ typedef struct attribute_compound_io_t { * A test to ensure that data is read back correctly from a attribute after it has * been written, using subsets of compound datatypes */ -static int -test_attribute_compound_subset(void) +static void +test_attribute_compound_subset(const void H5_ATTR_UNUSED *params) { hsize_t dims[1] = {ATTRIBUTE_COMPOUND_IO_ATTR_DIMS}; size_t i; @@ -8373,7 +8340,7 @@ test_attribute_compound_subset(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8581,7 +8548,7 @@ test_attribute_compound_subset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8597,15 +8564,15 @@ test_attribute_compound_subset(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that attributes preserve data * correctness for strings with ASCII or UTF-8 char sets */ -static int -test_attribute_string_encodings(void) +static void +test_attribute_string_encodings(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -8630,7 +8597,7 @@ test_attribute_string_encodings(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8841,7 +8808,7 @@ test_attribute_string_encodings(void) free(read_buf); PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8861,15 +8828,15 @@ test_attribute_string_encodings(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that an attribute can be deleted * using H5Adelete(_by_idx). */ -static int -test_delete_attribute(void) +static void +test_delete_attribute(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -8888,7 +8855,7 @@ test_delete_attribute(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10078,7 +10045,7 @@ test_delete_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10093,7 +10060,7 @@ test_delete_attribute(void) } H5E_END_TRY - return 1; + return; } /* @@ -10101,8 +10068,8 @@ test_delete_attribute(void) * when H5Adelete(_by_name/_by_idx) is passed invalid * parameters. */ -static int -test_delete_attribute_invalid_params(void) +static void +test_delete_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t attr_exists; @@ -10121,7 +10088,7 @@ test_delete_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10499,7 +10466,7 @@ test_delete_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10513,14 +10480,14 @@ test_delete_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aexists and H5Aexists_by_name. */ -static int -test_attribute_exists(void) +static void +test_attribute_exists(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -10538,7 +10505,7 @@ test_attribute_exists(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10639,7 +10606,7 @@ test_attribute_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10653,15 +10620,15 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that H5Aexists(_by_name) will fail when * given invalid parameters. */ -static int -test_attribute_exists_invalid_params(void) +static void +test_attribute_exists_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t attr_exists; @@ -10680,7 +10647,7 @@ test_attribute_exists_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10916,7 +10883,7 @@ test_attribute_exists_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10930,15 +10897,15 @@ test_attribute_exists_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to make sure many attributes can be written * to the file */ -static int -test_attribute_many(void) +static void +test_attribute_many(const void H5_ATTR_UNUSED *params) { unsigned u; htri_t attr_exists; @@ -10958,7 +10925,7 @@ test_attribute_many(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11026,7 +10993,7 @@ test_attribute_many(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11040,15 +11007,15 @@ test_attribute_many(void) } H5E_END_TRY - return 1; + return; } /* * A test to make sure an attribute can be opened for * a second time */ -static int -test_attribute_duplicate_id(void) +static void +test_attribute_duplicate_id(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -11066,7 +11033,7 @@ test_attribute_duplicate_id(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11138,7 +11105,7 @@ test_attribute_duplicate_id(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11153,7 +11120,7 @@ test_attribute_duplicate_id(void) } H5E_END_TRY - return 1; + return; } /* @@ -11162,8 +11129,8 @@ test_attribute_duplicate_id(void) * * XXX: Cover all of the cases and move to H5O tests. */ -static int -test_get_number_attributes(void) +static void +test_get_number_attributes(const void H5_ATTR_UNUSED *params) { H5O_info2_t obj_info; htri_t attr_exists; @@ -11182,7 +11149,7 @@ test_get_number_attributes(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or object aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11318,7 +11285,7 @@ test_get_number_attributes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11332,7 +11299,7 @@ test_get_number_attributes(void) } H5E_END_TRY - return 1; + return; } /* @@ -11341,8 +11308,8 @@ test_get_number_attributes(void) * * XXX: May move to H5O tests. */ -static int -test_attr_shared_dtype(void) +static void +test_attr_shared_dtype(const void H5_ATTR_UNUSED *params) { H5O_info2_t obj_info; htri_t attr_exists; @@ -11364,7 +11331,7 @@ test_attr_shared_dtype(void) SKIPPED(); printf(" API functions for basic file, group, attribute, stored datatype, or object aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11479,7 +11446,7 @@ test_attr_shared_dtype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11492,7 +11459,7 @@ test_attr_shared_dtype(void) } H5E_END_TRY - return 1; + return; } static herr_t @@ -11581,26 +11548,90 @@ attr_iter_callback2(hid_t location_id, const char *attr_name, const H5A_info_t * UNUSED(ainfo); UNUSED(op_data); - return 0; + return H5_ITER_CONT; } -int -H5_api_attribute_test(void) +void +H5_api_attribute_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Attribute Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(attribute_tests); i++) { - nerrors += (*attribute_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_attribute_test_header", print_attribute_test_header, NULL, NULL, NULL, 0, + "Prints header for attribute tests"); + + AddTest("test_create_attribute_on_root", test_create_attribute_on_root, NULL, NULL, NULL, 0, + "attribute creation on the root group"); + AddTest("test_create_attribute_on_dataset", test_create_attribute_on_dataset, NULL, NULL, NULL, 0, + "attribute creation on a dataset"); + AddTest("test_create_attribute_on_datatype", test_create_attribute_on_datatype, NULL, NULL, NULL, 0, + "attribute creation on a committed datatype"); + AddTest("test_create_attribute_with_null_space", test_create_attribute_with_null_space, NULL, NULL, NULL, + 0, "attribute creation with a NULL dataspace"); + AddTest("test_create_attribute_with_scalar_space", test_create_attribute_with_scalar_space, NULL, NULL, + NULL, 0, "attribute creation with a SCALAR dataspace"); + AddTest("test_create_attribute_with_space_in_name", test_create_attribute_with_space_in_name, NULL, NULL, + NULL, 0, "attribute creation with a space in attribute's name"); + AddTest("test_create_attribute_invalid_params", test_create_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute creation with invalid parameters"); + AddTest("test_open_attribute", test_open_attribute, NULL, NULL, NULL, 0, "attribute opening"); + AddTest("test_open_attribute_invalid_params", test_open_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute opening with invalid parameters"); + AddTest("test_write_attribute", test_write_attribute, NULL, NULL, NULL, 0, "H5Awrite"); + AddTest("test_write_attribute_invalid_params", test_write_attribute_invalid_params, NULL, NULL, NULL, 0, + "H5Awrite with invalid parameters"); + AddTest("test_read_attribute", test_read_attribute, NULL, NULL, NULL, 0, "H5Aread"); + AddTest("test_read_attribute_invalid_params", test_read_attribute_invalid_params, NULL, NULL, NULL, 0, + "H5Aread with invalid parameters"); + AddTest("test_read_empty_attribute", test_read_empty_attribute, NULL, NULL, NULL, 0, + "reading an empty attribute"); + AddTest("test_close_attribute_invalid_id", test_close_attribute_invalid_id, NULL, NULL, NULL, 0, + "H5Aclose with an invalid attribute ID"); + AddTest("test_get_attribute_space_and_type", test_get_attribute_space_and_type, NULL, NULL, NULL, 0, + "retrieval of an attribute's dataspace and datatype"); + AddTest("test_get_attribute_space_and_type_invalid_params", + test_get_attribute_space_and_type_invalid_params, NULL, NULL, NULL, 0, + "H5Aget_type/H5Aget_space with invalid parameters"); + AddTest("test_attribute_property_lists", test_attribute_property_lists, NULL, NULL, NULL, 0, + "attribute property list operations"); + AddTest("test_get_attribute_name", test_get_attribute_name, NULL, NULL, NULL, 0, + "retrieval of an attribute's name"); + AddTest("test_get_attribute_name_invalid_params", test_get_attribute_name_invalid_params, NULL, NULL, + NULL, 0, "retrieval of an attribute's name with invalid parameters"); + AddTest("test_get_attribute_storage_size", test_get_attribute_storage_size, NULL, NULL, NULL, 0, + "H5Aget_storage_size"); + AddTest("test_get_attribute_info", test_get_attribute_info, NULL, NULL, NULL, 0, + "retrieval of attribute info"); + AddTest("test_get_attribute_info_invalid_params", test_get_attribute_info_invalid_params, NULL, NULL, + NULL, 0, "retrieval of attribute info with invalid parameters"); + AddTest("test_rename_attribute", test_rename_attribute, NULL, NULL, NULL, 0, "attribute renaming"); + AddTest("test_rename_attribute_invalid_params", test_rename_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute renaming with invalid parameters"); + AddTest("test_attribute_iterate_group", test_attribute_iterate_group, NULL, NULL, NULL, 0, + "attribute iteration on a group"); + AddTest("test_attribute_iterate_dataset", test_attribute_iterate_dataset, NULL, NULL, NULL, 0, + "attribute iteration on a dataset"); + AddTest("test_attribute_iterate_datatype", test_attribute_iterate_datatype, NULL, NULL, NULL, 0, + "attribute iteration on a committed datatype"); + AddTest("test_attribute_iterate_index_saving", test_attribute_iterate_index_saving, NULL, NULL, NULL, 0, + "attribute iteration index saving capability"); + AddTest("test_attribute_iterate_invalid_params", test_attribute_iterate_invalid_params, NULL, NULL, NULL, + 0, "attribute iteration with invalid parameters"); + AddTest("test_attribute_iterate_0_attributes", test_attribute_iterate_0_attributes, NULL, NULL, NULL, 0, + "attribute iteration on object with 0 attributes"); + AddTest("test_attribute_compound_subset", test_attribute_compound_subset, NULL, NULL, NULL, 0, + "verification of attribute data using H5Awrite then H5Aread with compound type subsets"); + AddTest("test_attribute_string_encodings", test_attribute_string_encodings, NULL, NULL, NULL, 0, + "string encoding read/write correctness on attributes"); + AddTest("test_delete_attribute", test_delete_attribute, NULL, NULL, NULL, 0, "attribute deletion"); + AddTest("test_delete_attribute_invalid_params", test_delete_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute deletion with invalid parameters"); + AddTest("test_attribute_exists", test_attribute_exists, NULL, NULL, NULL, 0, "attribute existence"); + AddTest("test_attribute_exists_invalid_params", test_attribute_exists_invalid_params, NULL, NULL, NULL, 0, + "attribute existence with invalid parameters"); + AddTest("test_attribute_duplicate_id", test_attribute_duplicate_id, NULL, NULL, NULL, 0, + "duplicated IDs for an attribute"); + AddTest("test_attribute_many", test_attribute_many, NULL, NULL, NULL, 0, "creating many attributes"); + AddTest("test_get_number_attributes", test_get_number_attributes, NULL, NULL, NULL, 0, + "retrieval of the number of attributes on an object"); + AddTest("test_attr_shared_dtype", test_attr_shared_dtype, NULL, NULL, NULL, 0, + "shared datatype for attributes"); } diff --git a/test/API/H5_api_attribute_test.h b/test/API/H5_api_attribute_test.h index 153d444e2fa..ed0943650b0 100644 --- a/test/API/H5_api_attribute_test.h +++ b/test/API/H5_api_attribute_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_attribute_test(void); +void H5_api_attribute_test_add(void); /************************************************** * * diff --git a/test/API/H5_api_dataset_test.c b/test/API/H5_api_dataset_test.c index e5ea8279ad5..c88288bfd01 100644 --- a/test/API/H5_api_dataset_test.c +++ b/test/API/H5_api_dataset_test.c @@ -16,171 +16,106 @@ * XXX: H5Dread_chunk/H5Dwrite_chunk, H5Dfill/scatter/gather */ -static int test_create_dataset_under_root(void); -static int test_create_dataset_under_existing_group(void); -static int test_create_dataset_invalid_params(void); -static int test_create_anonymous_dataset(void); -static int test_create_anonymous_dataset_invalid_params(void); -static int test_create_dataset_null_space(void); -static int test_create_dataset_scalar_space(void); -static int test_create_zero_dim_dset(void); -static int test_create_dataset_random_shapes(void); -static int test_create_dataset_predefined_types(void); -static int test_create_dataset_string_types(void); -static int test_create_dataset_compound_types(void); -static int test_create_dataset_enum_types(void); -static int test_create_dataset_array_types(void); -static int test_create_dataset_creation_properties(void); -static int test_create_many_dataset(void); -static int test_open_dataset(void); -static int test_open_dataset_invalid_params(void); -static int test_close_dataset_invalid_params(void); -static int test_get_dataset_space_and_type(void); -static int test_get_dataset_space_and_type_invalid_params(void); -static int test_get_dataset_space_status(void); -static int test_get_dataset_space_status_invalid_params(void); -static int test_dataset_property_lists(void); -static int test_get_dataset_storage_size(void); -static int test_get_dataset_storage_size_invalid_params(void); -static int test_get_dataset_chunk_storage_size(void); -static int test_get_dataset_chunk_storage_size_invalid_params(void); -static int test_get_dataset_offset(void); -static int test_get_dataset_offset_invalid_params(void); -static int test_read_dataset_small_all(void); -static int test_read_dataset_small_hyperslab(void); -static int test_read_dataset_small_point_selection(void); -static int test_read_multi_dataset_small_all(void); -static int test_read_multi_dataset_small_hyperslab(void); -static int test_read_multi_dataset_small_point_selection(void); -static int test_dataset_io_point_selections(void); -static int test_read_dataset_invalid_params(void); -static int test_write_dataset_small_all(void); -static int test_write_dataset_small_hyperslab(void); -static int test_write_dataset_small_point_selection(void); -static int test_write_dataset_data_verification(void); -static int test_write_multi_dataset_small_all(void); -static int test_write_multi_dataset_small_hyperslab(void); -static int test_write_multi_dataset_small_point_selection(void); -static int test_write_multi_dataset_data_verification(void); -static int test_write_dataset_invalid_params(void); -static int test_dataset_string_encodings(void); -static int test_dataset_builtin_type_conversion(void); -static int test_dataset_real_to_int_conversion(void); -static int test_dataset_compound_partial_io(void); -static int test_dataset_vlen_io(void); -static int test_dataset_set_extent_chunked_unlimited(void); -static int test_dataset_set_extent_chunked_fixed(void); -static int test_dataset_set_extent_data(void); -static int test_dataset_set_extent_double_handles(void); -static int test_dataset_set_extent_invalid_params(void); -static int test_flush_dataset(void); -static int test_flush_dataset_invalid_params(void); -static int test_refresh_dataset(void); -static int test_refresh_dataset_invalid_params(void); +static void print_dataset_test_header(const void *params); +static void test_create_dataset_under_root(const void *params); +static void test_create_dataset_under_existing_group(const void *params); +static void test_create_dataset_invalid_params(const void *params); +static void test_create_anonymous_dataset(const void *params); +static void test_create_anonymous_dataset_invalid_params(const void *params); +static void test_create_dataset_null_space(const void *params); +static void test_create_dataset_scalar_space(const void *params); +static void test_create_zero_dim_dset(const void *params); +static void test_create_dataset_random_shapes(const void *params); +static void test_create_dataset_predefined_types(const void *params); +static void test_create_dataset_string_types(const void *params); +static void test_create_dataset_compound_types(const void *params); +static void test_create_dataset_enum_types(const void *params); +static void test_create_dataset_array_types(const void *params); +static void test_create_dataset_creation_properties(const void *params); +static void test_create_many_dataset(const void *params); +static void test_open_dataset(const void *params); +static void test_open_dataset_invalid_params(const void *params); +static void test_close_dataset_invalid_params(const void *params); +static void test_get_dataset_space_and_type(const void *params); +static void test_get_dataset_space_and_type_invalid_params(const void *params); +static void test_get_dataset_space_status(const void *params); +static void test_get_dataset_space_status_invalid_params(const void *params); +static void test_dataset_property_lists(const void *params); +static void test_get_dataset_storage_size(const void *params); +static void test_get_dataset_storage_size_invalid_params(const void *params); +static void test_get_dataset_chunk_storage_size(const void *params); +static void test_get_dataset_chunk_storage_size_invalid_params(const void *params); +static void test_get_dataset_offset(const void *params); +static void test_get_dataset_offset_invalid_params(const void *params); +static void test_read_dataset_small_all(const void *params); +static void test_read_dataset_small_hyperslab(const void *params); +static void test_read_dataset_small_point_selection(const void *params); +static void test_read_multi_dataset_small_all(const void *params); +static void test_read_multi_dataset_small_hyperslab(const void *params); +static void test_read_multi_dataset_small_point_selection(const void *params); +static void test_dataset_io_point_selections(const void *params); +static void test_read_dataset_invalid_params(const void *params); +static void test_write_dataset_small_all(const void *params); +static void test_write_dataset_small_hyperslab(const void *params); +static void test_write_dataset_small_point_selection(const void *params); +static void test_write_dataset_data_verification(const void *params); +static void test_write_multi_dataset_small_all(const void *params); +static void test_write_multi_dataset_small_hyperslab(const void *params); +static void test_write_multi_dataset_small_point_selection(const void *params); +static void test_write_multi_dataset_data_verification(const void *params); +static void test_write_dataset_invalid_params(const void *params); +static void test_dataset_string_encodings(const void *params); +static void test_dataset_builtin_type_conversion(const void *params); +static void test_dataset_real_to_int_conversion(const void *params); +static void test_dataset_compound_partial_io(const void *params); +static void test_dataset_vlen_io(const void *params); +static void test_dataset_set_extent_chunked_unlimited(const void *params); +static void test_dataset_set_extent_chunked_fixed(const void *params); +static void test_dataset_set_extent_data(const void *params); +static void test_dataset_set_extent_double_handles(const void *params); +static void test_dataset_set_extent_invalid_params(const void *params); +static void test_flush_dataset(const void *params); +static void test_flush_dataset_invalid_params(const void *params); +static void test_refresh_dataset(const void *params); +static void test_refresh_dataset_invalid_params(const void *params); /* * Chunking tests */ -static int test_create_single_chunk_dataset(void); -static int test_write_single_chunk_dataset(void); -static int test_create_multi_chunk_dataset(void); -static int test_write_multi_chunk_dataset_same_shape_read(void); -static int test_write_multi_chunk_dataset_diff_shape_read(void); -static int test_overwrite_multi_chunk_dataset_same_shape_read(void); -static int test_overwrite_multi_chunk_dataset_diff_shape_read(void); -static int test_read_partial_chunk_all_selection(void); -static int test_read_partial_chunk_hyperslab_selection(void); -static int test_read_partial_chunk_point_selection(void); - -static int test_get_vlen_buf_size(void); +static void test_create_single_chunk_dataset(const void *params); +static void test_write_single_chunk_dataset(const void *params); +static void test_create_multi_chunk_dataset(const void *params); +static void test_write_multi_chunk_dataset_same_shape_read(const void *params); +static void test_write_multi_chunk_dataset_diff_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_same_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_diff_shape_read(const void *params); +static void test_read_partial_chunk_all_selection(const void *params); +static void test_read_partial_chunk_hyperslab_selection(const void *params); +static void test_read_partial_chunk_point_selection(const void *params); + +static void test_get_vlen_buf_size(const void *params); + +static size_t filter(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, + size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf); + +static void +print_dataset_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Dataset Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} -/* - * The array of dataset tests to be performed. - */ -static int (*dataset_tests[])(void) = { - test_create_dataset_under_root, - test_create_dataset_under_existing_group, - test_create_dataset_invalid_params, - test_create_anonymous_dataset, - test_create_anonymous_dataset_invalid_params, - test_create_dataset_null_space, - test_create_dataset_scalar_space, - test_create_zero_dim_dset, - test_create_dataset_random_shapes, - test_create_dataset_predefined_types, - test_create_dataset_string_types, - test_create_dataset_compound_types, - test_create_dataset_enum_types, - test_create_dataset_array_types, - test_create_dataset_creation_properties, - test_create_many_dataset, - test_open_dataset, - test_open_dataset_invalid_params, - test_close_dataset_invalid_params, - test_get_dataset_space_and_type, - test_get_dataset_space_and_type_invalid_params, - test_get_dataset_space_status, - test_get_dataset_space_status_invalid_params, - test_dataset_property_lists, - test_get_dataset_storage_size, - test_get_dataset_storage_size_invalid_params, - test_get_dataset_chunk_storage_size, - test_get_dataset_chunk_storage_size_invalid_params, - test_get_dataset_offset, - test_get_dataset_offset_invalid_params, - test_read_dataset_small_all, - test_read_dataset_small_hyperslab, - test_read_dataset_small_point_selection, - test_read_multi_dataset_small_all, - test_read_multi_dataset_small_hyperslab, - test_read_multi_dataset_small_point_selection, - test_dataset_io_point_selections, - test_read_dataset_invalid_params, - test_dataset_string_encodings, - test_write_dataset_small_all, - test_write_dataset_small_hyperslab, - test_write_dataset_small_point_selection, - test_write_dataset_data_verification, - test_write_multi_dataset_small_all, - test_write_multi_dataset_small_hyperslab, - test_write_multi_dataset_small_point_selection, - test_write_multi_dataset_data_verification, - test_write_dataset_invalid_params, - test_dataset_builtin_type_conversion, - test_dataset_real_to_int_conversion, - test_dataset_compound_partial_io, - test_dataset_vlen_io, - test_dataset_set_extent_chunked_unlimited, - test_dataset_set_extent_chunked_fixed, - test_dataset_set_extent_data, - test_dataset_set_extent_double_handles, - test_dataset_set_extent_invalid_params, - test_flush_dataset, - test_flush_dataset_invalid_params, - test_refresh_dataset, - test_refresh_dataset_invalid_params, - test_create_single_chunk_dataset, - test_write_single_chunk_dataset, - test_create_multi_chunk_dataset, - test_write_multi_chunk_dataset_same_shape_read, - test_write_multi_chunk_dataset_diff_shape_read, - test_overwrite_multi_chunk_dataset_same_shape_read, - test_overwrite_multi_chunk_dataset_diff_shape_read, - test_read_partial_chunk_all_selection, - test_read_partial_chunk_hyperslab_selection, - test_read_partial_chunk_point_selection, - test_get_vlen_buf_size, -}; - -size_t filter(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, - void H5_ATTR_UNUSED **buf); /* * A test to check that a dataset can be * created under the root group. */ -static int -test_create_dataset_under_root(void) +static void +test_create_dataset_under_root(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -193,7 +128,7 @@ test_create_dataset_under_root(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -227,7 +162,7 @@ test_create_dataset_under_root(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -239,15 +174,15 @@ test_create_dataset_under_root(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created * under a group that is not the root group. */ -static int -test_create_dataset_under_existing_group(void) +static void +test_create_dataset_under_existing_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -262,7 +197,7 @@ test_create_dataset_under_existing_group(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -313,7 +248,7 @@ test_create_dataset_under_existing_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -327,15 +262,15 @@ test_create_dataset_under_existing_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can't be created * when H5Dcreate is passed invalid parameters. */ -static int -test_create_dataset_invalid_params(void) +static void +test_create_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -350,7 +285,7 @@ test_create_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -570,7 +505,7 @@ test_create_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -584,14 +519,14 @@ test_create_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous dataset can be created. */ -static int -test_create_anonymous_dataset(void) +static void +test_create_anonymous_dataset(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -606,7 +541,7 @@ test_create_anonymous_dataset(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -655,7 +590,7 @@ test_create_anonymous_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -669,7 +604,7 @@ test_create_anonymous_dataset(void) } H5E_END_TRY - return 1; + return; } /* @@ -677,8 +612,8 @@ test_create_anonymous_dataset(void) * be created when H5Dcreate_anon is passed invalid * parameters. */ -static int -test_create_anonymous_dataset_invalid_params(void) +static void +test_create_anonymous_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -693,7 +628,7 @@ test_create_anonymous_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -851,7 +786,7 @@ test_create_anonymous_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -865,15 +800,15 @@ test_create_anonymous_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating a dataset with a NULL * dataspace is not problematic. */ -static int -test_create_dataset_null_space(void) +static void +test_create_dataset_null_space(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -888,7 +823,7 @@ test_create_dataset_null_space(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -948,7 +883,7 @@ test_create_dataset_null_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -962,15 +897,15 @@ test_create_dataset_null_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating a dataset with a scalar * dataspace is not problematic. */ -static int -test_create_dataset_scalar_space(void) +static void +test_create_dataset_scalar_space(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -985,7 +920,7 @@ test_create_dataset_scalar_space(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1045,7 +980,7 @@ test_create_dataset_scalar_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1059,15 +994,15 @@ test_create_dataset_scalar_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating a dataset with a dataspace * which contains a 0-sized dimension is not problematic. */ -static int -test_create_zero_dim_dset(void) +static void +test_create_zero_dim_dset(const void H5_ATTR_UNUSED *params) { hsize_t dims[ZERO_DIM_DSET_TEST_SPACE_RANK] = {0}; hid_t file_id = H5I_INVALID_HID; @@ -1084,7 +1019,7 @@ test_create_zero_dim_dset(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1149,7 +1084,7 @@ test_create_zero_dim_dset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1162,15 +1097,15 @@ test_create_zero_dim_dset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created with * a variety of different dataspace shapes. */ -static int -test_create_dataset_random_shapes(void) +static void +test_create_dataset_random_shapes(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -1185,7 +1120,7 @@ test_create_dataset_random_shapes(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1246,7 +1181,7 @@ test_create_dataset_random_shapes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1260,7 +1195,7 @@ test_create_dataset_random_shapes(void) } H5E_END_TRY - return 1; + return; } /* @@ -1268,8 +1203,8 @@ test_create_dataset_random_shapes(void) * each of the predefined integer and floating-point * datatypes. */ -static int -test_create_dataset_predefined_types(void) +static void +test_create_dataset_predefined_types(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -1292,7 +1227,7 @@ test_create_dataset_predefined_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1354,7 +1289,7 @@ test_create_dataset_predefined_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1367,15 +1302,15 @@ test_create_dataset_predefined_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * string datatypes. */ -static int -test_create_dataset_string_types(void) +static void +test_create_dataset_string_types(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1390,7 +1325,7 @@ test_create_dataset_string_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1520,7 +1455,7 @@ test_create_dataset_string_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1536,15 +1471,15 @@ test_create_dataset_string_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * a variety of compound datatypes. */ -static int -test_create_dataset_compound_types(void) +static void +test_create_dataset_compound_types(const void H5_ATTR_UNUSED *params) { size_t i, j; hid_t file_id = H5I_INVALID_HID; @@ -1562,7 +1497,7 @@ test_create_dataset_compound_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* @@ -1690,7 +1625,7 @@ test_create_dataset_compound_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1706,15 +1641,15 @@ test_create_dataset_compound_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created with * enum datatypes. */ -static int -test_create_dataset_enum_types(void) +static void +test_create_dataset_enum_types(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -1732,7 +1667,7 @@ test_create_dataset_enum_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1832,7 +1767,7 @@ test_create_dataset_enum_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1848,15 +1783,15 @@ test_create_dataset_enum_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * array datatypes. */ -static int -test_create_dataset_array_types(void) +static void +test_create_dataset_array_types(const void H5_ATTR_UNUSED *params) { hsize_t array_dims1[DATASET_ARRAY_TYPE_TEST_RANK1]; hsize_t array_dims2[DATASET_ARRAY_TYPE_TEST_RANK2]; @@ -1879,7 +1814,7 @@ test_create_dataset_array_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2028,7 +1963,7 @@ test_create_dataset_array_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2050,10 +1985,10 @@ test_create_dataset_array_types(void) } H5E_END_TRY - return 1; + return; } -size_t +static size_t filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) @@ -2066,8 +2001,8 @@ filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, * A test to check the functionality of the different * dataset creation properties. */ -static int -test_create_dataset_creation_properties(void) +static void +test_create_dataset_creation_properties(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; hsize_t chunk_dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; @@ -2084,6 +2019,7 @@ test_create_dataset_creation_properties(void) int nfilters = 0; H5Z_filter_t retrieved_filter_id = H5I_INVALID_HID; size_t num_filter_params = DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS; + TESTING_MULTIPART("dataset creation properties"); /* Make sure the connector supports the API functions being tested */ @@ -2092,7 +2028,7 @@ test_create_dataset_creation_properties(void) SKIPPED(); printf(" API functions for basic file, group, or dataset " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3123,7 +3059,7 @@ test_create_dataset_creation_properties(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3144,15 +3080,15 @@ test_create_dataset_creation_properties(void) H5E_END_TRY - return 1; + return; } } /* * A test to create many small datasets (100,000) */ -static int -test_create_many_dataset(void) +static void +test_create_many_dataset(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -3169,7 +3105,7 @@ test_create_many_dataset(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3234,7 +3170,7 @@ test_create_many_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3247,29 +3183,29 @@ test_create_many_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that re-opening a dataset with * H5Dopen succeeds. */ -static int -test_open_dataset(void) +static void +test_open_dataset(const void H5_ATTR_UNUSED *params) { TESTING("H5Dopen"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Dopen fails when it is * passed invalid parameters. */ -static int -test_open_dataset_invalid_params(void) +static void +test_open_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -3284,7 +3220,7 @@ test_open_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3422,7 +3358,7 @@ test_open_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3436,15 +3372,15 @@ test_open_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Dclose fails when it is * passed an invalid dataset ID. */ -static int -test_close_dataset_invalid_params(void) +static void +test_close_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -3455,7 +3391,7 @@ test_close_dataset_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3481,7 +3417,7 @@ test_close_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3490,7 +3426,7 @@ test_close_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -3498,8 +3434,8 @@ test_close_dataset_invalid_params(void) * and datatype can be retrieved with H5Dget_space and * H5Dget_type, respectively. */ -static int -test_get_dataset_space_and_type(void) +static void +test_get_dataset_space_and_type(const void H5_ATTR_UNUSED *params) { hsize_t dset_dims[DATASET_GET_SPACE_TYPE_TEST_SPACE_RANK]; size_t i; @@ -3519,7 +3455,7 @@ test_get_dataset_space_and_type(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3764,7 +3700,7 @@ test_get_dataset_space_and_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3780,7 +3716,7 @@ test_get_dataset_space_and_type(void) } H5E_END_TRY - return 1; + return; } /* @@ -3788,8 +3724,8 @@ test_get_dataset_space_and_type(void) * can't be retrieved when H5Dget_space and H5Dget_type are passed * invalid parameters, respectively. */ -static int -test_get_dataset_space_and_type_invalid_params(void) +static void +test_get_dataset_space_and_type_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -3807,7 +3743,7 @@ test_get_dataset_space_and_type_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3909,7 +3845,7 @@ test_get_dataset_space_and_type_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3925,20 +3861,20 @@ test_get_dataset_space_and_type_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Dget_space_status. */ -static int -test_get_dataset_space_status(void) +static void +test_get_dataset_space_status(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_space_status"); SKIPPED(); - return 0; + return; } /* @@ -3946,14 +3882,14 @@ test_get_dataset_space_status(void) * status can't be retrieved with H5Dget_space_status when * it is passed invalid parameters. */ -static int -test_get_dataset_space_status_invalid_params(void) +static void +test_get_dataset_space_status_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_space_status with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -3963,14 +3899,13 @@ test_get_dataset_space_status_invalid_params(void) * Also tests that a valid copy of a DAPL used for dataset * access can be retrieved with a call to H5Dget_access_plist. */ -static int -test_dataset_property_lists(void) +static void +test_dataset_property_lists(const void H5_ATTR_UNUSED *params) { const char *path_prefix = "/test_prefix"; hsize_t dims[DATASET_PROPERTY_LIST_TEST_SPACE_RANK]; hsize_t chunk_dims[DATASET_PROPERTY_LIST_TEST_SPACE_RANK]; size_t i; - herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t dset_id1 = H5I_INVALID_HID, dset_id2 = H5I_INVALID_HID, dset_id3 = H5I_INVALID_HID, @@ -3981,7 +3916,6 @@ test_dataset_property_lists(void) dset_dtype4 = H5I_INVALID_HID; hid_t space_id = H5I_INVALID_HID; char *tmp_prefix = NULL; - char vol_name[5]; TESTING_MULTIPART("dataset property list operations"); @@ -3991,7 +3925,7 @@ test_dataset_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4002,13 +3936,6 @@ test_dataset_property_lists(void) goto error; } - /** for DAOS VOL, this test is problematic since auto chunking can be selected, so skip for now */ - if (H5VLget_connector_name(file_id, vol_name, 5) < 0) { - H5_FAILED(); - printf(" couldn't get VOL connector name\n"); - goto error; - } - if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't open container group '%s'\n", DATASET_TEST_GROUP_NAME); @@ -4106,20 +4033,6 @@ test_dataset_property_lists(void) printf(" DCPL property values were incorrect\n"); PART_ERROR(H5Dget_create_plist); } - - H5E_BEGIN_TRY - { - err_ret = H5Pget_chunk(dcpl_id2, DATASET_PROPERTY_LIST_TEST_SPACE_RANK, tmp_chunk_dims); - } - H5E_END_TRY - - /* DAOS VOL can auto chunk, so don't fail */ - if (err_ret >= 0 && strcmp(vol_name, "daos") != 0) { - H5_FAILED(); - printf(" property list 2 shouldn't have had chunk dimensionality set (not a chunked " - "layout)\n"); - PART_ERROR(H5Dget_create_plist); - } } PASSED(); @@ -4308,20 +4221,6 @@ test_dataset_property_lists(void) printf(" DCPL property values were incorrect\n"); PART_ERROR(H5Dget_create_plist_reopened); } - - H5E_BEGIN_TRY - { - err_ret = H5Pget_chunk(dcpl_id2, DATASET_PROPERTY_LIST_TEST_SPACE_RANK, tmp_chunk_dims); - } - H5E_END_TRY - - /* DAOS VOL can auto chunk, so don't fail */ - if (err_ret >= 0 && strcmp(vol_name, "daos") != 0) { - H5_FAILED(); - printf(" property list 2 shouldn't have had chunk dimensionality set (not a chunked " - "layout)\n"); - PART_ERROR(H5Dget_create_plist_reopened); - } } PASSED(); @@ -4372,7 +4271,7 @@ test_dataset_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4398,20 +4297,20 @@ test_dataset_property_lists(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Dget_storage_size. */ -static int -test_get_dataset_storage_size(void) +static void +test_get_dataset_storage_size(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_storage_size"); SKIPPED(); - return 0; + return; } /* @@ -4419,27 +4318,27 @@ test_get_dataset_storage_size(void) * be retrieved when H5Dget_storage_size is passed * invalid parameters. */ -static int -test_get_dataset_storage_size_invalid_params(void) +static void +test_get_dataset_storage_size_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_storage_size with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Dget_chunk_storage_size. */ -static int -test_get_dataset_chunk_storage_size(void) +static void +test_get_dataset_chunk_storage_size(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_chunk_storage_size"); SKIPPED(); - return 0; + return; } /* @@ -4447,27 +4346,27 @@ test_get_dataset_chunk_storage_size(void) * a dataset can't be retrieved when H5Dget_chunk_storage_size * is passed invalid parameters. */ -static int -test_get_dataset_chunk_storage_size_invalid_params(void) +static void +test_get_dataset_chunk_storage_size_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_chunk_storage_size with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Dget_offset. */ -static int -test_get_dataset_offset(void) +static void +test_get_dataset_offset(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_offset"); SKIPPED(); - return 0; + return; } /* @@ -4475,22 +4374,22 @@ test_get_dataset_offset(void) * retrieved when H5Dget_offset is passed invalid * parameters. */ -static int -test_get_dataset_offset_invalid_params(void) +static void +test_get_dataset_offset_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_offset with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test to check that a small amount of data can be * read back from a dataset using an H5S_ALL selection. */ -static int -test_read_dataset_small_all(void) +static void +test_read_dataset_small_all(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SMALL_READ_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; size_t i, data_size; @@ -4507,7 +4406,7 @@ test_read_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -4572,7 +4471,7 @@ test_read_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4587,15 +4486,15 @@ test_read_dataset_small_all(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small amount of data can be * read back from a dataset using a hyperslab selection. */ -static int -test_read_dataset_small_hyperslab(void) +static void +test_read_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -4616,7 +4515,7 @@ test_read_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -4698,7 +4597,7 @@ test_read_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4714,15 +4613,15 @@ test_read_dataset_small_hyperslab(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small amount of data can be * read back from a dataset using a point selection. */ -static int -test_read_dataset_small_point_selection(void) +static void +test_read_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_READ_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_READ_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -4743,7 +4642,7 @@ test_read_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -4827,7 +4726,7 @@ test_read_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4843,15 +4742,15 @@ test_read_dataset_small_point_selection(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small amount of data can be * read back from multiple datasets using H5S_ALL selections. */ -static int -test_read_multi_dataset_small_all(void) +static void +test_read_multi_dataset_small_all(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SMALL_READ_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; @@ -4871,7 +4770,7 @@ test_read_multi_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Prevent uninitialized memory usage on test failure */ @@ -4952,7 +4851,7 @@ test_read_multi_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4969,15 +4868,15 @@ test_read_multi_dataset_small_all(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small amount of data can be * read back from datasets using hyperslab selections. */ -static int -test_read_multi_dataset_small_hyperslab(void) +static void +test_read_multi_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -5001,7 +4900,7 @@ test_read_multi_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Prevent uninitialized memory usage on test failure */ @@ -5102,7 +5001,7 @@ test_read_multi_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5122,15 +5021,15 @@ test_read_multi_dataset_small_hyperslab(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small amount of data can be * read back from datasets using point selections. */ -static int -test_read_multi_dataset_small_point_selection(void) +static void +test_read_multi_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_READ_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_READ_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -5152,7 +5051,7 @@ test_read_multi_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Prevent uninitialized memory usage on test failure */ @@ -5256,7 +5155,7 @@ test_read_multi_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5276,7 +5175,7 @@ test_read_multi_dataset_small_point_selection(void) } H5E_END_TRY; - return 1; + return; } /* @@ -5299,8 +5198,8 @@ test_read_multi_dataset_small_point_selection(void) ; \ } while ((J) < (I)); \ } -static int -test_dataset_io_point_selections(void) +static void +test_dataset_io_point_selections(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -5330,7 +5229,7 @@ test_dataset_io_point_selections(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Create dataspaces and DCPL */ @@ -5757,7 +5656,7 @@ test_dataset_io_point_selections(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5773,15 +5672,15 @@ test_dataset_io_point_selections(void) } H5E_END_TRY - return 1; + return; } /* end test_dataset_io_point_selections() */ /* * A test to check that data can't be read from a * dataset when H5Dread is passed invalid parameters. */ -static int -test_read_dataset_invalid_params(void) +static void +test_read_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_READ_INVALID_PARAMS_TEST_DSET_SPACE_RANK] = {10, 5, 3}; herr_t err_ret = -1; @@ -5799,7 +5698,7 @@ test_read_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5992,7 +5891,7 @@ test_read_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6007,15 +5906,15 @@ test_read_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small write can be * made to a dataset using an H5S_ALL selection. */ -static int -test_write_dataset_small_all(void) +static void +test_write_dataset_small_all(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_SMALL_WRITE_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; @@ -6033,7 +5932,7 @@ test_write_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6120,7 +6019,7 @@ test_write_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6135,15 +6034,15 @@ test_write_dataset_small_all(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small write can be made * to a dataset using a hyperslab selection. */ -static int -test_write_dataset_small_hyperslab(void) +static void +test_write_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -6164,7 +6063,7 @@ test_write_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6250,7 +6149,7 @@ test_write_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6266,15 +6165,15 @@ test_write_dataset_small_hyperslab(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small write can be made * to a dataset using a point selection. */ -static int -test_write_dataset_small_point_selection(void) +static void +test_write_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -6295,7 +6194,7 @@ test_write_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6382,7 +6281,7 @@ test_write_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6398,15 +6297,15 @@ test_write_dataset_small_point_selection(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that data is read back correctly from * a dataset after it has been written. */ -static int -test_write_dataset_data_verification(void) +static void +test_write_dataset_data_verification(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_DATA_VERIFY_WRITE_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -6434,7 +6333,7 @@ test_write_dataset_data_verification(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6893,7 +6792,7 @@ test_write_dataset_data_verification(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6913,15 +6812,15 @@ test_write_dataset_data_verification(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small multi write can be * made to a dataset using an H5S_ALL selection. */ -static int -test_write_multi_dataset_small_all(void) +static void +test_write_multi_dataset_small_all(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_SMALL_WRITE_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; @@ -6948,7 +6847,7 @@ test_write_multi_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -7058,7 +6957,7 @@ test_write_multi_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7076,15 +6975,15 @@ test_write_multi_dataset_small_all(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small multi write can be made * to a dataset using a hyperslab selection. */ -static int -test_write_multi_dataset_small_hyperslab(void) +static void +test_write_multi_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -7108,7 +7007,7 @@ test_write_multi_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { @@ -7217,7 +7116,7 @@ test_write_multi_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7237,15 +7136,15 @@ test_write_multi_dataset_small_hyperslab(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small multi write can be made * to a dataset using a point selection. */ -static int -test_write_multi_dataset_small_point_selection(void) +static void +test_write_multi_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -7268,7 +7167,7 @@ test_write_multi_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { @@ -7380,7 +7279,7 @@ test_write_multi_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7400,15 +7299,15 @@ test_write_multi_dataset_small_point_selection(void) } H5E_END_TRY; - return 1; + return; } /* * A test to ensure that data is read back correctly from * multiple datasets after it has been written. */ -static int -test_write_multi_dataset_data_verification(void) +static void +test_write_multi_dataset_data_verification(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints[DATASET_MULTI_COUNT]; hsize_t dims[DATASET_DATA_VERIFY_WRITE_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -7440,7 +7339,7 @@ test_write_multi_dataset_data_verification(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7979,7 +7878,7 @@ test_write_multi_dataset_data_verification(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8003,15 +7902,15 @@ test_write_multi_dataset_data_verification(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a dataset can't be written to * when H5Dwrite is passed invalid parameters. */ -static int -test_write_dataset_invalid_params(void) +static void +test_write_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_WRITE_INVALID_PARAMS_TEST_DSET_SPACE_RANK] = {10, 5, 3}; @@ -8030,7 +7929,7 @@ test_write_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8229,7 +8128,7 @@ test_write_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8244,15 +8143,15 @@ test_write_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that strings of any encoding * can be written to and read from a dataset */ -static int -test_dataset_string_encodings(void) +static void +test_dataset_string_encodings(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -8275,7 +8174,7 @@ test_dataset_string_encodings(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8471,7 +8370,7 @@ test_dataset_string_encodings(void) free(read_buf); PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8489,15 +8388,15 @@ test_dataset_string_encodings(void) } H5E_END_TRY; - return 1; + return; } /* * A test to ensure that data is read back correctly from a dataset after it has * been written, using type conversion with builtin types. */ -static int -test_dataset_builtin_type_conversion(void) +static void +test_dataset_builtin_type_conversion(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_DATA_BUILTIN_CONVERSION_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -8528,7 +8427,7 @@ test_dataset_builtin_type_conversion(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9007,7 +8906,7 @@ test_dataset_builtin_type_conversion(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9027,11 +8926,11 @@ test_dataset_builtin_type_conversion(void) } H5E_END_TRY - return 1; + return; } -static int -test_dataset_real_to_int_conversion(void) +static void +test_dataset_real_to_int_conversion(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -9061,7 +8960,7 @@ test_dataset_real_to_int_conversion(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9549,7 +9448,7 @@ test_dataset_real_to_int_conversion(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9569,7 +9468,7 @@ test_dataset_real_to_int_conversion(void) } H5E_END_TRY; - return 1; + return; } /* @@ -9581,8 +9480,8 @@ typedef struct dataset_compount_partial_io_t { int b; } dataset_compount_partial_io_t; -static int -test_dataset_compound_partial_io(void) +static void +test_dataset_compound_partial_io(const void H5_ATTR_UNUSED *params) { hsize_t dims[1] = {DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS}; size_t i; @@ -9606,7 +9505,7 @@ test_dataset_compound_partial_io(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9815,7 +9714,7 @@ test_dataset_compound_partial_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9831,13 +9730,13 @@ test_dataset_compound_partial_io(void) } H5E_END_TRY - return 1; + return; } /* A test to check that vlen sequences can be written and read back * with basic parent types and selections */ -static int -test_dataset_vlen_io(void) +static void +test_dataset_vlen_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -9868,13 +9767,9 @@ test_dataset_vlen_io(void) SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this " "connector\n"); - return 0; + return; } - /* Skipped for now due to segfault with the Cache VOL */ - SKIPPED(); - return 0; - TESTING_2("test setup"); if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -10459,10 +10354,12 @@ test_dataset_vlen_io(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + PASSED(); - return 0; -error: + return; + +error: H5E_BEGIN_TRY { H5Dclose(dset_int); @@ -10492,7 +10389,7 @@ test_dataset_vlen_io(void) } H5E_END_TRY - return 1; + return; } /* @@ -10501,8 +10398,8 @@ test_dataset_vlen_io(void) * dimensions for the dataset, so the dimensionality of the * dataset may both shrink and grow. */ -static int -test_dataset_set_extent_chunked_unlimited(void) +static void +test_dataset_set_extent_chunked_unlimited(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SET_EXTENT_CHUNKED_UNLIMITED_TEST_SPACE_RANK]; hsize_t max_dims[DATASET_SET_EXTENT_CHUNKED_UNLIMITED_TEST_SPACE_RANK]; @@ -10525,7 +10422,7 @@ test_dataset_set_extent_chunked_unlimited(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -10710,7 +10607,7 @@ test_dataset_set_extent_chunked_unlimited(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10725,7 +10622,7 @@ test_dataset_set_extent_chunked_unlimited(void) } H5E_END_TRY - return 1; + return; } /* @@ -10734,8 +10631,8 @@ test_dataset_set_extent_chunked_unlimited(void) * dimensions for the dataset, so the dimensionality of the * dataset may only shrink. */ -static int -test_dataset_set_extent_chunked_fixed(void) +static void +test_dataset_set_extent_chunked_fixed(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SET_EXTENT_CHUNKED_FIXED_TEST_SPACE_RANK]; hsize_t dims2[DATASET_SET_EXTENT_CHUNKED_FIXED_TEST_SPACE_RANK]; @@ -10757,7 +10654,7 @@ test_dataset_set_extent_chunked_fixed(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -10988,7 +10885,7 @@ test_dataset_set_extent_chunked_fixed(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11005,15 +10902,15 @@ test_dataset_set_extent_chunked_fixed(void) } H5E_END_TRY - return 1; + return; } /* * A test to check the data is correct after expanding * and shrinking the dataset with H5Dset_extent */ -static int -test_dataset_set_extent_data(void) +static void +test_dataset_set_extent_data(const void H5_ATTR_UNUSED *params) { hsize_t dims_origin[DATASET_SET_EXTENT_DATA_TEST_SPACE_RANK] = {DATASET_SET_EXTENT_DATA_TEST_SPACE_DIM, DATASET_SET_EXTENT_DATA_TEST_SPACE_DIM}; @@ -11046,7 +10943,7 @@ test_dataset_set_extent_data(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11329,7 +11226,7 @@ test_dataset_set_extent_data(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11344,7 +11241,7 @@ test_dataset_set_extent_data(void) } H5E_END_TRY - return 1; + return; } /* test_dataset_set_extent_data */ /* @@ -11352,8 +11249,8 @@ test_dataset_set_extent_data(void) * used to extend the dataset, then the other handle should * return the new size when queried. */ -static int -test_dataset_set_extent_double_handles(void) +static void +test_dataset_set_extent_double_handles(const void H5_ATTR_UNUSED *params) { hsize_t dims_origin[DATASET_SET_EXTENT_DOUBLE_HANDLES_TEST_SPACE_RANK] = { DATASET_SET_EXTENT_DOUBLE_HANDLES_TEST_SPACE_DIM, DATASET_SET_EXTENT_DOUBLE_HANDLES_TEST_SPACE_DIM}; @@ -11380,7 +11277,7 @@ test_dataset_set_extent_double_handles(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11470,7 +11367,7 @@ test_dataset_set_extent_double_handles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11486,15 +11383,15 @@ test_dataset_set_extent_double_handles(void) } H5E_END_TRY - return 1; + return; } /* test_dataset_set_extent_double_handles */ /* * A test to check that a dataset's extent can't be * changed when H5Dset_extent is passed invalid parameters. */ -static int -test_dataset_set_extent_invalid_params(void) +static void +test_dataset_set_extent_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SET_EXTENT_INVALID_PARAMS_TEST_SPACE_RANK]; hsize_t chunk_dims[DATASET_SET_EXTENT_INVALID_PARAMS_TEST_SPACE_RANK]; @@ -11510,7 +11407,6 @@ test_dataset_set_extent_invalid_params(void) hid_t chunked_dcpl_id = H5I_INVALID_HID, compact_dcpl_id = H5I_INVALID_HID, contiguous_dcpl_id = H5I_INVALID_HID; hid_t fspace_id = H5I_INVALID_HID, compact_fspace_id = H5I_INVALID_HID; - char vol_name[5]; TESTING_MULTIPART("H5Dset_extent with invalid parameters"); @@ -11520,7 +11416,7 @@ test_dataset_set_extent_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11531,19 +11427,6 @@ test_dataset_set_extent_invalid_params(void) goto error; } - /** for DAOS VOL, this test is problematic since auto chunking can be selected, so skip for now */ - if (H5VLget_connector_name(file_id, vol_name, 5) < 0) { - H5_FAILED(); - printf(" couldn't get VOL connector name\n"); - goto error; - } - if (strcmp(vol_name, "daos") == 0) { - if (H5Fclose(file_id) < 0) - TEST_ERROR; - SKIPPED(); - return 0; - } - if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't open container group '%s'\n", DATASET_TEST_GROUP_NAME); @@ -11743,7 +11626,7 @@ test_dataset_set_extent_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11763,68 +11646,68 @@ test_dataset_set_extent_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* test_dataset_set_extent_invalid_params */ /* * A test for H5Dflush. */ -static int -test_flush_dataset(void) +static void +test_flush_dataset(const void H5_ATTR_UNUSED *params) { TESTING("H5Dflush"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Dflush fails when it is * passed invalid parameters. */ -static int -test_flush_dataset_invalid_params(void) +static void +test_flush_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dflush with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Drefresh. */ -static int -test_refresh_dataset(void) +static void +test_refresh_dataset(const void H5_ATTR_UNUSED *params) { TESTING("H5Drefresh"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Drefresh fails when it is * passed invalid parameters. */ -static int -test_refresh_dataset_invalid_params(void) +static void +test_refresh_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { - TESTING("H5Drefresh"); + TESTING("H5Drefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test to create a dataset composed of a single chunk. */ -static int -test_create_single_chunk_dataset(void) +static void +test_create_single_chunk_dataset(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SINGLE_CHUNK_TEST_SPACE_RANK]; hsize_t retrieved_chunk_dims[DATASET_SINGLE_CHUNK_TEST_SPACE_RANK]; @@ -11844,7 +11727,7 @@ test_create_single_chunk_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11979,7 +11862,7 @@ test_create_single_chunk_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11994,15 +11877,15 @@ test_create_single_chunk_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a single-chunk dataset can be written * and read correctly. */ -static int -test_write_single_chunk_dataset(void) +static void +test_write_single_chunk_dataset(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_SINGLE_CHUNK_WRITE_TEST_DSET_SPACE_RANK]; @@ -12025,7 +11908,7 @@ test_write_single_chunk_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -12197,7 +12080,7 @@ test_write_single_chunk_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -12215,14 +12098,14 @@ test_write_single_chunk_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to create a dataset composed of multiple chunks. */ -static int -test_create_multi_chunk_dataset(void) +static void +test_create_multi_chunk_dataset(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_TEST_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_TEST_SPACE_RANK] = {10, 10}; @@ -12243,7 +12126,7 @@ test_create_multi_chunk_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -12378,7 +12261,7 @@ test_create_multi_chunk_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -12393,7 +12276,7 @@ test_create_multi_chunk_dataset(void) } H5E_END_TRY - return 1; + return; } /* @@ -12402,8 +12285,8 @@ test_create_multi_chunk_dataset(void) * chunks of the dataset, the file dataspace and memory dataspace * used are the same shape. */ -static int -test_write_multi_chunk_dataset_same_shape_read(void) +static void +test_write_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -12429,7 +12312,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -12703,7 +12586,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -12720,7 +12603,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -12729,8 +12612,8 @@ test_write_multi_chunk_dataset_same_shape_read(void) * chunks of the dataset, the file dataspace and memory dataspace * used are differently shaped. */ -static int -test_write_multi_chunk_dataset_diff_shape_read(void) +static void +test_write_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -12755,7 +12638,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13038,7 +12921,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13057,7 +12940,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -13066,8 +12949,8 @@ test_write_multi_chunk_dataset_diff_shape_read(void) * When reading back the chunks of the dataset, the file * dataspace and memory dataspace used are the same shape. */ -static int -test_overwrite_multi_chunk_dataset_same_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -13093,7 +12976,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13375,7 +13258,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13392,7 +13275,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -13401,8 +13284,8 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) * When reading back the chunks of the dataset, the file * dataspace and memory dataspace used are differently shaped. */ -static int -test_overwrite_multi_chunk_dataset_diff_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -13428,7 +13311,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13720,7 +13603,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13739,7 +13622,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -13749,8 +13632,8 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) */ #define FIXED_DIMSIZE 25 #define FIXED_CHUNK_DIMSIZE 10 -static int -test_read_partial_chunk_all_selection(void) +static void +test_read_partial_chunk_all_selection(const void H5_ATTR_UNUSED *params) { DATASET_PARTIAL_CHUNK_READ_ALL_SEL_TEST_DSET_CTYPE write_buf[FIXED_DIMSIZE][FIXED_DIMSIZE]; DATASET_PARTIAL_CHUNK_READ_ALL_SEL_TEST_DSET_CTYPE read_buf[FIXED_DIMSIZE][FIXED_DIMSIZE]; @@ -13773,7 +13656,7 @@ test_read_partial_chunk_all_selection(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13908,7 +13791,7 @@ test_read_partial_chunk_all_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13922,7 +13805,7 @@ test_read_partial_chunk_all_selection(void) } H5E_END_TRY - return 1; + return; } #undef FIXED_DIMSIZE #undef FIXED_CHUNK_DIMSIZE @@ -13935,8 +13818,8 @@ test_read_partial_chunk_all_selection(void) #define FIXED_DIMSIZE 25 #define FIXED_CHUNK_DIMSIZE 10 #define FIXED_NCHUNKS 9 /* For convenience - make sure to adjust this as necessary */ -static int -test_read_partial_chunk_hyperslab_selection(void) +static void +test_read_partial_chunk_hyperslab_selection(const void H5_ATTR_UNUSED *params) { DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_CTYPE write_buf[FIXED_CHUNK_DIMSIZE][FIXED_CHUNK_DIMSIZE]; DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_CTYPE read_buf[FIXED_CHUNK_DIMSIZE][FIXED_CHUNK_DIMSIZE]; @@ -13960,7 +13843,7 @@ test_read_partial_chunk_hyperslab_selection(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -14063,6 +13946,7 @@ test_read_partial_chunk_hyperslab_selection(void) /* * Write and read each chunk in the dataset. */ + printf("\n"); for (i = 0; i < FIXED_NCHUNKS; i++) { hsize_t start[DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_SPACE_RANK]; hsize_t count[DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_SPACE_RANK]; @@ -14199,7 +14083,7 @@ test_read_partial_chunk_hyperslab_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -14214,7 +14098,7 @@ test_read_partial_chunk_hyperslab_selection(void) } H5E_END_TRY - return 1; + return; } #undef FIXED_DIMSIZE #undef FIXED_CHUNK_DIMSIZE @@ -14227,13 +14111,13 @@ test_read_partial_chunk_hyperslab_selection(void) */ /* #define FIXED_DIMSIZE 25 */ /* #define FIXED_CHUNK_DIMSIZE 10 */ -static int -test_read_partial_chunk_point_selection(void) +static void +test_read_partial_chunk_point_selection(const void H5_ATTR_UNUSED *params) { TESTING("reading a partial chunk using a point selection in file dataspace"); SKIPPED(); - return 1; + return; } /* #undef FIXED_DIMSIZE */ /* #undef FIXED_CHUNK_DIMSIZE */ @@ -14242,8 +14126,8 @@ test_read_partial_chunk_point_selection(void) * A test to verify that H5Dvlen_get_buf_size returns * correct size */ -static int -test_get_vlen_buf_size(void) +static void +test_get_vlen_buf_size(const void H5_ATTR_UNUSED *params) { hvl_t wdata[DATASET_GET_VLEN_BUF_SIZE_DSET_SPACE_DIM]; /* Information to write */ hid_t file_id = H5I_INVALID_HID; @@ -14265,7 +14149,7 @@ test_get_vlen_buf_size(void) SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this " "connector\n"); - return 0; + return; } /* Allocate and initialize VL data to write */ @@ -14354,7 +14238,7 @@ test_get_vlen_buf_size(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -14370,26 +14254,158 @@ test_get_vlen_buf_size(void) } H5E_END_TRY - return 1; + return; } /* end test_get_vlen_buf_size() */ -int -H5_api_dataset_test(void) +void +H5_api_dataset_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Dataset Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(dataset_tests); i++) { - nerrors += (*dataset_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_dataset_test_header", print_dataset_test_header, NULL, NULL, NULL, 0, + "Prints header for dataset tests"); + + AddTest("test_create_dataset_under_root", test_create_dataset_under_root, NULL, NULL, NULL, 0, + "dataset creation under root group"); + AddTest("test_create_dataset_under_existing_group", test_create_dataset_under_existing_group, NULL, NULL, + NULL, 0, "dataset creation under an existing group"); + AddTest("test_create_dataset_invalid_params", test_create_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dcreate with invalid parameters"); + AddTest("test_create_anonymous_dataset", test_create_anonymous_dataset, NULL, NULL, NULL, 0, + "anonymous dataset creation"); + AddTest("test_create_anonymous_dataset_invalid_params", test_create_anonymous_dataset_invalid_params, + NULL, NULL, NULL, 0, "anonymous dataset creation with invalid parameters"); + AddTest("test_create_dataset_null_space", test_create_dataset_null_space, NULL, NULL, NULL, 0, + "dataset creation with a NULL dataspace"); + AddTest("test_create_dataset_scalar_space", test_create_dataset_scalar_space, NULL, NULL, NULL, 0, + "dataset creation with a SCALAR dataspace"); + AddTest("test_create_zero_dim_dset", test_create_zero_dim_dset, NULL, NULL, NULL, 0, + "creation of 0-sized dataset"); + AddTest("test_create_dataset_random_shapes", test_create_dataset_random_shapes, NULL, NULL, NULL, 0, + "dataset creation with random dimension sizes"); + AddTest("test_create_dataset_predefined_types", test_create_dataset_predefined_types, NULL, NULL, NULL, 0, + "dataset creation with predefined datatypes"); + AddTest("test_create_dataset_string_types", test_create_dataset_string_types, NULL, NULL, NULL, 0, + "dataset creation with string types"); + AddTest("test_create_dataset_compound_types", test_create_dataset_compound_types, NULL, NULL, NULL, 0, + "dataset creation with compound datatypes"); + AddTest("test_create_dataset_enum_types", test_create_dataset_enum_types, NULL, NULL, NULL, 0, + "dataset creation with enum types"); + AddTest("test_create_dataset_array_types", test_create_dataset_array_types, NULL, NULL, NULL, 0, + "dataset creation with array types"); + AddTest("test_create_dataset_creation_properties", test_create_dataset_creation_properties, NULL, NULL, + NULL, 0, "dataset creation properties"); + AddTest("test_create_many_dataset", test_create_many_dataset, NULL, NULL, NULL, 0, + "creating many datasets"); + AddTest("test_open_dataset", test_open_dataset, NULL, NULL, NULL, 0, "H5Dopen"); + AddTest("test_open_dataset_invalid_params", test_open_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dopen with invalid parameters"); + AddTest("test_close_dataset_invalid_params", test_close_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dclose with an invalid dataset ID"); + AddTest("test_get_dataset_space_and_type", test_get_dataset_space_and_type, NULL, NULL, NULL, 0, + "retrieval of a dataset's dataspace and datatype"); + AddTest("test_get_dataset_space_and_type_invalid_params", test_get_dataset_space_and_type_invalid_params, + NULL, NULL, NULL, 0, "H5Dget_type/H5Dget_space with invalid parameters"); + AddTest("test_get_dataset_space_status", test_get_dataset_space_status, NULL, NULL, NULL, 0, + "H5Dget_space_status"); + AddTest("test_get_dataset_space_status_invalid_params", test_get_dataset_space_status_invalid_params, + NULL, NULL, NULL, 0, "H5Dget_space_status with invalid parameters"); + AddTest("test_dataset_property_lists", test_dataset_property_lists, NULL, NULL, NULL, 0, + "dataset property list operations"); + AddTest("test_get_dataset_storage_size", test_get_dataset_storage_size, NULL, NULL, NULL, 0, + "H5Dget_storage_size"); + AddTest("test_get_dataset_storage_size_invalid_params", test_get_dataset_storage_size_invalid_params, + NULL, NULL, NULL, 0, "H5Dget_storage_size with invalid parameters"); + AddTest("test_get_dataset_chunk_storage_size", test_get_dataset_chunk_storage_size, NULL, NULL, NULL, 0, + "H5Dget_chunk_storage_size"); + AddTest("test_get_dataset_chunk_storage_size_invalid_params", + test_get_dataset_chunk_storage_size_invalid_params, NULL, NULL, NULL, 0, + "H5Dget_chunk_storage_size with invalid parameters"); + AddTest("test_get_dataset_offset", test_get_dataset_offset, NULL, NULL, NULL, 0, "H5Dget_offset"); + AddTest("test_get_dataset_offset_invalid_params", test_get_dataset_offset_invalid_params, NULL, NULL, + NULL, 0, "H5Dget_offset with invalid parameters"); + AddTest("test_read_dataset_small_all", test_read_dataset_small_all, NULL, NULL, NULL, 0, + "small read from dataset with H5S_ALL"); + AddTest("test_read_dataset_small_hyperslab", test_read_dataset_small_hyperslab, NULL, NULL, NULL, 0, + "small read from dataset with a hyperslab selection"); + AddTest("test_read_dataset_small_point_selection", test_read_dataset_small_point_selection, NULL, NULL, + NULL, 0, "small read from dataset with a point selection"); + AddTest("test_read_multi_dataset_small_all", test_read_multi_dataset_small_all, NULL, NULL, NULL, 0, + "small multi read from datasets with H5S_ALL"); + AddTest("test_read_multi_dataset_small_hyperslab", test_read_multi_dataset_small_hyperslab, NULL, NULL, + NULL, 0, "small multi read from datasets with a hyperslab selection"); + AddTest("test_read_multi_dataset_small_point_selection", test_read_multi_dataset_small_point_selection, + NULL, NULL, NULL, 0, "small multi read from datasets with point selections"); + AddTest("test_dataset_io_point_selections", test_dataset_io_point_selections, NULL, NULL, NULL, 0, + "point selection I/O with all selection in memory and points in file"); + AddTest("test_read_dataset_invalid_params", test_read_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dread with invalid parameters"); + AddTest("test_dataset_string_encodings", test_dataset_string_encodings, NULL, NULL, NULL, 0, + "string encoding read/write correctness on datasets"); + AddTest("test_write_dataset_small_all", test_write_dataset_small_all, NULL, NULL, NULL, 0, + "small write to dataset with H5S_ALL"); + AddTest("test_write_dataset_small_hyperslab", test_write_dataset_small_hyperslab, NULL, NULL, NULL, 0, + "small write to dataset with a hyperslab selection"); + AddTest("test_write_dataset_small_point_selection", test_write_dataset_small_point_selection, NULL, NULL, + NULL, 0, "small write to dataset with a point selection"); + AddTest("test_write_dataset_data_verification", test_write_dataset_data_verification, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread"); + AddTest("test_write_multi_dataset_small_all", test_write_multi_dataset_small_all, NULL, NULL, NULL, 0, + "small multi write to datasets with H5S_ALL"); + AddTest("test_write_multi_dataset_small_hyperslab", test_write_multi_dataset_small_hyperslab, NULL, NULL, + NULL, 0, "small multi write to datasets with hyperslab selections"); + AddTest("test_write_multi_dataset_small_point_selection", test_write_multi_dataset_small_point_selection, + NULL, NULL, NULL, 0, "small multi write to datasets with point selections"); + AddTest("test_write_multi_dataset_data_verification", test_write_multi_dataset_data_verification, NULL, + NULL, NULL, 0, "verification of datasets' data using H5Dwrite_multi then H5Dread_multi"); + AddTest("test_write_dataset_invalid_params", test_write_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dwrite with invalid parameters"); + AddTest("test_dataset_builtin_type_conversion", test_dataset_builtin_type_conversion, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread with type conversion of builtin types"); + AddTest("test_dataset_real_to_int_conversion", test_dataset_real_to_int_conversion, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread with real <-> integer type conversion"); + AddTest( + "test_dataset_compound_partial_io", test_dataset_compound_partial_io, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread with partial element compound type I/O"); + AddTest( + "test_dataset_vlen_io", test_dataset_vlen_io, NULL, NULL, NULL, 0, + "verification of dataset data with H5Dwrite and then H5D read with variable length sequence data"); + AddTest("test_dataset_set_extent_chunked_unlimited", test_dataset_set_extent_chunked_unlimited, NULL, + NULL, NULL, 0, "H5Dset_extent on chunked dataset with unlimited dimensions"); + AddTest("test_dataset_set_extent_chunked_fixed", test_dataset_set_extent_chunked_fixed, NULL, NULL, NULL, + 0, "H5Dset_extent on chunked dataset with fixed dimensions"); + AddTest("test_dataset_set_extent_data", test_dataset_set_extent_data, NULL, NULL, NULL, 0, + "H5Dset_extent on data correctness"); + AddTest("test_dataset_set_extent_double_handles", test_dataset_set_extent_double_handles, NULL, NULL, + NULL, 0, "H5Dset_extent on double dataset handles"); + AddTest("test_dataset_set_extent_invalid_params", test_dataset_set_extent_invalid_params, NULL, NULL, + NULL, 0, "H5Dset_extent with invalid parameters"); + AddTest("test_flush_dataset", test_flush_dataset, NULL, NULL, NULL, 0, "H5Dflush"); + AddTest("test_flush_dataset_invalid_params", test_flush_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dflush with invalid parameters"); + AddTest("test_refresh_dataset", test_refresh_dataset, NULL, NULL, NULL, 0, "H5Drefresh"); + AddTest("test_refresh_dataset_invalid_params", test_refresh_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Drefresh with invalid parameters"); + AddTest("test_create_single_chunk_dataset", test_create_single_chunk_dataset, NULL, NULL, NULL, 0, + "creation of dataset with single chunk"); + AddTest("test_write_single_chunk_dataset", test_write_single_chunk_dataset, NULL, NULL, NULL, 0, + "write to dataset with single chunk"); + AddTest("test_create_multi_chunk_dataset", test_create_multi_chunk_dataset, NULL, NULL, NULL, 0, + "creation of dataset with multiple chunks"); + AddTest("test_write_multi_chunk_dataset_same_shape_read", test_write_multi_chunk_dataset_same_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_write_multi_chunk_dataset_diff_shape_read", test_write_multi_chunk_dataset_diff_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using differently shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_same_shape_read", + test_overwrite_multi_chunk_dataset_same_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_diff_shape_read", + test_overwrite_multi_chunk_dataset_diff_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using differently shaped dataspaces"); + AddTest("test_read_partial_chunk_all_selection", test_read_partial_chunk_all_selection, NULL, NULL, NULL, + 0, "reading a partial chunk using H5S_ALL for file dataspace"); + AddTest("test_read_partial_chunk_hyperslab_selection", test_read_partial_chunk_hyperslab_selection, NULL, + NULL, NULL, 0, "reading a partial chunk using a hyperslab selection in file dataspace"); + AddTest("test_read_partial_chunk_point_selection", test_read_partial_chunk_point_selection, NULL, NULL, + NULL, 0, "reading a partial chunk using a point selection in file dataspace"); + AddTest("test_get_vlen_buf_size", test_get_vlen_buf_size, NULL, NULL, NULL, 0, "H5Dvlen_get_buf_size"); } diff --git a/test/API/H5_api_dataset_test.h b/test/API/H5_api_dataset_test.h index cb87ae38bcb..2549b6ee540 100644 --- a/test/API/H5_api_dataset_test.h +++ b/test/API/H5_api_dataset_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_dataset_test(void); +void H5_api_dataset_test_add(void); /************************************************ * * diff --git a/test/API/H5_api_datatype_test.c b/test/API/H5_api_datatype_test.c index c788391d05c..968729df33e 100644 --- a/test/API/H5_api_datatype_test.c +++ b/test/API/H5_api_datatype_test.c @@ -17,68 +17,49 @@ */ #define PROBLEMATIC_TESTS -static int test_create_committed_datatype(void); -static int test_create_committed_datatype_invalid_params(void); -static int test_create_anonymous_committed_datatype(void); -static int test_create_anonymous_committed_datatype_invalid_params(void); +static void print_datatype_test_header(const void *params); +static void test_create_committed_datatype(const void *params); +static void test_create_committed_datatype_invalid_params(const void *params); +static void test_create_anonymous_committed_datatype(const void *params); +static void test_create_anonymous_committed_datatype_invalid_params(const void *params); #ifndef PROBLEMATIC_TESTS -static int test_create_committed_datatype_empty_types(void); +static void test_create_committed_datatype_empty_types(const void *params); #endif -static int test_recommit_committed_type(void); -static int test_open_committed_datatype(void); -static int test_open_committed_datatype_invalid_params(void); -static int test_reopen_committed_datatype_indirect(void); -static int test_close_committed_datatype_invalid_id(void); -static int test_datatype_property_lists(void); -static int test_create_dataset_with_committed_type(void); -static int test_create_attribute_with_committed_type(void); -static int test_delete_committed_type(void); -static int test_resurrect_datatype(void); -static int test_flush_committed_datatype(void); -static int test_flush_committed_datatype_invalid_params(void); -static int test_refresh_committed_datatype(void); -static int test_refresh_committed_datatype_invalid_params(void); +static void test_recommit_committed_type(const void *params); +static void test_open_committed_datatype(const void *params); +static void test_open_committed_datatype_invalid_params(const void *params); +static void test_reopen_committed_datatype_indirect(const void *params); +static void test_close_committed_datatype_invalid_id(const void *params); +static void test_datatype_property_lists(const void *params); +static void test_create_dataset_with_committed_type(const void *params); +static void test_create_attribute_with_committed_type(const void *params); +static void test_delete_committed_type(const void *params); +static void test_resurrect_datatype(const void *params); +static void test_flush_committed_datatype(const void *params); +static void test_flush_committed_datatype_invalid_params(const void *params); +static void test_refresh_committed_datatype(const void *params); +static void test_refresh_committed_datatype_invalid_params(const void *params); #ifndef PROBLEMATIC_TESTS -static int test_cant_commit_predefined(void); +static void test_cant_commit_predefined(const void *params); #endif -static int test_cant_modify_committed_type(void); +static void test_cant_modify_committed_type(const void *params); -/* - * The array of datatype tests to be performed. - */ -static int (*datatype_tests[])(void) = { - test_create_committed_datatype, - test_create_committed_datatype_invalid_params, - test_create_anonymous_committed_datatype, - test_create_anonymous_committed_datatype_invalid_params, -#ifndef PROBLEMATIC_TESTS - test_create_committed_datatype_empty_types, -#endif - test_recommit_committed_type, - test_open_committed_datatype, - test_open_committed_datatype_invalid_params, - test_reopen_committed_datatype_indirect, - test_close_committed_datatype_invalid_id, - test_datatype_property_lists, - test_create_dataset_with_committed_type, - test_create_attribute_with_committed_type, - test_delete_committed_type, - test_resurrect_datatype, - test_flush_committed_datatype, - test_flush_committed_datatype_invalid_params, - test_refresh_committed_datatype, - test_refresh_committed_datatype_invalid_params, -#ifndef PROBLEMATIC_TESTS - test_cant_commit_predefined, -#endif - test_cant_modify_committed_type, -}; +static void +print_datatype_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Datatype Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that a committed datatype can be created. */ -static int -test_create_committed_datatype(void) +static void +test_create_committed_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -92,7 +73,7 @@ test_create_committed_datatype(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -138,7 +119,7 @@ test_create_committed_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -150,15 +131,15 @@ test_create_committed_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can't be * created when H5Tcommit2 is passed invalid parameters. */ -static int -test_create_committed_datatype_invalid_params(void) +static void +test_create_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -173,7 +154,7 @@ test_create_committed_datatype_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -360,7 +341,7 @@ test_create_committed_datatype_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -372,15 +353,15 @@ test_create_committed_datatype_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous committed datatype * can be created with H5Tcommit_anon. */ -static int -test_create_anonymous_committed_datatype(void) +static void +test_create_anonymous_committed_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -394,7 +375,7 @@ test_create_anonymous_committed_datatype(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -439,7 +420,7 @@ test_create_anonymous_committed_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -451,15 +432,15 @@ test_create_anonymous_committed_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can't be * created when H5Tcommit_anon is passed invalid parameters. */ -static int -test_create_anonymous_committed_datatype_invalid_params(void) +static void +test_create_anonymous_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -474,7 +455,7 @@ test_create_anonymous_committed_datatype_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -604,7 +585,7 @@ test_create_anonymous_committed_datatype_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -616,7 +597,7 @@ test_create_anonymous_committed_datatype_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -624,8 +605,8 @@ test_create_anonymous_committed_datatype_invalid_params(void) * compound and enum datatypes. */ #ifndef PROBLEMATIC_TESTS -static int -test_create_committed_datatype_empty_types(void) +static void +test_create_committed_datatype_empty_types(const void H5_ATTR_UNUSED *params) { herr_t err_ret = FAIL; hid_t file_id = H5I_INVALID_HID; @@ -640,7 +621,7 @@ test_create_committed_datatype_empty_types(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -791,15 +772,15 @@ test_create_committed_datatype_empty_types(void) } H5E_END_TRY - return 1; + return; } #endif /* * A test to check that a committed datatype can't be re-committed. */ -static int -test_recommit_committed_type(void) +static void +test_recommit_committed_type(const void H5_ATTR_UNUSED *params) { htri_t is_committed = false; herr_t err_ret; @@ -815,7 +796,7 @@ test_recommit_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -886,7 +867,7 @@ test_recommit_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -898,15 +879,15 @@ test_recommit_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype * can be opened using H5Topen2. */ -static int -test_open_committed_datatype(void) +static void +test_open_committed_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -920,7 +901,7 @@ test_open_committed_datatype(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -975,7 +956,7 @@ test_open_committed_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -987,15 +968,15 @@ test_open_committed_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can't * be opened when H5Topen2 is passed invalid parameters. */ -static int -test_open_committed_datatype_invalid_params(void) +static void +test_open_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1009,7 +990,7 @@ test_open_committed_datatype_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1143,7 +1124,7 @@ test_open_committed_datatype_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1155,15 +1136,15 @@ test_open_committed_datatype_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that open named datatypes can be reopened indirectly * through H5Dget_type without causing problems. */ -static int -test_reopen_committed_datatype_indirect(void) +static void +test_reopen_committed_datatype_indirect(const void H5_ATTR_UNUSED *params) { size_t dt_size = 0; hid_t file_id = H5I_INVALID_HID; @@ -1183,7 +1164,7 @@ test_reopen_committed_datatype_indirect(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or stored datatype aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1611,7 +1592,7 @@ test_reopen_committed_datatype_indirect(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1627,15 +1608,15 @@ test_reopen_committed_datatype_indirect(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Tclose fails when * it is passed an invalid datatype ID. */ -static int -test_close_committed_datatype_invalid_id(void) +static void +test_close_committed_datatype_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -1647,7 +1628,7 @@ test_close_committed_datatype_invalid_id(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_STORED_DATATYPES)) { SKIPPED(); printf(" API functions for basic file or stored datatype aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1673,7 +1654,7 @@ test_close_committed_datatype_invalid_id(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1682,7 +1663,7 @@ test_close_committed_datatype_invalid_id(void) } H5E_END_TRY - return 1; + return; } /* @@ -1690,8 +1671,8 @@ test_close_committed_datatype_invalid_id(void) * can be persisted and that a valid copy of that TCPL can * be retrieved later with a call to H5Tget_create_plist. */ -static int -test_datatype_property_lists(void) +static void +test_datatype_property_lists(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1706,7 +1687,7 @@ test_datatype_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, stored datatype, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1883,7 +1864,7 @@ test_datatype_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1898,15 +1879,15 @@ test_datatype_property_lists(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * a committed datatype. */ -static int -test_create_dataset_with_committed_type(void) +static void +test_create_dataset_with_committed_type(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1923,7 +1904,7 @@ test_create_dataset_with_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or stored datatype aren't supported with " "this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2027,7 +2008,7 @@ test_create_dataset_with_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2041,15 +2022,15 @@ test_create_dataset_with_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be created * using a committed datatype. */ -static int -test_create_attribute_with_committed_type(void) +static void +test_create_attribute_with_committed_type(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -2067,7 +2048,7 @@ test_create_attribute_with_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or stored datatype aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2160,7 +2141,7 @@ test_create_attribute_with_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2174,15 +2155,15 @@ test_create_attribute_with_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can * be deleted. */ -static int -test_delete_committed_type(void) +static void +test_delete_committed_type(const void H5_ATTR_UNUSED *params) { htri_t type_exists; hid_t file_id = H5I_INVALID_HID; @@ -2198,7 +2179,7 @@ test_delete_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or stored datatype aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2274,7 +2255,7 @@ test_delete_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2286,15 +2267,15 @@ test_delete_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can still be opened when * the link to the datatype is deleted and then a new one is created. */ -static int -test_resurrect_datatype(void) +static void +test_resurrect_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -2310,7 +2291,7 @@ test_resurrect_datatype(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2415,7 +2396,7 @@ test_resurrect_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2427,47 +2408,47 @@ test_resurrect_datatype(void) } H5E_END_TRY - return 1; + return; } -static int -test_flush_committed_datatype(void) +static void +test_flush_committed_datatype(const void H5_ATTR_UNUSED *params) { TESTING("H5Tflush"); SKIPPED(); - return 0; + return; } -static int -test_flush_committed_datatype_invalid_params(void) +static void +test_flush_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Tflush with invalid parameters"); SKIPPED(); - return 0; + return; } -static int -test_refresh_committed_datatype(void) +static void +test_refresh_committed_datatype(const void H5_ATTR_UNUSED *params) { TESTING("H5Trefresh"); SKIPPED(); - return 0; + return; } -static int -test_refresh_committed_datatype_invalid_params(void) +static void +test_refresh_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Trefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -2476,8 +2457,8 @@ test_refresh_committed_datatype_invalid_params(void) * copied datatype. */ #ifndef PROBLEMATIC_TESTS -static int -test_cant_commit_predefined(void) +static void +test_cant_commit_predefined(const void H5_ATTR_UNUSED *params) { herr_t err_ret; hid_t file_id = H5I_INVALID_HID; @@ -2492,7 +2473,7 @@ test_cant_commit_predefined(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2536,7 +2517,7 @@ test_cant_commit_predefined(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2547,15 +2528,15 @@ test_cant_commit_predefined(void) } H5E_END_TRY - return 1; + return; } #endif /* * A test to check that a datatype cannot be modified once it has been committed. */ -static int -test_cant_modify_committed_type(void) +static void +test_cant_modify_committed_type(const void H5_ATTR_UNUSED *params) { htri_t is_committed = false; herr_t err_ret; @@ -2572,7 +2553,7 @@ test_cant_modify_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2643,7 +2624,7 @@ test_cant_modify_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2655,26 +2636,63 @@ test_cant_modify_committed_type(void) } H5E_END_TRY - return 1; + return; } -int -H5_api_datatype_test(void) +void +H5_api_datatype_test_add(void) { - size_t i; - int nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_datatype_test_header", print_datatype_test_header, NULL, NULL, NULL, 0, + "Prints header for datatype tests"); + + AddTest("test_create_committed_datatype", test_create_committed_datatype, NULL, NULL, NULL, 0, + "creation of a committed datatype"); + AddTest("test_create_committed_datatype_invalid_params", test_create_committed_datatype_invalid_params, + NULL, NULL, NULL, 0, "H5Tcommit2 with invalid parameters"); + AddTest("test_create_anonymous_committed_datatype", test_create_anonymous_committed_datatype, NULL, NULL, + NULL, 0, "creation of anonymous committed datatype"); + AddTest("test_create_anonymous_committed_datatype_invalid_params", + test_create_anonymous_committed_datatype_invalid_params, NULL, NULL, NULL, 0, + "H5Tcommit_anon with invalid parameters"); - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Datatype Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); +#ifndef PROBLEMATIC_TESTS + AddTest("test_create_committed_datatype_empty_types", test_create_committed_datatype_empty_types, NULL, + NULL, NULL, 0, "creation of committed datatype with empty types"); +#endif - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(datatype_tests); i++) { - nerrors += (*datatype_tests[i])() ? 1 : 0; - } + AddTest("test_recommit_committed_type", test_recommit_committed_type, NULL, NULL, NULL, 0, + "inability to re-commit a committed datatype"); + AddTest("test_open_committed_datatype", test_open_committed_datatype, NULL, NULL, NULL, 0, "H5Topen2"); + AddTest("test_open_committed_datatype_invalid_params", test_open_committed_datatype_invalid_params, NULL, + NULL, NULL, 0, "H5Topen2 with invalid parameters"); + AddTest("test_reopen_committed_datatype_indirect", test_reopen_committed_datatype_indirect, NULL, NULL, + NULL, 0, "reopening open committed datatypes using H5Dget_type"); + AddTest("test_close_committed_datatype_invalid_id", test_close_committed_datatype_invalid_id, NULL, NULL, + NULL, 0, "H5Tclose with an invalid committed datatype ID"); + AddTest("test_datatype_property_lists", test_datatype_property_lists, NULL, NULL, NULL, 0, + "datatype property list operations"); + AddTest("test_create_dataset_with_committed_type", test_create_dataset_with_committed_type, NULL, NULL, + NULL, 0, "dataset creation with a committed datatype"); + AddTest("test_create_attribute_with_committed_type", test_create_attribute_with_committed_type, NULL, + NULL, NULL, 0, "attribute creation with a committed datatype"); + AddTest("test_delete_committed_type", test_delete_committed_type, NULL, NULL, NULL, 0, + "committed datatype deletion"); + AddTest("test_resurrect_datatype", test_resurrect_datatype, NULL, NULL, NULL, 0, + "resurrecting datatype after deletion"); + AddTest("test_flush_committed_datatype", test_flush_committed_datatype, NULL, NULL, NULL, 0, "H5Tflush"); + AddTest("test_flush_committed_datatype_invalid_params", test_flush_committed_datatype_invalid_params, + NULL, NULL, NULL, 0, "H5Tflush with invalid parameters"); + AddTest("test_refresh_committed_datatype", test_refresh_committed_datatype, NULL, NULL, NULL, 0, + "H5Trefresh"); + AddTest("test_refresh_committed_datatype_invalid_params", test_refresh_committed_datatype_invalid_params, + NULL, NULL, NULL, 0, "H5Trefresh with invalid parameters"); - printf("\n"); +#ifndef PROBLEMATIC_TESTS + AddTest("test_cant_commit_predefined", test_cant_commit_predefined, NULL, NULL, NULL, 0, + "inability to commit predefined types directly"); +#endif - return nerrors; + AddTest("test_cant_modify_committed_type", test_cant_modify_committed_type, NULL, NULL, NULL, 0, + "inability to modify a committed datatype"); } diff --git a/test/API/H5_api_datatype_test.h b/test/API/H5_api_datatype_test.h index e35de7904bd..0cb861692b7 100644 --- a/test/API/H5_api_datatype_test.h +++ b/test/API/H5_api_datatype_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_datatype_test(void); +void H5_api_datatype_test_add(void); /************************************************* * * diff --git a/test/API/H5_api_file_test.c b/test/API/H5_api_file_test.c index e7bb632f1ae..bdcb9e8f9a7 100644 --- a/test/API/H5_api_file_test.c +++ b/test/API/H5_api_file_test.c @@ -12,52 +12,41 @@ #include "H5_api_file_test.h" -static int test_create_file(void); -static int test_create_file_invalid_params(void); -static int test_create_file_excl(void); -static int test_open_file(void); -static int test_open_file_invalid_params(void); -static int test_open_nonexistent_file(void); -static int test_file_open_overlap(void); -static int test_file_permission(void); -static int test_reopen_file(void); -static int test_close_file_invalid_id(void); -static int test_flush_file(void); -static int test_file_is_accessible(void); -static int test_file_property_lists(void); -static int test_get_file_intent(void); -static int test_get_file_obj_count(void); -static int test_file_mounts(void); -static int test_get_file_name(void); +static void print_file_test_header(const void *params); +static void test_create_file(const void *params); +static void test_create_file_invalid_params(const void *params); +static void test_create_file_excl(const void *params); +static void test_open_file(const void *params); +static void test_open_file_invalid_params(const void *params); +static void test_open_nonexistent_file(const void *params); +static void test_file_open_overlap(const void *params); +static void test_file_permission(const void *params); +static void test_reopen_file(const void *params); +static void test_close_file_invalid_id(const void *params); +static void test_flush_file(const void *params); +static void test_file_is_accessible(const void *params); +static void test_file_property_lists(const void *params); +static void test_get_file_intent(const void *params); +static void test_get_file_obj_count(const void *params); +static void test_file_mounts(const void *params); +static void test_get_file_name(const void *params); -/* - * The array of file tests to be performed. - */ -static int (*file_tests[])(void) = { - test_create_file, - test_create_file_invalid_params, - test_create_file_excl, - test_open_file, - test_open_file_invalid_params, - test_open_nonexistent_file, - test_file_open_overlap, - test_file_permission, - test_reopen_file, - test_close_file_invalid_id, - test_flush_file, - test_file_is_accessible, - test_file_property_lists, - test_get_file_intent, - test_get_file_obj_count, - test_file_mounts, - test_get_file_name, -}; +static void +print_file_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API File Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * Tests that a file can be created. */ -static int -test_create_file(void) +static void +test_create_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; char *prefixed_filename = NULL; @@ -68,7 +57,7 @@ test_create_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_CREATE_TEST_FILENAME, &prefixed_filename) < 0) { @@ -85,32 +74,36 @@ test_create_file(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * Tests that a file can't be created when H5Fcreate is passed * invalid parameters. */ -static int -test_create_file_invalid_params(void) +static void +test_create_file_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; char *prefixed_filename = NULL; @@ -121,7 +114,7 @@ test_create_file_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_CREATE_INVALID_PARAMS_FILE_NAME, &prefixed_filename) < 0) { @@ -239,7 +232,7 @@ test_create_file_invalid_params(void) free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: H5E_BEGIN_TRY @@ -253,15 +246,15 @@ test_create_file_invalid_params(void) free(prefixed_filename); - return 1; + return; } /* * Tests that file creation will fail when a file is created * using the H5F_ACC_EXCL flag while the file already exists. */ -static int -test_create_file_excl(void) +static void +test_create_file_excl(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t file_id2 = H5I_INVALID_HID; @@ -273,7 +266,7 @@ test_create_file_excl(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_CREATE_EXCL_FILE_NAME, &prefixed_filename) < 0) { @@ -316,32 +309,36 @@ test_create_file_excl(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { H5Fclose(file_id); H5Fclose(file_id2); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * Tests that a file can be opened. */ -static int -test_open_file(void) +static void +test_open_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; @@ -351,7 +348,7 @@ test_open_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -408,7 +405,7 @@ test_open_file(void) } END_MULTIPART; - return 0; + return; error: H5E_BEGIN_TRY @@ -417,15 +414,15 @@ test_open_file(void) } H5E_END_TRY - return 1; + return; } /* * Tests that a file can't be opened when H5Fopen is given * invalid parameters. */ -static int -test_open_file_invalid_params(void) +static void +test_open_file_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; @@ -435,7 +432,7 @@ test_open_file_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -510,7 +507,7 @@ test_open_file_invalid_params(void) } END_MULTIPART; - return 0; + return; error: H5E_BEGIN_TRY @@ -519,14 +516,14 @@ test_open_file_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that opening a file which doesn't exist will fail. */ -static int -test_open_nonexistent_file(void) +static void +test_open_nonexistent_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; char *prefixed_filename = NULL; @@ -537,7 +534,7 @@ test_open_nonexistent_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, NONEXISTENT_FILENAME, &prefixed_filename) < 0) { @@ -546,7 +543,12 @@ test_open_nonexistent_file(void) goto error; } - /* XXX: Make sure to first delete the file so we know for sure it doesn't exist */ + /* Make sure to first delete the file so we know for sure it doesn't exist */ + H5E_BEGIN_TRY + { + H5Fdelete(prefixed_filename, H5P_DEFAULT); + } + H5E_END_TRY; H5E_BEGIN_TRY { @@ -565,7 +567,7 @@ test_open_nonexistent_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -576,15 +578,15 @@ test_open_nonexistent_file(void) free(prefixed_filename); - return 1; + return; } /* * Tests that a file can be opened read-only or read-write * and things are handled appropriately. */ -static int -test_file_permission(void) +static void +test_file_permission(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -604,7 +606,7 @@ test_file_permission(void) SKIPPED(); printf(" API functions for basic file, group, dataset, attribute, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -790,13 +792,15 @@ test_file_permission(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -807,19 +811,21 @@ test_file_permission(void) H5Tclose(dtype_id); H5Gclose(group_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to check that a file can be re-opened with H5Freopen. */ -static int -test_reopen_file(void) +static void +test_reopen_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t file_id2 = H5I_INVALID_HID; @@ -830,7 +836,7 @@ test_reopen_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -852,7 +858,7 @@ test_reopen_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -862,14 +868,14 @@ test_reopen_file(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Fclose doesn't succeed for an * invalid file ID */ -static int -test_close_file_invalid_id(void) +static void +test_close_file_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; @@ -879,7 +885,7 @@ test_close_file_invalid_id(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -896,17 +902,17 @@ test_close_file_invalid_id(void) PASSED(); - return 0; + return; error: - return 1; + return; } /* * A test to check that a file can be flushed using H5Fflush. */ -static int -test_flush_file(void) +static void +test_flush_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dspace_id = H5I_INVALID_HID; @@ -923,7 +929,7 @@ test_flush_file(void) SKIPPED(); printf(" API functions for basic file, dataset, or file flush aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1001,13 +1007,15 @@ test_flush_file(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1015,19 +1023,21 @@ test_flush_file(void) H5Sclose(dspace_id); H5Dclose(dset_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test for H5Fis_accessible. */ -static int -test_file_is_accessible(void) +static void +test_file_is_accessible(const void H5_ATTR_UNUSED *params) { const char *const fake_filename = "nonexistent_file.h5"; char *prefixed_filename = NULL; @@ -1039,7 +1049,7 @@ test_file_is_accessible(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, fake_filename, &prefixed_filename) < 0) { @@ -1099,12 +1109,12 @@ test_file_is_accessible(void) free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: free(prefixed_filename); - return 1; + return; } /* @@ -1114,8 +1124,8 @@ test_file_is_accessible(void) * tests that a valid copy of a FAPL used for file access * can be retrieved with a call to H5Fget_access_plist. */ -static int -test_file_property_lists(void) +static void +test_file_property_lists(const void H5_ATTR_UNUSED *params) { hsize_t prop_val = 0; hid_t file_id1 = H5I_INVALID_HID; @@ -1135,7 +1145,7 @@ test_file_property_lists(void) SKIPPED(); printf(" API functions for basic or more file or get property list aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1385,6 +1395,10 @@ test_file_property_lists(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename1, H5P_DEFAULT) < 0) + TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename2, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename1); prefixed_filename1 = NULL; @@ -1393,7 +1407,7 @@ test_file_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1404,20 +1418,24 @@ test_file_property_lists(void) H5Pclose(fapl_id2); H5Fclose(file_id1); H5Fclose(file_id2); + if (GetTestCleanup()) { + H5Fdelete(prefixed_filename1, H5P_DEFAULT); + H5Fdelete(prefixed_filename2, H5P_DEFAULT); + } } H5E_END_TRY free(prefixed_filename1); free(prefixed_filename2); - return 1; + return; } /* * A test to check that the file intent flags can be retrieved. */ -static int -test_get_file_intent(void) +static void +test_get_file_intent(const void H5_ATTR_UNUSED *params) { unsigned file_intent; hid_t file_id = H5I_INVALID_HID; @@ -1429,7 +1447,7 @@ test_get_file_intent(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { SKIPPED(); printf(" API functions for basic or more file aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1553,29 +1571,34 @@ test_get_file_intent(void) } END_MULTIPART; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; + free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: H5E_BEGIN_TRY { H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to check that the number of open objects and IDs of objects in a file * can be retrieved. */ -static int -test_get_file_obj_count(void) +static void +test_get_file_obj_count(const void H5_ATTR_UNUSED *params) { ssize_t obj_count; hid_t file_id = H5I_INVALID_HID; @@ -1600,7 +1623,7 @@ test_get_file_obj_count(void) printf( " API functions for basic or more file, basic dataset, group, stored datatypes, or attribute " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1886,6 +1909,10 @@ test_get_file_obj_count(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename1, H5P_DEFAULT) < 0) + TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename2, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename1); prefixed_filename1 = NULL; @@ -1894,7 +1921,7 @@ test_get_file_obj_count(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1906,21 +1933,25 @@ test_get_file_obj_count(void) H5Dclose(dset_id); H5Fclose(file_id); H5Fclose(file_id2); + if (GetTestCleanup()) { + H5Fdelete(prefixed_filename1, H5P_DEFAULT); + H5Fdelete(prefixed_filename2, H5P_DEFAULT); + } } H5E_END_TRY free(prefixed_filename1); free(prefixed_filename2); - return 1; + return; } /* * A test to check that opening files in an overlapping way * works correctly. */ -static int -test_file_open_overlap(void) +static void +test_file_open_overlap(const void H5_ATTR_UNUSED *params) { ssize_t obj_count; hid_t file_id = H5I_INVALID_HID; @@ -1938,7 +1969,7 @@ test_file_open_overlap(void) SKIPPED(); printf(" API functions for basic or more file, dataset, or group aren't supported with this " "connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, OVERLAPPING_FILENAME, &prefixed_filename) < 0) { @@ -2029,13 +2060,15 @@ test_file_open_overlap(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2045,20 +2078,22 @@ test_file_open_overlap(void) H5Dclose(dset_id); H5Fclose(file_id); H5Fclose(file_id2); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to check that file mounting and unmounting works * correctly. */ -static int -test_file_mounts(void) +static void +test_file_mounts(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t child_fid = H5I_INVALID_HID; @@ -2073,7 +2108,7 @@ test_file_mounts(void) SKIPPED(); printf(" API functions for basic file, file mount, or basic group aren't supported with this " "connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_MOUNT_TEST_FILENAME, &prefixed_filename) < 0) { @@ -2120,13 +2155,15 @@ test_file_mounts(void) TEST_ERROR; if (H5Fclose(child_fid) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2134,19 +2171,21 @@ test_file_mounts(void) H5Gclose(group_id); H5Fclose(file_id); H5Fclose(child_fid); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to ensure that a file's name can be retrieved. */ -static int -test_get_file_name(void) +static void +test_get_file_name(const void H5_ATTR_UNUSED *params) { ssize_t file_name_buf_len = 0; hid_t file_id = H5I_INVALID_HID; @@ -2169,7 +2208,7 @@ test_get_file_name(void) printf( " API functions for basic or more file, basic dataset, group, stored datatypes, or attribute " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2463,13 +2502,15 @@ test_get_file_name(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2482,58 +2523,47 @@ test_get_file_name(void) H5Aclose(attr_id); H5Gclose(group_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; -} - -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) -{ - remove_test_file(test_path_prefix, FILE_CREATE_TEST_FILENAME); - remove_test_file(test_path_prefix, FILE_CREATE_EXCL_FILE_NAME); - - /* The below file should not get created */ - /* remove_test_file(test_path_prefix, FILE_CREATE_INVALID_PARAMS_FILE_NAME); */ - - remove_test_file(test_path_prefix, OVERLAPPING_FILENAME); - remove_test_file(test_path_prefix, FILE_PERMISSION_TEST_FILENAME); - remove_test_file(test_path_prefix, FILE_FLUSH_TEST_FILENAME); - remove_test_file(test_path_prefix, FILE_PROPERTY_LIST_TEST_FNAME1); - remove_test_file(test_path_prefix, FILE_PROPERTY_LIST_TEST_FNAME2); - remove_test_file(test_path_prefix, FILE_INTENT_TEST_FILENAME); - remove_test_file(test_path_prefix, GET_OBJ_COUNT_TEST_FILENAME1); - remove_test_file(test_path_prefix, GET_OBJ_COUNT_TEST_FILENAME2); - remove_test_file(test_path_prefix, FILE_MOUNT_TEST_FILENAME); - remove_test_file(test_path_prefix, GET_FILE_NAME_TEST_FNAME); + return; } -int -H5_api_file_test(void) +void +H5_api_file_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API File Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(file_tests); i++) { - nerrors += (*file_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_file_test_header", print_file_test_header, NULL, NULL, NULL, 0, + "Prints header for file tests"); + + AddTest("test_create_file", test_create_file, NULL, NULL, NULL, 0, "H5Fcreate"); + AddTest("test_create_file_invalid_params", test_create_file_invalid_params, NULL, NULL, NULL, 0, + "H5Fcreate with invalid parameters"); + AddTest("test_create_file_excl", test_create_file_excl, NULL, NULL, NULL, 0, + "H5Fcreate with H5F_ACC_EXCL/H5F_ACC_TRUNC flag"); + AddTest("test_open_file", test_open_file, NULL, NULL, NULL, 0, "H5Fopen"); + AddTest("test_open_file_invalid_params", test_open_file_invalid_params, NULL, NULL, NULL, 0, + "H5Fopen with invalid parameters"); + AddTest("test_open_nonexistent_file", test_open_nonexistent_file, NULL, NULL, NULL, 0, + "for invalid opening of a non-existent file"); + AddTest("test_file_open_overlap", test_file_open_overlap, NULL, NULL, NULL, 0, "overlapping file opens"); + AddTest("test_file_permission", test_file_permission, NULL, NULL, NULL, 0, + "file permissions (invalid creation of objects in read-only file)"); + AddTest("test_reopen_file", test_reopen_file, NULL, NULL, NULL, 0, "re-open of a file with H5Freopen"); + AddTest("test_close_file_invalid_id", test_close_file_invalid_id, NULL, NULL, NULL, 0, + "H5Fclose with an invalid ID"); + AddTest("test_flush_file", test_flush_file, NULL, NULL, NULL, 0, "H5Fflush"); + AddTest("test_file_is_accessible", test_file_is_accessible, NULL, NULL, NULL, 0, "H5Fis_accessible"); + AddTest("test_file_property_lists", test_file_property_lists, NULL, NULL, NULL, 0, + "file property list operations"); + AddTest("test_get_file_intent", test_get_file_intent, NULL, NULL, NULL, 0, + "retrieval of file intent with H5Fget_intent"); + AddTest("test_get_file_obj_count", test_get_file_obj_count, NULL, NULL, NULL, 0, + "retrieval of open object number and IDs"); + AddTest("test_file_mounts", test_file_mounts, NULL, NULL, NULL, 0, "file mounting/unmounting"); + AddTest("test_get_file_name", test_get_file_name, NULL, NULL, NULL, 0, "retrieval of file name"); } diff --git a/test/API/H5_api_file_test.h b/test/API/H5_api_file_test.h index 782b27b4941..6fb27671bff 100644 --- a/test/API/H5_api_file_test.h +++ b/test/API/H5_api_file_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_file_test(void); +void H5_api_file_test_add(void); /********************************************* * * diff --git a/test/API/H5_api_group_test.c b/test/API/H5_api_group_test.c index fb7a149db04..ce784e0c04f 100644 --- a/test/API/H5_api_group_test.c +++ b/test/API/H5_api_group_test.c @@ -12,55 +12,43 @@ #include "H5_api_group_test.h" -static int test_create_group_under_root(void); -static int test_create_group_under_existing_group(void); -static int test_create_many_groups(void); -static int test_create_deep_groups(void); -static int test_create_intermediate_group(void); -static int test_create_group_invalid_params(void); -static int test_create_anonymous_group(void); -static int test_create_anonymous_group_invalid_params(void); -static int test_open_nonexistent_group(void); -static int test_open_group_invalid_params(void); -static int test_close_group_invalid_id(void); -static int test_group_property_lists(void); -static int test_get_group_info(void); -static int test_get_group_info_invalid_params(void); -static int test_flush_group(void); -static int test_flush_group_invalid_params(void); -static int test_refresh_group(void); -static int test_refresh_group_invalid_params(void); -static int create_group_recursive(hid_t parent_gid, unsigned counter); - -/* - * The array of group tests to be performed. - */ -static int (*group_tests[])(void) = { - test_create_group_under_root, - test_create_group_under_existing_group, - test_create_many_groups, - test_create_deep_groups, - test_create_intermediate_group, - test_create_group_invalid_params, - test_create_anonymous_group, - test_create_anonymous_group_invalid_params, - test_open_nonexistent_group, - test_open_group_invalid_params, - test_close_group_invalid_id, - test_group_property_lists, - test_get_group_info, - test_get_group_info_invalid_params, - test_flush_group, - test_flush_group_invalid_params, - test_refresh_group, - test_refresh_group_invalid_params, -}; +static void print_group_test_header(const void *params); +static void test_create_group_under_root(const void *params); +static void test_create_group_under_existing_group(const void *params); +static void test_create_many_groups(const void *params); +static void test_create_deep_groups(const void *params); +static void test_create_intermediate_group(const void *params); +static void test_create_group_invalid_params(const void *params); +static void test_create_anonymous_group(const void *params); +static void test_create_anonymous_group_invalid_params(const void *params); +static void test_open_nonexistent_group(const void *params); +static void test_open_group_invalid_params(const void *params); +static void test_close_group_invalid_id(const void *params); +static void test_group_property_lists(const void *params); +static void test_get_group_info(const void *params); +static void test_get_group_info_invalid_params(const void *params); +static void test_flush_group(const void *params); +static void test_flush_group_invalid_params(const void *params); +static void test_refresh_group(const void *params); +static void test_refresh_group_invalid_params(const void *params); +static int create_group_recursive(hid_t parent_gid, unsigned counter); + +static void +print_group_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Group Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that a group can be created under the root group. */ -static int -test_create_group_under_root(void) +static void +test_create_group_under_root(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_gid = H5I_INVALID_HID; @@ -71,7 +59,7 @@ test_create_group_under_root(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -95,7 +83,7 @@ test_create_group_under_root(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -105,15 +93,15 @@ test_create_group_under_root(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group can be created under an existing * group which is not the root group. */ -static int -test_create_group_under_existing_group(void) +static void +test_create_group_under_existing_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID, child_group_id = H5I_INVALID_HID, @@ -125,7 +113,7 @@ test_create_group_under_existing_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -170,7 +158,7 @@ test_create_group_under_existing_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -182,14 +170,14 @@ test_create_group_under_existing_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to create many (one million) groups */ -static int -test_create_many_groups(void) +static void +test_create_many_groups(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -203,7 +191,7 @@ test_create_many_groups(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -250,7 +238,7 @@ test_create_many_groups(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -262,14 +250,14 @@ test_create_many_groups(void) } H5E_END_TRY - return 1; + return; } /* * A test to create groups of the depth GROUP_DEPTH. */ -static int -test_create_deep_groups(void) +static void +test_create_deep_groups(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -281,7 +269,7 @@ test_create_deep_groups(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -317,7 +305,7 @@ test_create_deep_groups(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -328,7 +316,7 @@ test_create_deep_groups(void) } H5E_END_TRY - return 1; + return; } /* @@ -376,8 +364,8 @@ create_group_recursive(hid_t parent_gid, unsigned counter) /* * A test to create groups automatically using H5Pset_create_intermediate_group */ -static int -test_create_intermediate_group(void) +static void +test_create_intermediate_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -390,7 +378,7 @@ test_create_intermediate_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -506,7 +494,7 @@ test_create_intermediate_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -518,15 +506,15 @@ test_create_intermediate_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group can't be created when H5Gcreate * is passed invalid parameters. */ -static int -test_create_group_invalid_params(void) +static void +test_create_group_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; @@ -537,7 +525,7 @@ test_create_group_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -683,7 +671,7 @@ test_create_group_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -693,15 +681,15 @@ test_create_group_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous group can be created with * H5Gcreate_anon. */ -static int -test_create_anonymous_group(void) +static void +test_create_anonymous_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, new_group_id = H5I_INVALID_HID; @@ -712,7 +700,7 @@ test_create_anonymous_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -742,7 +730,7 @@ test_create_anonymous_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -753,15 +741,15 @@ test_create_anonymous_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous group can't be created * when H5Gcreate_anon is passed invalid parameters. */ -static int -test_create_anonymous_group_invalid_params(void) +static void +test_create_anonymous_group_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, new_group_id = H5I_INVALID_HID; @@ -772,7 +760,7 @@ test_create_anonymous_group_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -867,7 +855,7 @@ test_create_anonymous_group_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -878,15 +866,15 @@ test_create_anonymous_group_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group which doesn't exist cannot * be opened. */ -static int -test_open_nonexistent_group(void) +static void +test_open_nonexistent_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; @@ -897,7 +885,7 @@ test_open_nonexistent_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -923,7 +911,7 @@ test_open_nonexistent_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -933,15 +921,15 @@ test_open_nonexistent_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group can't be opened when H5Gopen * is passed invalid parameters. */ -static int -test_open_group_invalid_params(void) +static void +test_open_group_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; @@ -952,7 +940,7 @@ test_open_group_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1052,7 +1040,7 @@ test_open_group_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1062,15 +1050,15 @@ test_open_group_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Gclose doesn't succeed for an * invalid group ID. */ -static int -test_close_group_invalid_id(void) +static void +test_close_group_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; @@ -1080,7 +1068,7 @@ test_close_group_invalid_id(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic group aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -1097,10 +1085,10 @@ test_close_group_invalid_id(void) PASSED(); - return 0; + return; error: - return 1; + return; } /* @@ -1108,8 +1096,8 @@ test_close_group_invalid_id(void) * be persisted and that a valid copy of that GCPL can be * retrieved later with a call to H5Gget_create_plist. */ -static int -test_group_property_lists(void) +static void +test_group_property_lists(const void H5_ATTR_UNUSED *params) { unsigned dummy_prop_val = GROUP_PROPERTY_LIST_TEST_DUMMY_VAL; hid_t file_id = H5I_INVALID_HID; @@ -1125,7 +1113,7 @@ test_group_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, property list, or creation order aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1358,7 +1346,7 @@ test_group_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1372,14 +1360,14 @@ test_group_property_lists(void) } H5E_END_TRY - return 1; + return; } /* * A test for the functionality of H5Gget_info(_by_idx). */ -static int -test_get_group_info(void) +static void +test_get_group_info(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; unsigned i; @@ -1396,7 +1384,7 @@ test_get_group_info(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1793,7 +1781,7 @@ test_get_group_info(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1806,15 +1794,15 @@ test_get_group_info(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group's info can't be retrieved when * H5Gget_info(_by_name/_by_idx) is passed invalid parameters. */ -static int -test_get_group_info_invalid_params(void) +static void +test_get_group_info_invalid_params(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; herr_t err_ret = -1; @@ -1827,7 +1815,7 @@ test_get_group_info_invalid_params(void) SKIPPED(); printf(" API functions for basic file, or more group aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2154,7 +2142,7 @@ test_get_group_info_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2163,14 +2151,14 @@ test_get_group_info_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Gflush. */ -static int -test_flush_group(void) +static void +test_flush_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -2184,7 +2172,7 @@ test_flush_group(void) SKIPPED(); printf(" API functions for basic file, group, or flush refresh aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2222,7 +2210,7 @@ test_flush_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2233,15 +2221,15 @@ test_flush_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Gflush fails when it * is passed invalid parameters. */ -static int -test_flush_group_invalid_params(void) +static void +test_flush_group_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t status; @@ -2251,7 +2239,7 @@ test_flush_group_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for group flush aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -2268,17 +2256,17 @@ test_flush_group_invalid_params(void) PASSED(); - return 0; + return; error: - return 1; + return; } /* * A test for H5Grefresh. */ -static int -test_refresh_group(void) +static void +test_refresh_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -2292,7 +2280,7 @@ test_refresh_group(void) SKIPPED(); printf(" API functions for basic file, group, or flush refresh aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2330,7 +2318,7 @@ test_refresh_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2341,15 +2329,15 @@ test_refresh_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Grefresh fails when it * is passed invalid parameters. */ -static int -test_refresh_group_invalid_params(void) +static void +test_refresh_group_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t status; @@ -2359,7 +2347,7 @@ test_refresh_group_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for group refresh aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -2376,29 +2364,49 @@ test_refresh_group_invalid_params(void) PASSED(); - return 0; + return; error: - return 1; + return; } -int -H5_api_group_test(void) +void +H5_api_group_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Group Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(group_tests); i++) { - nerrors += (*group_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_group_test_header", print_group_test_header, NULL, NULL, NULL, 0, + "Prints header for group tests"); + + AddTest("test_create_group_under_root", test_create_group_under_root, NULL, NULL, NULL, 0, + "creation of group under the root group"); + AddTest("test_create_group_under_existing_group", test_create_group_under_existing_group, NULL, NULL, + NULL, 0, "creation of group under existing group using a relative path"); + AddTest("test_create_many_groups", test_create_many_groups, NULL, NULL, NULL, 0, "H5Gcreate many groups"); + AddTest("test_create_deep_groups", test_create_deep_groups, NULL, NULL, NULL, 0, + "H5Gcreate groups of great depths"); + AddTest("test_create_intermediate_group", test_create_intermediate_group, NULL, NULL, NULL, 0, + "H5Gcreate group with intermediate group creation"); + AddTest("test_create_group_invalid_params", test_create_group_invalid_params, NULL, NULL, NULL, 0, + "H5Gcreate with invalid parameters"); + AddTest("test_create_anonymous_group", test_create_anonymous_group, NULL, NULL, NULL, 0, + "creation of anonymous group"); + AddTest("test_create_anonymous_group_invalid_params", test_create_anonymous_group_invalid_params, NULL, + NULL, NULL, 0, "H5Gcreate_anon with invalid parameters"); + AddTest("test_open_nonexistent_group", test_open_nonexistent_group, NULL, NULL, NULL, 0, + "for invalid opening of a nonexistent group"); + AddTest("test_open_group_invalid_params", test_open_group_invalid_params, NULL, NULL, NULL, 0, + "H5Gopen with invalid parameters"); + AddTest("test_close_group_invalid_id", test_close_group_invalid_id, NULL, NULL, NULL, 0, + "H5Gclose with an invalid group ID"); + AddTest("test_group_property_lists", test_group_property_lists, NULL, NULL, NULL, 0, + "group property list operations"); + AddTest("test_get_group_info", test_get_group_info, NULL, NULL, NULL, 0, "retrieval of group info"); + AddTest("test_get_group_info_invalid_params", test_get_group_info_invalid_params, NULL, NULL, NULL, 0, + "retrieval of group info with invalid parameters"); + AddTest("test_flush_group", test_flush_group, NULL, NULL, NULL, 0, "H5Gflush"); + AddTest("test_flush_group_invalid_params", test_flush_group_invalid_params, NULL, NULL, NULL, 0, + "H5Gflush with invalid parameters"); + AddTest("test_refresh_group", test_refresh_group, NULL, NULL, NULL, 0, "H5Grefresh"); + AddTest("test_refresh_group_invalid_params", test_refresh_group_invalid_params, NULL, NULL, NULL, 0, + "H5Grefresh with invalid parameters"); } diff --git a/test/API/H5_api_group_test.h b/test/API/H5_api_group_test.h index a60822daa75..6f1f5de2a5b 100644 --- a/test/API/H5_api_group_test.h +++ b/test/API/H5_api_group_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_group_test(void); +void H5_api_group_test_add(void); /********************************************** * * diff --git a/test/API/H5_api_link_test.c b/test/API/H5_api_link_test.c index fe00e1b82a4..25249976a53 100644 --- a/test/API/H5_api_link_test.c +++ b/test/API/H5_api_link_test.c @@ -16,62 +16,63 @@ * TODO: add link tests for short-circuit success in operator callback */ -static int test_create_hard_link(void); -static int test_create_hard_link_long_name(void); -static int test_create_hard_link_many(void); -static int test_create_hard_link_same_loc(void); -static int test_create_hard_link_invalid_params(void); -static int test_create_soft_link_existing_relative(void); -static int test_create_soft_link_existing_absolute(void); -static int test_create_soft_link_dangling_relative(void); -static int test_create_soft_link_dangling_absolute(void); -static int test_create_soft_link_long_name(void); -static int test_create_soft_link_many(void); -static int test_create_soft_link_invalid_params(void); -static int test_create_external_link(void); -static int test_create_external_link_dangling(void); -static int test_create_external_link_multi(void); -static int test_create_external_link_ping_pong(void); -static int test_create_external_link_invalid_params(void); -static int test_create_user_defined_link(void); -static int test_create_user_defined_link_invalid_params(void); -static int test_delete_link(void); -static int test_delete_link_reset_grp_max_crt_order(void); -static int test_delete_link_invalid_params(void); -static int test_copy_link(void); -static int test_copy_links_into_group_with_links(void); -static int test_copy_link_across_files(void); -static int test_copy_link_invalid_params(void); -static int test_move_link(void); -static int test_move_links_into_group_with_links(void); -static int test_move_link_across_files(void); -static int test_move_link_reset_grp_max_crt_order(void); -static int test_move_link_invalid_params(void); -static int test_get_link_val(void); -static int test_get_link_val_invalid_params(void); -static int test_get_link_info(void); -static int test_get_link_info_invalid_params(void); -static int test_get_link_name(void); -static int test_get_link_name_invalid_params(void); -static int test_link_iterate_hard_links(void); -static int test_link_iterate_soft_links(void); -static int test_link_iterate_external_links(void); -static int test_link_iterate_ud_links(void); -static int test_link_iterate_mixed_links(void); -static int test_link_iterate_invalid_params(void); -static int test_link_iterate_0_links(void); -static int test_link_visit_hard_links_no_cycles(void); -static int test_link_visit_soft_links_no_cycles(void); -static int test_link_visit_external_links_no_cycles(void); -static int test_link_visit_ud_links_no_cycles(void); -static int test_link_visit_mixed_links_no_cycles(void); -static int test_link_visit_hard_links_cycles(void); -static int test_link_visit_soft_links_cycles(void); -static int test_link_visit_external_links_cycles(void); -static int test_link_visit_ud_links_cycles(void); -static int test_link_visit_mixed_links_cycles(void); -static int test_link_visit_invalid_params(void); -static int test_link_visit_0_links(void); +static void print_link_test_header(const void *params); +static void test_create_hard_link(const void *params); +static void test_create_hard_link_long_name(const void *params); +static void test_create_hard_link_many(const void *params); +static void test_create_hard_link_same_loc(const void *params); +static void test_create_hard_link_invalid_params(const void *params); +static void test_create_soft_link_existing_relative(const void *params); +static void test_create_soft_link_existing_absolute(const void *params); +static void test_create_soft_link_dangling_relative(const void *params); +static void test_create_soft_link_dangling_absolute(const void *params); +static void test_create_soft_link_long_name(const void *params); +static void test_create_soft_link_many(const void *params); +static void test_create_soft_link_invalid_params(const void *params); +static void test_create_external_link(const void *params); +static void test_create_external_link_dangling(const void *params); +static void test_create_external_link_multi(const void *params); +static void test_create_external_link_ping_pong(const void *params); +static void test_create_external_link_invalid_params(const void *params); +static void test_create_user_defined_link(const void *params); +static void test_create_user_defined_link_invalid_params(const void *params); +static void test_delete_link(const void *params); +static void test_delete_link_reset_grp_max_crt_order(const void *params); +static void test_delete_link_invalid_params(const void *params); +static void test_copy_link(const void *params); +static void test_copy_links_into_group_with_links(const void *params); +static void test_copy_link_across_files(const void *params); +static void test_copy_link_invalid_params(const void *params); +static void test_move_link(const void *params); +static void test_move_links_into_group_with_links(const void *params); +static void test_move_link_across_files(const void *params); +static void test_move_link_reset_grp_max_crt_order(const void *params); +static void test_move_link_invalid_params(const void *params); +static void test_get_link_val(const void *params); +static void test_get_link_val_invalid_params(const void *params); +static void test_get_link_info(const void *params); +static void test_get_link_info_invalid_params(const void *params); +static void test_get_link_name(const void *params); +static void test_get_link_name_invalid_params(const void *params); +static void test_link_iterate_hard_links(const void *params); +static void test_link_iterate_soft_links(const void *params); +static void test_link_iterate_external_links(const void *params); +static void test_link_iterate_ud_links(const void *params); +static void test_link_iterate_mixed_links(const void *params); +static void test_link_iterate_invalid_params(const void *params); +static void test_link_iterate_0_links(const void *params); +static void test_link_visit_hard_links_no_cycles(const void *params); +static void test_link_visit_soft_links_no_cycles(const void *params); +static void test_link_visit_external_links_no_cycles(const void *params); +static void test_link_visit_ud_links_no_cycles(const void *params); +static void test_link_visit_mixed_links_no_cycles(const void *params); +static void test_link_visit_hard_links_cycles(const void *params); +static void test_link_visit_soft_links_cycles(const void *params); +static void test_link_visit_external_links_cycles(const void *params); +static void test_link_visit_ud_links_cycles(const void *params); +static void test_link_visit_mixed_links_cycles(const void *params); +static void test_link_visit_invalid_params(const void *params); +static void test_link_visit_0_links(const void *params); static herr_t link_iter_hard_links_cb(hid_t group_id, const char *name, const H5L_info2_t *info, void *op_data); @@ -106,74 +107,23 @@ static herr_t link_visit_invalid_params_cb(hid_t group_id, const char *name, con void *op_data); static herr_t link_visit_0_links_cb(hid_t group_id, const char *name, const H5L_info2_t *info, void *op_data); -/* - * The array of link tests to be performed. - */ -static int (*link_tests[])(void) = { - test_create_hard_link, - test_create_hard_link_long_name, - test_create_hard_link_many, - test_create_hard_link_same_loc, - test_create_hard_link_invalid_params, - test_create_soft_link_existing_relative, - test_create_soft_link_existing_absolute, - test_create_soft_link_dangling_relative, - test_create_soft_link_dangling_absolute, - test_create_soft_link_long_name, - test_create_soft_link_many, - test_create_soft_link_invalid_params, - test_create_external_link, - test_create_external_link_dangling, - test_create_external_link_multi, - test_create_external_link_ping_pong, - test_create_external_link_invalid_params, - test_create_user_defined_link, - test_create_user_defined_link_invalid_params, - test_delete_link, - test_delete_link_reset_grp_max_crt_order, - test_delete_link_invalid_params, - test_copy_link, - test_copy_links_into_group_with_links, - test_copy_link_across_files, - test_copy_link_invalid_params, - test_move_link, - test_move_links_into_group_with_links, - test_move_link_across_files, - test_move_link_reset_grp_max_crt_order, - test_move_link_invalid_params, - test_get_link_val, - test_get_link_val_invalid_params, - test_get_link_info, - test_get_link_info_invalid_params, - test_get_link_name, - test_get_link_name_invalid_params, - test_link_iterate_hard_links, - test_link_iterate_soft_links, - test_link_iterate_external_links, - test_link_iterate_ud_links, - test_link_iterate_mixed_links, - test_link_iterate_invalid_params, - test_link_iterate_0_links, - test_link_visit_hard_links_no_cycles, - test_link_visit_soft_links_no_cycles, - test_link_visit_external_links_no_cycles, - test_link_visit_ud_links_no_cycles, - test_link_visit_mixed_links_no_cycles, - test_link_visit_hard_links_cycles, - test_link_visit_soft_links_cycles, - test_link_visit_external_links_cycles, - test_link_visit_ud_links_cycles, - test_link_visit_mixed_links_cycles, - test_link_visit_invalid_params, - test_link_visit_0_links, -}; +static void +print_link_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Link Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that a hard link can be created * using H5Lcreate_hard. */ -static int -test_create_hard_link(void) +static void +test_create_hard_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -187,7 +137,7 @@ test_create_hard_link(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -237,7 +187,7 @@ test_create_hard_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -248,15 +198,15 @@ test_create_hard_link(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a hard link with a long name can be created * using H5Lcreate_hard. */ -static int -test_create_hard_link_long_name(void) +static void +test_create_hard_link_long_name(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -274,7 +224,7 @@ test_create_hard_link_long_name(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -302,10 +252,6 @@ test_create_hard_link_long_name(void) goto error; } - /** for DAOS VOL, max link name supported is 99 (Lexical key) */ - if (strcmp(vol_name, "daos") == 0) - name_len = 99; - /* Construct very long file name */ if ((objname = (char *)malloc((size_t)(name_len + 1))) == NULL) TEST_ERROR; @@ -346,7 +292,7 @@ test_create_hard_link_long_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -360,15 +306,15 @@ test_create_hard_link_long_name(void) if (objname) free(objname); - return 1; + return; } /* * A test to check that many hard links can be created * using H5Lcreate_hard. */ -static int -test_create_hard_link_many(void) +static void +test_create_hard_link_many(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -385,7 +331,7 @@ test_create_hard_link_many(void) SKIPPED(); printf( " API functions for basic file, group, or hard link aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -545,7 +491,7 @@ test_create_hard_link_many(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -557,15 +503,15 @@ test_create_hard_link_many(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that behavior is correct when using * the H5L_SAME_LOC macro for H5Lcreate_hard(). */ -static int -test_create_hard_link_same_loc(void) +static void +test_create_hard_link_same_loc(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -579,7 +525,7 @@ test_create_hard_link_same_loc(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -677,7 +623,7 @@ test_create_hard_link_same_loc(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -688,22 +634,22 @@ test_create_hard_link_same_loc(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a hard link can't be created when * H5Lcreate_hard is passed invalid parameters. */ -static int -test_create_hard_link_invalid_params(void) +static void +test_create_hard_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("hard link creation with invalid parameters"); @@ -713,7 +659,7 @@ test_create_hard_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -951,6 +897,12 @@ test_create_hard_link_invalid_params(void) PART_ERROR(H5Lcreate_hard_across_files); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcreate_hard_across_files); + } + PASSED(); } PART_END(H5Lcreate_hard_across_files); @@ -993,7 +945,7 @@ test_create_hard_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1002,18 +954,19 @@ test_create_hard_link_invalid_params(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* test_create_hard_link_invalid_params */ /* * A test to check that a soft link, which points to an * existing object with a relative path, can be created. */ -static int -test_create_soft_link_existing_relative(void) +static void +test_create_soft_link_existing_relative(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1028,7 +981,7 @@ test_create_soft_link_existing_relative(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1100,7 +1053,7 @@ test_create_soft_link_existing_relative(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1112,15 +1065,15 @@ test_create_soft_link_existing_relative(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft link, which points to an * existing object using an absolute path, can be created. */ -static int -test_create_soft_link_existing_absolute(void) +static void +test_create_soft_link_existing_absolute(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1134,7 +1087,7 @@ test_create_soft_link_existing_absolute(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1195,7 +1148,7 @@ test_create_soft_link_existing_absolute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1207,7 +1160,7 @@ test_create_soft_link_existing_absolute(void) } H5E_END_TRY - return 1; + return; } /* @@ -1215,8 +1168,8 @@ test_create_soft_link_existing_absolute(void) * an object that doesn't exist by using a relative * path, can be created. */ -static int -test_create_soft_link_dangling_relative(void) +static void +test_create_soft_link_dangling_relative(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1231,7 +1184,7 @@ test_create_soft_link_dangling_relative(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1316,7 +1269,7 @@ test_create_soft_link_dangling_relative(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1328,7 +1281,7 @@ test_create_soft_link_dangling_relative(void) } H5E_END_TRY - return 1; + return; } /* @@ -1336,8 +1289,8 @@ test_create_soft_link_dangling_relative(void) * object that doesn't exist by using an absolute path, * can be created. */ -static int -test_create_soft_link_dangling_absolute(void) +static void +test_create_soft_link_dangling_absolute(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1352,7 +1305,7 @@ test_create_soft_link_dangling_absolute(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1438,7 +1391,7 @@ test_create_soft_link_dangling_absolute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1450,15 +1403,15 @@ test_create_soft_link_dangling_absolute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft link with a long name can be created * using H5Lcreate_soft. */ -static int -test_create_soft_link_long_name(void) +static void +test_create_soft_link_long_name(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1476,7 +1429,7 @@ test_create_soft_link_long_name(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1504,10 +1457,6 @@ test_create_soft_link_long_name(void) goto error; } - /** for DAOS VOL, max link name supported is 99 (Lexical key) */ - if (strcmp(vol_name, "daos") == 0) - name_len = 99; - /* Construct very long file name */ if ((objname = (char *)malloc((size_t)(name_len + 1))) == NULL) TEST_ERROR; @@ -1548,7 +1497,7 @@ test_create_soft_link_long_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1562,15 +1511,15 @@ test_create_soft_link_long_name(void) if (objname) free(objname); - return 1; + return; } /* * A test to check that many soft links can be created * using H5Lcreate_soft. */ -static int -test_create_soft_link_many(void) +static void +test_create_soft_link_many(const void H5_ATTR_UNUSED *params) { htri_t link_exists = FAIL; bool valid_name_matched = false; @@ -1588,7 +1537,7 @@ test_create_soft_link_many(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1758,7 +1707,7 @@ test_create_soft_link_many(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1770,15 +1719,15 @@ test_create_soft_link_many(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft link can't be created * when H5Lcreate_soft is passed invalid parameters. */ -static int -test_create_soft_link_invalid_params(void) +static void +test_create_soft_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; @@ -1793,7 +1742,7 @@ test_create_soft_link_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or soft link aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1993,7 +1942,7 @@ test_create_soft_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2004,21 +1953,21 @@ test_create_soft_link_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an external link can be created * using H5Lcreate_external. */ -static int -test_create_external_link(void) +static void +test_create_external_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t root_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t root_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING("external link creation to existing object"); @@ -2028,7 +1977,7 @@ test_create_external_link(void) SKIPPED(); printf(" API functions for basic file, group, link, or external link aren't supported " "with this connector\n"); - return 0; + return; } snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, @@ -2097,10 +2046,12 @@ test_create_external_link(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2109,10 +2060,11 @@ test_create_external_link(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -2120,14 +2072,14 @@ test_create_external_link(void) * object that doesn't exist by using an absolute path, can * be created. */ -static int -test_create_external_link_dangling(void) +static void +test_create_external_link_dangling(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t object_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t object_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING("dangling external link creation"); @@ -2137,7 +2089,7 @@ test_create_external_link_dangling(void) SKIPPED(); printf(" API functions for basic file, group, link, or external link aren't supported " "with this connector\n"); - return 0; + return; } snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, @@ -2230,10 +2182,12 @@ test_create_external_link_dangling(void) TEST_ERROR; if (H5Fclose(ext_file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2243,26 +2197,27 @@ test_create_external_link_dangling(void) H5Gclose(container_group); H5Fclose(file_id); H5Fclose(ext_file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that an external link to an object * that crosses several files using H5Lcreate_external. */ -static int -test_create_external_link_multi(void) +static void +test_create_external_link_multi(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t group_id2 = H5I_INVALID_HID, group_id3 = H5I_INVALID_HID; - hid_t root_id = H5I_INVALID_HID; - char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH]; - char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH]; - char ext_link_filename3[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t root_id = H5I_INVALID_HID; + char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + char ext_link_filename3[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; char objname[EXTERNAL_LINK_TEST_MULTI_NAME_BUF_SIZE]; TESTING_MULTIPART("external link creation to an object across several files"); @@ -2273,7 +2228,7 @@ test_create_external_link_multi(void) SKIPPED(); printf(" API functions for basic file, group, or external link aren't supported with this " "connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -2596,7 +2551,14 @@ test_create_external_link_multi(void) } END_MULTIPART; - return 0; + if (remove_test_file(NULL, ext_link_filename1) < 0) + TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename2) < 0) + TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename3) < 0) + TEST_ERROR; + + return; error: H5E_BEGIN_TRY @@ -2607,10 +2569,13 @@ test_create_external_link_multi(void) H5Gclose(group_id3); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename1); + remove_test_file(NULL, ext_link_filename2); + remove_test_file(NULL, ext_link_filename3); } H5E_END_TRY - return 1; + return; } /* @@ -2624,15 +2589,15 @@ test_create_external_link_multi(void) * file1:/link5 -> file2: /link6 * file2:/link6 -> file1: /final */ -static int -test_create_external_link_ping_pong(void) +static void +test_create_external_link_ping_pong(const void H5_ATTR_UNUSED *params) { - hid_t file_id = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t group_id2 = H5I_INVALID_HID; - bool valid_name_matched = false; - char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH]; - char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t file_id = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t group_id2 = H5I_INVALID_HID; + bool valid_name_matched = false; + char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; char objname[EXTERNAL_LINK_TEST_MULTI_NAME_BUF_SIZE]; TESTING_MULTIPART("external link creation to an object in ping pong style"); @@ -2643,7 +2608,7 @@ test_create_external_link_ping_pong(void) SKIPPED(); printf(" API functions for basic file, group, or external link aren't supported with this " "connector\n"); - return 0; + return; } snprintf(ext_link_filename1, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, @@ -2884,7 +2849,12 @@ test_create_external_link_ping_pong(void) } END_MULTIPART; - return 0; + if (remove_test_file(NULL, ext_link_filename1) < 0) + TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename2) < 0) + TEST_ERROR; + + return; error: H5E_BEGIN_TRY @@ -2892,24 +2862,26 @@ test_create_external_link_ping_pong(void) H5Gclose(group_id); H5Gclose(group_id2); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename1); + remove_test_file(NULL, ext_link_filename2); } H5E_END_TRY - return 1; + return; } /* * A test to check that an external link can't be created * when H5Lcreate_external is passed invalid parameters. */ -static int -test_create_external_link_invalid_params(void) +static void +test_create_external_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("H5Lcreate_external with invalid parameters"); @@ -2919,7 +2891,7 @@ test_create_external_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or external link aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3170,10 +3142,12 @@ test_create_external_link_invalid_params(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3181,17 +3155,18 @@ test_create_external_link_invalid_params(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a user-defined link can be created. */ -static int -test_create_user_defined_link(void) +static void +test_create_user_defined_link(const void H5_ATTR_UNUSED *params) { ssize_t udata_size; htri_t link_exists; @@ -3208,7 +3183,7 @@ test_create_user_defined_link(void) printf( " API functions for basic file, group, link, or user-defined link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3262,7 +3237,7 @@ test_create_user_defined_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3273,15 +3248,15 @@ test_create_user_defined_link(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Lcreate_ud fails when * it is given invalid parameters. */ -static int -test_create_user_defined_link_invalid_params(void) +static void +test_create_user_defined_link_invalid_params(const void H5_ATTR_UNUSED *params) { ssize_t udata_size; htri_t link_exists; @@ -3298,7 +3273,7 @@ test_create_user_defined_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or user-defined link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3510,7 +3485,7 @@ test_create_user_defined_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3521,23 +3496,23 @@ test_create_user_defined_link_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a link can be deleted * using H5Ldelete and H5Ldelete_by_idx. */ -static int -test_delete_link(void) +static void +test_delete_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t nested_grp_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t nested_grp_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link deletion"); @@ -3549,7 +3524,7 @@ test_delete_link(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3885,6 +3860,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_external); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_external); + } + PASSED(); } PART_END(H5Ldelete_external); @@ -6091,6 +6072,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_crt_order_increasing); @@ -6379,6 +6366,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_crt_order_decreasing); @@ -6661,6 +6654,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_name_order_increasing); @@ -6943,6 +6942,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_name_order_decreasing); @@ -7043,7 +7048,7 @@ test_delete_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7054,10 +7059,11 @@ test_delete_link(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -7065,8 +7071,8 @@ test_delete_link(void) * maximum link creation order value gets reset once * all the links have been deleted from the group. */ -static int -test_delete_link_reset_grp_max_crt_order(void) +static void +test_delete_link_reset_grp_max_crt_order(const void H5_ATTR_UNUSED *params) { H5G_info_t grp_info; size_t i; @@ -7085,7 +7091,7 @@ test_delete_link_reset_grp_max_crt_order(void) SKIPPED(); printf(" API functions for basic file, group, link, or creation order " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7300,7 +7306,7 @@ test_delete_link_reset_grp_max_crt_order(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7313,11 +7319,11 @@ test_delete_link_reset_grp_max_crt_order(void) } H5E_END_TRY - return 1; + return; } -static int -test_delete_link_invalid_params(void) +static void +test_delete_link_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t link_exists; herr_t err_ret = -1; @@ -7333,7 +7339,7 @@ test_delete_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, flag by index, or hard link aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7629,7 +7635,7 @@ test_delete_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7640,20 +7646,20 @@ test_delete_link_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a link can be copied using H5Lcopy. */ -static int -test_copy_link(void) +static void +test_copy_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link copying"); @@ -7665,7 +7671,7 @@ test_copy_link(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, or external link aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8481,6 +8487,12 @@ test_copy_link(void) PART_ERROR(H5Lcopy_external_no_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_external_no_check); + } + PASSED(); } PART_END(H5Lcopy_external_no_check); @@ -8692,6 +8704,12 @@ test_copy_link(void) PART_ERROR(H5Lcopy_external_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_external_check); + } + PASSED(); } PART_END(H5Lcopy_external_check); @@ -8835,6 +8853,12 @@ test_copy_link(void) PART_ERROR(H5Lcopy_external_same_loc); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_external_same_loc); + } + PASSED(); } PART_END(H5Lcopy_external_same_loc); @@ -8896,7 +8920,7 @@ test_copy_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8907,10 +8931,11 @@ test_copy_link(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -8922,14 +8947,14 @@ test_copy_link(void) * H5Lcopy might cause a group to have two links with the same * creation order values. */ -static int -test_copy_links_into_group_with_links(void) +static void +test_copy_links_into_group_with_links(const void H5_ATTR_UNUSED *params) { TESTING("H5Lcopy adjusting creation order values for copied links"); SKIPPED(); - return 1; + return; } /* @@ -8941,8 +8966,8 @@ test_copy_links_into_group_with_links(void) * copied links retain the properties of the original * links. */ -static int -test_copy_link_across_files(void) +static void +test_copy_link_across_files(const void H5_ATTR_UNUSED *params) { TESTING("link copying across files"); @@ -8950,23 +8975,23 @@ test_copy_link_across_files(void) SKIPPED(); - return 0; + return; } /* * A test to check that a link can't be copied * when H5Lcopy is passed invalid parameters. */ -static int -test_copy_link_invalid_params(void) +static void +test_copy_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("H5Lcopy with invalid parameters"); @@ -8977,7 +9002,7 @@ test_copy_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard links aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9254,6 +9279,12 @@ test_copy_link_invalid_params(void) PART_ERROR(H5Lcopy_invalid_across_files); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_invalid_across_files); + } + PASSED(); } PART_END(H5Lcopy_invalid_across_files); @@ -9275,7 +9306,7 @@ test_copy_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9286,24 +9317,25 @@ test_copy_link_invalid_params(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a link can be moved with H5Lmove. */ -static int -test_move_link(void) +static void +test_move_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("link moving"); @@ -9315,7 +9347,7 @@ test_move_link(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, or external link aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10289,6 +10321,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_no_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_no_check); + } + PASSED(); } PART_END(H5Lmove_external_no_check); @@ -10500,6 +10538,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_check); + } + PASSED(); } PART_END(H5Lmove_external_check); @@ -10639,6 +10683,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_same_loc); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_same_loc); + } + PASSED(); } PART_END(H5Lmove_external_same_loc); @@ -10741,6 +10791,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_rename); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_rename); + } + PASSED(); } PART_END(H5Lmove_external_rename); @@ -10813,7 +10869,7 @@ test_move_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10824,10 +10880,11 @@ test_move_link(void) H5Gclose(container_group); H5Fclose(file_id); H5Fclose(ext_file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -10839,8 +10896,8 @@ test_move_link(void) * H5Lmove might cause a group to have two links with the same * creation order values. */ -static int -test_move_links_into_group_with_links(void) +static void +test_move_links_into_group_with_links(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; size_t i; @@ -10859,7 +10916,7 @@ test_move_links_into_group_with_links(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or creation order aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11000,7 +11057,7 @@ test_move_links_into_group_with_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11014,7 +11071,7 @@ test_move_links_into_group_with_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -11025,8 +11082,8 @@ test_move_links_into_group_with_links(void) * TODO: Ideally, tests should be written to verify that the * moved links retain their original properties. */ -static int -test_move_link_across_files(void) +static void +test_move_link_across_files(const void H5_ATTR_UNUSED *params) { TESTING("link moving across files"); @@ -11034,7 +11091,7 @@ test_move_link_across_files(void) SKIPPED(); - return 0; + return; } /* @@ -11042,8 +11099,8 @@ test_move_link_across_files(void) * maximum link creation order value gets reset once * all the links have been moved out of the group. */ -static int -test_move_link_reset_grp_max_crt_order(void) +static void +test_move_link_reset_grp_max_crt_order(const void H5_ATTR_UNUSED *params) { H5G_info_t grp_info; size_t i; @@ -11062,7 +11119,7 @@ test_move_link_reset_grp_max_crt_order(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or creation order aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11204,7 +11261,7 @@ test_move_link_reset_grp_max_crt_order(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11218,23 +11275,23 @@ test_move_link_reset_grp_max_crt_order(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Lmove fails when it is given * invalid parameters. */ -static int -test_move_link_invalid_params(void) +static void +test_move_link_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t link_exists; herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("H5Lmove with invalid parameters"); @@ -11244,7 +11301,7 @@ test_move_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11584,6 +11641,12 @@ test_move_link_invalid_params(void) PART_ERROR(H5Lmove_across_files); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_across_files); + } + PASSED(); } PART_END(H5Lmove_across_files); @@ -11605,7 +11668,7 @@ test_move_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11616,18 +11679,19 @@ test_move_link_invalid_params(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft or external link's value can * be retrieved by using H5Lget_val and H5Lget_val_by_idx. */ -static int -test_get_link_val(void) +static void +test_get_link_val(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; const char *ext_link_filepath; @@ -11638,9 +11702,9 @@ test_get_link_val(void) char link_val_buf[GET_LINK_VAL_TEST_LINK_VAL_BUF_SIZE]; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link value retrieval"); @@ -11651,7 +11715,7 @@ test_get_link_val(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, external link, or creation " "order aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11869,6 +11933,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_external); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_external); + } + PASSED(); } PART_END(H5Lget_val_external); @@ -12901,6 +12971,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_crt_order_increasing); @@ -13151,6 +13227,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_crt_order_decreasing); @@ -13395,6 +13477,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_name_order_increasing); @@ -13639,6 +13727,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_name_order_decreasing); @@ -13731,7 +13825,7 @@ test_get_link_val(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13742,18 +13836,19 @@ test_get_link_val(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft or external link's value can't be * retrieved when H5Lget_val(_by_idx) is passed invalid parameters. */ -static int -test_get_link_val_invalid_params(void) +static void +test_get_link_val_invalid_params(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; htri_t link_exists; @@ -13773,7 +13868,7 @@ test_get_link_val_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, external link, or creation " "order aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -14078,7 +14173,7 @@ test_get_link_val_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -14092,15 +14187,15 @@ test_get_link_val_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check the functionality of H5Lget_info2 and * H5Lget_info_by_idx2. */ -static int -test_get_link_info(void) +static void +test_get_link_info(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; const char *ext_objname = "/"; @@ -14108,9 +14203,9 @@ test_get_link_info(void) size_t link_val_size; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link info retrieval"); @@ -14122,7 +14217,7 @@ test_get_link_info(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, hard link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -14401,6 +14496,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_external); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_external); + } + PASSED(); } PART_END(H5Lget_info_external); @@ -16071,6 +16172,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_crt_order_increasing); @@ -16275,6 +16382,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_crt_order_decreasing); @@ -16479,6 +16592,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_name_order_increasing); @@ -16683,6 +16802,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_name_order_decreasing); @@ -16775,7 +16900,7 @@ test_get_link_info(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -16786,18 +16911,19 @@ test_get_link_info(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a link's info can't be retrieved * when H5Lget_info(_by_idx)2 is passed invalid parameters. */ -static int -test_get_link_info_invalid_params(void) +static void +test_get_link_info_invalid_params(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; herr_t err_ret = -1; @@ -16815,7 +16941,7 @@ test_get_link_info_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -17109,7 +17235,7 @@ test_get_link_info_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -17121,15 +17247,15 @@ test_get_link_info_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a link's name can be correctly * retrieved by using H5Lget_name_by_idx. */ -static int -test_get_link_name(void) +static void +test_get_link_name(const void H5_ATTR_UNUSED *params) { ssize_t link_name_buf_size = 0; htri_t link_exists; @@ -17138,7 +17264,7 @@ test_get_link_name(void) hid_t subgroup_id = H5I_INVALID_HID; hid_t gcpl_id = H5I_INVALID_HID; char link_name_buf[GET_LINK_NAME_TEST_BUF_SIZE]; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link name retrieval"); @@ -17150,7 +17276,7 @@ test_get_link_name(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, hard link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -18688,6 +18814,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_crt_order_increasing); @@ -18877,6 +19009,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_crt_order_decreasing); @@ -19060,6 +19198,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_name_order_increasing); @@ -19243,6 +19387,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_name_order_decreasing); @@ -19343,7 +19493,7 @@ test_get_link_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -19354,18 +19504,19 @@ test_get_link_name(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a link's name can't be retrieved * when H5Lget_name_by_idx is passed invalid parameters. */ -static int -test_get_link_name_invalid_params(void) +static void +test_get_link_name_invalid_params(const void H5_ATTR_UNUSED *params) { ssize_t ret; htri_t link_exists; @@ -19385,7 +19536,7 @@ test_get_link_name_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, hard link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -19607,7 +19758,7 @@ test_get_link_name_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -19620,7 +19771,7 @@ test_get_link_name_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -19630,8 +19781,8 @@ test_get_link_name_invalid_params(void) * increasing and decreasing order of both link * name and link creation order. */ -static int -test_link_iterate_hard_links(void) +static void +test_link_iterate_hard_links(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -19651,7 +19802,7 @@ test_link_iterate_hard_links(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, or iterate aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -19986,7 +20137,7 @@ test_link_iterate_hard_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -20001,7 +20152,7 @@ test_link_iterate_hard_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -20011,8 +20162,8 @@ test_link_iterate_hard_links(void) * increasing and decreasing order of both link * name and link creation order. */ -static int -test_link_iterate_soft_links(void) +static void +test_link_iterate_soft_links(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -20029,7 +20180,7 @@ test_link_iterate_soft_links(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -20342,7 +20493,7 @@ test_link_iterate_soft_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -20354,7 +20505,7 @@ test_link_iterate_soft_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -20364,15 +20515,15 @@ test_link_iterate_soft_links(void) * increasing and decreasing order of both link * name and link creation order. */ -static int -test_link_iterate_external_links(void) +static void +test_link_iterate_external_links(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link iteration (only external links)"); @@ -20383,7 +20534,7 @@ test_link_iterate_external_links(void) SKIPPED(); printf(" API functions for basic file, group, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -20738,10 +20889,12 @@ test_link_iterate_external_links(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -20750,10 +20903,11 @@ test_link_iterate_external_links(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -20766,14 +20920,14 @@ test_link_iterate_external_links(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_iterate_ud_links(void) +static void +test_link_iterate_ud_links(const void H5_ATTR_UNUSED *params) { TESTING("link iteration (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -20790,8 +20944,8 @@ test_link_iterate_ud_links(void) * * TODO refactor link saving portion into its own test */ -static int -test_link_iterate_mixed_links(void) +static void +test_link_iterate_mixed_links(const void H5_ATTR_UNUSED *params) { hsize_t saved_idx; size_t i; @@ -20803,7 +20957,7 @@ test_link_iterate_mixed_links(void) hid_t dset_dtype = H5I_INVALID_HID; hid_t dset_dspace = H5I_INVALID_HID; int halted; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link iteration (mixed link types)"); @@ -20814,7 +20968,7 @@ test_link_iterate_mixed_links(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -21300,10 +21454,12 @@ test_link_iterate_mixed_links(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -21315,29 +21471,30 @@ test_link_iterate_mixed_links(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Literate(_by_name)2 fails * when given invalid parameters. */ -static int -test_link_iterate_invalid_params(void) +static void +test_link_iterate_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; size_t i; htri_t link_exists; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID; - hid_t dset_dspace = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID; + hid_t dset_dspace = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link iteration with invalid parameters"); @@ -21349,7 +21506,7 @@ test_link_iterate_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, soft link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -21711,10 +21868,12 @@ test_link_iterate_invalid_params(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -21725,18 +21884,19 @@ test_link_iterate_invalid_params(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that link iteration performed on a * group with no links in it is not problematic. */ -static int -test_link_iterate_0_links(void) +static void +test_link_iterate_0_links(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -21750,7 +21910,7 @@ test_link_iterate_0_links(void) SKIPPED(); printf(" API functions for basic file, group, or iterate aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -21954,7 +22114,7 @@ test_link_iterate_0_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -21966,7 +22126,7 @@ test_link_iterate_0_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -21977,8 +22137,8 @@ test_link_iterate_0_links(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_hard_links_no_cycles(void) +static void +test_link_visit_hard_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -21998,7 +22158,7 @@ test_link_visit_hard_links_no_cycles(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or link iterate aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -22350,7 +22510,7 @@ test_link_visit_hard_links_no_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -22366,7 +22526,7 @@ test_link_visit_hard_links_no_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -22377,8 +22537,8 @@ test_link_visit_hard_links_no_cycles(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_soft_links_no_cycles(void) +static void +test_link_visit_soft_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -22396,7 +22556,7 @@ test_link_visit_soft_links_no_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -22733,7 +22893,7 @@ test_link_visit_soft_links_no_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -22746,7 +22906,7 @@ test_link_visit_soft_links_no_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -22757,16 +22917,16 @@ test_link_visit_soft_links_no_cycles(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_external_links_no_cycles(void) +static void +test_link_visit_external_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting without cycles (only external links)"); @@ -22777,7 +22937,7 @@ test_link_visit_external_links_no_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -23125,10 +23285,12 @@ test_link_visit_external_links_no_cycles(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -23138,10 +23300,11 @@ test_link_visit_external_links_no_cycles(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -23155,14 +23318,14 @@ test_link_visit_external_links_no_cycles(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_visit_ud_links_no_cycles(void) +static void +test_link_visit_ud_links_no_cycles(const void H5_ATTR_UNUSED *params) { TESTING("link visiting without cycles (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -23180,19 +23343,19 @@ test_link_visit_ud_links_no_cycles(void) * * TODO refactor test to create a macroed number of subgroups */ -static int -test_link_visit_mixed_links_no_cycles(void) +static void +test_link_visit_mixed_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t subgroup1 = H5I_INVALID_HID, subgroup2 = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t gcpl_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting without cycles (mixed link types)"); @@ -23206,7 +23369,7 @@ test_link_visit_mixed_links_no_cycles(void) printf( " API functions for basic file, group, link, hard link, soft link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -23635,10 +23798,12 @@ test_link_visit_mixed_links_no_cycles(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -23652,10 +23817,11 @@ test_link_visit_mixed_links_no_cycles(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -23665,8 +23831,8 @@ test_link_visit_mixed_links_no_cycles(void) * Iteration is done in increasing and decreasing * order of both link name and link creation order. */ -static int -test_link_visit_hard_links_cycles(void) +static void +test_link_visit_hard_links_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -23684,7 +23850,7 @@ test_link_visit_hard_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -24015,7 +24181,7 @@ test_link_visit_hard_links_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -24028,7 +24194,7 @@ test_link_visit_hard_links_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -24038,8 +24204,8 @@ test_link_visit_hard_links_cycles(void) * Iteration is done in increasing and decreasing * order of both link name and link creation order. */ -static int -test_link_visit_soft_links_cycles(void) +static void +test_link_visit_soft_links_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -24057,7 +24223,7 @@ test_link_visit_soft_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -24394,7 +24560,7 @@ test_link_visit_soft_links_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -24407,7 +24573,7 @@ test_link_visit_soft_links_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -24418,8 +24584,8 @@ test_link_visit_soft_links_cycles(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_external_links_cycles(void) +static void +test_link_visit_external_links_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -24437,7 +24603,7 @@ test_link_visit_external_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -24779,7 +24945,7 @@ test_link_visit_external_links_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -24792,7 +24958,7 @@ test_link_visit_external_links_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -24806,14 +24972,14 @@ test_link_visit_external_links_cycles(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_visit_ud_links_cycles(void) +static void +test_link_visit_ud_links_cycles(const void H5_ATTR_UNUSED *params) { TESTING("link visiting with cycles (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -24826,16 +24992,16 @@ test_link_visit_ud_links_cycles(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_visit_mixed_links_cycles(void) +static void +test_link_visit_mixed_links_cycles(const void H5_ATTR_UNUSED *params) { htri_t link_exists; size_t i; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t subgroup1 = H5I_INVALID_HID, subgroup2 = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting with cycles (mixed link types)"); @@ -24847,7 +25013,7 @@ test_link_visit_mixed_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, external link, iterate, " "or user defined link aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -25239,10 +25405,12 @@ test_link_visit_mixed_links_cycles(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -25253,28 +25421,29 @@ test_link_visit_mixed_links_cycles(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Lvisit(_by_name)2 fails when * it is given invalid parameters. */ -static int -test_link_visit_invalid_params(void) +static void +test_link_visit_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t subgroup1 = H5I_INVALID_HID, subgroup2 = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t dset_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting with invalid parameters"); @@ -25285,7 +25454,7 @@ test_link_visit_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -25699,10 +25868,12 @@ test_link_visit_invalid_params(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -25715,10 +25886,11 @@ test_link_visit_invalid_params(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -25726,8 +25898,8 @@ test_link_visit_invalid_params(void) * performed on a group with no links in it is * not problematic. */ -static int -test_link_visit_0_links(void) +static void +test_link_visit_0_links(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -25741,7 +25913,7 @@ test_link_visit_0_links(void) SKIPPED(); printf(" API functions for basic file, group, or link iterate aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -25940,7 +26112,7 @@ test_link_visit_0_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -25952,7 +26124,7 @@ test_link_visit_0_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -27264,36 +27436,116 @@ link_visit_0_links_cb(hid_t group_id, const char *name, const H5L_info2_t *info, return 0; } -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) +void +H5_api_link_test_add(void) { - remove_test_file(test_path_prefix, EXTERNAL_LINK_TEST_FILE_NAME); - remove_test_file(test_path_prefix, EXTERNAL_LINK_INVALID_PARAMS_TEST_FILE_NAME); -} - -int -H5_api_link_test(void) -{ - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Link Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(link_tests); i++) { - nerrors += (*link_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_link_test_header", print_link_test_header, NULL, NULL, NULL, 0, + "Prints header for link tests"); + + AddTest("test_create_hard_link", test_create_hard_link, NULL, NULL, NULL, 0, "hard link creation"); + AddTest("test_create_hard_link_long_name", test_create_hard_link_long_name, NULL, NULL, NULL, 0, + "hard link creation with a long name"); + AddTest("test_create_hard_link_many", test_create_hard_link_many, NULL, NULL, NULL, 0, + "hard link creation of many links"); + AddTest("test_create_hard_link_same_loc", test_create_hard_link_same_loc, NULL, NULL, NULL, 0, + "hard link creation with H5L_SAME_LOC"); + AddTest("test_create_hard_link_invalid_params", test_create_hard_link_invalid_params, NULL, NULL, NULL, 0, + "hard link creation with invalid parameters"); + AddTest("test_create_soft_link_existing_relative", test_create_soft_link_existing_relative, NULL, NULL, + NULL, 0, "soft link creation to existing object by relative path"); + AddTest("test_create_soft_link_existing_absolute", test_create_soft_link_existing_absolute, NULL, NULL, + NULL, 0, "soft link creation to existing object by absolute path"); + AddTest("test_create_soft_link_dangling_relative", test_create_soft_link_dangling_relative, NULL, NULL, + NULL, 0, "dangling soft link creation to object by relative path"); + AddTest("test_create_soft_link_dangling_absolute", test_create_soft_link_dangling_absolute, NULL, NULL, + NULL, 0, "dangling soft link creation to object by absolute path"); + AddTest("test_create_soft_link_long_name", test_create_soft_link_long_name, NULL, NULL, NULL, 0, + "soft link creation with a long name"); + AddTest("test_create_soft_link_many", test_create_soft_link_many, NULL, NULL, NULL, 0, + "soft link creation of many links"); + AddTest("test_create_soft_link_invalid_params", test_create_soft_link_invalid_params, NULL, NULL, NULL, 0, + "soft link creation with invalid parameters"); + AddTest("test_create_external_link", test_create_external_link, NULL, NULL, NULL, 0, + "external link creation to existing object"); + AddTest("test_create_external_link_dangling", test_create_external_link_dangling, NULL, NULL, NULL, 0, + "dangling external link creation"); + AddTest("test_create_external_link_multi", test_create_external_link_multi, NULL, NULL, NULL, 0, + "external link creation to an object across several files"); + AddTest("test_create_external_link_ping_pong", test_create_external_link_ping_pong, NULL, NULL, NULL, 0, + "external link creation to an object in ping pong style"); + AddTest("test_create_external_link_invalid_params", test_create_external_link_invalid_params, NULL, NULL, + NULL, 0, "H5Lcreate_external with invalid parameters"); + AddTest("test_create_user_defined_link", test_create_user_defined_link, NULL, NULL, NULL, 0, + "user-defined link creation"); + AddTest("test_create_user_defined_link_invalid_params", test_create_user_defined_link_invalid_params, + NULL, NULL, NULL, 0, "H5Lcreate_ud with invalid parameters"); + AddTest("test_delete_link", test_delete_link, NULL, NULL, NULL, 0, "link deletion"); + AddTest("test_delete_link_reset_grp_max_crt_order", test_delete_link_reset_grp_max_crt_order, NULL, NULL, + NULL, 0, "H5Ldelete of all links in group resets group's maximum link creation order value"); + AddTest("test_delete_link_invalid_params", test_delete_link_invalid_params, NULL, NULL, NULL, 0, + "H5Ldelete with invalid parameters"); + AddTest("test_copy_link", test_copy_link, NULL, NULL, NULL, 0, "link copying"); + AddTest("test_copy_links_into_group_with_links", test_copy_links_into_group_with_links, NULL, NULL, NULL, + 0, "H5Lcopy adjusting creation order values for copied links"); + AddTest("test_copy_link_across_files", test_copy_link_across_files, NULL, NULL, NULL, 0, + "link copying across files"); + AddTest("test_copy_link_invalid_params", test_copy_link_invalid_params, NULL, NULL, NULL, 0, + "H5Lcopy with invalid parameters"); + AddTest("test_move_link", test_move_link, NULL, NULL, NULL, 0, "link moving"); + AddTest("test_move_links_into_group_with_links", test_move_links_into_group_with_links, NULL, NULL, NULL, + 0, "H5Lmove adjusting creation order values for moved links"); + AddTest("test_move_link_across_files", test_move_link_across_files, NULL, NULL, NULL, 0, + "link moving across files"); + AddTest("test_move_link_reset_grp_max_crt_order", test_move_link_reset_grp_max_crt_order, NULL, NULL, + NULL, 0, "H5Lmove of all links out of group resets group's maximum link creation order value"); + AddTest("test_move_link_invalid_params", test_move_link_invalid_params, NULL, NULL, NULL, 0, + "H5Lmove with invalid parameters"); + AddTest("test_get_link_val", test_get_link_val, NULL, NULL, NULL, 0, "link value retrieval"); + AddTest("test_get_link_val_invalid_params", test_get_link_val_invalid_params, NULL, NULL, NULL, 0, + "link value retrieval with invalid parameters"); + AddTest("test_get_link_info", test_get_link_info, NULL, NULL, NULL, 0, "link info retrieval"); + AddTest("test_get_link_info_invalid_params", test_get_link_info_invalid_params, NULL, NULL, NULL, 0, + "link info retrieval with invalid parameters"); + AddTest("test_get_link_name", test_get_link_name, NULL, NULL, NULL, 0, "link name retrieval"); + AddTest("test_get_link_name_invalid_params", test_get_link_name_invalid_params, NULL, NULL, NULL, 0, + "link name retrieval with invalid parameters"); + AddTest("test_link_iterate_hard_links", test_link_iterate_hard_links, NULL, NULL, NULL, 0, + "link iteration (only hard links)"); + AddTest("test_link_iterate_soft_links", test_link_iterate_soft_links, NULL, NULL, NULL, 0, + "link iteration (only soft links)"); + AddTest("test_link_iterate_external_links", test_link_iterate_external_links, NULL, NULL, NULL, 0, + "link iteration (only external links)"); + AddTest("test_link_iterate_ud_links", test_link_iterate_ud_links, NULL, NULL, NULL, 0, + "link iteration (only user-defined links)"); + AddTest("test_link_iterate_mixed_links", test_link_iterate_mixed_links, NULL, NULL, NULL, 0, + "link iteration (mixed link types)"); + AddTest("test_link_iterate_invalid_params", test_link_iterate_invalid_params, NULL, NULL, NULL, 0, + "link iteration with invalid parameters"); + AddTest("test_link_iterate_0_links", test_link_iterate_0_links, NULL, NULL, NULL, 0, + "link iteration on group with 0 links"); + AddTest("test_link_visit_hard_links_no_cycles", test_link_visit_hard_links_no_cycles, NULL, NULL, NULL, 0, + "link visiting without cycles (only hard links)"); + AddTest("test_link_visit_soft_links_no_cycles", test_link_visit_soft_links_no_cycles, NULL, NULL, NULL, 0, + "link visiting without cycles (only soft links)"); + AddTest("test_link_visit_external_links_no_cycles", test_link_visit_external_links_no_cycles, NULL, NULL, + NULL, 0, "link visiting without cycles (only external links)"); + AddTest("test_link_visit_ud_links_no_cycles", test_link_visit_ud_links_no_cycles, NULL, NULL, NULL, 0, + "link visiting without cycles (only user-defined links)"); + AddTest("test_link_visit_mixed_links_no_cycles", test_link_visit_mixed_links_no_cycles, NULL, NULL, NULL, + 0, "link visiting without cycles (mixed link types)"); + AddTest("test_link_visit_hard_links_cycles", test_link_visit_hard_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (only hard links)"); + AddTest("test_link_visit_soft_links_cycles", test_link_visit_soft_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (only soft links)"); + AddTest("test_link_visit_external_links_cycles", test_link_visit_external_links_cycles, NULL, NULL, NULL, + 0, "link visiting with cycles (only external links)"); + AddTest("test_link_visit_ud_links_cycles", test_link_visit_ud_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (only user-defined links)"); + AddTest("test_link_visit_mixed_links_cycles", test_link_visit_mixed_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (mixed link types)"); + AddTest("test_link_visit_invalid_params", test_link_visit_invalid_params, NULL, NULL, NULL, 0, + "link visiting with invalid parameters"); + AddTest("test_link_visit_0_links", test_link_visit_0_links, NULL, NULL, NULL, 0, + "link visiting on group with subgroups containing 0 links"); } diff --git a/test/API/H5_api_link_test.h b/test/API/H5_api_link_test.h index d7d69154939..17b06e850dc 100644 --- a/test/API/H5_api_link_test.h +++ b/test/API/H5_api_link_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_link_test(void); +void H5_api_link_test_add(void); /********************************************* * * @@ -79,7 +79,6 @@ int H5_api_link_test(void); #define EXTERNAL_LINK_TEST_MULTI_NAME_BUF_SIZE 1024 #define EXTERNAL_LINK_TEST_FILE_NAME2 "ext_link_file_2.h5" #define EXTERNAL_LINK_TEST_FILE_NAME3 "ext_link_file_3.h5" -#define EXTERNAL_LINK_TEST_FILE_NAME4 "ext_link_file_4.h5" #define EXTERNAL_LINK_TEST_PING_PONG_NAME1 "ext_link_file_ping_pong_1.h5" #define EXTERNAL_LINK_TEST_PING_PONG_NAME2 "ext_link_file_ping_pong_2.h5" diff --git a/test/API/H5_api_misc_test.c b/test/API/H5_api_misc_test.c index d747f882750..14611a001eb 100644 --- a/test/API/H5_api_misc_test.c +++ b/test/API/H5_api_misc_test.c @@ -12,24 +12,27 @@ #include "H5_api_misc_test.h" -static int test_open_link_without_leading_slash(void); -static int test_object_creation_by_absolute_path(void); -static int test_absolute_vs_relative_path(void); -static int test_dot_for_object_name(void); -static int test_symbols_in_compound_field_name(void); -static int test_double_init_term(void); +static void print_misc_test_header(const void *params); +static void test_open_link_without_leading_slash(const void *params); +static void test_object_creation_by_absolute_path(const void *params); +static void test_absolute_vs_relative_path(const void *params); +static void test_dot_for_object_name(const void *params); +static void test_symbols_in_compound_field_name(const void *params); +static void test_double_init_term(const void *params); + +static void +print_misc_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Miscellaneous Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} -/* - * The array of miscellaneous tests to be performed. - */ -static int (*misc_tests[])(void) = { - test_open_link_without_leading_slash, test_object_creation_by_absolute_path, - test_absolute_vs_relative_path, test_dot_for_object_name, - test_symbols_in_compound_field_name, test_double_init_term, -}; - -static int -test_open_link_without_leading_slash(void) +static void +test_open_link_without_leading_slash(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -45,7 +48,7 @@ test_open_link_without_leading_slash(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -113,7 +116,7 @@ test_open_link_without_leading_slash(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -127,11 +130,11 @@ test_open_link_without_leading_slash(void) } H5E_END_TRY - return 1; + return; } -static int -test_object_creation_by_absolute_path(void) +static void +test_object_creation_by_absolute_path(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -150,7 +153,7 @@ test_object_creation_by_absolute_path(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -345,7 +348,7 @@ test_object_creation_by_absolute_path(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -361,12 +364,12 @@ test_object_creation_by_absolute_path(void) } H5E_END_TRY - return 1; + return; } /* XXX: Add testing for groups */ -static int -test_absolute_vs_relative_path(void) +static void +test_absolute_vs_relative_path(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -385,7 +388,7 @@ test_absolute_vs_relative_path(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -680,7 +683,7 @@ test_absolute_vs_relative_path(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -704,14 +707,14 @@ test_absolute_vs_relative_path(void) } H5E_END_TRY - return 1; + return; } /* * A test to check creating/opening objects with the "." as the name */ -static int -test_dot_for_object_name(void) +static void +test_dot_for_object_name(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, subgroup_id = H5I_INVALID_HID; @@ -730,7 +733,7 @@ test_dot_for_object_name(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or stored datatype aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -855,7 +858,7 @@ test_dot_for_object_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -871,7 +874,7 @@ test_dot_for_object_name(void) } H5E_END_TRY - return 1; + return; } /* @@ -882,23 +885,23 @@ test_dot_for_object_name(void) * TODO: Not sure if this test can be done from public APIs * at the moment. */ -static int -test_double_init_term(void) +static void +test_double_init_term(const void H5_ATTR_UNUSED *params) { TESTING("double init/term correctness"); SKIPPED(); - return 0; + return; #if 0 error: - return 1; + return; #endif } -static int -test_symbols_in_compound_field_name(void) +static void +test_symbols_in_compound_field_name(const void H5_ATTR_UNUSED *params) { size_t i; size_t total_type_size; @@ -918,7 +921,7 @@ test_symbols_in_compound_field_name(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } for (i = 0; i < COMPOUND_WITH_SYMBOLS_IN_MEMBER_NAMES_TEST_NUM_SUBTYPES; i++) @@ -1017,7 +1020,7 @@ test_symbols_in_compound_field_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1033,26 +1036,26 @@ test_symbols_in_compound_field_name(void) } H5E_END_TRY - return 1; + return; } -int -H5_api_misc_test(void) +void +H5_api_misc_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Miscellaneous Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(misc_tests); i++) { - nerrors += (*misc_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_misc_test_header", print_misc_test_header, NULL, NULL, NULL, 0, + "Prints header for miscellaneous tests"); + + AddTest("test_open_link_without_leading_slash", test_open_link_without_leading_slash, NULL, NULL, NULL, 0, + "opening a link without a leading slash"); + AddTest("test_object_creation_by_absolute_path", test_object_creation_by_absolute_path, NULL, NULL, NULL, + 0, "object creation by absolute path"); + AddTest("test_absolute_vs_relative_path", test_absolute_vs_relative_path, NULL, NULL, NULL, 0, + "absolute vs. relative pathnames"); + AddTest("test_dot_for_object_name", test_dot_for_object_name, NULL, NULL, NULL, 0, + "creating objects with \".\" as the name"); + AddTest("test_symbols_in_compound_field_name", test_symbols_in_compound_field_name, NULL, NULL, NULL, 0, + "usage of '{', '}' and '\\\"' symbols in compound field name"); + AddTest("test_double_init_term", test_double_init_term, NULL, NULL, NULL, 0, + "double init/term correctness"); } diff --git a/test/API/H5_api_misc_test.h b/test/API/H5_api_misc_test.h index 13c82ed60ca..f9203e24556 100644 --- a/test/API/H5_api_misc_test.h +++ b/test/API/H5_api_misc_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_misc_test(void); +void H5_api_misc_test_add(void); /****************************************************** * * diff --git a/test/API/H5_api_object_test.c b/test/API/H5_api_object_test.c index 063ddf6a530..85714f2ed1f 100644 --- a/test/API/H5_api_object_test.c +++ b/test/API/H5_api_object_test.c @@ -12,36 +12,37 @@ #include "H5_api_object_test.h" -static int test_open_object(void); -static int test_open_object_invalid_params(void); -static int test_object_exists(void); -static int test_object_exists_invalid_params(void); -static int test_get_object_info(void); -static int test_get_object_info_invalid_params(void); -static int test_link_object(void); -static int test_link_object_invalid_params(void); -static int test_incr_decr_object_refcount(void); -static int test_incr_decr_object_refcount_invalid_params(void); -static int test_object_copy_basic(void); -static int test_object_copy_already_existing(void); -static int test_object_copy_shallow_group_copy(void); -static int test_object_copy_no_attributes(void); -static int test_object_copy_by_soft_link(void); -static int test_object_copy_group_with_soft_links(void); -static int test_object_copy_between_files(void); -static int test_object_copy_invalid_params(void); -static int test_object_comments(void); -static int test_object_comments_invalid_params(void); -static int test_object_visit(void); -static int test_object_visit_soft_link(void); -static int test_object_visit_invalid_params(void); -static int test_close_object(void); -static int test_close_object_invalid_params(void); -static int test_close_invalid_objects(void); -static int test_flush_object(void); -static int test_flush_object_invalid_params(void); -static int test_refresh_object(void); -static int test_refresh_object_invalid_params(void); +static void print_object_test_header(const void *params); +static void test_open_object(const void *params); +static void test_open_object_invalid_params(const void *params); +static void test_object_exists(const void *params); +static void test_object_exists_invalid_params(const void *params); +static void test_get_object_info(const void *params); +static void test_get_object_info_invalid_params(const void *params); +static void test_link_object(const void *params); +static void test_link_object_invalid_params(const void *params); +static void test_incr_decr_object_refcount(const void *params); +static void test_incr_decr_object_refcount_invalid_params(const void *params); +static void test_object_copy_basic(const void *params); +static void test_object_copy_already_existing(const void *params); +static void test_object_copy_shallow_group_copy(const void *params); +static void test_object_copy_no_attributes(const void *params); +static void test_object_copy_by_soft_link(const void *params); +static void test_object_copy_group_with_soft_links(const void *params); +static void test_object_copy_between_files(const void *params); +static void test_object_copy_invalid_params(const void *params); +static void test_object_comments(const void *params); +static void test_object_comments_invalid_params(const void *params); +static void test_object_visit(const void *params); +static void test_object_visit_soft_link(const void *params); +static void test_object_visit_invalid_params(const void *params); +static void test_close_object(const void *params); +static void test_close_object_invalid_params(const void *params); +static void test_close_invalid_objects(const void *params); +static void test_flush_object(const void *params); +static void test_flush_object_invalid_params(const void *params); +static void test_refresh_object(const void *params); +static void test_refresh_object_invalid_params(const void *params); static herr_t object_copy_attribute_iter_callback(hid_t location_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data); @@ -62,41 +63,16 @@ static herr_t object_visit_soft_link_callback(hid_t o_id, const char *name, cons static herr_t object_visit_noop_callback(hid_t o_id, const char *name, const H5O_info2_t *object_info, void *op_data); -/* - * The array of object tests to be performed. - */ -static int (*object_tests[])(void) = { - test_open_object, - test_open_object_invalid_params, - test_object_exists, - test_object_exists_invalid_params, - test_get_object_info, - test_get_object_info_invalid_params, - test_link_object, - test_link_object_invalid_params, - test_incr_decr_object_refcount, - test_incr_decr_object_refcount_invalid_params, - test_object_copy_basic, - test_object_copy_already_existing, - test_object_copy_shallow_group_copy, - test_object_copy_no_attributes, - test_object_copy_by_soft_link, - test_object_copy_group_with_soft_links, - test_object_copy_between_files, - test_object_copy_invalid_params, - test_object_comments, - test_object_comments_invalid_params, - test_object_visit, - test_object_visit_soft_link, - test_object_visit_invalid_params, - test_close_object, - test_close_object_invalid_params, - test_close_invalid_objects, - test_flush_object, - test_flush_object_invalid_params, - test_refresh_object, - test_refresh_object_invalid_params, -}; +static void +print_object_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Object Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that various objects (group, dataset, datatype) @@ -108,8 +84,8 @@ static int (*object_tests[])(void) = { * * XXX: test opening through dangling and resolving soft links. */ -static int -test_open_object(void) +static void +test_open_object(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -130,7 +106,7 @@ test_open_object(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -398,7 +374,7 @@ test_open_object(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -414,7 +390,7 @@ test_open_object(void) } H5E_END_TRY - return 1; + return; } /* @@ -422,8 +398,8 @@ test_open_object(void) * can't be opened when H5Oopen, H5Oopen_by_idx and H5Oopen_by_addr * are passed invalid parameters. */ -static int -test_open_object_invalid_params(void) +static void +test_open_object_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -438,7 +414,7 @@ test_open_object_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -773,7 +749,7 @@ test_open_object_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -786,14 +762,14 @@ test_open_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oexists_by_name. */ -static int -test_object_exists(void) +static void +test_object_exists(const void H5_ATTR_UNUSED *params) { htri_t object_exists; hid_t file_id = H5I_INVALID_HID; @@ -814,7 +790,7 @@ test_object_exists(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, stored datatype or soft link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1035,7 +1011,7 @@ test_object_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1051,15 +1027,15 @@ test_object_exists(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Oexists_by_name fails * when it is passed invalid parameters. */ -static int -test_object_exists_invalid_params(void) +static void +test_object_exists_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t object_exists; hid_t file_id = H5I_INVALID_HID; @@ -1073,7 +1049,7 @@ test_object_exists_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1199,7 +1175,7 @@ test_object_exists_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1211,20 +1187,20 @@ test_object_exists_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oget_info(_by_name/_by_idx). */ -static int -test_get_object_info(void) +static void +test_get_object_info(const void H5_ATTR_UNUSED *params) { TESTING("object info retrieval"); SKIPPED(); - return 0; + return; } /* @@ -1232,21 +1208,21 @@ test_get_object_info(void) * when H5Oget_info(_by_name/_by_idx) are passed invalid * parameters. */ -static int -test_get_object_info_invalid_params(void) +static void +test_get_object_info_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("object info retrieval with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Olink. */ -static int -test_link_object(void) +static void +test_link_object(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1265,7 +1241,7 @@ test_link_object(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1380,7 +1356,7 @@ test_link_object(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1396,7 +1372,7 @@ test_link_object(void) } H5E_END_TRY - return 1; + return; } /* @@ -1404,8 +1380,8 @@ test_link_object(void) * the file structure when H5Olink is passed invalid * parameters. */ -static int -test_link_object_invalid_params(void) +static void +test_link_object_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1419,7 +1395,7 @@ test_link_object_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1584,7 +1560,7 @@ test_link_object_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1596,14 +1572,14 @@ test_link_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oincr_refcount/H5Odecr_refcount. */ -static int -test_incr_decr_object_refcount(void) +static void +test_incr_decr_object_refcount(const void H5_ATTR_UNUSED *params) { H5O_info2_t oinfo; /* Object info struct */ hid_t file_id = H5I_INVALID_HID; @@ -1623,7 +1599,7 @@ test_incr_decr_object_refcount(void) SKIPPED(); printf(" API functions for basic file, group, dataset, stored datatype, or object " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1879,7 +1855,7 @@ test_incr_decr_object_refcount(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1894,15 +1870,15 @@ test_incr_decr_object_refcount(void) } H5E_END_TRY - return 1; + return; } /* test_incr_decr_object_refcount */ /* * A test to check that H5Oincr_refcount/H5Odecr_refcount * fail when passed invalid parameters. */ -static int -test_incr_decr_object_refcount_invalid_params(void) +static void +test_incr_decr_object_refcount_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t status; @@ -1912,7 +1888,7 @@ test_incr_decr_object_refcount_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE)) { SKIPPED(); printf(" API functions for more object aren't supported with this connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -1959,17 +1935,17 @@ test_incr_decr_object_refcount_invalid_params(void) } END_MULTIPART; - return 0; + return; error: - return 1; + return; } /* * Basic tests for H5Ocopy. */ -static int -test_object_copy_basic(void) +static void +test_object_copy_basic(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; H5G_info_t group_info; @@ -2000,7 +1976,7 @@ test_object_copy_basic(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, iterate, or " "stored datatype aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2517,7 +2493,7 @@ test_object_copy_basic(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2538,15 +2514,15 @@ test_object_copy_basic(void) } H5E_END_TRY - return 1; + return; } /* * Tests to ensure that H5Ocopy fails when attempting to copy * an object to a destination where the object already exists. */ -static int -test_object_copy_already_existing(void) +static void +test_object_copy_already_existing(const void H5_ATTR_UNUSED *params) { herr_t err_ret; hid_t file_id = H5I_INVALID_HID; @@ -2568,7 +2544,7 @@ test_object_copy_already_existing(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2720,7 +2696,7 @@ test_object_copy_already_existing(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2736,15 +2712,15 @@ test_object_copy_already_existing(void) } H5E_END_TRY - return 1; + return; } /* * A test to exercise the H5O_COPY_SHALLOW_HIERARCHY_FLAG flag * for H5Ocopy. */ -static int -test_object_copy_shallow_group_copy(void) +static void +test_object_copy_shallow_group_copy(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; htri_t object_link_exists; @@ -2765,7 +2741,7 @@ test_object_copy_shallow_group_copy(void) SKIPPED(); printf(" API functions for basic file, group, object, or link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2949,7 +2925,7 @@ test_object_copy_shallow_group_copy(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2963,15 +2939,15 @@ test_object_copy_shallow_group_copy(void) } H5E_END_TRY - return 1; + return; } /* * Tests to exercise the H5O_COPY_WITHOUT_ATTR_FLAG flag * of H5Ocopy. */ -static int -test_object_copy_no_attributes(void) +static void +test_object_copy_no_attributes(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; htri_t object_link_exists; @@ -3002,7 +2978,7 @@ test_object_copy_no_attributes(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, or stored " "datatype aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3454,7 +3430,7 @@ test_object_copy_no_attributes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3476,15 +3452,15 @@ test_object_copy_no_attributes(void) } H5E_END_TRY - return 1; + return; } /* * Tests to exercise the behavior of H5Ocopy when the source * object specified is a soft link or dangling soft link. */ -static int -test_object_copy_by_soft_link(void) +static void +test_object_copy_by_soft_link(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; H5G_info_t group_info; @@ -3510,7 +3486,7 @@ test_object_copy_by_soft_link(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, iterate, or " "soft link aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3793,7 +3769,7 @@ test_object_copy_by_soft_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3808,7 +3784,7 @@ test_object_copy_by_soft_link(void) } H5E_END_TRY - return 1; + return; } /* @@ -3816,8 +3792,8 @@ test_object_copy_by_soft_link(void) * H5Ocopy. Also tested is the H5O_COPY_EXPAND_SOFT_LINK_FLAG * flag. */ -static int -test_object_copy_group_with_soft_links(void) +static void +test_object_copy_group_with_soft_links(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; htri_t object_link_exists; @@ -3840,7 +3816,7 @@ test_object_copy_group_with_soft_links(void) printf(" API functions for basic file, group, object, link, iterate, or soft link aren't " "supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4153,7 +4129,7 @@ test_object_copy_group_with_soft_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4167,15 +4143,15 @@ test_object_copy_group_with_soft_links(void) } H5E_END_TRY - return 1; + return; } /* * Tests for copying objects between two different files using * H5Ocopy. */ -static int -test_object_copy_between_files(void) +static void +test_object_copy_between_files(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; H5G_info_t group_info; @@ -4209,7 +4185,7 @@ test_object_copy_between_files(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, stored " "datatype, or iterate aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4750,9 +4726,12 @@ test_object_copy_between_files(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME) < 0) + TEST_ERROR; + PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4772,18 +4751,19 @@ test_object_copy_between_files(void) H5Gclose(container_group); H5Fclose(file_id2); H5Fclose(file_id); + remove_test_file(NULL, OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME); } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Ocopy fails when it * is passed invalid parameters. */ -static int -test_object_copy_invalid_params(void) +static void +test_object_copy_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -4797,7 +4777,7 @@ test_object_copy_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5000,7 +4980,7 @@ test_object_copy_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5012,34 +4992,34 @@ test_object_copy_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oset_comment(_by_name)/H5Oget_comment(_by_name). */ -static int -test_object_comments(void) +static void +test_object_comments(const void H5_ATTR_UNUSED *params) { TESTING("object comments"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Oset_comment(_by_name)/H5Oget_comment(_by_name) * fail when passed invalid parameters. */ -static int -test_object_comments_invalid_params(void) +static void +test_object_comments_invalid_params(const void H5_ATTR_UNUSED *params) { - TESTING("object comment "); + TESTING("object comments with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -5047,8 +5027,8 @@ test_object_comments_invalid_params(void) * * XXX: Should have test for checking nested object's names/paths. */ -static int -test_object_visit(void) +static void +test_object_visit(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -5078,7 +5058,7 @@ test_object_visit(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, attribute, stored datatype, or " "iterate aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5708,10 +5688,12 @@ test_object_visit(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (remove_test_file(NULL, visit_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5730,10 +5712,11 @@ test_object_visit(void) H5Gclose(container_group); H5Fclose(file_id); H5Fclose(file_id2); + remove_test_file(NULL, visit_filename); } H5E_END_TRY; - return 1; + return; } /* @@ -5745,8 +5728,8 @@ test_object_visit(void) * the links to ensure that the objects in the other group * do not get visited. */ -static int -test_object_visit_soft_link(void) +static void +test_object_visit_soft_link(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -5764,7 +5747,7 @@ test_object_visit_soft_link(void) SKIPPED(); printf(" API functions for basic file, group, object, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6208,7 +6191,7 @@ test_object_visit_soft_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6223,15 +6206,15 @@ test_object_visit_soft_link(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Ovisit(_by_name) fails when * it is passed invalid parameters. */ -static int -test_object_visit_invalid_params(void) +static void +test_object_visit_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -6245,7 +6228,7 @@ test_object_visit_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_ITERATE)) { SKIPPED(); printf(" API functions for basic file, group, or iterate aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6529,7 +6512,7 @@ test_object_visit_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6541,14 +6524,14 @@ test_object_visit_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oclose. */ -static int -test_close_object(void) +static void +test_close_object(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -6568,7 +6551,7 @@ test_close_object(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, attribute, or stored datatype " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6724,7 +6707,7 @@ test_close_object(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6740,15 +6723,15 @@ test_close_object(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Oclose fails when it * is passed invalid parameters. */ -static int -test_close_object_invalid_params(void) +static void +test_close_object_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -6759,7 +6742,7 @@ test_close_object_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_BASIC)) { SKIPPED(); printf(" API functions for basic file or object aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6785,7 +6768,7 @@ test_close_object_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6794,15 +6777,15 @@ test_close_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that various objects (file, dataspace, property list, * and attribute) can't be closed with H5Oclose. */ -static int -test_close_invalid_objects(void) +static void +test_close_invalid_objects(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -6820,7 +6803,7 @@ test_close_invalid_objects(void) SKIPPED(); printf(" API functions for basic file, group, or object " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6963,7 +6946,7 @@ test_close_invalid_objects(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6978,61 +6961,61 @@ test_close_invalid_objects(void) } H5E_END_TRY - return 1; + return; } /* test_close_invalid_objects */ /* * A test for H5Oflush. */ -static int -test_flush_object(void) +static void +test_flush_object(const void H5_ATTR_UNUSED *params) { TESTING("H5Oflush"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Oflush fails when * it is passed invalid parameters. */ -static int -test_flush_object_invalid_params(void) +static void +test_flush_object_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Oflush with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Orefresh. */ -static int -test_refresh_object(void) +static void +test_refresh_object(const void H5_ATTR_UNUSED *params) { TESTING("H5Orefresh"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Orefresh fails when * it is passed invalid parameters. */ -static int -test_refresh_object_invalid_params(void) +static void +test_refresh_object_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Orefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -7363,36 +7346,61 @@ object_visit_noop_callback(hid_t o_id, const char *name, const H5O_info2_t *obje return 0; } -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) -{ - remove_test_file(test_path_prefix, OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME); - remove_test_file(test_path_prefix, OBJECT_VISIT_TEST_FILE_NAME); -} - -int -H5_api_object_test(void) +void +H5_api_object_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Object Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(object_tests); i++) { - nerrors += (*object_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_object_test_header", print_object_test_header, NULL, NULL, NULL, 0, + "Prints header for object tests"); + + AddTest("test_open_object", test_open_object, NULL, NULL, NULL, 0, "object opening"); + AddTest("test_open_object_invalid_params", test_open_object_invalid_params, NULL, NULL, NULL, 0, + "object opening with invalid parameters"); + AddTest("test_object_exists", test_object_exists, NULL, NULL, NULL, 0, "object existence"); + AddTest("test_object_exists_invalid_params", test_object_exists_invalid_params, NULL, NULL, NULL, 0, + "object existence with invalid parameters"); + AddTest("test_get_object_info", test_get_object_info, NULL, NULL, NULL, 0, "object info retrieval"); + AddTest("test_get_object_info_invalid_params", test_get_object_info_invalid_params, NULL, NULL, NULL, 0, + "object info retrieval with invalid parameters"); + AddTest("test_link_object", test_link_object, NULL, NULL, NULL, 0, "object linking"); + AddTest("test_link_object_invalid_params", test_link_object_invalid_params, NULL, NULL, NULL, 0, + "object linking with invalid parameters"); + AddTest("test_incr_decr_object_refcount", test_incr_decr_object_refcount, NULL, NULL, NULL, 0, + "increment/decrement the reference count of object"); + AddTest("test_incr_decr_object_refcount_invalid_params", test_incr_decr_object_refcount_invalid_params, + NULL, NULL, NULL, 0, "object reference count incr./decr. with an invalid parameter"); + AddTest("test_object_copy_basic", test_object_copy_basic, NULL, NULL, NULL, 0, "basic object copying"); + AddTest("test_object_copy_already_existing", test_object_copy_already_existing, NULL, NULL, NULL, 0, + "object copying to location where objects already exist"); + AddTest("test_object_copy_shallow_group_copy", test_object_copy_shallow_group_copy, NULL, NULL, NULL, 0, + "object copying with H5O_COPY_SHALLOW_HIERARCHY_FLAG flag"); + AddTest("test_object_copy_no_attributes", test_object_copy_no_attributes, NULL, NULL, NULL, 0, + "object copying with H5O_COPY_WITHOUT_ATTR_FLAG flag"); + AddTest("test_object_copy_by_soft_link", test_object_copy_by_soft_link, NULL, NULL, NULL, 0, + "object copying through use of soft links"); + AddTest("test_object_copy_group_with_soft_links", test_object_copy_group_with_soft_links, NULL, NULL, + NULL, 0, "group copying when group contains soft links"); + AddTest("test_object_copy_between_files", test_object_copy_between_files, NULL, NULL, NULL, 0, + "object copying between files"); + AddTest("test_object_copy_invalid_params", test_object_copy_invalid_params, NULL, NULL, NULL, 0, + "object copying with invalid parameters"); + AddTest("test_object_comments", test_object_comments, NULL, NULL, NULL, 0, "object comments"); + AddTest("test_object_comments_invalid_params", test_object_comments_invalid_params, NULL, NULL, NULL, 0, + "object comments with invalid parameters"); + AddTest("test_object_visit", test_object_visit, NULL, NULL, NULL, 0, "object visiting"); + AddTest("test_object_visit_soft_link", test_object_visit_soft_link, NULL, NULL, NULL, 0, + "object visiting with soft links"); + AddTest("test_object_visit_invalid_params", test_object_visit_invalid_params, NULL, NULL, NULL, 0, + "object visiting with invalid parameters"); + AddTest("test_close_object", test_close_object, NULL, NULL, NULL, 0, "H5Oclose"); + AddTest("test_close_object_invalid_params", test_close_object_invalid_params, NULL, NULL, NULL, 0, + "H5Oclose with an invalid object ID"); + AddTest("test_close_invalid_objects", test_close_invalid_objects, NULL, NULL, NULL, 0, + "H5Oclose invalid objects"); + AddTest("test_flush_object", test_flush_object, NULL, NULL, NULL, 0, "H5Oflush"); + AddTest("test_flush_object_invalid_params", test_flush_object_invalid_params, NULL, NULL, NULL, 0, + "H5Oflush with invalid parameters"); + AddTest("test_refresh_object", test_refresh_object, NULL, NULL, NULL, 0, "H5Orefresh"); + AddTest("test_refresh_object_invalid_params", test_refresh_object_invalid_params, NULL, NULL, NULL, 0, + "H5Orefresh with invalid parameters"); } diff --git a/test/API/H5_api_object_test.h b/test/API/H5_api_object_test.h index 9231b91c2b9..ebefbbc0353 100644 --- a/test/API/H5_api_object_test.h +++ b/test/API/H5_api_object_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_object_test(void); +void H5_api_object_test_add(void); /*********************************************** * * diff --git a/test/API/H5_api_test.c b/test/API/H5_api_test.c index 22df50a0964..8b300c0fb0b 100644 --- a/test/API/H5_api_test.c +++ b/test/API/H5_api_test.c @@ -53,27 +53,27 @@ const char *test_path_prefix; #ifdef H5_API_TEST_HAVE_ASYNC #define H5_API_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test, 1) \ - X(H5_API_TEST_ASYNC, "async", H5_api_async_test, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_add, 1) \ + X(H5_API_TEST_ASYNC, "async", H5_api_async_test_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #else #define H5_API_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #endif @@ -84,7 +84,7 @@ enum H5_api_test_type { H5_API_TESTS }; static const char *const H5_api_test_name[] = {H5_API_TESTS}; #undef X #define X(a, b, c, d) c, -static int (*H5_api_test_func[])(void) = {H5_API_TESTS}; +static void (*H5_api_test_add_func[])(void) = {H5_API_TESTS}; #undef X #define X(a, b, c, d) d, static int H5_api_test_enabled[] = {H5_API_TESTS}; @@ -102,20 +102,49 @@ H5_api_test_name_to_type(const char *test_name) } static void -H5_api_test_run(void) +H5_api_test_add(void) { enum H5_api_test_type i; for (i = H5_API_TEST_FILE; i < H5_API_TEST_MAX; i++) if (H5_api_test_enabled[i]) - (void)H5_api_test_func[i](); + H5_api_test_add_func[i](); } -/******************************************************************************/ +static int +parse_command_line(int argc, char **argv) +{ + /* Simple argument checking, TODO can improve that later */ + if (argc > 1) { + enum H5_api_test_type i = H5_api_test_name_to_type(argv[argc - 1]); + if (i != H5_API_TEST_NULL) { + /* Run only specific API test */ + memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); + H5_api_test_enabled[i] = 1; + } + } + + return 0; +} + +static void +usage(FILE *stream) +{ + fprintf(stream, "file run only the file interface tests\n"); + fprintf(stream, "group run only the group interface tests\n"); + fprintf(stream, "dataset run only the dataset interface tests\n"); + fprintf(stream, "attribute run only the attribute interface tests\n"); + fprintf(stream, "datatype run only the datatype interface tests\n"); + fprintf(stream, "link run only the link interface tests\n"); + fprintf(stream, "object run only the object interface tests\n"); + fprintf(stream, "misc run only the miscellaneous tests\n"); + fprintf(stream, "async run only the async interface tests\n"); +} int main(int argc, char **argv) { + H5E_auto2_t default_err_func; const char *vol_connector_string; const char *vol_connector_name; unsigned seed; @@ -124,19 +153,47 @@ main(int argc, char **argv) hid_t registered_con_id = H5I_INVALID_HID; char *vol_connector_string_copy = NULL; char *vol_connector_info = NULL; + void *default_err_data = NULL; bool err_occurred = false; - /* Simple argument checking, TODO can improve that later */ - if (argc > 1) { - enum H5_api_test_type i = H5_api_test_name_to_type(argv[1]); - if (i != H5_API_TEST_NULL) { - /* Run only specific API test */ - memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); - H5_api_test_enabled[i] = 1; - } + H5open(); + + /* Store current error stack printing function since TestInit unsets it */ + H5Eget_auto2(H5E_DEFAULT, &default_err_func, &default_err_data); + + /* Initialize testing framework */ + if (TestInit(argv[0], usage, NULL, NULL, NULL, 0) < 0) { + fprintf(stderr, "Unable to initialize testing framework\n"); + err_occurred = true; + goto done; } - H5open(); + /* Reset error stack printing function */ + H5Eset_auto2(H5E_DEFAULT, default_err_func, default_err_data); + + /* Hide all output from testing framework and replace with our own */ + SetTestVerbosity(VERBO_NONE); + + /* Parse command line separately from the test framework since + * tests need to be added before TestParseCmdLine in order for + * the -help option to show them, but we need to know ahead of + * time which tests to add if only a specific interface's tests + * are going to be run. + */ + parse_command_line(argc, argv); + + /* Add tests */ + H5_api_test_add(); + + /* Display testing information */ + TestInfo(stdout); + + /* Parse command line arguments */ + if (TestParseCmdLine(argc, argv) < 0) { + fprintf(stderr, "Unable to parse command-line arguments\n"); + err_occurred = true; + goto done; + } n_tests_run_g = 0; n_tests_passed_g = 0; @@ -183,7 +240,7 @@ main(int argc, char **argv) printf("Test parameters:\n"); printf(" - Test file name: '%s'\n", H5_api_test_filename); printf(" - Test seed: %u\n", seed); - printf("\n\n"); + printf("\n"); if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) { fprintf(stderr, "Unable to create FAPL\n"); @@ -267,18 +324,30 @@ main(int argc, char **argv) goto done; } - /* Run all the tests that are enabled */ - H5_api_test_run(); + /* Perform tests */ + if (PerformTests() < 0) { + fprintf(stderr, "Unable to run tests\n"); + err_occurred = true; + goto done; + } + + printf("\n"); + + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(stdout); - printf("Cleaning up testing files\n"); + printf("Deleting container file for tests\n\n"); - H5E_BEGIN_TRY - { - if (H5Fis_accessible(H5_api_test_filename, H5P_DEFAULT) > 0) { - H5Fdelete(H5_api_test_filename, fapl_id); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + if (H5Fis_accessible(H5_api_test_filename, H5P_DEFAULT) > 0) { + H5Fdelete(H5_api_test_filename, fapl_id); + } } + H5E_END_TRY } - H5E_END_TRY if (n_tests_run_g > 0) { printf("%zu/%zu (%.2f%%) API tests passed with VOL connector '%s'\n", n_tests_passed_g, n_tests_run_g, @@ -308,7 +377,20 @@ main(int argc, char **argv) err_occurred = true; } + if (GetTestNumErrs() > 0) + n_tests_failed_g += (size_t)GetTestNumErrs(); + + /* Release test infrastructure */ + if (TestShutdown() < 0) { + fprintf(stderr, "Unable to shut down testing framework\n"); + err_occurred = true; + } + H5close(); - exit(((err_occurred || n_tests_failed_g > 0) ? EXIT_FAILURE : EXIT_SUCCESS)); + /* Exit failure if errors encountered; else exit success. */ + if (err_occurred || n_tests_failed_g > 0) + exit(EXIT_FAILURE); + else + exit(EXIT_SUCCESS); } diff --git a/test/API/H5_api_test.h b/test/API/H5_api_test.h index 9f11cdb35fb..50c87400126 100644 --- a/test/API/H5_api_test.h +++ b/test/API/H5_api_test.h @@ -17,6 +17,7 @@ #include #include "h5test.h" +#include "testframe.h" #include "H5_api_test_config.h" #include "H5_api_test_util.h" diff --git a/test/API/H5_api_test_util.c b/test/API/H5_api_test_util.c index 4fcf6fa756c..efb88c77100 100644 --- a/test/API/H5_api_test_util.c +++ b/test/API/H5_api_test_util.c @@ -703,6 +703,8 @@ create_test_container(char *filename, uint64_t vol_cap_flags) hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; + printf("Creating container file for tests\n"); + if (!(vol_cap_flags & H5VL_CAP_FLAG_FILE_BASIC)) { printf(" VOL connector doesn't support file creation\n"); goto error; @@ -713,6 +715,8 @@ create_test_container(char *filename, uint64_t vol_cap_flags) goto error; } + printf(" created container file\n"); + if (vol_cap_flags & H5VL_CAP_FLAG_GROUP_BASIC) { /* Create container groups for each of the test interfaces * (group, attribute, dataset, etc.). @@ -831,6 +835,9 @@ remove_test_file(const char *prefix, const char *filename) char *prefixed_filename = NULL; herr_t ret_value = SUCCEED; + if (!GetTestCleanup()) + goto done; + if (prefix) { if (prefix_filename(prefix, filename, &prefixed_filename) < 0) { printf(" couldn't prefix filename\n"); diff --git a/test/event_set.c b/test/event_set.c index aa1a66fe695..3e667d90e4d 100644 --- a/test/event_set.c +++ b/test/event_set.c @@ -159,7 +159,7 @@ fake_wait_request_wait(void H5_ATTR_UNUSED *req, uint64_t H5_ATTR_UNUSED timeout *status = H5VL_REQUEST_STATUS_SUCCEED; return 0; -} /* end H5_daos_req_wait() */ +} /* end fake_wait_request_wait() */ herr_t fake_wait_request_free(void H5_ATTR_UNUSED *req) diff --git a/testpar/API/CMakeLists.txt b/testpar/API/CMakeLists.txt index c744366188a..db95d728b8e 100644 --- a/testpar/API/CMakeLists.txt +++ b/testpar/API/CMakeLists.txt @@ -394,11 +394,6 @@ if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) foreach (api_test_extra ${HDF5_API_PAR_TESTS_EXTRA}) if (TARGET ${api_test_extra}) - set_target_properties ( - ${api_test_extra} - PROPERTIES - OUTPUT_NAME "h5_api_test_parallel_${api_test_extra}" - ) install ( TARGETS ${api_test_extra} diff --git a/testpar/API/H5_api_async_test_parallel.c b/testpar/API/H5_api_async_test_parallel.c index cfa9230ffed..450b69f1464 100644 --- a/testpar/API/H5_api_async_test_parallel.c +++ b/testpar/API/H5_api_async_test_parallel.c @@ -12,42 +12,57 @@ #include "H5_api_async_test_parallel.h" -#ifdef H5ESpublic_H - -static int test_one_dataset_io(void); -static int test_multi_dataset_io(void); -static int test_multi_file_dataset_io(void); -static int test_multi_file_grp_dset_io(void); -static int test_set_extent(void); -static int test_attribute_exists(void); -static int test_attribute_io(void); -static int test_attribute_io_tconv(void); -static int test_attribute_io_compound(void); -static int test_group(void); -static int test_link(void); -static int test_ocopy_orefresh(void); -static int test_file_reopen(void); +static void print_async_test_header(const void *params); -/* - * The array of parallel async tests to be performed. - */ -static int (*par_async_tests[])(void) = { - test_one_dataset_io, - test_multi_dataset_io, - test_multi_file_dataset_io, - test_multi_file_grp_dset_io, - test_set_extent, - test_attribute_exists, - test_attribute_io, - test_attribute_io_tconv, - test_attribute_io_compound, - test_group, - test_link, - test_ocopy_orefresh, - test_file_reopen, -}; - -bool coll_metadata_read = true; +static void +print_async_test_header(const void *params) +{ + bool coll_md_read = true; + + if (params) + coll_md_read = *(const bool *)params; + + if (coll_md_read) { + if (MAINPROCESS) { + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Parallel Async Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + +#ifndef H5_API_TEST_HAVE_ASYNC + printf("SKIPPED due to no async support\n"); +#endif + } + } +#ifdef H5_API_TEST_HAVE_ASYNC + else if (MAINPROCESS) { + printf("\n"); + printf("****************************************************\n"); + printf("* *\n"); + printf("* Re-running tests with independent metadata reads *\n"); + printf("* *\n"); + printf("****************************************************\n\n"); + } +#endif +} + +#ifdef H5_API_TEST_HAVE_ASYNC + +static void test_async_one_dataset_io(const void *params); +static void test_async_multi_dataset_io(const void *params); +static void test_async_multi_file_dataset_io(const void *params); +static void test_async_multi_file_grp_dset_io(const void *params); +static void test_async_set_extent(const void *params); +static void test_async_attribute_exists(const void *params); +static void test_async_attribute_io(const void *params); +static void test_async_attribute_io_tconv(const void *params); +static void test_async_attribute_io_compound(const void *params); +static void test_async_group(const void *params); +static void test_async_link(const void *params); +static void test_async_ocopy_orefresh(const void *params); +static void test_async_file_reopen(const void *params); /* Highest "printf" file created (starting at 0) */ int max_printf_file = -1; @@ -57,8 +72,8 @@ int max_printf_file = -1; * of the dataset. */ #define ONE_DATASET_IO_TEST_SPACE_RANK 2 -static int -test_one_dataset_io(void) +static void +test_async_one_dataset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[ONE_DATASET_IO_TEST_SPACE_RANK]; @@ -79,8 +94,11 @@ test_one_dataset_io(void) TESTING_MULTIPART("single dataset I/O"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); @@ -88,12 +106,10 @@ test_one_dataset_io(void) " API functions for basic file, dataset, or flush aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -389,7 +405,7 @@ test_one_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -410,7 +426,7 @@ test_one_dataset_io(void) } H5E_END_TRY - return 1; + return; } #undef ONE_DATASET_IO_TEST_SPACE_RANK @@ -421,8 +437,8 @@ test_one_dataset_io(void) */ #define MULTI_DATASET_IO_TEST_SPACE_RANK 2 #define MULTI_DATASET_IO_TEST_NDSETS 5 -static int -test_multi_dataset_io(void) +static void +test_async_multi_dataset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[MULTI_DATASET_IO_TEST_SPACE_RANK]; @@ -444,8 +460,11 @@ test_multi_dataset_io(void) TESTING_MULTIPART("multi dataset I/O"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); @@ -453,12 +472,10 @@ test_multi_dataset_io(void) " API functions for basic file, dataset, or flush aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -712,7 +729,7 @@ test_multi_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -734,7 +751,7 @@ test_multi_dataset_io(void) } H5E_END_TRY - return 1; + return; } #undef MULTI_DATASET_IO_TEST_SPACE_RANK #undef MULTI_DATASET_IO_TEST_NDSETS @@ -745,8 +762,8 @@ test_multi_dataset_io(void) */ #define MULTI_FILE_DATASET_IO_TEST_SPACE_RANK 2 #define MULTI_FILE_DATASET_IO_TEST_NFILES 5 -static int -test_multi_file_dataset_io(void) +static void +test_async_multi_file_dataset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[MULTI_FILE_DATASET_IO_TEST_SPACE_RANK]; @@ -770,8 +787,11 @@ test_multi_file_dataset_io(void) TESTING_MULTIPART("multi file dataset I/O"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); @@ -779,12 +799,10 @@ test_multi_file_dataset_io(void) " API functions for basic file, dataset, or flush aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -1136,7 +1154,7 @@ test_multi_file_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1159,7 +1177,7 @@ test_multi_file_dataset_io(void) } H5E_END_TRY - return 1; + return; } #undef MULTI_FILE_DATASET_IO_TEST_SPACE_RANK #undef MULTI_FILE_DATASET_IO_TEST_NFILES @@ -1170,8 +1188,8 @@ test_multi_file_dataset_io(void) */ #define MULTI_FILE_GRP_DSET_IO_TEST_SPACE_RANK 2 #define MULTI_FILE_GRP_DSET_IO_TEST_NFILES 5 -static int -test_multi_file_grp_dset_io(void) +static void +test_async_multi_file_grp_dset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[MULTI_FILE_GRP_DSET_IO_TEST_SPACE_RANK]; @@ -1193,21 +1211,21 @@ test_multi_file_grp_dset_io(void) TESTING_MULTIPART("multi file dataset I/O with groups"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { if (MAINPROCESS) { SKIPPED(); printf( " API functions for basic file, group, or dataset aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -1552,7 +1570,7 @@ test_multi_file_grp_dset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1574,7 +1592,7 @@ test_multi_file_grp_dset_io(void) } H5E_END_TRY - return 1; + return; } #undef MULTI_FILE_GRP_DSET_IO_TEST_SPACE_RANK #undef MULTI_FILE_GRP_DSET_IO_TEST_NFILES @@ -1587,8 +1605,8 @@ test_multi_file_grp_dset_io(void) */ #define SET_EXTENT_TEST_SPACE_RANK 2 #define SET_EXTENT_TEST_NUM_EXTENDS 6 -static int -test_set_extent(void) +static void +test_async_set_extent(const void *params) { hsize_t *dims = NULL; hsize_t *maxdims = NULL; @@ -1615,7 +1633,8 @@ test_set_extent(void) TESTING("extending dataset"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { if (MAINPROCESS) { SKIPPED(); @@ -1623,10 +1642,10 @@ test_set_extent(void) "with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -1891,7 +1910,7 @@ test_set_extent(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1918,7 +1937,7 @@ test_set_extent(void) } H5E_END_TRY - return 1; + return; } #undef SET_EXTENT_TEST_SPACE_RANK #undef SET_EXTENT_TEST_NUM_EXTENDS @@ -1929,8 +1948,8 @@ test_set_extent(void) * attribute on the dataset. */ #define ATTRIBUTE_EXISTS_TEST_SPACE_RANK 2 -static int -test_attribute_exists(void) +static void +test_async_attribute_exists(const void *params) { hsize_t *dims = NULL; bool op_failed = false; @@ -1948,7 +1967,8 @@ test_attribute_exists(void) TESTING("H5Aexists()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); @@ -1956,10 +1976,10 @@ test_attribute_exists(void) "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2054,7 +2074,7 @@ test_attribute_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2071,7 +2091,7 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } #undef ATTRIBUTE_EXISTS_TEST_SPACE_RANK @@ -2081,8 +2101,8 @@ test_attribute_exists(void) * verifies the data is correct. */ #define ATTRIBUTE_IO_TEST_SPACE_RANK 2 -static int -test_attribute_io(void) +static void +test_async_attribute_io(const void *params) { hsize_t *dims = NULL; bool op_failed = false; @@ -2101,7 +2121,8 @@ test_attribute_io(void) TESTING("attribute I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); @@ -2109,10 +2130,10 @@ test_attribute_io(void) "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2259,7 +2280,7 @@ test_attribute_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2280,7 +2301,7 @@ test_attribute_io(void) } H5E_END_TRY - return 1; + return; } /* @@ -2289,8 +2310,8 @@ test_attribute_io(void) * attribute and verifies the data is correct. */ #define ATTRIBUTE_IO_TCONV_TEST_SPACE_RANK 2 -static int -test_attribute_io_tconv(void) +static void +test_async_attribute_io_tconv(const void *params) { hsize_t *dims = NULL; bool op_failed; @@ -2308,18 +2329,18 @@ test_attribute_io_tconv(void) TESTING("attribute I/O with type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, attribute, or flush aren't supported with this " "connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2454,7 +2475,7 @@ test_attribute_io_tconv(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2475,7 +2496,7 @@ test_attribute_io_tconv(void) } H5E_END_TRY - return 1; + return; } /* @@ -2489,8 +2510,8 @@ typedef struct tattr_cmpd_t { } tattr_cmpd_t; #define ATTRIBUTE_IO_COMPOUND_TEST_SPACE_RANK 2 -static int -test_attribute_io_compound(void) +static void +test_async_attribute_io_compound(const void *params) { hsize_t *dims = NULL; bool op_failed; @@ -2512,18 +2533,18 @@ test_attribute_io_compound(void) TESTING("attribute I/O with compound type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, attribute, or flush aren't " "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2861,7 +2882,7 @@ test_attribute_io_compound(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2887,14 +2908,14 @@ test_attribute_io_compound(void) } H5E_END_TRY - return 1; + return; } /* * Tests async group interfaces in parallel */ -static int -test_group(void) +static void +test_async_group(const void *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -2912,18 +2933,19 @@ test_group(void) TESTING("group operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, group, group more or flush aren't " "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create GCPL */ @@ -3048,7 +3070,7 @@ test_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3064,14 +3086,14 @@ test_group(void) } H5E_END_TRY - return 1; + return; } /* * Tests async link interfaces in parallel */ -static int -test_link(void) +static void +test_async_link(const void *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -3092,9 +3114,9 @@ test_link(void) TESTING("link operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { if (MAINPROCESS) { SKIPPED(); @@ -3102,10 +3124,10 @@ test_link(void) "aren't supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create GCPL */ @@ -3309,7 +3331,7 @@ test_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3324,15 +3346,15 @@ test_link(void) } H5E_END_TRY - return 1; + return; } /* * Tests H5Ocopy_async and H5Orefresh_async in parallel */ #define OCOPY_REFRESH_TEST_SPACE_RANK 2 -static int -test_ocopy_orefresh(void) +static void +test_async_ocopy_orefresh(const void *params) { hsize_t *dims = NULL; hid_t file_id = H5I_INVALID_HID; @@ -3342,24 +3364,27 @@ test_ocopy_orefresh(void) hid_t space_id = H5I_INVALID_HID; hid_t es_id = H5I_INVALID_HID; size_t num_in_progress; - bool op_failed = false; - bool is_native_vol = false; + bool coll_metadata_read = false; + bool op_failed = false; + bool is_native_vol = false; TESTING("H5Ocopy() and H5Orefresh()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, group, dataset, object more, flush, or refresh " "aren't supported with this connector\n"); } - return 0; + return; } + coll_metadata_read = *(const bool *)params; + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) TEST_ERROR; @@ -3468,7 +3493,7 @@ test_ocopy_orefresh(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3485,15 +3510,15 @@ test_ocopy_orefresh(void) } H5E_END_TRY - return 1; + return; } #undef OCOPY_REFRESH_TEST_SPACE_RANK /* * Tests H5Freopen_async in parallel */ -static int -test_file_reopen(void) +static void +test_async_file_reopen(const void *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -3505,16 +3530,17 @@ test_file_reopen(void) TESTING("H5Freopen()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file or file more aren't supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create event stack */ @@ -3554,7 +3580,7 @@ test_file_reopen(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3567,107 +3593,126 @@ test_file_reopen(void) } H5E_END_TRY - return 1; + return; } /* * Cleanup temporary test files */ static void -cleanup_files(void) +test_async_file_cleanup(const void H5_ATTR_UNUSED *params) { char file_name[64]; int i; if (MAINPROCESS) { - H5Fdelete(PAR_ASYNC_API_TEST_FILE, H5P_DEFAULT); + remove_test_file(NULL, PAR_ASYNC_API_TEST_FILE); + for (i = 0; i <= max_printf_file; i++) { snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, i); - H5Fdelete(file_name, H5P_DEFAULT); - } /* end for */ + remove_test_file(NULL, file_name); + } } } -int -H5_api_async_test_parallel(void) +void +H5_api_async_test_parallel_add(void) { - size_t i; - int nerrors; - - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC)) { - if (MAINPROCESS) { - SKIPPED(); - printf(" Async APIs aren't supported with this connector\n"); - } - - return 0; - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_async_tests); i++) { - nerrors += (*par_async_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) { - printf("\n"); - printf("Cleaning up testing files\n"); - } - - cleanup_files(); - - if (MAINPROCESS) { - printf("\n * Re-testing with independent metadata reads *\n"); - } - + bool coll_metadata_read = true; + + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header (coll)", print_async_test_header, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "Prints header for async tests"); + + /* Add tests using collective metadata reads */ + AddTest("test_async_one_dataset_io (coll)", test_async_one_dataset_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async single dataset I/O (collective metadata reads)"); + AddTest("test_async_multi_dataset_io (coll)", test_async_multi_dataset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi dataset I/O (collective metadata reads)"); + AddTest("test_async_multi_file_dataset_io (coll)", test_async_multi_file_dataset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O (collective metadata reads)"); + AddTest("test_async_multi_file_grp_dset_io (coll)", test_async_multi_file_grp_dset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O with groups (collective metadata reads)"); + AddTest("test_async_set_extent (coll)", test_async_set_extent, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async extending dataset (collective metadata reads)"); + AddTest("test_async_attribute_exists (coll)", test_async_attribute_exists, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), "async H5Aexists() (collective metadata reads)"); + AddTest("test_async_attribute_io (coll)", test_async_attribute_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async attribute I/O (collective metadata reads)"); + AddTest("test_async_attribute_io_tconv (coll)", test_async_attribute_io_tconv, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with type conversion (collective metadata reads)"); + AddTest("test_async_attribute_io_compound (coll)", test_async_attribute_io_compound, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with compound type conversion (collective metadata reads)"); + AddTest("test_async_group (coll)", test_async_group, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async group operations (collective metadata reads)"); + AddTest("test_async_link (coll)", test_async_link, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async link operations (collective metadata reads)"); + AddTest("test_async_ocopy_orefresh (coll)", test_async_ocopy_orefresh, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Ocopy() and H5Orefresh() (collective metadata reads)"); + AddTest("test_async_file_reopen (coll)", test_async_file_reopen, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Freopen() (collective metadata reads)"); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_async_file_cleanup (coll)", test_async_file_cleanup, NULL, NULL, NULL, 0, + "cleanup async test files"); + + /* Re-run tests with independent metadata reads */ coll_metadata_read = false; - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_async_tests); i++) { - nerrors += (*par_async_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) { - printf("\n"); - printf("Cleaning up testing files\n"); - } - - cleanup_files(); - - return nerrors; + /* Add a fake test to print out that tests are being re-run with independent metadata reads */ + AddTest("print_async_test_header (ind)", print_async_test_header, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "Prints header for async tests"); + + /* Add tests using independent metadata reads */ + AddTest("test_async_one_dataset_io (ind)", test_async_one_dataset_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async single dataset I/O (independent metadata reads)"); + AddTest("test_async_multi_dataset_io (ind)", test_async_multi_dataset_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async multi dataset I/O (independent metadata reads)"); + AddTest("test_async_multi_file_dataset_io (ind)", test_async_multi_file_dataset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O (independent metadata reads)"); + AddTest("test_async_multi_file_grp_dset_io (ind)", test_async_multi_file_grp_dset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O with groups (independent metadata reads)"); + AddTest("test_async_set_extent (ind)", test_async_set_extent, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async extending dataset (independent metadata reads)"); + AddTest("test_async_attribute_exists (ind)", test_async_attribute_exists, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Aexists() (independent metadata reads)"); + AddTest("test_async_attribute_io (ind)", test_async_attribute_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async attribute I/O (independent metadata reads)"); + AddTest("test_async_attribute_io_tconv (ind)", test_async_attribute_io_tconv, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with type conversion (independent metadata reads)"); + AddTest("test_async_attribute_io_compound (ind)", test_async_attribute_io_compound, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with compound type conversion (independent metadata reads)"); + AddTest("test_async_group (ind)", test_async_group, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async group operations (independent metadata reads)"); + AddTest("test_async_link (ind)", test_async_link, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async link operations (independent metadata reads)"); + AddTest("test_async_ocopy_orefresh (ind)", test_async_ocopy_orefresh, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Ocopy() and H5Orefresh() (independent metadata reads)"); + AddTest("test_async_file_reopen (ind)", test_async_file_reopen, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Freopen() (independent metadata reads)"); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_async_file_cleanup (ind)", test_async_file_cleanup, NULL, NULL, NULL, 0, + "cleanup async test files"); } -#else /* H5ESpublic_H */ +#else /* H5_API_TEST_HAVE_ASYNC */ -int -H5_api_async_test_parallel(void) +void +H5_api_async_test_parallel_add(void) { - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - printf("SKIPPED due to no async support in HDF5 library\n"); - - return 0; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header", print_async_test_header, NULL, NULL, NULL, 0, + "Prints header for async tests"); } #endif diff --git a/testpar/API/H5_api_async_test_parallel.h b/testpar/API/H5_api_async_test_parallel.h index 02b910b5a8f..6f12a36b178 100644 --- a/testpar/API/H5_api_async_test_parallel.h +++ b/testpar/API/H5_api_async_test_parallel.h @@ -15,7 +15,7 @@ #include "H5_api_test_parallel.h" -int H5_api_async_test_parallel(void); +void H5_api_async_test_parallel_add(void); /******************************************************** * * diff --git a/testpar/API/H5_api_attribute_test_parallel.c b/testpar/API/H5_api_attribute_test_parallel.c index aaee7503ac8..c06ac918147 100644 --- a/testpar/API/H5_api_attribute_test_parallel.c +++ b/testpar/API/H5_api_attribute_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_attribute_test_parallel.h" -/* - * The array of parallel attribute tests to be performed. - */ -static int (*par_attribute_tests[])(void) = {NULL}; +static void print_attribute_test_header(const void *params); -int -H5_api_attribute_test_parallel(void) +static void +print_attribute_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Attribute Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_attribute_tests); i++) { - /* nerrors += (*par_attribute_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_attribute_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_attribute_test_header", print_attribute_test_header, NULL, NULL, NULL, 0, + "Prints header for attribute tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_attribute_test_parallel.h b/testpar/API/H5_api_attribute_test_parallel.h index 73ed9708cf4..7a2033dd90a 100644 --- a/testpar/API/H5_api_attribute_test_parallel.h +++ b/testpar/API/H5_api_attribute_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_attribute_test_parallel(void); +void H5_api_attribute_test_parallel_add(void); #endif /* H5_API_ATTRIBUTE_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_dataset_test_parallel.c b/testpar/API/H5_api_dataset_test_parallel.c index 7dd9f7027ea..d4e208aaee9 100644 --- a/testpar/API/H5_api_dataset_test_parallel.c +++ b/testpar/API/H5_api_dataset_test_parallel.c @@ -16,64 +16,48 @@ */ #include "H5_api_dataset_test_parallel.h" -static int test_write_dataset_data_verification(void); -static int test_write_dataset_independent(void); -static int test_write_dataset_one_proc_0_selection(void); -static int test_write_dataset_one_proc_none_selection(void); -static int test_write_dataset_one_proc_all_selection(void); -static int test_write_dataset_hyper_file_all_mem(void); -static int test_write_dataset_all_file_hyper_mem(void); -static int test_write_dataset_point_file_all_mem(void); -static int test_write_dataset_all_file_point_mem(void); -static int test_write_dataset_hyper_file_point_mem(void); -static int test_write_dataset_point_file_hyper_mem(void); -static int test_read_dataset_one_proc_0_selection(void); -static int test_read_dataset_one_proc_none_selection(void); -static int test_read_dataset_one_proc_all_selection(void); -static int test_read_dataset_hyper_file_all_mem(void); -static int test_read_dataset_all_file_hyper_mem(void); -static int test_read_dataset_point_file_all_mem(void); -static int test_read_dataset_all_file_point_mem(void); -static int test_read_dataset_hyper_file_point_mem(void); -static int test_read_dataset_point_file_hyper_mem(void); +static void print_dataset_test_header(const void *params); +static void test_write_dataset_data_verification(const void *params); +static void test_write_dataset_independent(const void *params); +static void test_write_dataset_one_proc_0_selection(const void *params); +static void test_write_dataset_one_proc_none_selection(const void *params); +static void test_write_dataset_one_proc_all_selection(const void *params); +static void test_write_dataset_hyper_file_all_mem(const void *params); +static void test_write_dataset_all_file_hyper_mem(const void *params); +static void test_write_dataset_point_file_all_mem(const void *params); +static void test_write_dataset_all_file_point_mem(const void *params); +static void test_write_dataset_hyper_file_point_mem(const void *params); +static void test_write_dataset_point_file_hyper_mem(const void *params); +static void test_read_dataset_one_proc_0_selection(const void *params); +static void test_read_dataset_one_proc_none_selection(const void *params); +static void test_read_dataset_one_proc_all_selection(const void *params); +static void test_read_dataset_hyper_file_all_mem(const void *params); +static void test_read_dataset_all_file_hyper_mem(const void *params); +static void test_read_dataset_point_file_all_mem(const void *params); +static void test_read_dataset_all_file_point_mem(const void *params); +static void test_read_dataset_hyper_file_point_mem(const void *params); +static void test_read_dataset_point_file_hyper_mem(const void *params); /* * Chunking tests */ -static int test_write_multi_chunk_dataset_same_shape_read(void); -static int test_write_multi_chunk_dataset_diff_shape_read(void); -static int test_overwrite_multi_chunk_dataset_same_shape_read(void); -static int test_overwrite_multi_chunk_dataset_diff_shape_read(void); +static void test_write_multi_chunk_dataset_same_shape_read(const void *params); +static void test_write_multi_chunk_dataset_diff_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_same_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_diff_shape_read(const void *params); -/* - * The array of parallel dataset tests to be performed. - */ -static int (*par_dataset_tests[])(void) = { - test_write_dataset_data_verification, - test_write_dataset_independent, - test_write_dataset_one_proc_0_selection, - test_write_dataset_one_proc_none_selection, - test_write_dataset_one_proc_all_selection, - test_write_dataset_hyper_file_all_mem, - test_write_dataset_all_file_hyper_mem, - test_write_dataset_point_file_all_mem, - test_write_dataset_all_file_point_mem, - test_write_dataset_hyper_file_point_mem, - test_write_dataset_point_file_hyper_mem, - test_read_dataset_one_proc_0_selection, - test_read_dataset_one_proc_none_selection, - test_read_dataset_one_proc_all_selection, - test_read_dataset_hyper_file_all_mem, - test_read_dataset_all_file_hyper_mem, - test_read_dataset_point_file_all_mem, - test_read_dataset_all_file_point_mem, - test_read_dataset_hyper_file_point_mem, - test_read_dataset_point_file_hyper_mem, - test_write_multi_chunk_dataset_same_shape_read, - test_write_multi_chunk_dataset_diff_shape_read, - test_overwrite_multi_chunk_dataset_same_shape_read, - test_overwrite_multi_chunk_dataset_diff_shape_read, -}; +static void +print_dataset_test_header(const void H5_ATTR_UNUSED *params) +{ + if (MAINPROCESS) { + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Parallel Dataset Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + } +} /* * A test to ensure that data is read back correctly from @@ -88,8 +72,8 @@ static int (*par_dataset_tests[])(void) = { #define DATASET_WRITE_DATA_VERIFY_TEST_DSET_NAME1 "dataset_write_data_verification_all" #define DATASET_WRITE_DATA_VERIFY_TEST_DSET_NAME2 "dataset_write_data_verification_hyperslab" #define DATASET_WRITE_DATA_VERIFY_TEST_DSET_NAME3 "dataset_write_data_verification_points" -static int -test_write_dataset_data_verification(void) +static void +test_write_dataset_data_verification(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -115,7 +99,7 @@ test_write_dataset_data_verification(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -866,7 +850,7 @@ test_write_dataset_data_verification(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -889,7 +873,7 @@ test_write_dataset_data_verification(void) } H5E_END_TRY - return 1; + return; } /* @@ -906,8 +890,8 @@ test_write_dataset_data_verification(void) #define DATASET_INDEPENDENT_WRITE_TEST_GROUP_NAME "independent_dataset_write_test" #define DATASET_INDEPENDENT_WRITE_TEST_DSET_NAME1 "dset1" #define DATASET_INDEPENDENT_WRITE_TEST_DSET_NAME2 "dset2" -static int -test_write_dataset_independent(void) +static void +test_write_dataset_independent(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -932,7 +916,7 @@ test_write_dataset_independent(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -1211,7 +1195,7 @@ test_write_dataset_independent(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1233,7 +1217,7 @@ test_write_dataset_independent(void) } H5E_END_TRY - return 1; + return; } /* @@ -1245,8 +1229,8 @@ test_write_dataset_independent(void) #define DATASET_WRITE_ONE_PROC_0_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ONE_PROC_0_SEL_TEST_GROUP_NAME "one_rank_0_sel_write_test" #define DATASET_WRITE_ONE_PROC_0_SEL_TEST_DSET_NAME "one_rank_0_sel_dset" -static int -test_write_dataset_one_proc_0_selection(void) +static void +test_write_dataset_one_proc_0_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -1271,7 +1255,7 @@ test_write_dataset_one_proc_0_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -1509,7 +1493,7 @@ test_write_dataset_one_proc_0_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1530,7 +1514,7 @@ test_write_dataset_one_proc_0_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -1542,8 +1526,8 @@ test_write_dataset_one_proc_0_selection(void) #define DATASET_WRITE_ONE_PROC_NONE_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ONE_PROC_NONE_SEL_TEST_GROUP_NAME "one_rank_none_sel_write_test" #define DATASET_WRITE_ONE_PROC_NONE_SEL_TEST_DSET_NAME "one_rank_none_sel_dset" -static int -test_write_dataset_one_proc_none_selection(void) +static void +test_write_dataset_one_proc_none_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -1568,7 +1552,7 @@ test_write_dataset_one_proc_none_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -1822,7 +1806,7 @@ test_write_dataset_one_proc_none_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1843,7 +1827,7 @@ test_write_dataset_one_proc_none_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -1856,8 +1840,8 @@ test_write_dataset_one_proc_none_selection(void) #define DATASET_WRITE_ONE_PROC_ALL_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ONE_PROC_ALL_SEL_TEST_GROUP_NAME "one_rank_all_sel_write_test" #define DATASET_WRITE_ONE_PROC_ALL_SEL_TEST_DSET_NAME "one_rank_all_sel_dset" -static int -test_write_dataset_one_proc_all_selection(void) +static void +test_write_dataset_one_proc_all_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -1878,7 +1862,7 @@ test_write_dataset_one_proc_all_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -2110,7 +2094,7 @@ test_write_dataset_one_proc_all_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2131,7 +2115,7 @@ test_write_dataset_one_proc_all_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -2148,8 +2132,8 @@ test_write_dataset_one_proc_all_selection(void) #define DATASET_WRITE_HYPER_FILE_ALL_MEM_TEST_GROUP_NAME "hyper_sel_file_all_sel_mem_write_test" #define DATASET_WRITE_HYPER_FILE_ALL_MEM_TEST_DSET_NAME "hyper_sel_file_all_sel_mem_dset" #endif -static int -test_write_dataset_hyper_file_all_mem(void) +static void +test_write_dataset_hyper_file_all_mem(const void H5_ATTR_UNUSED *params) { #ifdef BROKEN hssize_t space_npoints; @@ -2177,7 +2161,7 @@ test_write_dataset_hyper_file_all_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -2387,7 +2371,7 @@ test_write_dataset_hyper_file_all_mem(void) SKIPPED(); #endif - return 0; + return; #ifdef BROKEN error: @@ -2409,7 +2393,7 @@ test_write_dataset_hyper_file_all_mem(void) } H5E_END_TRY - return 1; + return; #endif } @@ -2423,8 +2407,8 @@ test_write_dataset_hyper_file_all_mem(void) #define DATASET_WRITE_ALL_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ALL_FILE_HYPER_MEM_TEST_GROUP_NAME "all_sel_file_hyper_sel_mem_write_test" #define DATASET_WRITE_ALL_FILE_HYPER_MEM_TEST_DSET_NAME "all_sel_file_hyper_sel_mem_dset" -static int -test_write_dataset_all_file_hyper_mem(void) +static void +test_write_dataset_all_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -2445,7 +2429,7 @@ test_write_dataset_all_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -2681,7 +2665,7 @@ test_write_dataset_all_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2702,7 +2686,7 @@ test_write_dataset_all_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -2710,14 +2694,14 @@ test_write_dataset_all_file_hyper_mem(void) * a point selection in the file dataspace and an all selection * in the memory dataspace. */ -static int -test_write_dataset_point_file_all_mem(void) +static void +test_write_dataset_point_file_all_mem(const void H5_ATTR_UNUSED *params) { TESTING("write to dataset with point sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -2730,8 +2714,8 @@ test_write_dataset_point_file_all_mem(void) #define DATASET_WRITE_ALL_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ALL_FILE_POINT_MEM_TEST_GROUP_NAME "all_sel_file_point_sel_mem_write_test" #define DATASET_WRITE_ALL_FILE_POINT_MEM_TEST_DSET_NAME "all_sel_file_point_sel_mem_dset" -static int -test_write_dataset_all_file_point_mem(void) +static void +test_write_dataset_all_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *points = NULL; @@ -2753,7 +2737,7 @@ test_write_dataset_all_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -3005,7 +2989,7 @@ test_write_dataset_all_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3028,7 +3012,7 @@ test_write_dataset_all_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -3041,8 +3025,8 @@ test_write_dataset_all_file_point_mem(void) #define DATASET_WRITE_HYPER_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_HYPER_FILE_POINT_MEM_TEST_GROUP_NAME "hyper_sel_file_point_sel_mem_write_test" #define DATASET_WRITE_HYPER_FILE_POINT_MEM_TEST_DSET_NAME "hyper_sel_file_point_sel_mem_dset" -static int -test_write_dataset_hyper_file_point_mem(void) +static void +test_write_dataset_hyper_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -3068,7 +3052,7 @@ test_write_dataset_hyper_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -3329,7 +3313,7 @@ test_write_dataset_hyper_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3352,7 +3336,7 @@ test_write_dataset_hyper_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -3365,8 +3349,8 @@ test_write_dataset_hyper_file_point_mem(void) #define DATASET_WRITE_POINT_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_POINT_FILE_HYPER_MEM_TEST_GROUP_NAME "point_sel_file_hyper_sel_mem_write_test" #define DATASET_WRITE_POINT_FILE_HYPER_MEM_TEST_DSET_NAME "point_sel_file_hyper_sel_mem_dset" -static int -test_write_dataset_point_file_hyper_mem(void) +static void +test_write_dataset_point_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -3388,7 +3372,7 @@ test_write_dataset_point_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -3647,7 +3631,7 @@ test_write_dataset_point_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3670,7 +3654,7 @@ test_write_dataset_point_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -3682,8 +3666,8 @@ test_write_dataset_point_file_hyper_mem(void) #define DATASET_READ_ONE_PROC_0_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ONE_PROC_0_SEL_TEST_GROUP_NAME "one_rank_0_sel_read_test" #define DATASET_READ_ONE_PROC_0_SEL_TEST_DSET_NAME "one_rank_0_sel_dset" -static int -test_read_dataset_one_proc_0_selection(void) +static void +test_read_dataset_one_proc_0_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -3708,7 +3692,7 @@ test_read_dataset_one_proc_0_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ONE_PROC_0_SEL_TEST_SPACE_RANK, &dims) < 0) @@ -3983,7 +3967,7 @@ test_read_dataset_one_proc_0_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4004,7 +3988,7 @@ test_read_dataset_one_proc_0_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -4016,8 +4000,8 @@ test_read_dataset_one_proc_0_selection(void) #define DATASET_READ_ONE_PROC_NONE_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ONE_PROC_NONE_SEL_TEST_GROUP_NAME "one_rank_none_sel_read_test" #define DATASET_READ_ONE_PROC_NONE_SEL_TEST_DSET_NAME "one_rank_none_sel_dset" -static int -test_read_dataset_one_proc_none_selection(void) +static void +test_read_dataset_one_proc_none_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -4042,7 +4026,7 @@ test_read_dataset_one_proc_none_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ONE_PROC_NONE_SEL_TEST_SPACE_RANK, &dims) < 0) @@ -4332,7 +4316,7 @@ test_read_dataset_one_proc_none_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4353,7 +4337,7 @@ test_read_dataset_one_proc_none_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -4366,8 +4350,8 @@ test_read_dataset_one_proc_none_selection(void) #define DATASET_READ_ONE_PROC_ALL_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ONE_PROC_ALL_SEL_TEST_GROUP_NAME "one_rank_all_sel_read_test" #define DATASET_READ_ONE_PROC_ALL_SEL_TEST_DSET_NAME "one_rank_all_sel_dset" -static int -test_read_dataset_one_proc_all_selection(void) +static void +test_read_dataset_one_proc_all_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -4388,7 +4372,7 @@ test_read_dataset_one_proc_all_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ONE_PROC_ALL_SEL_TEST_SPACE_RANK, &dims) < 0) @@ -4669,7 +4653,7 @@ test_read_dataset_one_proc_all_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4690,7 +4674,7 @@ test_read_dataset_one_proc_all_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -4698,14 +4682,14 @@ test_read_dataset_one_proc_all_selection(void) * a hyperslab selection in the file dataspace and an all * selection in the memory dataspace. */ -static int -test_read_dataset_hyper_file_all_mem(void) +static void +test_read_dataset_hyper_file_all_mem(const void H5_ATTR_UNUSED *params) { TESTING("read from dataset with hyperslab sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -4718,8 +4702,8 @@ test_read_dataset_hyper_file_all_mem(void) #define DATASET_READ_ALL_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ALL_FILE_HYPER_MEM_TEST_GROUP_NAME "all_sel_file_hyper_sel_mem_read_test" #define DATASET_READ_ALL_FILE_HYPER_MEM_TEST_DSET_NAME "all_sel_file_hyper_sel_mem_dset" -static int -test_read_dataset_all_file_hyper_mem(void) +static void +test_read_dataset_all_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -4740,7 +4724,7 @@ test_read_dataset_all_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ALL_FILE_HYPER_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -5016,7 +5000,7 @@ test_read_dataset_all_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5037,7 +5021,7 @@ test_read_dataset_all_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -5045,14 +5029,14 @@ test_read_dataset_all_file_hyper_mem(void) * a point selection in the file dataspace and an all selection * in the memory dataspace. */ -static int -test_read_dataset_point_file_all_mem(void) +static void +test_read_dataset_point_file_all_mem(const void H5_ATTR_UNUSED *params) { TESTING("read from dataset with point sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -5065,8 +5049,8 @@ test_read_dataset_point_file_all_mem(void) #define DATASET_READ_ALL_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ALL_FILE_POINT_MEM_TEST_GROUP_NAME "all_sel_file_point_sel_mem_read_test" #define DATASET_READ_ALL_FILE_POINT_MEM_TEST_DSET_NAME "all_sel_file_point_sel_mem_dset" -static int -test_read_dataset_all_file_point_mem(void) +static void +test_read_dataset_all_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *points = NULL; @@ -5088,7 +5072,7 @@ test_read_dataset_all_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ALL_FILE_POINT_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -5377,7 +5361,7 @@ test_read_dataset_all_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5400,7 +5384,7 @@ test_read_dataset_all_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -5413,8 +5397,8 @@ test_read_dataset_all_file_point_mem(void) #define DATASET_READ_HYPER_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_HYPER_FILE_POINT_MEM_TEST_GROUP_NAME "hyper_sel_file_point_sel_mem_read_test" #define DATASET_READ_HYPER_FILE_POINT_MEM_TEST_DSET_NAME "hyper_sel_file_point_sel_mem_dset" -static int -test_read_dataset_hyper_file_point_mem(void) +static void +test_read_dataset_hyper_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -5440,7 +5424,7 @@ test_read_dataset_hyper_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_HYPER_FILE_POINT_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -5735,7 +5719,7 @@ test_read_dataset_hyper_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5758,7 +5742,7 @@ test_read_dataset_hyper_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -5771,8 +5755,8 @@ test_read_dataset_hyper_file_point_mem(void) #define DATASET_READ_POINT_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_POINT_FILE_HYPER_MEM_TEST_GROUP_NAME "point_sel_file_hyper_sel_mem_read_test" #define DATASET_READ_POINT_FILE_HYPER_MEM_TEST_DSET_NAME "point_sel_file_hyper_sel_mem_dset" -static int -test_read_dataset_point_file_hyper_mem(void) +static void +test_read_dataset_point_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -5794,7 +5778,7 @@ test_read_dataset_point_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_POINT_FILE_HYPER_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -6092,7 +6076,7 @@ test_read_dataset_point_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6115,7 +6099,7 @@ test_read_dataset_point_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -6134,8 +6118,8 @@ test_read_dataset_point_file_hyper_mem(void) #define DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_GROUP_NAME \ "multi_chunk_dataset_write_same_space_read_test" #define DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" -static int -test_write_multi_chunk_dataset_same_shape_read(void) +static void +test_write_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -6162,7 +6146,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == @@ -6553,7 +6537,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6575,7 +6559,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -6596,8 +6580,8 @@ test_write_multi_chunk_dataset_same_shape_read(void) #define DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_GROUP_NAME \ "multi_chunk_dataset_write_diff_space_read_test" #define DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" -static int -test_write_multi_chunk_dataset_diff_shape_read(void) +static void +test_write_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -6625,7 +6609,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == @@ -7018,7 +7002,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7040,7 +7024,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -7061,8 +7045,8 @@ test_write_multi_chunk_dataset_diff_shape_read(void) "multi_chunk_dataset_same_space_overwrite_test" #define DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" #define DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_NITERS 10 -static int -test_overwrite_multi_chunk_dataset_same_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -7090,7 +7074,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == (dims = malloc(DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK * @@ -7541,7 +7525,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7563,7 +7547,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -7586,8 +7570,8 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) "multi_chunk_dataset_diff_space_overwrite_test" #define DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" #define DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_NITERS 10 -static int -test_overwrite_multi_chunk_dataset_diff_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -7616,7 +7600,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == (dims = malloc(DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK * @@ -8069,7 +8053,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8091,34 +8075,64 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } -int -H5_api_dataset_test_parallel(void) +void +H5_api_dataset_test_parallel_add(void) { - size_t i; - int nerrors; - - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel Dataset Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_dataset_tests); i++) { - nerrors += (*par_dataset_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_dataset_test_header", print_dataset_test_header, NULL, NULL, NULL, 0, + "Prints header for dataset tests"); + + AddTest("test_write_dataset_data_verification", test_write_dataset_data_verification, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread"); + AddTest("test_write_dataset_independent", test_write_dataset_independent, NULL, NULL, NULL, 0, + "independent writing to different datasets by different ranks"); + AddTest("test_write_dataset_one_proc_0_selection", test_write_dataset_one_proc_0_selection, NULL, NULL, + NULL, 0, "write to dataset with one rank selecting 0 rows"); + AddTest("test_write_dataset_one_proc_none_selection", test_write_dataset_one_proc_none_selection, NULL, + NULL, NULL, 0, "write to dataset with one rank using 'none' selection"); + AddTest("test_write_dataset_one_proc_all_selection", test_write_dataset_one_proc_all_selection, NULL, + NULL, NULL, 0, "write to dataset with one rank using all selection; others none selection"); + AddTest("test_write_dataset_hyper_file_all_mem", test_write_dataset_hyper_file_all_mem, NULL, NULL, NULL, + 0, "write to dataset with hyperslab sel. for file space; all sel. for memory"); + AddTest("test_write_dataset_all_file_hyper_mem", test_write_dataset_all_file_hyper_mem, NULL, NULL, NULL, + 0, "write to dataset with all sel. for file space; hyperslab sel. for memory"); + AddTest("test_write_dataset_point_file_all_mem", test_write_dataset_point_file_all_mem, NULL, NULL, NULL, + 0, "write to dataset with point sel. for file space; all sel. for memory"); + AddTest("test_write_dataset_all_file_point_mem", test_write_dataset_all_file_point_mem, NULL, NULL, NULL, + 0, "write to dataset with all sel. for file space; point sel. for memory"); + AddTest("test_write_dataset_hyper_file_point_mem", test_write_dataset_hyper_file_point_mem, NULL, NULL, + NULL, 0, "write to dataset with hyperslab sel. for file space; point sel. for memory"); + AddTest("test_write_dataset_point_file_hyper_mem", test_write_dataset_point_file_hyper_mem, NULL, NULL, + NULL, 0, "write to dataset with point sel. for file space; hyperslab sel. for memory"); + AddTest("test_read_dataset_one_proc_0_selection", test_read_dataset_one_proc_0_selection, NULL, NULL, + NULL, 0, "read from dataset with one rank selecting 0 rows"); + AddTest("test_read_dataset_one_proc_none_selection", test_read_dataset_one_proc_none_selection, NULL, + NULL, NULL, 0, "read from dataset with one rank using 'none' selection"); + AddTest("test_read_dataset_one_proc_all_selection", test_read_dataset_one_proc_all_selection, NULL, NULL, + NULL, 0, "read from dataset with one rank using all selection; others none selection"); + AddTest("test_read_dataset_hyper_file_all_mem", test_read_dataset_hyper_file_all_mem, NULL, NULL, NULL, 0, + "read from dataset with hyperslab sel. for file space; all sel. for memory"); + AddTest("test_read_dataset_all_file_hyper_mem", test_read_dataset_all_file_hyper_mem, NULL, NULL, NULL, 0, + "read from dataset with all sel. for file space; hyperslab sel. for memory"); + AddTest("test_read_dataset_point_file_all_mem", test_read_dataset_point_file_all_mem, NULL, NULL, NULL, 0, + "read from dataset with point sel. for file space; all sel. for memory"); + AddTest("test_read_dataset_all_file_point_mem", test_read_dataset_all_file_point_mem, NULL, NULL, NULL, 0, + "read from dataset with all sel. for file space; point sel. for memory"); + AddTest("test_read_dataset_hyper_file_point_mem", test_read_dataset_hyper_file_point_mem, NULL, NULL, + NULL, 0, "read from dataset with hyperslab sel. for file space; point sel. for memory"); + AddTest("test_read_dataset_point_file_hyper_mem", test_read_dataset_point_file_hyper_mem, NULL, NULL, + NULL, 0, "read from dataset with point sel. for file space; hyperslab sel. for memory"); + AddTest("test_write_multi_chunk_dataset_same_shape_read", test_write_multi_chunk_dataset_same_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_write_multi_chunk_dataset_diff_shape_read", test_write_multi_chunk_dataset_diff_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using differently shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_same_shape_read", + test_overwrite_multi_chunk_dataset_same_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_diff_shape_read", + test_overwrite_multi_chunk_dataset_diff_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using differently shaped dataspaces"); } diff --git a/testpar/API/H5_api_dataset_test_parallel.h b/testpar/API/H5_api_dataset_test_parallel.h index d1af1d430ec..17ab7fefeba 100644 --- a/testpar/API/H5_api_dataset_test_parallel.h +++ b/testpar/API/H5_api_dataset_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_dataset_test_parallel(void); +void H5_api_dataset_test_parallel_add(void); #endif /* H5_API_DATASET_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_datatype_test_parallel.c b/testpar/API/H5_api_datatype_test_parallel.c index a6234042258..6b5faf2d04e 100644 --- a/testpar/API/H5_api_datatype_test_parallel.c +++ b/testpar/API/H5_api_datatype_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_datatype_test_parallel.h" -/* - * The array of parallel datatype tests to be performed. - */ -static int (*par_datatype_tests[])(void) = {NULL}; +static void print_datatype_test_header(const void *params); -int -H5_api_datatype_test_parallel(void) +static void +print_datatype_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Datatype Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_datatype_tests); i++) { - /* nerrors += (*par_datatype_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_datatype_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_datatype_test_header", print_datatype_test_header, NULL, NULL, NULL, 0, + "Prints header for datatype tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_datatype_test_parallel.h b/testpar/API/H5_api_datatype_test_parallel.h index 9f169fdc8ed..4524debfc81 100644 --- a/testpar/API/H5_api_datatype_test_parallel.h +++ b/testpar/API/H5_api_datatype_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_datatype_test_parallel(void); +void H5_api_datatype_test_parallel_add(void); #endif /* H5_API_DATATYPE_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_file_test_parallel.c b/testpar/API/H5_api_file_test_parallel.c index 70f37c00405..c86517c7347 100644 --- a/testpar/API/H5_api_file_test_parallel.c +++ b/testpar/API/H5_api_file_test_parallel.c @@ -12,25 +12,30 @@ #include "H5_api_file_test_parallel.h" -static int test_create_file(void); -static int test_open_file(void); -static int test_split_comm_file_access(void); +static void print_file_test_header(const void *params); +static void test_create_file(const void *params); +static void test_open_file(const void *params); +static void test_split_comm_file_access(const void *params); -/* - * The array of parallel file tests to be performed. - */ -static int (*par_file_tests[])(void) = { - test_create_file, - test_open_file, - test_split_comm_file_access, -}; +static void +print_file_test_header(const void H5_ATTR_UNUSED *params) +{ + if (MAINPROCESS) { + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Parallel File Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + } +} /* * A test to ensure that a file can be created in parallel. */ #define FILE_CREATE_TEST_FILENAME "test_file_parallel.h5" -static int -test_create_file(void) +static void +test_create_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -41,7 +46,7 @@ test_create_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -53,31 +58,35 @@ test_create_file(void) goto error; } - if (H5Pclose(fapl_id) < 0) - TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(FILE_CREATE_TEST_FILENAME, fapl_id) < 0) + TEST_ERROR; + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { - H5Pclose(fapl_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(FILE_CREATE_TEST_FILENAME, fapl_id); + H5Pclose(fapl_id); } H5E_END_TRY - return 1; + return; } /* * A test to ensure that a file can be opened in parallel. */ -static int -test_open_file(void) +static void +test_open_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -88,7 +97,7 @@ test_open_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -159,7 +168,7 @@ test_open_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -169,7 +178,7 @@ test_open_file(void) } H5E_END_TRY - return 1; + return; } /* @@ -185,8 +194,8 @@ test_open_file(void) * sooner or later due to MPI_Barrier calls being mixed up. */ #define SPLIT_FILE_COMM_TEST_FILE_NAME "split_comm_file.h5" -static int -test_split_comm_file_access(void) +static void +test_split_comm_file_access(const void H5_ATTR_UNUSED *params) { MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; @@ -202,7 +211,7 @@ test_split_comm_file_access(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } /* set up MPI parameters */ @@ -251,7 +260,7 @@ test_split_comm_file_access(void) } /* delete the test file */ - if (H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, fapl_id) < 0) { + if (GetTestCleanup() && H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, fapl_id) < 0) { H5_FAILED(); printf(" failed to delete file '%s'\n", SPLIT_FILE_COMM_TEST_FILE_NAME); err_occurred = 1; @@ -294,74 +303,30 @@ test_split_comm_file_access(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { - H5Pclose(fapl_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, fapl_id); + H5Pclose(fapl_id); } H5E_END_TRY - return 1; + return; } -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) +void +H5_api_file_test_parallel_add(void) { - hid_t fapl_id = H5I_INVALID_HID; - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) { - if (MAINPROCESS) - printf(" failed to create FAPL for deleting test files\n"); - return; - } - - H5Fdelete(FILE_CREATE_TEST_FILENAME, fapl_id); - - /* The below file is deleted as part of the test */ - /* H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, H5P_DEFAULT); */ - - if (H5Pclose(fapl_id) < 0) { - if (MAINPROCESS) - printf(" failed to close FAPL used for deleting test files\n"); - return; - } -} - -int -H5_api_file_test_parallel(void) -{ - size_t i; - int nerrors; - - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel File Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_file_tests); i++) { - nerrors += (*par_file_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) { - printf("\n"); - printf("Cleaning up testing files\n"); - } - - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_file_test_header", print_file_test_header, NULL, NULL, NULL, 0, + "Prints header for file tests"); + + AddTest("test_create_file", test_create_file, NULL, NULL, NULL, 0, "H5Fcreate"); + AddTest("test_open_file", test_open_file, NULL, NULL, NULL, 0, "H5Fopen"); + AddTest("test_split_comm_file_access", test_split_comm_file_access, NULL, NULL, NULL, 0, + "file access with a split communicator"); } diff --git a/testpar/API/H5_api_file_test_parallel.h b/testpar/API/H5_api_file_test_parallel.h index d7bf5522dea..057df817f57 100644 --- a/testpar/API/H5_api_file_test_parallel.h +++ b/testpar/API/H5_api_file_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_file_test_parallel(void); +void H5_api_file_test_parallel_add(void); #endif /* H5_API_FILE_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_group_test_parallel.c b/testpar/API/H5_api_group_test_parallel.c index f3e81cc4db7..ffacc870ac0 100644 --- a/testpar/API/H5_api_group_test_parallel.c +++ b/testpar/API/H5_api_group_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_group_test_parallel.h" -/* - * The array of parallel group tests to be performed. - */ -static int (*par_group_tests[])(void) = {NULL}; +static void print_group_test_header(const void *params); -int -H5_api_group_test_parallel(void) +static void +print_group_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Group Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_group_tests); i++) { - /* nerrors += (*par_group_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_group_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_group_test_header", print_group_test_header, NULL, NULL, NULL, 0, + "Prints header for group tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_group_test_parallel.h b/testpar/API/H5_api_group_test_parallel.h index a3201d13500..74897c602a6 100644 --- a/testpar/API/H5_api_group_test_parallel.h +++ b/testpar/API/H5_api_group_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_group_test_parallel(void); +void H5_api_group_test_parallel_add(void); #endif /* H5_API_GROUP_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_link_test_parallel.c b/testpar/API/H5_api_link_test_parallel.c index 33dcb002108..8df1d74ba24 100644 --- a/testpar/API/H5_api_link_test_parallel.c +++ b/testpar/API/H5_api_link_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_link_test_parallel.h" -/* - * The array of parallel link tests to be performed. - */ -static int (*par_link_tests[])(void) = {NULL}; +static void print_link_test_header(const void *params); -int -H5_api_link_test_parallel(void) +static void +print_link_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Link Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_link_tests); i++) { - /* nerrors += (*par_link_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_link_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_link_test_header", print_link_test_header, NULL, NULL, NULL, 0, + "Prints header for link tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_link_test_parallel.h b/testpar/API/H5_api_link_test_parallel.h index 72aaef22aed..0b0666c0e66 100644 --- a/testpar/API/H5_api_link_test_parallel.h +++ b/testpar/API/H5_api_link_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_link_test_parallel(void); +void H5_api_link_test_parallel_add(void); #endif /* H5_API_LINK_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_misc_test_parallel.c b/testpar/API/H5_api_misc_test_parallel.c index b8a9147633d..37ce0374bba 100644 --- a/testpar/API/H5_api_misc_test_parallel.c +++ b/testpar/API/H5_api_misc_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_misc_test_parallel.h" -/* - * The array of parallel miscellaneous tests to be performed. - */ -static int (*par_misc_tests[])(void) = {NULL}; +static void print_misc_test_header(const void *params); -int -H5_api_misc_test_parallel(void) +static void +print_misc_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Miscellaneous Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_misc_tests); i++) { - /* nerrors += (*par_misc_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_misc_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_misc_test_header", print_misc_test_header, NULL, NULL, NULL, 0, + "Prints header for miscellaneous tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_misc_test_parallel.h b/testpar/API/H5_api_misc_test_parallel.h index abe5ec0a163..cf1a33dc5bb 100644 --- a/testpar/API/H5_api_misc_test_parallel.h +++ b/testpar/API/H5_api_misc_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_misc_test_parallel(void); +void H5_api_misc_test_parallel_add(void); #endif /* H5_API_MISC_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_object_test_parallel.c b/testpar/API/H5_api_object_test_parallel.c index b475dfdf768..e7b3804281a 100644 --- a/testpar/API/H5_api_object_test_parallel.c +++ b/testpar/API/H5_api_object_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_object_test_parallel.h" -/* - * The array of parallel object tests to be performed. - */ -static int (*par_object_tests[])(void) = {NULL}; +static void print_object_test_header(const void *params); -int -H5_api_object_test_parallel(void) +static void +print_object_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Object Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_object_tests); i++) { - /* nerrors += (*par_object_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_object_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_object_test_header", print_object_test_header, NULL, NULL, NULL, 0, + "Prints header for object tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_object_test_parallel.h b/testpar/API/H5_api_object_test_parallel.h index 8e8e81739d4..66a47fb2fe2 100644 --- a/testpar/API/H5_api_object_test_parallel.h +++ b/testpar/API/H5_api_object_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_object_test_parallel(void); +void H5_api_object_test_parallel_add(void); #endif /* H5_API_OBJECT_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_test_parallel.c b/testpar/API/H5_api_test_parallel.c index 882cce2fdae..7a80c9b1bdd 100644 --- a/testpar/API/H5_api_test_parallel.c +++ b/testpar/API/H5_api_test_parallel.c @@ -46,27 +46,27 @@ int mpi_rank; #ifdef H5_API_TEST_HAVE_ASYNC #define H5_API_PARALLEL_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel, 1) \ - X(H5_API_TEST_ASYNC, "async", H5_api_async_test_parallel, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel_add, 1) \ + X(H5_API_TEST_ASYNC, "async", H5_api_async_test_parallel_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #else #define H5_API_PARALLEL_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #endif @@ -77,7 +77,7 @@ enum H5_api_test_type { H5_API_PARALLEL_TESTS }; static const char *const H5_api_test_name[] = {H5_API_PARALLEL_TESTS}; #undef X #define X(a, b, c, d) c, -static int (*H5_api_test_func[])(void) = {H5_API_PARALLEL_TESTS}; +static void (*H5_api_test_add_func[])(void) = {H5_API_PARALLEL_TESTS}; #undef X #define X(a, b, c, d) d, static int H5_api_test_enabled[] = {H5_API_PARALLEL_TESTS}; @@ -95,13 +95,13 @@ H5_api_test_name_to_type(const char *test_name) } static void -H5_api_test_run(void) +H5_api_test_add(void) { enum H5_api_test_type i; for (i = H5_API_TEST_FILE; i < H5_API_TEST_MAX; i++) if (H5_api_test_enabled[i]) - (void)H5_api_test_func[i](); + H5_api_test_add_func[i](); } hid_t @@ -169,9 +169,40 @@ generate_random_parallel_dimensions(int space_rank, hsize_t **dims_out) return -1; } +static int +parse_command_line(int argc, char **argv) +{ + /* Simple argument checking, TODO can improve that later */ + if (argc > 1) { + enum H5_api_test_type i = H5_api_test_name_to_type(argv[argc - 1]); + if (i != H5_API_TEST_NULL) { + /* Run only specific API test */ + memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); + H5_api_test_enabled[i] = 1; + } + } + + return 0; +} + +static void +usage(FILE *stream) +{ + fprintf(stream, "file run only the file interface tests\n"); + fprintf(stream, "group run only the group interface tests\n"); + fprintf(stream, "dataset run only the dataset interface tests\n"); + fprintf(stream, "attribute run only the attribute interface tests\n"); + fprintf(stream, "datatype run only the datatype interface tests\n"); + fprintf(stream, "link run only the link interface tests\n"); + fprintf(stream, "object run only the object interface tests\n"); + fprintf(stream, "misc run only the miscellaneous tests\n"); + fprintf(stream, "async run only the async interface tests\n"); +} + int main(int argc, char **argv) { + H5E_auto2_t default_err_func; const char *vol_connector_string; const char *vol_connector_name; unsigned seed; @@ -180,6 +211,7 @@ main(int argc, char **argv) hid_t registered_con_id = H5I_INVALID_HID; char *vol_connector_string_copy = NULL; char *vol_connector_info = NULL; + void *default_err_data = NULL; int required = MPI_THREAD_MULTIPLE; int provided; @@ -200,16 +232,6 @@ main(int argc, char **argv) printf("** INFO: couldn't initialize with MPI_THREAD_MULTIPLE threading support **\n"); } - /* Simple argument checking, TODO can improve that later */ - if (argc > 1) { - enum H5_api_test_type i = H5_api_test_name_to_type(argv[1]); - if (i != H5_API_TEST_NULL) { - /* Run only specific API test */ - memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); - H5_api_test_enabled[i] = 1; - } - } - /* * Make sure that HDF5 is initialized on all MPI ranks before proceeding. * This is important for certain VOL connectors which may require a @@ -217,6 +239,43 @@ main(int argc, char **argv) */ H5open(); + /* Store current error stack printing function since TestInit unsets it */ + H5Eget_auto2(H5E_DEFAULT, &default_err_func, &default_err_data); + + /* Initialize testing framework */ + if (TestInit(argv[0], usage, NULL, NULL, NULL, mpi_rank) < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't initialize testing framework\n"); + goto error; + } + + /* Reset error stack printing function */ + H5Eset_auto2(H5E_DEFAULT, default_err_func, default_err_data); + + /* Hide all output from testing framework and replace with our own */ + SetTestVerbosity(VERBO_NONE); + + /* Parse command line separately from the test framework since + * tests need to be added before TestParseCmdLine in order for + * the -help option to show them, but we need to know ahead of + * time which tests to add if only a specific interface's tests + * are going to be run. + */ + parse_command_line(argc, argv); + + /* Add tests */ + H5_api_test_add(); + + /* Display testing information */ + TestInfo(stdout); + + /* Parse command line arguments */ + if (TestParseCmdLine(argc, argv) < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't parse command-line arguments\n"); + goto error; + } + n_tests_run_g = 0; n_tests_passed_g = 0; n_tests_failed_g = 0; @@ -285,7 +344,7 @@ main(int argc, char **argv) printf(" - Test file name: '%s'\n", H5_api_test_parallel_filename); printf(" - Number of MPI ranks: %d\n", mpi_size); printf(" - Test seed: %u\n", seed); - printf("\n\n"); + printf("\n"); } BEGIN_INDEPENDENT_OP(create_fapl) @@ -389,19 +448,35 @@ main(int argc, char **argv) } END_INDEPENDENT_OP(create_test_container); - /* Run all the tests that are enabled */ - H5_api_test_run(); + MPI_Barrier(MPI_COMM_WORLD); + + /* Perform tests */ + if (PerformTests() < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't run tests\n"); + goto error; + } if (MAINPROCESS) - printf("Cleaning up testing files\n"); - H5Fdelete(H5_api_test_parallel_filename, fapl_id); + printf("\n"); + + if (MAINPROCESS) { + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(stdout); + + printf("Deleting container file for tests\n\n"); + } + + if (GetTestCleanup()) + H5Fdelete(H5_api_test_parallel_filename, fapl_id); if (n_tests_run_g > 0) { if (MAINPROCESS) printf("The below statistics are minimum values due to the possibility of some ranks failing a " "test while others pass:\n"); - if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_passed_g, 1, MPI_UNSIGNED_LONG_LONG, MPI_MIN, + if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_passed_g, 1, H5_SIZE_T_AS_MPI_TYPE, MPI_MIN, MPI_COMM_WORLD)) { if (MAINPROCESS) printf(" failed to collect consensus about the minimum number of tests that passed -- " @@ -413,7 +488,7 @@ main(int argc, char **argv) n_tests_passed_g > 0 ? "At least " : "", n_tests_passed_g, n_tests_run_g, ((double)n_tests_passed_g / (double)n_tests_run_g * 100.0), vol_connector_name); - if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_failed_g, 1, MPI_UNSIGNED_LONG_LONG, MPI_MIN, + if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_failed_g, 1, H5_SIZE_T_AS_MPI_TYPE, MPI_MIN, MPI_COMM_WORLD)) { if (MAINPROCESS) printf(" failed to collect consensus about the minimum number of tests that failed -- " @@ -446,11 +521,28 @@ main(int argc, char **argv) fprintf(stderr, " failed to close MPI FAPL\n"); } + free(vol_connector_string_copy); + vol_connector_string_copy = NULL; + + if (GetTestNumErrs() > 0) + n_tests_failed_g += (size_t)GetTestNumErrs(); + + /* Release test infrastructure */ + if (TestShutdown() < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't shut down testing framework\n"); + goto error; + } + H5close(); MPI_Finalize(); - exit(EXIT_SUCCESS); + /* Exit failure if errors encountered; else exit success. */ + if (n_tests_failed_g > 0) + exit(EXIT_FAILURE); + else + exit(EXIT_SUCCESS); error: free(vol_connector_string_copy);