From db94aed483dfcd663ca89076371739810734e4d5 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Fri, 12 Jul 2024 18:00:54 -0500 Subject: [PATCH] Integrate API tests with testing framework Allows skipping of individual tests by interface or by name --- test/API/CMakeLists.txt | 4 - test/API/H5_api_async_test.c | 294 +++-- test/API/H5_api_async_test.h | 2 +- test/API/H5_api_attribute_test.c | 556 ++++----- test/API/H5_api_attribute_test.h | 2 +- test/API/H5_api_dataset_test.c | 997 ++++++++-------- test/API/H5_api_dataset_test.h | 2 +- test/API/H5_api_datatype_test.c | 297 ++--- test/API/H5_api_datatype_test.h | 2 +- test/API/H5_api_file_test.c | 323 ++--- test/API/H5_api_file_test.h | 2 +- test/API/H5_api_group_test.c | 273 ++--- test/API/H5_api_group_test.h | 2 +- test/API/H5_api_link_test.c | 1105 +++++++++++------- test/API/H5_api_link_test.h | 3 +- test/API/H5_api_misc_test.c | 114 +- test/API/H5_api_misc_test.h | 2 +- test/API/H5_api_object_test.c | 409 +++---- test/API/H5_api_object_test.h | 2 +- test/API/H5_api_test.c | 141 ++- test/API/H5_api_test_util.c | 4 + test/event_set.c | 2 +- testpar/API/CMakeLists.txt | 5 - testpar/API/H5_api_async_test_parallel.c | 473 ++++---- testpar/API/H5_api_async_test_parallel.h | 2 +- testpar/API/H5_api_attribute_test_parallel.c | 33 +- testpar/API/H5_api_attribute_test_parallel.h | 2 +- testpar/API/H5_api_dataset_test_parallel.c | 352 +++--- testpar/API/H5_api_dataset_test_parallel.h | 2 +- testpar/API/H5_api_datatype_test_parallel.c | 33 +- testpar/API/H5_api_datatype_test_parallel.h | 2 +- testpar/API/H5_api_file_test_parallel.c | 126 +- testpar/API/H5_api_file_test_parallel.h | 2 +- testpar/API/H5_api_group_test_parallel.c | 32 +- testpar/API/H5_api_group_test_parallel.h | 2 +- testpar/API/H5_api_link_test_parallel.c | 32 +- testpar/API/H5_api_link_test_parallel.h | 2 +- testpar/API/H5_api_misc_test_parallel.c | 33 +- testpar/API/H5_api_misc_test_parallel.h | 2 +- testpar/API/H5_api_object_test_parallel.c | 33 +- testpar/API/H5_api_object_test_parallel.h | 2 +- testpar/API/H5_api_test_parallel.c | 155 ++- 42 files changed, 3149 insertions(+), 2714 deletions(-) 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..e40f929a7b3 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(void); -/* - * 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(void) +{ + 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(void); +static void test_multi_dataset_io(void); +static void test_multi_file_dataset_io(void); +static void test_multi_file_grp_dset_io(void); +static void test_set_extent(void); +static void test_attribute_exists(void); +static void test_attribute_io(void); +static void test_attribute_io_tconv(void); +static void test_attribute_io_compound(void); +static void test_group(void); +static void test_link(void); +static void test_ocopy_orefresh(void); +static void test_file_reopen(void); +static void test_file_cleanup(void); /* Highest "printf" file created (starting at 0) */ int max_printf_file = -1; @@ -53,7 +52,7 @@ int max_printf_file = -1; /* * Create file and dataset, write to dataset */ -static int +static void test_one_dataset_io(void) { hid_t file_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,13 +313,13 @@ 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 +static void test_multi_dataset_io(void) { hid_t file_id = 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,14 +567,14 @@ 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 +static void test_multi_file_dataset_io(void) { hid_t file_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,14 +877,14 @@ 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 +static void test_multi_file_grp_dset_io(void) { hid_t file_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,13 +1186,13 @@ 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 +static void test_set_extent(void) { hid_t file_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,13 +1401,13 @@ test_set_extent(void) } H5E_END_TRY - return 1; + return; } /* end test_set_extent() */ /* * Test H5Aexists() */ -static int +static void test_attribute_exists(void) { hid_t file_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,13 +1522,13 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io() */ /* * Create file, dataset, and attribute, write to attribute */ -static int +static void test_attribute_io(void) { hid_t file_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,13 +1666,13 @@ 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 +static void test_attribute_io_tconv(void) { hid_t file_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,7 +1813,7 @@ typedef struct tattr_cmpd_t { int b; } tattr_cmpd_t; -static int +static void test_attribute_io_compound(void) { hid_t file_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,13 +2117,13 @@ test_attribute_io_compound(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io_compound() */ /* * Test group interfaces */ -static int +static void test_group(void) { hid_t file_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,13 +2285,13 @@ test_group(void) } H5E_END_TRY - return 1; + return; } /* end test_group() */ /* * Test link interfaces */ -static int +static void test_link(void) { hid_t file_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,13 +2482,13 @@ test_link(void) } H5E_END_TRY - return 1; + return; } /* end test_link() */ /* * Test H5Ocopy() and H5Orefresh() */ -static int +static void test_ocopy_orefresh(void) { hid_t file_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,13 +2597,13 @@ test_ocopy_orefresh(void) } H5E_END_TRY - return 1; + return; } /* end test_ocopy_orefresh() */ /* * Test H5Freopen() */ -static int +static void test_file_reopen(void) { hid_t 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(void) { char file_name[64]; int i; @@ -2679,54 +2686,43 @@ 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, "Prints header for async tests", NULL); + + AddTest("test_one_dataset_io", test_one_dataset_io, NULL, "single dataset I/O", NULL); + AddTest("test_multi_dataset_io", test_multi_dataset_io, NULL, "multi dataset I/O", NULL); + AddTest("test_multi_file_dataset_io", test_multi_file_dataset_io, NULL, "multi file dataset I/O", NULL); + AddTest("test_multi_file_grp_dset_io", test_multi_file_grp_dset_io, NULL, + "multi file dataset I/O with groups", NULL); + AddTest("test_set_extent", test_set_extent, NULL, "H5Dset_extent() and H5Dget_space()", NULL); + AddTest("test_attribute_exists", test_attribute_exists, NULL, "H5Aexists()", NULL); + AddTest("test_attribute_io", test_attribute_io, NULL, "attribute I/O", NULL); + AddTest("test_attribute_io_tconv", test_attribute_io_tconv, NULL, "attribute I/O with type conversion", + NULL); + AddTest("test_attribute_io_compound", test_attribute_io_compound, NULL, + "attribute I/O with compound type conversion", NULL); + AddTest("test_group", test_group, NULL, "group operations", NULL); + AddTest("test_link", test_link, NULL, "link operations", NULL); + AddTest("test_ocopy_orefresh", test_ocopy_orefresh, NULL, "H5Ocopy() and H5Orefresh()", NULL); + AddTest("test_file_reopen", test_file_reopen, NULL, "H5Freopen()", NULL); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_file_cleanup", test_file_cleanup, NULL, "cleanup test files", NULL); } -#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, "Prints header for async tests", NULL); } -#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..76be0b153ad 100644 --- a/test/API/H5_api_attribute_test.c +++ b/test/API/H5_api_attribute_test.c @@ -20,103 +20,70 @@ * 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(void); +static void test_create_attribute_on_root(void); +static void test_create_attribute_on_dataset(void); +static void test_create_attribute_on_datatype(void); +static void test_create_attribute_with_null_space(void); +static void test_create_attribute_with_scalar_space(void); +static void test_create_attribute_with_space_in_name(void); +static void test_create_attribute_invalid_params(void); +static void test_open_attribute(void); +static void test_open_attribute_invalid_params(void); +static void test_write_attribute(void); +static void test_write_attribute_invalid_params(void); +static void test_read_attribute(void); +static void test_read_attribute_invalid_params(void); +static void test_read_empty_attribute(void); +static void test_close_attribute_invalid_id(void); +static void test_get_attribute_space_and_type(void); +static void test_get_attribute_space_and_type_invalid_params(void); +static void test_attribute_property_lists(void); +static void test_get_attribute_name(void); +static void test_get_attribute_name_invalid_params(void); +static void test_get_attribute_storage_size(void); +static void test_get_attribute_info(void); +static void test_get_attribute_info_invalid_params(void); +static void test_rename_attribute(void); +static void test_rename_attribute_invalid_params(void); +static void test_attribute_iterate_group(void); +static void test_attribute_iterate_dataset(void); +static void test_attribute_iterate_datatype(void); +static void test_attribute_iterate_index_saving(void); +static void test_attribute_iterate_invalid_params(void); +static void test_attribute_iterate_0_attributes(void); +static void test_attribute_compound_subset(void); +static void test_attribute_string_encodings(void); +static void test_delete_attribute(void); +static void test_delete_attribute_invalid_params(void); +static void test_attribute_exists(void); +static void test_attribute_exists_invalid_params(void); +static void test_attribute_many(void); +static void test_attribute_duplicate_id(void); +static void test_get_number_attributes(void); +static void test_attr_shared_dtype(void); 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(void) +{ + 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 +static void test_create_attribute_on_root(void) { htri_t attr_exists; @@ -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,14 +213,14 @@ 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 +static void test_create_attribute_on_dataset(void) { htri_t attr_exists; @@ -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,14 +398,14 @@ 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 +static void test_create_attribute_on_datatype(void) { htri_t attr_exists; @@ -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,14 +573,14 @@ 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 +static void test_create_attribute_with_null_space(void) { htri_t attr_exists; @@ -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,14 +684,14 @@ 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 +static void test_create_attribute_with_scalar_space(void) { htri_t attr_exists; @@ -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,14 +795,14 @@ 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 +static void test_create_attribute_with_space_in_name(void) { htri_t attr_exists; @@ -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,14 +901,14 @@ 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 +static void test_create_attribute_invalid_params(void) { hid_t file_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,13 +1345,13 @@ test_create_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aopen(_by_idx). */ -static int +static void test_open_attribute(void) { hid_t file_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,14 +1748,14 @@ 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 +static void test_open_attribute_invalid_params(void) { hid_t file_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,14 +2263,14 @@ 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 +static void test_write_attribute(void) { hsize_t dims[ATTRIBUTE_WRITE_TEST_SPACE_RANK]; @@ -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,14 +2392,14 @@ 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 +static void test_write_attribute_invalid_params(void) { hsize_t dims[ATTRIBUTE_WRITE_INVALID_PARAMS_TEST_SPACE_RANK]; @@ -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,7 +2589,7 @@ test_write_attribute_invalid_params(void) * and verified after it has been written to an * attribute. */ -static int +static void test_read_attribute(void) { hsize_t dims[ATTRIBUTE_READ_TEST_SPACE_RANK]; @@ -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,14 +2737,14 @@ 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 +static void test_read_attribute_invalid_params(void) { hsize_t dims[ATTRIBUTE_READ_INVALID_PARAMS_TEST_SPACE_RANK]; @@ -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,13 +2951,13 @@ test_read_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * Test reading an empty attribute is ok */ -static int +static void test_read_empty_attribute(void) { hsize_t dims[ATTRIBUTE_READ_EMPTY_SPACE_RANK]; @@ -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,13 +3078,13 @@ 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 +static void test_close_attribute_invalid_id(void) { herr_t err_ret = -1; @@ -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,7 +3139,7 @@ test_close_attribute_invalid_id(void) * dataspace and datatype can be retrieved with * H5Aget_space and H5Aget_type, respectively. */ -static int +static void test_get_attribute_space_and_type(void) { hsize_t attr_dims[ATTRIBUTE_GET_SPACE_TYPE_TEST_SPACE_RANK]; @@ -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,7 +3444,7 @@ test_get_attribute_space_and_type(void) * can't be retrieved when H5Aget_space and H5Aget_type are passed * invalid parameters, respectively. */ -static int +static void test_get_attribute_space_and_type_invalid_params(void) { htri_t attr_exists; @@ -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,7 +3605,7 @@ 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 +static void test_attribute_property_lists(void) { H5T_cset_t encoding = H5T_CSET_UTF8; @@ -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,7 +3890,7 @@ test_attribute_property_lists(void) * correctly retrieved with H5Aget_name and * H5Aget_name_by_idx. */ -static int +static void test_get_attribute_name(void) { ssize_t name_buf_size; @@ -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,7 +4387,7 @@ test_get_attribute_name(void) * retrieved when H5Aget_name(_by_idx) is passed invalid * parameters. */ -static int +static void test_get_attribute_name_invalid_params(void) { ssize_t name_buf_size; @@ -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,26 +4737,26 @@ test_get_attribute_name_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aget_storage_size. */ -static int +static void test_get_attribute_storage_size(void) { TESTING("H5Aget_storage_size"); SKIPPED(); - return 0; + return; } /* * A test to check the functionality of H5Aget_info(_by_idx). */ -static int +static void test_get_attribute_info(void) { H5A_info_t attr_info; @@ -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,14 +5397,14 @@ 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 +static void test_get_attribute_info_invalid_params(void) { H5A_info_t attr_info; @@ -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,14 +5859,14 @@ 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 +static void test_rename_attribute(void) { htri_t attr_exists; @@ -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,14 +6076,14 @@ 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 +static void test_rename_attribute_invalid_params(void) { htri_t attr_exists; @@ -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,7 +6455,7 @@ test_rename_attribute_invalid_params(void) * order of both attribute name and attribute * creation order. */ -static int +static void test_attribute_iterate_group(void) { size_t link_counter; @@ -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,7 +6847,7 @@ test_attribute_iterate_group(void) * order of both attribute name and attribute * creation order. */ -static int +static void test_attribute_iterate_dataset(void) { size_t link_counter; @@ -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,7 +7271,7 @@ test_attribute_iterate_dataset(void) * decreasing order of both attribute name and attribute * creation order. */ -static int +static void test_attribute_iterate_datatype(void) { size_t link_counter; @@ -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 +static void test_attribute_iterate_index_saving(void) { TESTING("attribute iteration index saving capability"); SKIPPED(); - return 1; + return; } /* @@ -7734,7 +7701,7 @@ test_attribute_iterate_index_saving(void) * be iterated over when H5Aiterate(_by_name) is * passed invalid parameters. */ -static int +static void test_attribute_iterate_invalid_params(void) { herr_t err_ret = -1; @@ -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,7 +8122,7 @@ test_attribute_iterate_invalid_params(void) * on an object with no attributes attached to it is * not problematic. */ -static int +static void test_attribute_iterate_0_attributes(void) { hid_t file_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,7 +8314,7 @@ 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 +static void test_attribute_compound_subset(void) { hsize_t dims[1] = {ATTRIBUTE_COMPOUND_IO_ATTR_DIMS}; @@ -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,14 +8564,14 @@ 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 +static void test_attribute_string_encodings(void) { hid_t file_id = 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,14 +8828,14 @@ 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 +static void test_delete_attribute(void) { htri_t attr_exists; @@ -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,7 +10068,7 @@ test_delete_attribute(void) * when H5Adelete(_by_name/_by_idx) is passed invalid * parameters. */ -static int +static void test_delete_attribute_invalid_params(void) { herr_t err_ret = -1; @@ -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,13 +10480,13 @@ test_delete_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aexists and H5Aexists_by_name. */ -static int +static void test_attribute_exists(void) { htri_t attr_exists; @@ -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,14 +10620,14 @@ 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 +static void test_attribute_exists_invalid_params(void) { herr_t err_ret = -1; @@ -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,14 +10897,14 @@ 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 +static void test_attribute_many(void) { unsigned u; @@ -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,14 +11007,14 @@ 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 +static void test_attribute_duplicate_id(void) { htri_t attr_exists; @@ -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,7 +11129,7 @@ test_attribute_duplicate_id(void) * * XXX: Cover all of the cases and move to H5O tests. */ -static int +static void test_get_number_attributes(void) { H5O_info2_t obj_info; @@ -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,7 +11308,7 @@ test_get_number_attributes(void) * * XXX: May move to H5O tests. */ -static int +static void test_attr_shared_dtype(void) { H5O_info2_t obj_info; @@ -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,87 @@ 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, + "Prints header for attribute tests", NULL); + + AddTest("test_create_attribute_on_root", test_create_attribute_on_root, NULL, + "attribute creation on the root group", NULL); + AddTest("test_create_attribute_on_dataset", test_create_attribute_on_dataset, NULL, + "attribute creation on a dataset", NULL); + AddTest("test_create_attribute_on_datatype", test_create_attribute_on_datatype, NULL, + "attribute creation on a committed datatype", NULL); + AddTest("test_create_attribute_with_null_space", test_create_attribute_with_null_space, NULL, + "attribute creation with a NULL dataspace", NULL); + AddTest("test_create_attribute_with_scalar_space", test_create_attribute_with_scalar_space, NULL, + "attribute creation with a SCALAR dataspace", NULL); + AddTest("test_create_attribute_with_space_in_name", test_create_attribute_with_space_in_name, NULL, + "attribute creation with a space in attribute's name", NULL); + AddTest("test_create_attribute_invalid_params", test_create_attribute_invalid_params, NULL, + "attribute creation with invalid parameters", NULL); + AddTest("test_open_attribute", test_open_attribute, NULL, "attribute opening", NULL); + AddTest("test_open_attribute_invalid_params", test_open_attribute_invalid_params, NULL, + "attribute opening with invalid parameters", NULL); + AddTest("test_write_attribute", test_write_attribute, NULL, "H5Awrite", NULL); + AddTest("test_write_attribute_invalid_params", test_write_attribute_invalid_params, NULL, + "H5Awrite with invalid parameters", NULL); + AddTest("test_read_attribute", test_read_attribute, NULL, "H5Aread", NULL); + AddTest("test_read_attribute_invalid_params", test_read_attribute_invalid_params, NULL, + "H5Aread with invalid parameters", NULL); + AddTest("test_read_empty_attribute", test_read_empty_attribute, NULL, "reading an empty attribute", NULL); + AddTest("test_close_attribute_invalid_id", test_close_attribute_invalid_id, NULL, + "H5Aclose with an invalid attribute ID", NULL); + AddTest("test_get_attribute_space_and_type", test_get_attribute_space_and_type, NULL, + "retrieval of an attribute's dataspace and datatype", NULL); + AddTest("test_get_attribute_space_and_type_invalid_params", + test_get_attribute_space_and_type_invalid_params, NULL, + "H5Aget_type/H5Aget_space with invalid parameters", NULL); + AddTest("test_attribute_property_lists", test_attribute_property_lists, NULL, + "attribute property list operations", NULL); + AddTest("test_get_attribute_name", test_get_attribute_name, NULL, "retrieval of an attribute's name", + NULL); + AddTest("test_get_attribute_name_invalid_params", test_get_attribute_name_invalid_params, NULL, + "retrieval of an attribute's name with invalid parameters", NULL); + AddTest("test_get_attribute_storage_size", test_get_attribute_storage_size, NULL, "H5Aget_storage_size", + NULL); + AddTest("test_get_attribute_info", test_get_attribute_info, NULL, "retrieval of attribute info", NULL); + AddTest("test_get_attribute_info_invalid_params", test_get_attribute_info_invalid_params, NULL, + "retrieval of attribute info with invalid parameters", NULL); + AddTest("test_rename_attribute", test_rename_attribute, NULL, "attribute renaming", NULL); + AddTest("test_rename_attribute_invalid_params", test_rename_attribute_invalid_params, NULL, + "attribute renaming with invalid parameters", NULL); + AddTest("test_attribute_iterate_group", test_attribute_iterate_group, NULL, + "attribute iteration on a group", NULL); + AddTest("test_attribute_iterate_dataset", test_attribute_iterate_dataset, NULL, + "attribute iteration on a dataset", NULL); + AddTest("test_attribute_iterate_datatype", test_attribute_iterate_datatype, NULL, + "attribute iteration on a committed datatype", NULL); + AddTest("test_attribute_iterate_index_saving", test_attribute_iterate_index_saving, NULL, + "attribute iteration index saving capability", NULL); + AddTest("test_attribute_iterate_invalid_params", test_attribute_iterate_invalid_params, NULL, + "attribute iteration with invalid parameters", NULL); + AddTest("test_attribute_iterate_0_attributes", test_attribute_iterate_0_attributes, NULL, + "attribute iteration on object with 0 attributes", NULL); + AddTest("test_attribute_compound_subset", test_attribute_compound_subset, NULL, + "verification of attribute data using H5Awrite then H5Aread with compound type subsets", NULL); + AddTest("test_attribute_string_encodings", test_attribute_string_encodings, NULL, + "string encoding read/write correctness on attributes", NULL); + AddTest("test_delete_attribute", test_delete_attribute, NULL, "attribute deletion", NULL); + AddTest("test_delete_attribute_invalid_params", test_delete_attribute_invalid_params, NULL, + "attribute deletion with invalid parameters", NULL); + AddTest("test_attribute_exists", test_attribute_exists, NULL, "attribute existence", NULL); + AddTest("test_attribute_exists_invalid_params", test_attribute_exists_invalid_params, NULL, + "attribute existence with invalid parameters", NULL); + AddTest("test_attribute_duplicate_id", test_attribute_duplicate_id, NULL, + "duplicated IDs for an attribute", NULL); + AddTest("test_attribute_many", test_attribute_many, NULL, "creating many attributes", NULL); + AddTest("test_get_number_attributes", test_get_number_attributes, NULL, + "retrieval of the number of attributes on an object", NULL); + AddTest("test_attr_shared_dtype", test_attr_shared_dtype, NULL, "shared datatype for attributes", NULL); } 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..2da61700111 100644 --- a/test/API/H5_api_dataset_test.c +++ b/test/API/H5_api_dataset_test.c @@ -16,170 +16,105 @@ * 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(void); +static void test_create_dataset_under_root(void); +static void test_create_dataset_under_existing_group(void); +static void test_create_dataset_invalid_params(void); +static void test_create_anonymous_dataset(void); +static void test_create_anonymous_dataset_invalid_params(void); +static void test_create_dataset_null_space(void); +static void test_create_dataset_scalar_space(void); +static void test_create_zero_dim_dset(void); +static void test_create_dataset_random_shapes(void); +static void test_create_dataset_predefined_types(void); +static void test_create_dataset_string_types(void); +static void test_create_dataset_compound_types(void); +static void test_create_dataset_enum_types(void); +static void test_create_dataset_array_types(void); +static void test_create_dataset_creation_properties(void); +static void test_create_many_dataset(void); +static void test_open_dataset(void); +static void test_open_dataset_invalid_params(void); +static void test_close_dataset_invalid_params(void); +static void test_get_dataset_space_and_type(void); +static void test_get_dataset_space_and_type_invalid_params(void); +static void test_get_dataset_space_status(void); +static void test_get_dataset_space_status_invalid_params(void); +static void test_dataset_property_lists(void); +static void test_get_dataset_storage_size(void); +static void test_get_dataset_storage_size_invalid_params(void); +static void test_get_dataset_chunk_storage_size(void); +static void test_get_dataset_chunk_storage_size_invalid_params(void); +static void test_get_dataset_offset(void); +static void test_get_dataset_offset_invalid_params(void); +static void test_read_dataset_small_all(void); +static void test_read_dataset_small_hyperslab(void); +static void test_read_dataset_small_point_selection(void); +static void test_read_multi_dataset_small_all(void); +static void test_read_multi_dataset_small_hyperslab(void); +static void test_read_multi_dataset_small_point_selection(void); +static void test_dataset_io_point_selections(void); +static void test_read_dataset_invalid_params(void); +static void test_write_dataset_small_all(void); +static void test_write_dataset_small_hyperslab(void); +static void test_write_dataset_small_point_selection(void); +static void test_write_dataset_data_verification(void); +static void test_write_multi_dataset_small_all(void); +static void test_write_multi_dataset_small_hyperslab(void); +static void test_write_multi_dataset_small_point_selection(void); +static void test_write_multi_dataset_data_verification(void); +static void test_write_dataset_invalid_params(void); +static void test_dataset_string_encodings(void); +static void test_dataset_builtin_type_conversion(void); +static void test_dataset_real_to_int_conversion(void); +static void test_dataset_compound_partial_io(void); +static void test_dataset_vlen_io(void); +static void test_dataset_set_extent_chunked_unlimited(void); +static void test_dataset_set_extent_chunked_fixed(void); +static void test_dataset_set_extent_data(void); +static void test_dataset_set_extent_double_handles(void); +static void test_dataset_set_extent_invalid_params(void); +static void test_flush_dataset(void); +static void test_flush_dataset_invalid_params(void); +static void test_refresh_dataset(void); +static void test_refresh_dataset_invalid_params(void); /* * 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(void); +static void test_write_single_chunk_dataset(void); +static void test_create_multi_chunk_dataset(void); +static void test_write_multi_chunk_dataset_same_shape_read(void); +static void test_write_multi_chunk_dataset_diff_shape_read(void); +static void test_overwrite_multi_chunk_dataset_same_shape_read(void); +static void test_overwrite_multi_chunk_dataset_diff_shape_read(void); +static void test_read_partial_chunk_all_selection(void); +static void test_read_partial_chunk_hyperslab_selection(void); +static void test_read_partial_chunk_point_selection(void); + +static void test_get_vlen_buf_size(void); + +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(void) +{ + 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 +static void test_create_dataset_under_root(void) { hid_t file_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,14 +174,14 @@ 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 +static void test_create_dataset_under_existing_group(void) { hid_t file_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,14 +262,14 @@ 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 +static void test_create_dataset_invalid_params(void) { hid_t file_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,13 +519,13 @@ 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 +static void test_create_anonymous_dataset(void) { hid_t file_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,7 +612,7 @@ test_create_anonymous_dataset(void) * be created when H5Dcreate_anon is passed invalid * parameters. */ -static int +static void test_create_anonymous_dataset_invalid_params(void) { hid_t file_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,14 +800,14 @@ 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 +static void test_create_dataset_null_space(void) { hid_t file_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,14 +897,14 @@ 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 +static void test_create_dataset_scalar_space(void) { hid_t file_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,14 +994,14 @@ 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 +static void test_create_zero_dim_dset(void) { hsize_t dims[ZERO_DIM_DSET_TEST_SPACE_RANK] = {0}; @@ -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,14 +1097,14 @@ 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 +static void test_create_dataset_random_shapes(void) { size_t i; @@ -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,7 +1203,7 @@ test_create_dataset_random_shapes(void) * each of the predefined integer and floating-point * datatypes. */ -static int +static void test_create_dataset_predefined_types(void) { size_t i; @@ -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,14 +1302,14 @@ 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 +static void test_create_dataset_string_types(void) { hid_t file_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,14 +1471,14 @@ 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 +static void test_create_dataset_compound_types(void) { size_t i, j; @@ -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,14 +1641,14 @@ 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 +static void test_create_dataset_enum_types(void) { size_t i; @@ -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,14 +1783,14 @@ 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 +static void test_create_dataset_array_types(void) { hsize_t array_dims1[DATASET_ARRAY_TYPE_TEST_RANK1]; @@ -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,7 +2001,7 @@ 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 +static void test_create_dataset_creation_properties(void) { hsize_t 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,14 +3080,14 @@ test_create_dataset_creation_properties(void) H5E_END_TRY - return 1; + return; } } /* * A test to create many small datasets (100,000) */ -static int +static void test_create_many_dataset(void) { hid_t file_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,28 +3183,28 @@ 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 +static void test_open_dataset(void) { TESTING("H5Dopen"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Dopen fails when it is * passed invalid parameters. */ -static int +static void test_open_dataset_invalid_params(void) { hid_t file_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,14 +3372,14 @@ 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 +static void test_close_dataset_invalid_params(void) { herr_t err_ret = -1; @@ -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,7 +3434,7 @@ test_close_dataset_invalid_params(void) * and datatype can be retrieved with H5Dget_space and * H5Dget_type, respectively. */ -static int +static void test_get_dataset_space_and_type(void) { hsize_t dset_dims[DATASET_GET_SPACE_TYPE_TEST_SPACE_RANK]; @@ -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,7 +3724,7 @@ test_get_dataset_space_and_type(void) * can't be retrieved when H5Dget_space and H5Dget_type are passed * invalid parameters, respectively. */ -static int +static void test_get_dataset_space_and_type_invalid_params(void) { hid_t file_id = 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 +static void test_get_dataset_space_status(void) { 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 +static void test_get_dataset_space_status_invalid_params(void) { 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 +static void test_dataset_property_lists(void) { 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 +static void test_get_dataset_storage_size(void) { 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 +static void test_get_dataset_storage_size_invalid_params(void) { TESTING("H5Dget_storage_size with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Dget_chunk_storage_size. */ -static int +static void test_get_dataset_chunk_storage_size(void) { 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 +static void test_get_dataset_chunk_storage_size_invalid_params(void) { TESTING("H5Dget_chunk_storage_size with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Dget_offset. */ -static int +static void test_get_dataset_offset(void) { TESTING("H5Dget_offset"); SKIPPED(); - return 0; + return; } /* @@ -4475,21 +4374,21 @@ test_get_dataset_offset(void) * retrieved when H5Dget_offset is passed invalid * parameters. */ -static int +static void test_get_dataset_offset_invalid_params(void) { 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 +static void test_read_dataset_small_all(void) { hsize_t dims[DATASET_SMALL_READ_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; @@ -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,14 +4486,14 @@ 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 +static void test_read_dataset_small_hyperslab(void) { hsize_t start[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,14 +4613,14 @@ 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 +static void test_read_dataset_small_point_selection(void) { hsize_t points[DATASET_SMALL_READ_TEST_POINT_SELECTION_NUM_POINTS * @@ -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,14 +4742,14 @@ 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 +static void test_read_multi_dataset_small_all(void) { @@ -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,14 +4868,14 @@ 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 +static void test_read_multi_dataset_small_hyperslab(void) { hsize_t start[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,14 +5021,14 @@ 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 +static void test_read_multi_dataset_small_point_selection(void) { hsize_t points[DATASET_SMALL_READ_TEST_POINT_SELECTION_NUM_POINTS * @@ -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,7 +5198,7 @@ test_read_multi_dataset_small_point_selection(void) ; \ } while ((J) < (I)); \ } -static int +static void test_dataset_io_point_selections(void) { hid_t file_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,14 +5672,14 @@ 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 +static void test_read_dataset_invalid_params(void) { hsize_t dims[DATASET_READ_INVALID_PARAMS_TEST_DSET_SPACE_RANK] = {10, 5, 3}; @@ -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,14 +5906,14 @@ 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 +static void test_write_dataset_small_all(void) { hssize_t space_npoints; @@ -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,14 +6034,14 @@ 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 +static void test_write_dataset_small_hyperslab(void) { hsize_t start[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,14 +6165,14 @@ 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 +static void test_write_dataset_small_point_selection(void) { hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * @@ -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,14 +6297,14 @@ 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 +static void test_write_dataset_data_verification(void) { hssize_t space_npoints; @@ -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,14 +6812,14 @@ 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 +static void test_write_multi_dataset_small_all(void) { hssize_t space_npoints; @@ -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,14 +6975,14 @@ 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 +static void test_write_multi_dataset_small_hyperslab(void) { hsize_t start[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,14 +7136,14 @@ 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 +static void test_write_multi_dataset_small_point_selection(void) { hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * @@ -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,14 +7299,14 @@ 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 +static void test_write_multi_dataset_data_verification(void) { hssize_t space_npoints[DATASET_MULTI_COUNT]; @@ -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,14 +7902,14 @@ 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 +static void test_write_dataset_invalid_params(void) { hssize_t space_npoints; @@ -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,14 +8143,14 @@ 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 +static void test_dataset_string_encodings(void) { hid_t file_id = 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,14 +8388,14 @@ 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 +static void test_dataset_builtin_type_conversion(void) { hssize_t space_npoints; @@ -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,10 +8926,10 @@ test_dataset_builtin_type_conversion(void) } H5E_END_TRY - return 1; + return; } -static int +static void test_dataset_real_to_int_conversion(void) { hssize_t space_npoints; @@ -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,7 +9480,7 @@ typedef struct dataset_compount_partial_io_t { int b; } dataset_compount_partial_io_t; -static int +static void test_dataset_compound_partial_io(void) { hsize_t dims[1] = {DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS}; @@ -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,12 +9730,12 @@ 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 +static void test_dataset_vlen_io(void) { hid_t file_id = 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,7 +10398,7 @@ test_dataset_vlen_io(void) * dimensions for the dataset, so the dimensionality of the * dataset may both shrink and grow. */ -static int +static void test_dataset_set_extent_chunked_unlimited(void) { hsize_t 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,7 +10631,7 @@ test_dataset_set_extent_chunked_unlimited(void) * dimensions for the dataset, so the dimensionality of the * dataset may only shrink. */ -static int +static void test_dataset_set_extent_chunked_fixed(void) { hsize_t dims[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,14 +10902,14 @@ 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 +static void test_dataset_set_extent_data(void) { hsize_t dims_origin[DATASET_SET_EXTENT_DATA_TEST_SPACE_RANK] = {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,7 +11249,7 @@ test_dataset_set_extent_data(void) * used to extend the dataset, then the other handle should * return the new size when queried. */ -static int +static void test_dataset_set_extent_double_handles(void) { hsize_t dims_origin[DATASET_SET_EXTENT_DOUBLE_HANDLES_TEST_SPACE_RANK] = { @@ -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,14 +11383,14 @@ 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 +static void test_dataset_set_extent_invalid_params(void) { hsize_t 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,67 +11646,67 @@ 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 +static void test_flush_dataset(void) { TESTING("H5Dflush"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Dflush fails when it is * passed invalid parameters. */ -static int +static void test_flush_dataset_invalid_params(void) { TESTING("H5Dflush with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Drefresh. */ -static int +static void test_refresh_dataset(void) { TESTING("H5Drefresh"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Drefresh fails when it is * passed invalid parameters. */ -static int +static void test_refresh_dataset_invalid_params(void) { - TESTING("H5Drefresh"); + TESTING("H5Drefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test to create a dataset composed of a single chunk. */ -static int +static void test_create_single_chunk_dataset(void) { hsize_t 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,14 +11877,14 @@ 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 +static void test_write_single_chunk_dataset(void) { hssize_t space_npoints; @@ -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,13 +12098,13 @@ test_write_single_chunk_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to create a dataset composed of multiple chunks. */ -static int +static void test_create_multi_chunk_dataset(void) { hsize_t dims[DATASET_MULTI_CHUNK_TEST_SPACE_RANK] = {100, 100}; @@ -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,7 +12285,7 @@ test_create_multi_chunk_dataset(void) * chunks of the dataset, the file dataspace and memory dataspace * used are the same shape. */ -static int +static void test_write_multi_chunk_dataset_same_shape_read(void) { hsize_t dims[DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; @@ -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,7 +12612,7 @@ 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 +static void test_write_multi_chunk_dataset_diff_shape_read(void) { hsize_t dims[DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; @@ -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,7 +12949,7 @@ 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 +static void test_overwrite_multi_chunk_dataset_same_shape_read(void) { hsize_t dims[DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; @@ -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,7 +13284,7 @@ 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 +static void test_overwrite_multi_chunk_dataset_diff_shape_read(void) { hsize_t dims[DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; @@ -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,7 +13632,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) */ #define FIXED_DIMSIZE 25 #define FIXED_CHUNK_DIMSIZE 10 -static int +static void test_read_partial_chunk_all_selection(void) { DATASET_PARTIAL_CHUNK_READ_ALL_SEL_TEST_DSET_CTYPE write_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,7 +13818,7 @@ 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 +static void test_read_partial_chunk_hyperslab_selection(void) { DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_CTYPE write_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 +static void test_read_partial_chunk_point_selection(void) { TESTING("reading a partial chunk using a point selection in file dataspace"); SKIPPED(); - return 1; + return; } /* #undef FIXED_DIMSIZE */ /* #undef FIXED_CHUNK_DIMSIZE */ @@ -14242,7 +14126,7 @@ test_read_partial_chunk_point_selection(void) * A test to verify that H5Dvlen_get_buf_size returns * correct size */ -static int +static void test_get_vlen_buf_size(void) { hvl_t wdata[DATASET_GET_VLEN_BUF_SIZE_DSET_SPACE_DIM]; /* Information to write */ @@ -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,159 @@ 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, "Prints header for dataset tests", + NULL); + + AddTest("test_create_dataset_under_root", test_create_dataset_under_root, NULL, + "dataset creation under root group", NULL); + AddTest("test_create_dataset_under_existing_group", test_create_dataset_under_existing_group, NULL, + "dataset creation under an existing group", NULL); + AddTest("test_create_dataset_invalid_params", test_create_dataset_invalid_params, NULL, + "H5Dcreate with invalid parameters", NULL); + AddTest("test_create_anonymous_dataset", test_create_anonymous_dataset, NULL, + "anonymous dataset creation", NULL); + AddTest("test_create_anonymous_dataset_invalid_params", test_create_anonymous_dataset_invalid_params, + NULL, "anonymous dataset creation with invalid parameters", NULL); + AddTest("test_create_dataset_null_space", test_create_dataset_null_space, NULL, + "dataset creation with a NULL dataspace", NULL); + AddTest("test_create_dataset_scalar_space", test_create_dataset_scalar_space, NULL, + "dataset creation with a SCALAR dataspace", NULL); + AddTest("test_create_zero_dim_dset", test_create_zero_dim_dset, NULL, "creation of 0-sized dataset", + NULL); + AddTest("test_create_dataset_random_shapes", test_create_dataset_random_shapes, NULL, + "dataset creation with random dimension sizes", NULL); + AddTest("test_create_dataset_predefined_types", test_create_dataset_predefined_types, NULL, + "dataset creation with predefined datatypes", NULL); + AddTest("test_create_dataset_string_types", test_create_dataset_string_types, NULL, + "dataset creation with string types", NULL); + AddTest("test_create_dataset_compound_types", test_create_dataset_compound_types, NULL, + "dataset creation with compound datatypes", NULL); + AddTest("test_create_dataset_enum_types", test_create_dataset_enum_types, NULL, + "dataset creation with enum types", NULL); + AddTest("test_create_dataset_array_types", test_create_dataset_array_types, NULL, + "dataset creation with array types", NULL); + AddTest("test_create_dataset_creation_properties", test_create_dataset_creation_properties, NULL, + "dataset creation properties", NULL); + AddTest("test_create_many_dataset", test_create_many_dataset, NULL, "creating many datasets", NULL); + AddTest("test_open_dataset", test_open_dataset, NULL, "H5Dopen", NULL); + AddTest("test_open_dataset_invalid_params", test_open_dataset_invalid_params, NULL, + "H5Dopen with invalid parameters", NULL); + AddTest("test_close_dataset_invalid_params", test_close_dataset_invalid_params, NULL, + "H5Dclose with an invalid dataset ID", NULL); + AddTest("test_get_dataset_space_and_type", test_get_dataset_space_and_type, NULL, + "retrieval of a dataset's dataspace and datatype", NULL); + AddTest("test_get_dataset_space_and_type_invalid_params", test_get_dataset_space_and_type_invalid_params, + NULL, "H5Dget_type/H5Dget_space with invalid parameters", NULL); + AddTest("test_get_dataset_space_status", test_get_dataset_space_status, NULL, "H5Dget_space_status", + NULL); + AddTest("test_get_dataset_space_status_invalid_params", test_get_dataset_space_status_invalid_params, + NULL, "H5Dget_space_status with invalid parameters", NULL); + AddTest("test_dataset_property_lists", test_dataset_property_lists, NULL, + "dataset property list operations", NULL); + AddTest("test_get_dataset_storage_size", test_get_dataset_storage_size, NULL, "H5Dget_storage_size", + NULL); + AddTest("test_get_dataset_storage_size_invalid_params", test_get_dataset_storage_size_invalid_params, + NULL, "H5Dget_storage_size with invalid parameters", NULL); + AddTest("test_get_dataset_chunk_storage_size", test_get_dataset_chunk_storage_size, NULL, + "H5Dget_chunk_storage_size", NULL); + AddTest("test_get_dataset_chunk_storage_size_invalid_params", + test_get_dataset_chunk_storage_size_invalid_params, NULL, + "H5Dget_chunk_storage_size with invalid parameters", NULL); + AddTest("test_get_dataset_offset", test_get_dataset_offset, NULL, "H5Dget_offset", NULL); + AddTest("test_get_dataset_offset_invalid_params", test_get_dataset_offset_invalid_params, NULL, + "H5Dget_offset with invalid parameters", NULL); + AddTest("test_read_dataset_small_all", test_read_dataset_small_all, NULL, + "small read from dataset with H5S_ALL", NULL); + AddTest("test_read_dataset_small_hyperslab", test_read_dataset_small_hyperslab, NULL, + "small read from dataset with a hyperslab selection", NULL); + AddTest("test_read_dataset_small_point_selection", test_read_dataset_small_point_selection, NULL, + "small read from dataset with a point selection", NULL); + AddTest("test_read_multi_dataset_small_all", test_read_multi_dataset_small_all, NULL, + "small multi read from datasets with H5S_ALL", NULL); + AddTest("test_read_multi_dataset_small_hyperslab", test_read_multi_dataset_small_hyperslab, NULL, + "small multi read from datasets with a hyperslab selection", NULL); + AddTest("test_read_multi_dataset_small_point_selection", test_read_multi_dataset_small_point_selection, + NULL, "small multi read from datasets with point selections", NULL); + AddTest("test_dataset_io_point_selections", test_dataset_io_point_selections, NULL, + "point selection I/O with all selection in memory and points in file", NULL); + AddTest("test_read_dataset_invalid_params", test_read_dataset_invalid_params, NULL, + "H5Dread with invalid parameters", NULL); + AddTest("test_dataset_string_encodings", test_dataset_string_encodings, NULL, + "string encoding read/write correctness on datasets", NULL); + AddTest("test_write_dataset_small_all", test_write_dataset_small_all, NULL, + "small write to dataset with H5S_ALL", NULL); + AddTest("test_write_dataset_small_hyperslab", test_write_dataset_small_hyperslab, NULL, + "small write to dataset with a hyperslab selection", NULL); + AddTest("test_write_dataset_small_point_selection", test_write_dataset_small_point_selection, NULL, + "small write to dataset with a point selection", NULL); + AddTest("test_write_dataset_data_verification", test_write_dataset_data_verification, NULL, + "verification of dataset data using H5Dwrite then H5Dread", NULL); + AddTest("test_write_multi_dataset_small_all", test_write_multi_dataset_small_all, NULL, + "small multi write to datasets with H5S_ALL", NULL); + AddTest("test_write_multi_dataset_small_hyperslab", test_write_multi_dataset_small_hyperslab, NULL, + "small multi write to datasets with hyperslab selections", NULL); + AddTest("test_write_multi_dataset_small_point_selection", test_write_multi_dataset_small_point_selection, + NULL, "small multi write to datasets with point selections", NULL); + AddTest("test_write_multi_dataset_data_verification", test_write_multi_dataset_data_verification, NULL, + "verification of datasets' data using H5Dwrite_multi then H5Dread_multi", NULL); + AddTest("test_write_dataset_invalid_params", test_write_dataset_invalid_params, NULL, + "H5Dwrite with invalid parameters", NULL); + AddTest("test_dataset_builtin_type_conversion", test_dataset_builtin_type_conversion, NULL, + "verification of dataset data using H5Dwrite then H5Dread with type conversion of builtin types", + NULL); + AddTest("test_dataset_real_to_int_conversion", test_dataset_real_to_int_conversion, NULL, + "verification of dataset data using H5Dwrite then H5Dread with real <-> integer type conversion", + NULL); + AddTest("test_dataset_compound_partial_io", test_dataset_compound_partial_io, NULL, + "verification of dataset data using H5Dwrite then H5Dread with partial element compound type I/O", + NULL); + AddTest("test_dataset_vlen_io", test_dataset_vlen_io, NULL, + "verification of dataset data with H5Dwrite and then H5D read with variable length sequence data", + NULL); + AddTest("test_dataset_set_extent_chunked_unlimited", test_dataset_set_extent_chunked_unlimited, NULL, + "H5Dset_extent on chunked dataset with unlimited dimensions", NULL); + AddTest("test_dataset_set_extent_chunked_fixed", test_dataset_set_extent_chunked_fixed, NULL, + "H5Dset_extent on chunked dataset with fixed dimensions", NULL); + AddTest("test_dataset_set_extent_data", test_dataset_set_extent_data, NULL, + "H5Dset_extent on data correctness", NULL); + AddTest("test_dataset_set_extent_double_handles", test_dataset_set_extent_double_handles, NULL, + "H5Dset_extent on double dataset handles", NULL); + AddTest("test_dataset_set_extent_invalid_params", test_dataset_set_extent_invalid_params, NULL, + "H5Dset_extent with invalid parameters", NULL); + AddTest("test_flush_dataset", test_flush_dataset, NULL, "H5Dflush", NULL); + AddTest("test_flush_dataset_invalid_params", test_flush_dataset_invalid_params, NULL, + "H5Dflush with invalid parameters", NULL); + AddTest("test_refresh_dataset", test_refresh_dataset, NULL, "H5Drefresh", NULL); + AddTest("test_refresh_dataset_invalid_params", test_refresh_dataset_invalid_params, NULL, + "H5Drefresh with invalid parameters", NULL); + AddTest("test_create_single_chunk_dataset", test_create_single_chunk_dataset, NULL, + "creation of dataset with single chunk", NULL); + AddTest("test_write_single_chunk_dataset", test_write_single_chunk_dataset, NULL, + "write to dataset with single chunk", NULL); + AddTest("test_create_multi_chunk_dataset", test_create_multi_chunk_dataset, NULL, + "creation of dataset with multiple chunks", NULL); + AddTest("test_write_multi_chunk_dataset_same_shape_read", test_write_multi_chunk_dataset_same_shape_read, + NULL, "write to dataset with multiple chunks using same shaped dataspaces", NULL); + AddTest("test_write_multi_chunk_dataset_diff_shape_read", test_write_multi_chunk_dataset_diff_shape_read, + NULL, "write to dataset with multiple chunks using differently shaped dataspaces", NULL); + AddTest("test_overwrite_multi_chunk_dataset_same_shape_read", + test_overwrite_multi_chunk_dataset_same_shape_read, NULL, + "several overwrites to dataset with multiple chunks using same shaped dataspaces", NULL); + AddTest("test_overwrite_multi_chunk_dataset_diff_shape_read", + test_overwrite_multi_chunk_dataset_diff_shape_read, NULL, + "several overwrites to dataset with multiple chunks using differently shaped dataspaces", NULL); + AddTest("test_read_partial_chunk_all_selection", test_read_partial_chunk_all_selection, NULL, + "reading a partial chunk using H5S_ALL for file dataspace", NULL); + AddTest("test_read_partial_chunk_hyperslab_selection", test_read_partial_chunk_hyperslab_selection, NULL, + "reading a partial chunk using a hyperslab selection in file dataspace", NULL); + AddTest("test_read_partial_chunk_point_selection", test_read_partial_chunk_point_selection, NULL, + "reading a partial chunk using a point selection in file dataspace", NULL); + AddTest("test_get_vlen_buf_size", test_get_vlen_buf_size, NULL, "H5Dvlen_get_buf_size", NULL); } 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..3a3d1ca3026 100644 --- a/test/API/H5_api_datatype_test.c +++ b/test/API/H5_api_datatype_test.c @@ -17,67 +17,48 @@ */ #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(void); +static void test_create_committed_datatype(void); +static void test_create_committed_datatype_invalid_params(void); +static void test_create_anonymous_committed_datatype(void); +static void test_create_anonymous_committed_datatype_invalid_params(void); #ifndef PROBLEMATIC_TESTS -static int test_create_committed_datatype_empty_types(void); +static void test_create_committed_datatype_empty_types(void); #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(void); +static void test_open_committed_datatype(void); +static void test_open_committed_datatype_invalid_params(void); +static void test_reopen_committed_datatype_indirect(void); +static void test_close_committed_datatype_invalid_id(void); +static void test_datatype_property_lists(void); +static void test_create_dataset_with_committed_type(void); +static void test_create_attribute_with_committed_type(void); +static void test_delete_committed_type(void); +static void test_resurrect_datatype(void); +static void test_flush_committed_datatype(void); +static void test_flush_committed_datatype_invalid_params(void); +static void test_refresh_committed_datatype(void); +static void test_refresh_committed_datatype_invalid_params(void); #ifndef PROBLEMATIC_TESTS -static int test_cant_commit_predefined(void); +static void test_cant_commit_predefined(void); #endif -static int test_cant_modify_committed_type(void); +static void test_cant_modify_committed_type(void); -/* - * 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(void) +{ + 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 +static void test_create_committed_datatype(void) { hid_t file_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,14 +131,14 @@ 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 +static void test_create_committed_datatype_invalid_params(void) { herr_t err_ret = -1; @@ -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,14 +353,14 @@ 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 +static void test_create_anonymous_committed_datatype(void) { hid_t file_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,14 +432,14 @@ 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 +static void test_create_anonymous_committed_datatype_invalid_params(void) { herr_t err_ret = -1; @@ -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,7 +605,7 @@ test_create_anonymous_committed_datatype_invalid_params(void) * compound and enum datatypes. */ #ifndef PROBLEMATIC_TESTS -static int +static void test_create_committed_datatype_empty_types(void) { herr_t err_ret = FAIL; @@ -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,14 +772,14 @@ 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 +static void test_recommit_committed_type(void) { htri_t is_committed = false; @@ -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,14 +879,14 @@ 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 +static void test_open_committed_datatype(void) { hid_t file_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,14 +968,14 @@ 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 +static void test_open_committed_datatype_invalid_params(void) { hid_t file_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,14 +1136,14 @@ 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 +static void test_reopen_committed_datatype_indirect(void) { size_t dt_size = 0; @@ -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,14 +1608,14 @@ 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 +static void test_close_committed_datatype_invalid_id(void) { herr_t err_ret = -1; @@ -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,7 +1671,7 @@ 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 +static void test_datatype_property_lists(void) { hid_t file_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,14 +1879,14 @@ 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 +static void test_create_dataset_with_committed_type(void) { hid_t file_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,14 +2022,14 @@ 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 +static void test_create_attribute_with_committed_type(void) { htri_t attr_exists; @@ -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,14 +2155,14 @@ 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 +static void test_delete_committed_type(void) { htri_t type_exists; @@ -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,14 +2267,14 @@ 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 +static void test_resurrect_datatype(void) { hid_t file_id = 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 +static void test_flush_committed_datatype(void) { TESTING("H5Tflush"); SKIPPED(); - return 0; + return; } -static int +static void test_flush_committed_datatype_invalid_params(void) { TESTING("H5Tflush with invalid parameters"); SKIPPED(); - return 0; + return; } -static int +static void test_refresh_committed_datatype(void) { TESTING("H5Trefresh"); SKIPPED(); - return 0; + return; } -static int +static void test_refresh_committed_datatype_invalid_params(void) { TESTING("H5Trefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -2476,7 +2457,7 @@ test_refresh_committed_datatype_invalid_params(void) * copied datatype. */ #ifndef PROBLEMATIC_TESTS -static int +static void test_cant_commit_predefined(void) { herr_t err_ret; @@ -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,14 +2528,14 @@ 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 +static void test_cant_modify_committed_type(void) { htri_t is_committed = false; @@ -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,62 @@ 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, + "Prints header for datatype tests", NULL); + + AddTest("test_create_committed_datatype", test_create_committed_datatype, NULL, + "creation of a committed datatype", NULL); + AddTest("test_create_committed_datatype_invalid_params", test_create_committed_datatype_invalid_params, + NULL, "H5Tcommit2 with invalid parameters", NULL); + AddTest("test_create_anonymous_committed_datatype", test_create_anonymous_committed_datatype, NULL, + "creation of anonymous committed datatype", NULL); + AddTest("test_create_anonymous_committed_datatype_invalid_params", + test_create_anonymous_committed_datatype_invalid_params, NULL, + "H5Tcommit_anon with invalid parameters", NULL); - 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, + "creation of committed datatype with empty types", NULL); +#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, + "inability to re-commit a committed datatype", NULL); + AddTest("test_open_committed_datatype", test_open_committed_datatype, NULL, "H5Topen2", NULL); + AddTest("test_open_committed_datatype_invalid_params", test_open_committed_datatype_invalid_params, NULL, + "H5Topen2 with invalid parameters", NULL); + AddTest("test_reopen_committed_datatype_indirect", test_reopen_committed_datatype_indirect, NULL, + "reopening open committed datatypes using H5Dget_type", NULL); + AddTest("test_close_committed_datatype_invalid_id", test_close_committed_datatype_invalid_id, NULL, + "H5Tclose with an invalid committed datatype ID", NULL); + AddTest("test_datatype_property_lists", test_datatype_property_lists, NULL, + "datatype property list operations", NULL); + AddTest("test_create_dataset_with_committed_type", test_create_dataset_with_committed_type, NULL, + "dataset creation with a committed datatype", NULL); + AddTest("test_create_attribute_with_committed_type", test_create_attribute_with_committed_type, NULL, + "attribute creation with a committed datatype", NULL); + AddTest("test_delete_committed_type", test_delete_committed_type, NULL, "committed datatype deletion", + NULL); + AddTest("test_resurrect_datatype", test_resurrect_datatype, NULL, "resurrecting datatype after deletion", + NULL); + AddTest("test_flush_committed_datatype", test_flush_committed_datatype, NULL, "H5Tflush", NULL); + AddTest("test_flush_committed_datatype_invalid_params", test_flush_committed_datatype_invalid_params, + NULL, "H5Tflush with invalid parameters", NULL); + AddTest("test_refresh_committed_datatype", test_refresh_committed_datatype, NULL, "H5Trefresh", NULL); + AddTest("test_refresh_committed_datatype_invalid_params", test_refresh_committed_datatype_invalid_params, + NULL, "H5Trefresh with invalid parameters", NULL); - printf("\n"); +#ifndef PROBLEMATIC_TESTS + AddTest("test_cant_commit_predefined", test_cant_commit_predefined, NULL, + "inability to commit predefined types directly", NULL); +#endif - return nerrors; + AddTest("test_cant_modify_committed_type", test_cant_modify_committed_type, NULL, + "inability to modify a committed datatype", NULL); } 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..1f6f280e4a1 100644 --- a/test/API/H5_api_file_test.c +++ b/test/API/H5_api_file_test.c @@ -12,51 +12,40 @@ #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(void); +static void test_create_file(void); +static void test_create_file_invalid_params(void); +static void test_create_file_excl(void); +static void test_open_file(void); +static void test_open_file_invalid_params(void); +static void test_open_nonexistent_file(void); +static void test_file_open_overlap(void); +static void test_file_permission(void); +static void test_reopen_file(void); +static void test_close_file_invalid_id(void); +static void test_flush_file(void); +static void test_file_is_accessible(void); +static void test_file_property_lists(void); +static void test_get_file_intent(void); +static void test_get_file_obj_count(void); +static void test_file_mounts(void); +static void test_get_file_name(void); -/* - * 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(void) +{ + 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 +static void test_create_file(void) { hid_t file_id = H5I_INVALID_HID; @@ -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,31 +74,34 @@ test_create_file(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (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); + 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 +static void test_create_file_invalid_params(void) { hid_t file_id = H5I_INVALID_HID; @@ -121,7 +113,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 +231,7 @@ test_create_file_invalid_params(void) free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: H5E_BEGIN_TRY @@ -253,14 +245,14 @@ 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 +static void test_create_file_excl(void) { hid_t file_id = H5I_INVALID_HID; @@ -273,7 +265,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,31 +308,34 @@ test_create_file_excl(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (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); + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * Tests that a file can be opened. */ -static int +static void test_open_file(void) { hid_t file_id = H5I_INVALID_HID; @@ -351,7 +346,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 +403,7 @@ test_open_file(void) } END_MULTIPART; - return 0; + return; error: H5E_BEGIN_TRY @@ -417,14 +412,14 @@ 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 +static void test_open_file_invalid_params(void) { hid_t file_id = H5I_INVALID_HID; @@ -435,7 +430,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 +505,7 @@ test_open_file_invalid_params(void) } END_MULTIPART; - return 0; + return; error: H5E_BEGIN_TRY @@ -519,13 +514,13 @@ 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 +static void test_open_nonexistent_file(void) { hid_t file_id = H5I_INVALID_HID; @@ -537,7 +532,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 +541,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 +565,7 @@ test_open_nonexistent_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -576,14 +576,14 @@ 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 +static void test_file_permission(void) { hid_t file_id = H5I_INVALID_HID; @@ -604,7 +604,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 +790,15 @@ test_file_permission(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -807,18 +809,19 @@ test_file_permission(void) H5Tclose(dtype_id); H5Gclose(group_id); H5Fclose(file_id); + 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 +static void test_reopen_file(void) { hid_t file_id = H5I_INVALID_HID; @@ -830,7 +833,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 +855,7 @@ test_reopen_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -862,13 +865,13 @@ 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 +static void test_close_file_invalid_id(void) { herr_t err_ret = -1; @@ -879,7 +882,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,16 +899,16 @@ 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 +static void test_flush_file(void) { hid_t file_id = H5I_INVALID_HID; @@ -923,7 +926,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 +1004,15 @@ test_flush_file(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1015,18 +1020,19 @@ test_flush_file(void) H5Sclose(dspace_id); H5Dclose(dset_id); H5Fclose(file_id); + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test for H5Fis_accessible. */ -static int +static void test_file_is_accessible(void) { const char *const fake_filename = "nonexistent_file.h5"; @@ -1039,7 +1045,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 +1105,12 @@ test_file_is_accessible(void) free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: free(prefixed_filename); - return 1; + return; } /* @@ -1114,7 +1120,7 @@ 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 +static void test_file_property_lists(void) { hsize_t prop_val = 0; @@ -1135,7 +1141,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 +1391,10 @@ test_file_property_lists(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (H5Fdelete(prefixed_filename1, H5P_DEFAULT) < 0) + TEST_ERROR; + if (H5Fdelete(prefixed_filename2, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename1); prefixed_filename1 = NULL; @@ -1393,7 +1403,7 @@ test_file_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1404,19 +1414,21 @@ test_file_property_lists(void) H5Pclose(fapl_id2); H5Fclose(file_id1); H5Fclose(file_id2); + 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 +static void test_get_file_intent(void) { unsigned file_intent; @@ -1429,7 +1441,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,28 +1565,32 @@ test_get_file_intent(void) } END_MULTIPART; + if (H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; + free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: H5E_BEGIN_TRY { H5Fclose(file_id); + 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 +static void test_get_file_obj_count(void) { ssize_t obj_count; @@ -1600,7 +1616,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 +1902,10 @@ test_get_file_obj_count(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (H5Fdelete(prefixed_filename1, H5P_DEFAULT) < 0) + TEST_ERROR; + if (H5Fdelete(prefixed_filename2, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename1); prefixed_filename1 = NULL; @@ -1894,7 +1914,7 @@ test_get_file_obj_count(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1906,20 +1926,22 @@ test_get_file_obj_count(void) H5Dclose(dset_id); H5Fclose(file_id); H5Fclose(file_id2); + 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 +static void test_file_open_overlap(void) { ssize_t obj_count; @@ -1938,7 +1960,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 +2051,15 @@ test_file_open_overlap(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2045,19 +2069,20 @@ test_file_open_overlap(void) H5Dclose(dset_id); H5Fclose(file_id); H5Fclose(file_id2); + 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 +static void test_file_mounts(void) { hid_t file_id = H5I_INVALID_HID; @@ -2073,7 +2098,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 +2145,15 @@ test_file_mounts(void) TEST_ERROR; if (H5Fclose(child_fid) < 0) TEST_ERROR; + if (H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2134,18 +2161,19 @@ test_file_mounts(void) H5Gclose(group_id); H5Fclose(file_id); H5Fclose(child_fid); + 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 +static void test_get_file_name(void) { ssize_t file_name_buf_len = 0; @@ -2169,7 +2197,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 +2491,15 @@ test_get_file_name(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2482,58 +2512,45 @@ test_get_file_name(void) H5Aclose(attr_id); H5Gclose(group_id); H5Fclose(file_id); + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } -/* - * 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); -} - -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, "Prints header for file tests", NULL); + + AddTest("test_create_file", test_create_file, NULL, "H5Fcreate", NULL); + AddTest("test_create_file_invalid_params", test_create_file_invalid_params, NULL, + "H5Fcreate with invalid parameters", NULL); + AddTest("test_create_file_excl", test_create_file_excl, NULL, + "H5Fcreate with H5F_ACC_EXCL/H5F_ACC_TRUNC flag", NULL); + AddTest("test_open_file", test_open_file, NULL, "H5Fopen", NULL); + AddTest("test_open_file_invalid_params", test_open_file_invalid_params, NULL, + "H5Fopen with invalid parameters", NULL); + AddTest("test_open_nonexistent_file", test_open_nonexistent_file, NULL, + "for invalid opening of a non-existent file", NULL); + AddTest("test_file_open_overlap", test_file_open_overlap, NULL, "overlapping file opens", NULL); + AddTest("test_file_permission", test_file_permission, NULL, + "file permissions (invalid creation of objects in read-only file)", NULL); + AddTest("test_reopen_file", test_reopen_file, NULL, "re-open of a file with H5Freopen", NULL); + AddTest("test_close_file_invalid_id", test_close_file_invalid_id, NULL, "H5Fclose with an invalid ID", + NULL); + AddTest("test_flush_file", test_flush_file, NULL, "H5Fflush", NULL); + AddTest("test_file_is_accessible", test_file_is_accessible, NULL, "H5Fis_accessible", NULL); + AddTest("test_file_property_lists", test_file_property_lists, NULL, "file property list operations", + NULL); + AddTest("test_get_file_intent", test_get_file_intent, NULL, "retrieval of file intent with H5Fget_intent", + NULL); + AddTest("test_get_file_obj_count", test_get_file_obj_count, NULL, + "retrieval of open object number and IDs", NULL); + AddTest("test_file_mounts", test_file_mounts, NULL, "file mounting/unmounting", NULL); + AddTest("test_get_file_name", test_get_file_name, NULL, "retrieval of file name", NULL); } 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..cceb51e0fe5 100644 --- a/test/API/H5_api_group_test.c +++ b/test/API/H5_api_group_test.c @@ -12,54 +12,42 @@ #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(void); +static void test_create_group_under_root(void); +static void test_create_group_under_existing_group(void); +static void test_create_many_groups(void); +static void test_create_deep_groups(void); +static void test_create_intermediate_group(void); +static void test_create_group_invalid_params(void); +static void test_create_anonymous_group(void); +static void test_create_anonymous_group_invalid_params(void); +static void test_open_nonexistent_group(void); +static void test_open_group_invalid_params(void); +static void test_close_group_invalid_id(void); +static void test_group_property_lists(void); +static void test_get_group_info(void); +static void test_get_group_info_invalid_params(void); +static void test_flush_group(void); +static void test_flush_group_invalid_params(void); +static void test_refresh_group(void); +static void test_refresh_group_invalid_params(void); +static int create_group_recursive(hid_t parent_gid, unsigned counter); + +static void +print_group_test_header(void) +{ + 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 +static void test_create_group_under_root(void) { hid_t file_id = 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,14 +93,14 @@ 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 +static void test_create_group_under_existing_group(void) { hid_t file_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,13 +170,13 @@ test_create_group_under_existing_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to create many (one million) groups */ -static int +static void test_create_many_groups(void) { hid_t file_id = 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,13 +250,13 @@ test_create_many_groups(void) } H5E_END_TRY - return 1; + return; } /* * A test to create groups of the depth GROUP_DEPTH. */ -static int +static void test_create_deep_groups(void) { hid_t file_id = 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,7 +364,7 @@ create_group_recursive(hid_t parent_gid, unsigned counter) /* * A test to create groups automatically using H5Pset_create_intermediate_group */ -static int +static void test_create_intermediate_group(void) { hid_t file_id = 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,14 +506,14 @@ 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 +static void test_create_group_invalid_params(void) { hid_t file_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,14 +681,14 @@ 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 +static void test_create_anonymous_group(void) { hid_t file_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,14 +741,14 @@ 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 +static void test_create_anonymous_group_invalid_params(void) { hid_t file_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,14 +866,14 @@ 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 +static void test_open_nonexistent_group(void) { hid_t file_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,14 +921,14 @@ 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 +static void test_open_group_invalid_params(void) { hid_t file_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,14 +1050,14 @@ 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 +static void test_close_group_invalid_id(void) { 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,7 +1096,7 @@ 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 +static void test_group_property_lists(void) { unsigned dummy_prop_val = GROUP_PROPERTY_LIST_TEST_DUMMY_VAL; @@ -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,13 +1360,13 @@ test_group_property_lists(void) } H5E_END_TRY - return 1; + return; } /* * A test for the functionality of H5Gget_info(_by_idx). */ -static int +static void test_get_group_info(void) { H5G_info_t group_info; @@ -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,14 +1794,14 @@ 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 +static void test_get_group_info_invalid_params(void) { H5G_info_t group_info; @@ -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,13 +2151,13 @@ test_get_group_info_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Gflush. */ -static int +static void test_flush_group(void) { hid_t file_id = 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,14 +2221,14 @@ 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 +static void test_flush_group_invalid_params(void) { 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,16 +2256,16 @@ test_flush_group_invalid_params(void) PASSED(); - return 0; + return; error: - return 1; + return; } /* * A test for H5Grefresh. */ -static int +static void test_refresh_group(void) { hid_t file_id = 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,14 +2329,14 @@ 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 +static void test_refresh_group_invalid_params(void) { 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,48 @@ 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, "Prints header for group tests", NULL); + + AddTest("test_create_group_under_root", test_create_group_under_root, NULL, + "creation of group under the root group", NULL); + AddTest("test_create_group_under_existing_group", test_create_group_under_existing_group, NULL, + "creation of group under existing group using a relative path", NULL); + AddTest("test_create_many_groups", test_create_many_groups, NULL, "H5Gcreate many groups", NULL); + AddTest("test_create_deep_groups", test_create_deep_groups, NULL, "H5Gcreate groups of great depths", + NULL); + AddTest("test_create_intermediate_group", test_create_intermediate_group, NULL, + "H5Gcreate group with intermediate group creation", NULL); + AddTest("test_create_group_invalid_params", test_create_group_invalid_params, NULL, + "H5Gcreate with invalid parameters", NULL); + AddTest("test_create_anonymous_group", test_create_anonymous_group, NULL, "creation of anonymous group", + NULL); + AddTest("test_create_anonymous_group_invalid_params", test_create_anonymous_group_invalid_params, NULL, + "H5Gcreate_anon with invalid parameters", NULL); + AddTest("test_open_nonexistent_group", test_open_nonexistent_group, NULL, + "for invalid opening of a nonexistent group", NULL); + AddTest("test_open_group_invalid_params", test_open_group_invalid_params, NULL, + "H5Gopen with invalid parameters", NULL); + AddTest("test_close_group_invalid_id", test_close_group_invalid_id, NULL, + "H5Gclose with an invalid group ID", NULL); + AddTest("test_group_property_lists", test_group_property_lists, NULL, "group property list operations", + NULL); + AddTest("test_get_group_info", test_get_group_info, NULL, "retrieval of group info", NULL); + AddTest("test_get_group_info_invalid_params", test_get_group_info_invalid_params, NULL, + "retrieval of group info with invalid parameters", NULL); + AddTest("test_flush_group", test_flush_group, NULL, "H5Gflush", NULL); + AddTest("test_flush_group_invalid_params", test_flush_group_invalid_params, NULL, + "H5Gflush with invalid parameters", NULL); + AddTest("test_refresh_group", test_refresh_group, NULL, "H5Grefresh", NULL); + AddTest("test_refresh_group_invalid_params", test_refresh_group_invalid_params, NULL, + "H5Grefresh with invalid parameters", NULL); } 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..d5479c1ba63 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(void); +static void test_create_hard_link(void); +static void test_create_hard_link_long_name(void); +static void test_create_hard_link_many(void); +static void test_create_hard_link_same_loc(void); +static void test_create_hard_link_invalid_params(void); +static void test_create_soft_link_existing_relative(void); +static void test_create_soft_link_existing_absolute(void); +static void test_create_soft_link_dangling_relative(void); +static void test_create_soft_link_dangling_absolute(void); +static void test_create_soft_link_long_name(void); +static void test_create_soft_link_many(void); +static void test_create_soft_link_invalid_params(void); +static void test_create_external_link(void); +static void test_create_external_link_dangling(void); +static void test_create_external_link_multi(void); +static void test_create_external_link_ping_pong(void); +static void test_create_external_link_invalid_params(void); +static void test_create_user_defined_link(void); +static void test_create_user_defined_link_invalid_params(void); +static void test_delete_link(void); +static void test_delete_link_reset_grp_max_crt_order(void); +static void test_delete_link_invalid_params(void); +static void test_copy_link(void); +static void test_copy_links_into_group_with_links(void); +static void test_copy_link_across_files(void); +static void test_copy_link_invalid_params(void); +static void test_move_link(void); +static void test_move_links_into_group_with_links(void); +static void test_move_link_across_files(void); +static void test_move_link_reset_grp_max_crt_order(void); +static void test_move_link_invalid_params(void); +static void test_get_link_val(void); +static void test_get_link_val_invalid_params(void); +static void test_get_link_info(void); +static void test_get_link_info_invalid_params(void); +static void test_get_link_name(void); +static void test_get_link_name_invalid_params(void); +static void test_link_iterate_hard_links(void); +static void test_link_iterate_soft_links(void); +static void test_link_iterate_external_links(void); +static void test_link_iterate_ud_links(void); +static void test_link_iterate_mixed_links(void); +static void test_link_iterate_invalid_params(void); +static void test_link_iterate_0_links(void); +static void test_link_visit_hard_links_no_cycles(void); +static void test_link_visit_soft_links_no_cycles(void); +static void test_link_visit_external_links_no_cycles(void); +static void test_link_visit_ud_links_no_cycles(void); +static void test_link_visit_mixed_links_no_cycles(void); +static void test_link_visit_hard_links_cycles(void); +static void test_link_visit_soft_links_cycles(void); +static void test_link_visit_external_links_cycles(void); +static void test_link_visit_ud_links_cycles(void); +static void test_link_visit_mixed_links_cycles(void); +static void test_link_visit_invalid_params(void); +static void test_link_visit_0_links(void); static herr_t link_iter_hard_links_cb(hid_t group_id, const char *name, const H5L_info2_t *info, void *op_data); @@ -106,73 +107,22 @@ 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(void) +{ + 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 +static void test_create_hard_link(void) { htri_t link_exists; @@ -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,14 +198,14 @@ 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 +static void test_create_hard_link_long_name(void) { htri_t link_exists; @@ -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,14 +306,14 @@ 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 +static void test_create_hard_link_many(void) { htri_t link_exists; @@ -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,14 +503,14 @@ 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 +static void test_create_hard_link_same_loc(void) { htri_t link_exists; @@ -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 +static void test_create_hard_link_invalid_params(void) { 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,17 +954,18 @@ 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 +static void test_create_soft_link_existing_relative(void) { htri_t link_exists; @@ -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,14 +1065,14 @@ 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 +static void test_create_soft_link_existing_absolute(void) { htri_t link_exists; @@ -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,7 +1168,7 @@ test_create_soft_link_existing_absolute(void) * an object that doesn't exist by using a relative * path, can be created. */ -static int +static void test_create_soft_link_dangling_relative(void) { htri_t link_exists; @@ -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,7 +1289,7 @@ test_create_soft_link_dangling_relative(void) * object that doesn't exist by using an absolute path, * can be created. */ -static int +static void test_create_soft_link_dangling_absolute(void) { htri_t link_exists; @@ -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,14 +1403,14 @@ 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 +static void test_create_soft_link_long_name(void) { htri_t link_exists; @@ -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,14 +1511,14 @@ 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 +static void test_create_soft_link_many(void) { htri_t link_exists = FAIL; @@ -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,14 +1719,14 @@ 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 +static void test_create_soft_link_invalid_params(void) { herr_t err_ret = -1; @@ -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 +static void test_create_external_link(void) { 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 +static void test_create_external_link_dangling(void) { 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 +static void test_create_external_link_multi(void) { 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 +static void test_create_external_link_ping_pong(void) { - 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 +static void test_create_external_link_invalid_params(void) { 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,16 +3155,17 @@ 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 +static void test_create_user_defined_link(void) { ssize_t udata_size; @@ -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,14 +3248,14 @@ 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 +static void test_create_user_defined_link_invalid_params(void) { ssize_t udata_size; @@ -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 +static void test_delete_link(void) { 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,7 +7071,7 @@ test_delete_link(void) * maximum link creation order value gets reset once * all the links have been deleted from the group. */ -static int +static void test_delete_link_reset_grp_max_crt_order(void) { H5G_info_t grp_info; @@ -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,10 +7319,10 @@ test_delete_link_reset_grp_max_crt_order(void) } H5E_END_TRY - return 1; + return; } -static int +static void test_delete_link_invalid_params(void) { htri_t link_exists; @@ -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 +static void test_copy_link(void) { 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 +static void test_copy_links_into_group_with_links(void) { TESTING("H5Lcopy adjusting creation order values for copied links"); SKIPPED(); - return 1; + return; } /* @@ -8941,7 +8966,7 @@ test_copy_links_into_group_with_links(void) * copied links retain the properties of the original * links. */ -static int +static void test_copy_link_across_files(void) { TESTING("link copying across files"); @@ -8950,14 +8975,14 @@ 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 +static void test_copy_link_invalid_params(void) { herr_t err_ret = -1; @@ -8965,8 +8990,8 @@ test_copy_link_invalid_params(void) 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 +static void test_move_link(void) { 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,7 +10896,7 @@ test_move_link(void) * H5Lmove might cause a group to have two links with the same * creation order values. */ -static int +static void test_move_links_into_group_with_links(void) { H5L_info2_t link_info; @@ -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,7 +11082,7 @@ 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 +static void test_move_link_across_files(void) { TESTING("link moving across files"); @@ -11034,7 +11091,7 @@ test_move_link_across_files(void) SKIPPED(); - return 0; + return; } /* @@ -11042,7 +11099,7 @@ 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 +static void test_move_link_reset_grp_max_crt_order(void) { H5G_info_t grp_info; @@ -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,14 +11275,14 @@ 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 +static void test_move_link_invalid_params(void) { htri_t link_exists; @@ -11233,8 +11290,8 @@ test_move_link_invalid_params(void) 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,17 +11679,18 @@ 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 +static void test_get_link_val(void) { H5L_info2_t link_info; @@ -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,17 +13836,18 @@ 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 +static void test_get_link_val_invalid_params(void) { H5L_info2_t link_info; @@ -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,14 +14187,14 @@ 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 +static void test_get_link_info(void) { H5L_info2_t link_info; @@ -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,17 +16911,18 @@ 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 +static void test_get_link_info_invalid_params(void) { H5L_info2_t link_info; @@ -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,14 +17247,14 @@ 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 +static void test_get_link_name(void) { ssize_t link_name_buf_size = 0; @@ -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,17 +19504,18 @@ 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 +static void test_get_link_name_invalid_params(void) { ssize_t ret; @@ -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,7 +19781,7 @@ test_get_link_name_invalid_params(void) * increasing and decreasing order of both link * name and link creation order. */ -static int +static void test_link_iterate_hard_links(void) { size_t i; @@ -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,7 +20162,7 @@ test_link_iterate_hard_links(void) * increasing and decreasing order of both link * name and link creation order. */ -static int +static void test_link_iterate_soft_links(void) { size_t i; @@ -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 +static void test_link_iterate_external_links(void) { 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 +static void test_link_iterate_ud_links(void) { TESTING("link iteration (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -20790,7 +20944,7 @@ test_link_iterate_ud_links(void) * * TODO refactor link saving portion into its own test */ -static int +static void test_link_iterate_mixed_links(void) { hsize_t saved_idx; @@ -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 +static void test_link_iterate_invalid_params(void) { 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,17 +21884,18 @@ 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 +static void test_link_iterate_0_links(void) { hid_t file_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,7 +22137,7 @@ test_link_iterate_0_links(void) * decreasing order of both link name and link * creation order. */ -static int +static void test_link_visit_hard_links_no_cycles(void) { size_t i; @@ -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,7 +22537,7 @@ test_link_visit_hard_links_no_cycles(void) * decreasing order of both link name and link * creation order. */ -static int +static void test_link_visit_soft_links_no_cycles(void) { size_t i; @@ -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 +static void test_link_visit_external_links_no_cycles(void) { 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 +static void test_link_visit_ud_links_no_cycles(void) { TESTING("link visiting without cycles (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -23180,7 +23343,7 @@ test_link_visit_ud_links_no_cycles(void) * * TODO refactor test to create a macroed number of subgroups */ -static int +static void test_link_visit_mixed_links_no_cycles(void) { size_t i; @@ -23188,11 +23351,11 @@ test_link_visit_mixed_links_no_cycles(void) 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,7 +23831,7 @@ 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 +static void test_link_visit_hard_links_cycles(void) { size_t i; @@ -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,7 +24204,7 @@ 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 +static void test_link_visit_soft_links_cycles(void) { size_t i; @@ -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,7 +24584,7 @@ test_link_visit_soft_links_cycles(void) * decreasing order of both link name and link * creation order. */ -static int +static void test_link_visit_external_links_cycles(void) { size_t i; @@ -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 +static void test_link_visit_ud_links_cycles(void) { TESTING("link visiting with cycles (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -24826,7 +24992,7 @@ 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 +static void test_link_visit_mixed_links_cycles(void) { htri_t link_exists; @@ -24834,8 +25000,8 @@ test_link_visit_mixed_links_cycles(void) 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,17 +25421,18 @@ 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 +static void test_link_visit_invalid_params(void) { herr_t err_ret = -1; @@ -25271,10 +25440,10 @@ test_link_visit_invalid_params(void) 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,7 +25898,7 @@ test_link_visit_invalid_params(void) * performed on a group with no links in it is * not problematic. */ -static int +static void test_link_visit_0_links(void) { hid_t file_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,115 @@ 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, "Prints header for link tests", NULL); + + AddTest("test_create_hard_link", test_create_hard_link, NULL, "hard link creation", NULL); + AddTest("test_create_hard_link_long_name", test_create_hard_link_long_name, NULL, + "hard link creation with a long name", NULL); + AddTest("test_create_hard_link_many", test_create_hard_link_many, NULL, + "hard link creation of many links", NULL); + AddTest("test_create_hard_link_same_loc", test_create_hard_link_same_loc, NULL, + "hard link creation with H5L_SAME_LOC", NULL); + AddTest("test_create_hard_link_invalid_params", test_create_hard_link_invalid_params, NULL, + "hard link creation with invalid parameters", NULL); + AddTest("test_create_soft_link_existing_relative", test_create_soft_link_existing_relative, NULL, + "soft link creation to existing object by relative path", NULL); + AddTest("test_create_soft_link_existing_absolute", test_create_soft_link_existing_absolute, NULL, + "soft link creation to existing object by absolute path", NULL); + AddTest("test_create_soft_link_dangling_relative", test_create_soft_link_dangling_relative, NULL, + "dangling soft link creation to object by relative path", NULL); + AddTest("test_create_soft_link_dangling_absolute", test_create_soft_link_dangling_absolute, NULL, + "dangling soft link creation to object by absolute path", NULL); + AddTest("test_create_soft_link_long_name", test_create_soft_link_long_name, NULL, + "soft link creation with a long name", NULL); + AddTest("test_create_soft_link_many", test_create_soft_link_many, NULL, + "soft link creation of many links", NULL); + AddTest("test_create_soft_link_invalid_params", test_create_soft_link_invalid_params, NULL, + "soft link creation with invalid parameters", NULL); + AddTest("test_create_external_link", test_create_external_link, NULL, + "external link creation to existing object", NULL); + AddTest("test_create_external_link_dangling", test_create_external_link_dangling, NULL, + "dangling external link creation", NULL); + AddTest("test_create_external_link_multi", test_create_external_link_multi, NULL, + "external link creation to an object across several files", NULL); + AddTest("test_create_external_link_ping_pong", test_create_external_link_ping_pong, NULL, + "external link creation to an object in ping pong style", NULL); + AddTest("test_create_external_link_invalid_params", test_create_external_link_invalid_params, NULL, + "H5Lcreate_external with invalid parameters", NULL); + AddTest("test_create_user_defined_link", test_create_user_defined_link, NULL, + "user-defined link creation", NULL); + AddTest("test_create_user_defined_link_invalid_params", test_create_user_defined_link_invalid_params, + NULL, "H5Lcreate_ud with invalid parameters", NULL); + AddTest("test_delete_link", test_delete_link, NULL, "link deletion", NULL); + AddTest("test_delete_link_reset_grp_max_crt_order", test_delete_link_reset_grp_max_crt_order, NULL, + "H5Ldelete of all links in group resets group's maximum link creation order value", NULL); + AddTest("test_delete_link_invalid_params", test_delete_link_invalid_params, NULL, + "H5Ldelete with invalid parameters", NULL); + AddTest("test_copy_link", test_copy_link, NULL, "link copying", NULL); + AddTest("test_copy_links_into_group_with_links", test_copy_links_into_group_with_links, NULL, + "H5Lcopy adjusting creation order values for copied links", NULL); + AddTest("test_copy_link_across_files", test_copy_link_across_files, NULL, "link copying across files", + NULL); + AddTest("test_copy_link_invalid_params", test_copy_link_invalid_params, NULL, + "H5Lcopy with invalid parameters", NULL); + AddTest("test_move_link", test_move_link, NULL, "link moving", NULL); + AddTest("test_move_links_into_group_with_links", test_move_links_into_group_with_links, NULL, + "H5Lmove adjusting creation order values for moved links", NULL); + AddTest("test_move_link_across_files", test_move_link_across_files, NULL, "link moving across files", + NULL); + AddTest("test_move_link_reset_grp_max_crt_order", test_move_link_reset_grp_max_crt_order, NULL, + "H5Lmove of all links out of group resets group's maximum link creation order value", NULL); + AddTest("test_move_link_invalid_params", test_move_link_invalid_params, NULL, + "H5Lmove with invalid parameters", NULL); + AddTest("test_get_link_val", test_get_link_val, NULL, "link value retrieval", NULL); + AddTest("test_get_link_val_invalid_params", test_get_link_val_invalid_params, NULL, + "link value retrieval with invalid parameters", NULL); + AddTest("test_get_link_info", test_get_link_info, NULL, "link info retrieval", NULL); + AddTest("test_get_link_info_invalid_params", test_get_link_info_invalid_params, NULL, + "link info retrieval with invalid parameters", NULL); + AddTest("test_get_link_name", test_get_link_name, NULL, "link name retrieval", NULL); + AddTest("test_get_link_name_invalid_params", test_get_link_name_invalid_params, NULL, + "link name retrieval with invalid parameters", NULL); + AddTest("test_link_iterate_hard_links", test_link_iterate_hard_links, NULL, + "link iteration (only hard links)", NULL); + AddTest("test_link_iterate_soft_links", test_link_iterate_soft_links, NULL, + "link iteration (only soft links)", NULL); + AddTest("test_link_iterate_external_links", test_link_iterate_external_links, NULL, + "link iteration (only external links)", NULL); + AddTest("test_link_iterate_ud_links", test_link_iterate_ud_links, NULL, + "link iteration (only user-defined links)", NULL); + AddTest("test_link_iterate_mixed_links", test_link_iterate_mixed_links, NULL, + "link iteration (mixed link types)", NULL); + AddTest("test_link_iterate_invalid_params", test_link_iterate_invalid_params, NULL, + "link iteration with invalid parameters", NULL); + AddTest("test_link_iterate_0_links", test_link_iterate_0_links, NULL, + "link iteration on group with 0 links", NULL); + AddTest("test_link_visit_hard_links_no_cycles", test_link_visit_hard_links_no_cycles, NULL, + "link visiting without cycles (only hard links)", NULL); + AddTest("test_link_visit_soft_links_no_cycles", test_link_visit_soft_links_no_cycles, NULL, + "link visiting without cycles (only soft links)", NULL); + AddTest("test_link_visit_external_links_no_cycles", test_link_visit_external_links_no_cycles, NULL, + "link visiting without cycles (only external links)", NULL); + AddTest("test_link_visit_ud_links_no_cycles", test_link_visit_ud_links_no_cycles, NULL, + "link visiting without cycles (only user-defined links)", NULL); + AddTest("test_link_visit_mixed_links_no_cycles", test_link_visit_mixed_links_no_cycles, NULL, + "link visiting without cycles (mixed link types)", NULL); + AddTest("test_link_visit_hard_links_cycles", test_link_visit_hard_links_cycles, NULL, + "link visiting with cycles (only hard links)", NULL); + AddTest("test_link_visit_soft_links_cycles", test_link_visit_soft_links_cycles, NULL, + "link visiting with cycles (only soft links)", NULL); + AddTest("test_link_visit_external_links_cycles", test_link_visit_external_links_cycles, NULL, + "link visiting with cycles (only external links)", NULL); + AddTest("test_link_visit_ud_links_cycles", test_link_visit_ud_links_cycles, NULL, + "link visiting with cycles (only user-defined links)", NULL); + AddTest("test_link_visit_mixed_links_cycles", test_link_visit_mixed_links_cycles, NULL, + "link visiting with cycles (mixed link types)", NULL); + AddTest("test_link_visit_invalid_params", test_link_visit_invalid_params, NULL, + "link visiting with invalid parameters", NULL); + AddTest("test_link_visit_0_links", test_link_visit_0_links, NULL, + "link visiting on group with subgroups containing 0 links", NULL); } 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..c742f3d5c30 100644 --- a/test/API/H5_api_misc_test.c +++ b/test/API/H5_api_misc_test.c @@ -12,23 +12,26 @@ #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); - -/* - * 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 void print_misc_test_header(void); +static void test_open_link_without_leading_slash(void); +static void test_object_creation_by_absolute_path(void); +static void test_absolute_vs_relative_path(void); +static void test_dot_for_object_name(void); +static void test_symbols_in_compound_field_name(void); +static void test_double_init_term(void); + +static void +print_misc_test_header(void) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Miscellaneous Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} -static int +static void test_open_link_without_leading_slash(void) { hid_t file_id = 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,10 +130,10 @@ test_open_link_without_leading_slash(void) } H5E_END_TRY - return 1; + return; } -static int +static void test_object_creation_by_absolute_path(void) { htri_t link_exists; @@ -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,11 +364,11 @@ test_object_creation_by_absolute_path(void) } H5E_END_TRY - return 1; + return; } /* XXX: Add testing for groups */ -static int +static void test_absolute_vs_relative_path(void) { htri_t link_exists; @@ -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,13 +707,13 @@ 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 +static void test_dot_for_object_name(void) { hid_t file_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,22 +885,22 @@ test_dot_for_object_name(void) * TODO: Not sure if this test can be done from public APIs * at the moment. */ -static int +static void test_double_init_term(void) { TESTING("double init/term correctness"); SKIPPED(); - return 0; + return; #if 0 error: - return 1; + return; #endif } -static int +static void test_symbols_in_compound_field_name(void) { size_t i; @@ -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,25 @@ 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, "Prints header for miscellaneous tests", + NULL); + + AddTest("test_open_link_without_leading_slash", test_open_link_without_leading_slash, NULL, + "opening a link without a leading slash", NULL); + AddTest("test_object_creation_by_absolute_path", test_object_creation_by_absolute_path, NULL, + "object creation by absolute path", NULL); + AddTest("test_absolute_vs_relative_path", test_absolute_vs_relative_path, NULL, + "absolute vs. relative pathnames", NULL); + AddTest("test_dot_for_object_name", test_dot_for_object_name, NULL, + "creating objects with \".\" as the name", NULL); + AddTest("test_symbols_in_compound_field_name", test_symbols_in_compound_field_name, NULL, + "usage of '{', '}' and '\\\"' symbols in compound field name", NULL); + AddTest("test_double_init_term", test_double_init_term, NULL, "double init/term correctness", NULL); } 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..3b881efa0f1 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(void); +static void test_open_object(void); +static void test_open_object_invalid_params(void); +static void test_object_exists(void); +static void test_object_exists_invalid_params(void); +static void test_get_object_info(void); +static void test_get_object_info_invalid_params(void); +static void test_link_object(void); +static void test_link_object_invalid_params(void); +static void test_incr_decr_object_refcount(void); +static void test_incr_decr_object_refcount_invalid_params(void); +static void test_object_copy_basic(void); +static void test_object_copy_already_existing(void); +static void test_object_copy_shallow_group_copy(void); +static void test_object_copy_no_attributes(void); +static void test_object_copy_by_soft_link(void); +static void test_object_copy_group_with_soft_links(void); +static void test_object_copy_between_files(void); +static void test_object_copy_invalid_params(void); +static void test_object_comments(void); +static void test_object_comments_invalid_params(void); +static void test_object_visit(void); +static void test_object_visit_soft_link(void); +static void test_object_visit_invalid_params(void); +static void test_close_object(void); +static void test_close_object_invalid_params(void); +static void test_close_invalid_objects(void); +static void test_flush_object(void); +static void test_flush_object_invalid_params(void); +static void test_refresh_object(void); +static void test_refresh_object_invalid_params(void); 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(void) +{ + 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,7 +84,7 @@ static int (*object_tests[])(void) = { * * XXX: test opening through dangling and resolving soft links. */ -static int +static void test_open_object(void) { hid_t file_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,7 +398,7 @@ test_open_object(void) * can't be opened when H5Oopen, H5Oopen_by_idx and H5Oopen_by_addr * are passed invalid parameters. */ -static int +static void test_open_object_invalid_params(void) { hid_t file_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,13 +762,13 @@ test_open_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oexists_by_name. */ -static int +static void test_object_exists(void) { htri_t object_exists; @@ -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,14 +1027,14 @@ 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 +static void test_object_exists_invalid_params(void) { htri_t object_exists; @@ -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 +static void test_get_object_info(void) { TESTING("object info retrieval"); SKIPPED(); - return 0; + return; } /* @@ -1232,20 +1208,20 @@ test_get_object_info(void) * when H5Oget_info(_by_name/_by_idx) are passed invalid * parameters. */ -static int +static void test_get_object_info_invalid_params(void) { TESTING("object info retrieval with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Olink. */ -static int +static void test_link_object(void) { hid_t file_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,7 +1380,7 @@ test_link_object(void) * the file structure when H5Olink is passed invalid * parameters. */ -static int +static void test_link_object_invalid_params(void) { hid_t file_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,13 +1572,13 @@ test_link_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oincr_refcount/H5Odecr_refcount. */ -static int +static void test_incr_decr_object_refcount(void) { H5O_info2_t oinfo; /* Object info struct */ @@ -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,14 +1870,14 @@ 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 +static void test_incr_decr_object_refcount_invalid_params(void) { 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,16 +1935,16 @@ test_incr_decr_object_refcount_invalid_params(void) } END_MULTIPART; - return 0; + return; error: - return 1; + return; } /* * Basic tests for H5Ocopy. */ -static int +static void test_object_copy_basic(void) { H5O_info2_t object_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,14 +2514,14 @@ 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 +static void test_object_copy_already_existing(void) { herr_t err_ret; @@ -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,14 +2712,14 @@ 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 +static void test_object_copy_shallow_group_copy(void) { H5G_info_t group_info; @@ -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,14 +2939,14 @@ 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 +static void test_object_copy_no_attributes(void) { H5O_info2_t object_info; @@ -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,14 +3452,14 @@ 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 +static void test_object_copy_by_soft_link(void) { H5O_info2_t object_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,7 +3792,7 @@ test_object_copy_by_soft_link(void) * H5Ocopy. Also tested is the H5O_COPY_EXPAND_SOFT_LINK_FLAG * flag. */ -static int +static void test_object_copy_group_with_soft_links(void) { H5G_info_t group_info; @@ -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,14 +4143,14 @@ 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 +static void test_object_copy_between_files(void) { H5O_info2_t object_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,17 +4751,18 @@ 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 +static void test_object_copy_invalid_params(void) { herr_t err_ret = -1; @@ -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 +static void test_object_comments(void) { 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 +static void test_object_comments_invalid_params(void) { - TESTING("object comment "); + TESTING("object comments with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -5047,7 +5027,7 @@ test_object_comments_invalid_params(void) * * XXX: Should have test for checking nested object's names/paths. */ -static int +static void test_object_visit(void) { size_t i; @@ -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,7 +5728,7 @@ test_object_visit(void) * the links to ensure that the objects in the other group * do not get visited. */ -static int +static void test_object_visit_soft_link(void) { size_t i; @@ -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,14 +6206,14 @@ 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 +static void test_object_visit_invalid_params(void) { herr_t err_ret = -1; @@ -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,13 +6524,13 @@ test_object_visit_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oclose. */ -static int +static void test_close_object(void) { hid_t file_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,14 +6723,14 @@ 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 +static void test_close_object_invalid_params(void) { herr_t err_ret = -1; @@ -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,14 +6777,14 @@ 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 +static void test_close_invalid_objects(void) { hid_t file_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 +static void test_flush_object(void) { TESTING("H5Oflush"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Oflush fails when * it is passed invalid parameters. */ -static int +static void test_flush_object_invalid_params(void) { TESTING("H5Oflush with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Orefresh. */ -static int +static void test_refresh_object(void) { TESTING("H5Orefresh"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Orefresh fails when * it is passed invalid parameters. */ -static int +static void test_refresh_object_invalid_params(void) { TESTING("H5Orefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -7363,36 +7346,60 @@ 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, "Prints header for object tests", + NULL); + + AddTest("test_open_object", test_open_object, NULL, "object opening", NULL); + AddTest("test_open_object_invalid_params", test_open_object_invalid_params, NULL, + "object opening with invalid parameters", NULL); + AddTest("test_object_exists", test_object_exists, NULL, "object existence", NULL); + AddTest("test_object_exists_invalid_params", test_object_exists_invalid_params, NULL, + "object existence with invalid parameters", NULL); + AddTest("test_get_object_info", test_get_object_info, NULL, "object info retrieval", NULL); + AddTest("test_get_object_info_invalid_params", test_get_object_info_invalid_params, NULL, + "object info retrieval with invalid parameters", NULL); + AddTest("test_link_object", test_link_object, NULL, "object linking", NULL); + AddTest("test_link_object_invalid_params", test_link_object_invalid_params, NULL, + "object linking with invalid parameters", NULL); + AddTest("test_incr_decr_object_refcount", test_incr_decr_object_refcount, NULL, + "increment/decrement the reference count of object", NULL); + AddTest("test_incr_decr_object_refcount_invalid_params", test_incr_decr_object_refcount_invalid_params, + NULL, "object reference count incr./decr. with an invalid parameter", NULL); + AddTest("test_object_copy_basic", test_object_copy_basic, NULL, "basic object copying", NULL); + AddTest("test_object_copy_already_existing", test_object_copy_already_existing, NULL, + "object copying to location where objects already exist", NULL); + AddTest("test_object_copy_shallow_group_copy", test_object_copy_shallow_group_copy, NULL, + "object copying with H5O_COPY_SHALLOW_HIERARCHY_FLAG flag", NULL); + AddTest("test_object_copy_no_attributes", test_object_copy_no_attributes, NULL, + "object copying with H5O_COPY_WITHOUT_ATTR_FLAG flag", NULL); + AddTest("test_object_copy_by_soft_link", test_object_copy_by_soft_link, NULL, + "object copying through use of soft links", NULL); + AddTest("test_object_copy_group_with_soft_links", test_object_copy_group_with_soft_links, NULL, + "group copying when group contains soft links", NULL); + AddTest("test_object_copy_between_files", test_object_copy_between_files, NULL, + "object copying between files", NULL); + AddTest("test_object_copy_invalid_params", test_object_copy_invalid_params, NULL, + "object copying with invalid parameters", NULL); + AddTest("test_object_comments", test_object_comments, NULL, "object comments", NULL); + AddTest("test_object_comments_invalid_params", test_object_comments_invalid_params, NULL, + "object comments with invalid parameters", NULL); + AddTest("test_object_visit", test_object_visit, NULL, "object visiting", NULL); + AddTest("test_object_visit_soft_link", test_object_visit_soft_link, NULL, + "object visiting with soft links", NULL); + AddTest("test_object_visit_invalid_params", test_object_visit_invalid_params, NULL, + "object visiting with invalid parameters", NULL); + AddTest("test_close_object", test_close_object, NULL, "H5Oclose", NULL); + AddTest("test_close_object_invalid_params", test_close_object_invalid_params, NULL, + "H5Oclose with an invalid object ID", NULL); + AddTest("test_close_invalid_objects", test_close_invalid_objects, NULL, "H5Oclose invalid objects", NULL); + AddTest("test_flush_object", test_flush_object, NULL, "H5Oflush", NULL); + AddTest("test_flush_object_invalid_params", test_flush_object_invalid_params, NULL, + "H5Oflush with invalid parameters", NULL); + AddTest("test_refresh_object", test_refresh_object, NULL, "H5Orefresh", NULL); + AddTest("test_refresh_object_invalid_params", test_refresh_object_invalid_params, NULL, + "H5Orefresh with invalid parameters", NULL); } 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..cd33fc916c0 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(void) +{ + print_func("file run only the file interface tests\n"); + print_func("group run only the group interface tests\n"); + print_func("dataset run only the dataset interface tests\n"); + print_func("attribute run only the attribute interface tests\n"); + print_func("datatype run only the datatype interface tests\n"); + print_func("link run only the link interface tests\n"); + print_func("object run only the object interface tests\n"); + print_func("misc run only the miscellaneous tests\n"); + print_func("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,20 +153,40 @@ 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 */ + TestInit(argv[0], usage, NULL); + + /* 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(argv[0]); + + /* Parse command line arguments */ + TestParseCmdLine(argc, argv); + n_tests_run_g = 0; n_tests_passed_g = 0; n_tests_failed_g = 0; @@ -183,7 +232,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,10 +316,20 @@ main(int argc, char **argv) goto done; } - /* Run all the tests that are enabled */ - H5_api_test_run(); + /* Perform tests */ + PerformTests(); + + printf("\n"); - printf("Cleaning up testing files\n"); + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(); + + /* Clean up test files, if allowed */ + if (GetTestCleanup() && !getenv(HDF5_NOCLEANUP)) + TestCleanup(); + + printf("Deleting container file for tests\n\n"); H5E_BEGIN_TRY { @@ -308,7 +367,17 @@ main(int argc, char **argv) err_occurred = true; } + if (GetTestNumErrs() > 0) + n_tests_failed_g += (size_t)GetTestNumErrs(); + + /* Release test infrastructure */ + TestShutdown(); + 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_util.c b/test/API/H5_api_test_util.c index 4fcf6fa756c..7a95b88d8cc 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.). 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..cd47e82659b 100644 --- a/testpar/API/H5_api_async_test_parallel.c +++ b/testpar/API/H5_api_async_test_parallel.c @@ -12,42 +12,55 @@ #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(void); -/* - * 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 bool coll_metadata_read_g = true; +static bool ind_metadata_read_g = false; + +static void +print_async_test_header(void) +{ + if (*(const bool *)GetTestParameters()) { + 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(void); +static void test_async_multi_dataset_io(void); +static void test_async_multi_file_dataset_io(void); +static void test_async_multi_file_grp_dset_io(void); +static void test_async_set_extent(void); +static void test_async_attribute_exists(void); +static void test_async_attribute_io(void); +static void test_async_attribute_io_tconv(void); +static void test_async_attribute_io_compound(void); +static void test_async_group(void); +static void test_async_link(void); +static void test_async_ocopy_orefresh(void); +static void test_async_file_reopen(void); /* Highest "printf" file created (starting at 0) */ int max_printf_file = -1; @@ -57,8 +70,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(void) { hsize_t *dims = NULL; hsize_t start[ONE_DATASET_IO_TEST_SPACE_RANK]; @@ -79,8 +92,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 +104,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -389,7 +403,7 @@ test_one_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -410,7 +424,7 @@ test_one_dataset_io(void) } H5E_END_TRY - return 1; + return; } #undef ONE_DATASET_IO_TEST_SPACE_RANK @@ -421,8 +435,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(void) { hsize_t *dims = NULL; hsize_t start[MULTI_DATASET_IO_TEST_SPACE_RANK]; @@ -444,8 +458,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 +470,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -712,7 +727,7 @@ test_multi_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -734,7 +749,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 +760,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(void) { hsize_t *dims = NULL; hsize_t start[MULTI_FILE_DATASET_IO_TEST_SPACE_RANK]; @@ -770,8 +785,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 +797,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -1136,7 +1152,7 @@ test_multi_file_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1159,7 +1175,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 +1186,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(void) { hsize_t *dims = NULL; hsize_t start[MULTI_FILE_GRP_DSET_IO_TEST_SPACE_RANK]; @@ -1193,21 +1209,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -1552,7 +1568,7 @@ test_multi_file_grp_dset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1574,7 +1590,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 +1603,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(void) { hsize_t *dims = NULL; hsize_t *maxdims = NULL; @@ -1615,7 +1631,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 +1640,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -1891,7 +1908,7 @@ test_set_extent(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1918,7 +1935,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 +1946,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(void) { hsize_t *dims = NULL; bool op_failed = false; @@ -1948,7 +1965,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 +1974,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -2054,7 +2072,7 @@ test_attribute_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2071,7 +2089,7 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } #undef ATTRIBUTE_EXISTS_TEST_SPACE_RANK @@ -2081,8 +2099,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(void) { hsize_t *dims = NULL; bool op_failed = false; @@ -2101,7 +2119,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 +2128,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -2259,7 +2278,7 @@ test_attribute_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2280,7 +2299,7 @@ test_attribute_io(void) } H5E_END_TRY - return 1; + return; } /* @@ -2289,8 +2308,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(void) { hsize_t *dims = NULL; bool op_failed; @@ -2308,18 +2327,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -2454,7 +2473,7 @@ test_attribute_io_tconv(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2475,7 +2494,7 @@ test_attribute_io_tconv(void) } H5E_END_TRY - return 1; + return; } /* @@ -2489,8 +2508,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(void) { hsize_t *dims = NULL; bool op_failed; @@ -2512,18 +2531,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create dataspace */ @@ -2861,7 +2880,7 @@ test_attribute_io_compound(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2887,14 +2906,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(void) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -2912,18 +2931,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create GCPL */ @@ -3048,7 +3068,7 @@ test_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3064,14 +3084,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(void) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -3092,9 +3112,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 +3122,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create GCPL */ @@ -3309,7 +3329,7 @@ test_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3324,15 +3344,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(void) { hsize_t *dims = NULL; hid_t file_id = H5I_INVALID_HID; @@ -3342,24 +3362,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 *)GetTestParameters(); + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) TEST_ERROR; @@ -3468,7 +3491,7 @@ test_ocopy_orefresh(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3485,15 +3508,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(void) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -3505,16 +3528,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 *)GetTestParameters())) < 0) TEST_ERROR; /* Create event stack */ @@ -3554,7 +3578,7 @@ test_file_reopen(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3567,107 +3591,112 @@ test_file_reopen(void) } H5E_END_TRY - return 1; + return; } /* * Cleanup temporary test files */ static void -cleanup_files(void) +test_async_file_cleanup(void) { 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"); - } - - 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 a header to distinguish different test interfaces */ + AddTest("print_async_test_header (coll)", print_async_test_header, NULL, "Prints header for async tests", + &coll_metadata_read_g); + + /* Add tests using collective metadata reads */ + AddTest("test_async_one_dataset_io (coll)", test_async_one_dataset_io, NULL, + "async single dataset I/O (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_multi_dataset_io (coll)", test_async_multi_dataset_io, NULL, + "async multi dataset I/O (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_multi_file_dataset_io (coll)", test_async_multi_file_dataset_io, NULL, + "async multi file dataset I/O (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_multi_file_grp_dset_io (coll)", test_async_multi_file_grp_dset_io, NULL, + "async multi file dataset I/O with groups (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_set_extent (coll)", test_async_set_extent, NULL, + "async extending dataset (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_attribute_exists (coll)", test_async_attribute_exists, NULL, + "async H5Aexists() (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_attribute_io (coll)", test_async_attribute_io, NULL, + "async attribute I/O (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_attribute_io_tconv (coll)", test_async_attribute_io_tconv, NULL, + "async attribute I/O with type conversion (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_attribute_io_compound (coll)", test_async_attribute_io_compound, NULL, + "async attribute I/O with compound type conversion (collective metadata reads)", + &coll_metadata_read_g); + AddTest("test_async_group (coll)", test_async_group, NULL, + "async group operations (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_link (coll)", test_async_link, NULL, + "async link operations (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_ocopy_orefresh (coll)", test_async_ocopy_orefresh, NULL, + "async H5Ocopy() and H5Orefresh() (collective metadata reads)", &coll_metadata_read_g); + AddTest("test_async_file_reopen (coll)", test_async_file_reopen, NULL, + "async H5Freopen() (collective metadata reads)", &coll_metadata_read_g); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_async_file_cleanup (coll)", test_async_file_cleanup, NULL, "cleanup async test files", + NULL); + + /* 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, "Prints header for async tests", + &ind_metadata_read_g); + + /* Add tests using independent metadata reads */ + AddTest("test_async_one_dataset_io (ind)", test_async_one_dataset_io, NULL, + "async single dataset I/O (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_multi_dataset_io (ind)", test_async_multi_dataset_io, NULL, + "async multi dataset I/O (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_multi_file_dataset_io (ind)", test_async_multi_file_dataset_io, NULL, + "async multi file dataset I/O (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_multi_file_grp_dset_io (ind)", test_async_multi_file_grp_dset_io, NULL, + "async multi file dataset I/O with groups (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_set_extent (ind)", test_async_set_extent, NULL, + "async extending dataset (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_attribute_exists (ind)", test_async_attribute_exists, NULL, + "async H5Aexists() (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_attribute_io (ind)", test_async_attribute_io, NULL, + "async attribute I/O (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_attribute_io_tconv (ind)", test_async_attribute_io_tconv, NULL, + "async attribute I/O with type conversion (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_attribute_io_compound (ind)", test_async_attribute_io_compound, NULL, + "async attribute I/O with compound type conversion (independent metadata reads)", + &ind_metadata_read_g); + AddTest("test_async_group (ind)", test_async_group, NULL, + "async group operations (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_link (ind)", test_async_link, NULL, + "async link operations (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_ocopy_orefresh (ind)", test_async_ocopy_orefresh, NULL, + "async H5Ocopy() and H5Orefresh() (independent metadata reads)", &ind_metadata_read_g); + AddTest("test_async_file_reopen (ind)", test_async_file_reopen, NULL, + "async H5Freopen() (independent metadata reads)", &ind_metadata_read_g); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_async_file_cleanup (ind)", test_async_file_cleanup, NULL, "cleanup async test files", NULL); } -#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, "Prints header for async tests", NULL); } #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..9b14c28257b 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(void); -int -H5_api_attribute_test_parallel(void) +static void +print_attribute_test_header(void) { - 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, + "Prints header for attribute tests", NULL); - 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..c31725552d2 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(void); +static void test_write_dataset_data_verification(void); +static void test_write_dataset_independent(void); +static void test_write_dataset_one_proc_0_selection(void); +static void test_write_dataset_one_proc_none_selection(void); +static void test_write_dataset_one_proc_all_selection(void); +static void test_write_dataset_hyper_file_all_mem(void); +static void test_write_dataset_all_file_hyper_mem(void); +static void test_write_dataset_point_file_all_mem(void); +static void test_write_dataset_all_file_point_mem(void); +static void test_write_dataset_hyper_file_point_mem(void); +static void test_write_dataset_point_file_hyper_mem(void); +static void test_read_dataset_one_proc_0_selection(void); +static void test_read_dataset_one_proc_none_selection(void); +static void test_read_dataset_one_proc_all_selection(void); +static void test_read_dataset_hyper_file_all_mem(void); +static void test_read_dataset_all_file_hyper_mem(void); +static void test_read_dataset_point_file_all_mem(void); +static void test_read_dataset_all_file_point_mem(void); +static void test_read_dataset_hyper_file_point_mem(void); +static void test_read_dataset_point_file_hyper_mem(void); /* * 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(void); +static void test_write_multi_chunk_dataset_diff_shape_read(void); +static void test_overwrite_multi_chunk_dataset_same_shape_read(void); +static void test_overwrite_multi_chunk_dataset_diff_shape_read(void); -/* - * 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(void) +{ + 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,7 +72,7 @@ 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 +static void test_write_dataset_data_verification(void) { hssize_t space_npoints; @@ -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,7 +890,7 @@ 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 +static void test_write_dataset_independent(void) { hssize_t space_npoints; @@ -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,7 +1229,7 @@ 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 +static void test_write_dataset_one_proc_0_selection(void) { hssize_t space_npoints; @@ -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,7 +1526,7 @@ 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 +static void test_write_dataset_one_proc_none_selection(void) { hssize_t space_npoints; @@ -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,7 +1840,7 @@ 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 +static void test_write_dataset_one_proc_all_selection(void) { hssize_t space_npoints; @@ -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,7 +2132,7 @@ 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 +static void test_write_dataset_hyper_file_all_mem(void) { #ifdef BROKEN @@ -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,7 +2407,7 @@ 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 +static void test_write_dataset_all_file_hyper_mem(void) { hssize_t space_npoints; @@ -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 +static void test_write_dataset_point_file_all_mem(void) { TESTING("write to dataset with point sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -2730,7 +2714,7 @@ 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 +static void test_write_dataset_all_file_point_mem(void) { hssize_t space_npoints; @@ -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,7 +3025,7 @@ 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 +static void test_write_dataset_hyper_file_point_mem(void) { hssize_t space_npoints; @@ -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,7 +3349,7 @@ 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 +static void test_write_dataset_point_file_hyper_mem(void) { hssize_t space_npoints; @@ -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,7 +3666,7 @@ 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 +static void test_read_dataset_one_proc_0_selection(void) { hssize_t space_npoints; @@ -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,7 +4000,7 @@ 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 +static void test_read_dataset_one_proc_none_selection(void) { hssize_t space_npoints; @@ -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,7 +4350,7 @@ 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 +static void test_read_dataset_one_proc_all_selection(void) { hssize_t space_npoints; @@ -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 +static void test_read_dataset_hyper_file_all_mem(void) { TESTING("read from dataset with hyperslab sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -4718,7 +4702,7 @@ 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 +static void test_read_dataset_all_file_hyper_mem(void) { hssize_t space_npoints; @@ -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 +static void test_read_dataset_point_file_all_mem(void) { TESTING("read from dataset with point sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -5065,7 +5049,7 @@ 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 +static void test_read_dataset_all_file_point_mem(void) { hssize_t space_npoints; @@ -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,7 +5397,7 @@ 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 +static void test_read_dataset_hyper_file_point_mem(void) { hssize_t space_npoints; @@ -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,7 +5755,7 @@ 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 +static void test_read_dataset_point_file_hyper_mem(void) { hssize_t space_npoints; @@ -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,7 +6118,7 @@ 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 +static void test_write_multi_chunk_dataset_same_shape_read(void) { hsize_t *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,7 +6580,7 @@ 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 +static void test_write_multi_chunk_dataset_diff_shape_read(void) { hsize_t *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,7 +7045,7 @@ 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 +static void test_overwrite_multi_chunk_dataset_same_shape_read(void) { hsize_t *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,7 +7570,7 @@ 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 +static void test_overwrite_multi_chunk_dataset_diff_shape_read(void) { hsize_t *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, "Prints header for dataset tests", + NULL); + + AddTest("test_write_dataset_data_verification", test_write_dataset_data_verification, NULL, + "verification of dataset data using H5Dwrite then H5Dread", NULL); + AddTest("test_write_dataset_independent", test_write_dataset_independent, NULL, + "independent writing to different datasets by different ranks", NULL); + AddTest("test_write_dataset_one_proc_0_selection", test_write_dataset_one_proc_0_selection, NULL, + "write to dataset with one rank selecting 0 rows", NULL); + AddTest("test_write_dataset_one_proc_none_selection", test_write_dataset_one_proc_none_selection, NULL, + "write to dataset with one rank using 'none' selection", NULL); + AddTest("test_write_dataset_one_proc_all_selection", test_write_dataset_one_proc_all_selection, NULL, + "write to dataset with one rank using all selection; others none selection", NULL); + AddTest("test_write_dataset_hyper_file_all_mem", test_write_dataset_hyper_file_all_mem, NULL, + "write to dataset with hyperslab sel. for file space; all sel. for memory", NULL); + AddTest("test_write_dataset_all_file_hyper_mem", test_write_dataset_all_file_hyper_mem, NULL, + "write to dataset with all sel. for file space; hyperslab sel. for memory", NULL); + AddTest("test_write_dataset_point_file_all_mem", test_write_dataset_point_file_all_mem, NULL, + "write to dataset with point sel. for file space; all sel. for memory", NULL); + AddTest("test_write_dataset_all_file_point_mem", test_write_dataset_all_file_point_mem, NULL, + "write to dataset with all sel. for file space; point sel. for memory", NULL); + AddTest("test_write_dataset_hyper_file_point_mem", test_write_dataset_hyper_file_point_mem, NULL, + "write to dataset with hyperslab sel. for file space; point sel. for memory", NULL); + AddTest("test_write_dataset_point_file_hyper_mem", test_write_dataset_point_file_hyper_mem, NULL, + "write to dataset with point sel. for file space; hyperslab sel. for memory", NULL); + AddTest("test_read_dataset_one_proc_0_selection", test_read_dataset_one_proc_0_selection, NULL, + "read from dataset with one rank selecting 0 rows", NULL); + AddTest("test_read_dataset_one_proc_none_selection", test_read_dataset_one_proc_none_selection, NULL, + "read from dataset with one rank using 'none' selection", NULL); + AddTest("test_read_dataset_one_proc_all_selection", test_read_dataset_one_proc_all_selection, NULL, + "read from dataset with one rank using all selection; others none selection", NULL); + AddTest("test_read_dataset_hyper_file_all_mem", test_read_dataset_hyper_file_all_mem, NULL, + "read from dataset with hyperslab sel. for file space; all sel. for memory", NULL); + AddTest("test_read_dataset_all_file_hyper_mem", test_read_dataset_all_file_hyper_mem, NULL, + "read from dataset with all sel. for file space; hyperslab sel. for memory", NULL); + AddTest("test_read_dataset_point_file_all_mem", test_read_dataset_point_file_all_mem, NULL, + "read from dataset with point sel. for file space; all sel. for memory", NULL); + AddTest("test_read_dataset_all_file_point_mem", test_read_dataset_all_file_point_mem, NULL, + "read from dataset with all sel. for file space; point sel. for memory", NULL); + AddTest("test_read_dataset_hyper_file_point_mem", test_read_dataset_hyper_file_point_mem, NULL, + "read from dataset with hyperslab sel. for file space; point sel. for memory", NULL); + AddTest("test_read_dataset_point_file_hyper_mem", test_read_dataset_point_file_hyper_mem, NULL, + "read from dataset with point sel. for file space; hyperslab sel. for memory", NULL); + AddTest("test_write_multi_chunk_dataset_same_shape_read", test_write_multi_chunk_dataset_same_shape_read, + NULL, "write to dataset with multiple chunks using same shaped dataspaces", NULL); + AddTest("test_write_multi_chunk_dataset_diff_shape_read", test_write_multi_chunk_dataset_diff_shape_read, + NULL, "write to dataset with multiple chunks using differently shaped dataspaces", NULL); + AddTest("test_overwrite_multi_chunk_dataset_same_shape_read", + test_overwrite_multi_chunk_dataset_same_shape_read, NULL, + "several overwrites to dataset with multiple chunks using same shaped dataspaces", NULL); + AddTest("test_overwrite_multi_chunk_dataset_diff_shape_read", + test_overwrite_multi_chunk_dataset_diff_shape_read, NULL, + "several overwrites to dataset with multiple chunks using differently shaped dataspaces", NULL); } 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..087b4d8a74d 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(void); -int -H5_api_datatype_test_parallel(void) +static void +print_datatype_test_header(void) { - 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, + "Prints header for datatype tests", NULL); - 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..613995d0ac3 100644 --- a/testpar/API/H5_api_file_test_parallel.c +++ b/testpar/API/H5_api_file_test_parallel.c @@ -12,24 +12,29 @@ #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(void); +static void test_create_file(void); +static void test_open_file(void); +static void test_split_comm_file_access(void); -/* - * 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(void) +{ + 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 +static void test_create_file(void) { hid_t file_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,30 +58,33 @@ test_create_file(void) goto error; } - if (H5Pclose(fapl_id) < 0) - TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (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); + 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 +static void test_open_file(void) { hid_t file_id = H5I_INVALID_HID; @@ -88,7 +96,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 +167,7 @@ test_open_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -169,7 +177,7 @@ test_open_file(void) } H5E_END_TRY - return 1; + return; } /* @@ -185,7 +193,7 @@ 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 +static void test_split_comm_file_access(void) { MPI_Comm comm; @@ -202,7 +210,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 */ @@ -294,74 +302,28 @@ test_split_comm_file_access(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { - H5Pclose(fapl_id); H5Fclose(file_id); + H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, fapl_id); + H5Pclose(fapl_id); } H5E_END_TRY - return 1; -} - -/* - * Cleanup temporary test files - */ -static void -cleanup_files(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; - } + return; } -int -H5_api_file_test_parallel(void) +void +H5_api_file_test_parallel_add(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(); + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_file_test_header", print_file_test_header, NULL, "Prints header for file tests", NULL); - return nerrors; + AddTest("test_create_file", test_create_file, NULL, "H5Fcreate", NULL); + AddTest("test_open_file", test_open_file, NULL, "H5Fopen", NULL); + AddTest("test_split_comm_file_access", test_split_comm_file_access, NULL, + "file access with a split communicator", NULL); } 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..41e7fc92b29 100644 --- a/testpar/API/H5_api_group_test_parallel.c +++ b/testpar/API/H5_api_group_test_parallel.c @@ -12,36 +12,26 @@ #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(void); -int -H5_api_group_test_parallel(void) +static void +print_group_test_header(void) { - 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, "Prints header for group tests", NULL); - 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..d54f4941c38 100644 --- a/testpar/API/H5_api_link_test_parallel.c +++ b/testpar/API/H5_api_link_test_parallel.c @@ -12,36 +12,26 @@ #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(void); -int -H5_api_link_test_parallel(void) +static void +print_link_test_header(void) { - 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, "Prints header for link tests", NULL); - 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..a2b2e498666 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(void); -int -H5_api_misc_test_parallel(void) +static void +print_misc_test_header(void) { - 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, "Prints header for miscellaneous tests", + NULL); - 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..25a557f9615 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(void); -int -H5_api_object_test_parallel(void) +static void +print_object_test_header(void) { - 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, "Prints header for object tests", + NULL); - 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..78ee057033c 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(void) +{ + print_func("file run only the file interface tests\n"); + print_func("group run only the group interface tests\n"); + print_func("dataset run only the dataset interface tests\n"); + print_func("attribute run only the attribute interface tests\n"); + print_func("datatype run only the datatype interface tests\n"); + print_func("link run only the link interface tests\n"); + print_func("object run only the object interface tests\n"); + print_func("misc run only the miscellaneous tests\n"); + print_func("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; @@ -195,21 +227,13 @@ main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + mpi_rank_framework_g = mpi_rank; + if (provided < required) { if (MAINPROCESS) 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 +241,35 @@ 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 */ + TestInit(argv[0], usage, NULL); + + /* 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(argv[0]); + + /* Parse command line arguments */ + TestParseCmdLine(argc, argv); + n_tests_run_g = 0; n_tests_passed_g = 0; n_tests_failed_g = 0; @@ -285,7 +338,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,11 +442,26 @@ 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 */ + PerformTests(); if (MAINPROCESS) - printf("Cleaning up testing files\n"); + printf("\n"); + + if (MAINPROCESS) { + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(); + + /* Clean up test files, if allowed */ + if (GetTestCleanup() && !getenv(HDF5_NOCLEANUP)) + TestCleanup(); + + printf("Deleting container file for tests\n\n"); + } + H5Fdelete(H5_api_test_parallel_filename, fapl_id); if (n_tests_run_g > 0) { @@ -401,7 +469,7 @@ main(int argc, char **argv) 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 +481,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 +514,24 @@ 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 */ + TestShutdown(); + 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);