diff options
Diffstat (limited to 'tools/libtest/h5tools_test_utils.c')
-rw-r--r-- | tools/libtest/h5tools_test_utils.c | 432 |
1 files changed, 217 insertions, 215 deletions
diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index dbc22d2..c4d4555 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -5,7 +5,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -21,26 +21,18 @@ #include "h5test.h" /* Selector for which test cases to run */ -typedef enum vfd_tests_e { - VFD_TESTS_COMMON, - VFD_TESTS_ROS3, - VFD_TESTS_HDFS -} vfd_tests_e; +typedef enum vfd_tests_e { VFD_TESTS_COMMON, VFD_TESTS_ROS3, VFD_TESTS_HDFS } vfd_tests_e; /* Whether we pass in H5I_INVALID_HID, H5P_DEFAULT, or a created fapl */ -typedef enum fapl_choice_e { - FAPL_CHOICE_INVALID, - FAPL_CHOICE_DEFAULT, - FAPL_CHOICE_CREATE -} fapl_choice_e; +typedef enum fapl_choice_e { FAPL_CHOICE_INVALID, FAPL_CHOICE_DEFAULT, FAPL_CHOICE_CREATE } fapl_choice_e; /* Test case data */ typedef struct fapl_testcase_t { - const char error_message[88]; - herr_t expected_result; - fapl_choice_e fapl_choice; - const char vfd_name[12]; - void *fa; + const char error_message[88]; + herr_t expected_result; + fapl_choice_e fapl_choice; + const char vfd_name[12]; + void * fa; } fapl_testcase_t; /* Generic "incorrect" VFD struct */ @@ -50,56 +42,62 @@ typedef struct other_fa_t { int c; } other_fa_t; -other_fa_t wrong_fa_g = {0x432, 0xf82, 0x9093}; +other_fa_t wrong_fa_g = {0x432, 0xf82, 0x9093}; /******************************/ /* Common test configurations */ /******************************/ fapl_testcase_t common_cases_g[] = { - { "(common) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)", + { + "(common) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)", FAIL, FAPL_CHOICE_INVALID, "", NULL, }, - { "(common) H5I_INVALID_HID + inappropriate VFD struct (UNEXPECTED SUCCESS)", + { + "(common) H5I_INVALID_HID + inappropriate VFD struct (UNEXPECTED SUCCESS)", FAIL, FAPL_CHOICE_INVALID, "", &wrong_fa_g, }, - { "(common) H5P_DEFAULT + NULL VFD struct (FAILED)", + { + "(common) H5P_DEFAULT + NULL VFD struct (FAILED)", SUCCEED, FAPL_CHOICE_DEFAULT, "", NULL, }, - { "(common) H5P_DEFAULT + ignored VFD struct (FAILED)", + { + "(common) H5P_DEFAULT + ignored VFD struct (FAILED)", SUCCEED, FAPL_CHOICE_DEFAULT, "", &wrong_fa_g, }, - { "(common) H5Pcreate() + NULL VFD struct (FAILED)", + { + "(common) H5Pcreate() + NULL VFD struct (FAILED)", SUCCEED, FAPL_CHOICE_CREATE, "", NULL, }, - { "(common) H5Pcreate() + ignored VFD struct (FAILED)", + { + "(common) H5Pcreate() + ignored VFD struct (FAILED)", SUCCEED, FAPL_CHOICE_CREATE, "", &wrong_fa_g, }, - { "(common) H5P_DEFAULT + non-VFD name + NULL VFD struct (UNEXPECTED SUCCESS)", + { + "(common) H5P_DEFAULT + non-VFD name + NULL VFD struct (UNEXPECTED SUCCESS)", FAIL, FAPL_CHOICE_DEFAULT, "unknown", NULL, - } -}; + }}; #ifdef H5_HAVE_ROS3_VFD @@ -109,38 +107,41 @@ fapl_testcase_t common_cases_g[] = { H5FD_ros3_fapl_t ros3_anon_fa_g = {1, FALSE, "", "", ""}; -fapl_testcase_t ros3_cases_g[] = { - { "(ROS3) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)", - FAIL, - FAPL_CHOICE_INVALID, - "ros3", - NULL, - }, - { "(ROS3) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)", - FAIL, - FAPL_CHOICE_INVALID, - "ros3", - &ros3_anon_fa_g, - }, - { "(ROS3) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)", - FAIL, - FAPL_CHOICE_CREATE, - "ros3", - NULL, - }, - { "(ROS3) H5Pcreate() + valid VFD struct (FAILED)", - SUCCEED, - FAPL_CHOICE_CREATE, - "ros3", - &ros3_anon_fa_g, - }, - { "(ROS3) H5P_DEFAULT + valid VFD struct (FAILED)", - SUCCEED, - FAPL_CHOICE_DEFAULT, - "ros3", - &ros3_anon_fa_g, - } -}; +fapl_testcase_t ros3_cases_g[] = {{ + "(ROS3) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)", + FAIL, + FAPL_CHOICE_INVALID, + "ros3", + NULL, + }, + { + "(ROS3) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)", + FAIL, + FAPL_CHOICE_INVALID, + "ros3", + &ros3_anon_fa_g, + }, + { + "(ROS3) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)", + FAIL, + FAPL_CHOICE_CREATE, + "ros3", + NULL, + }, + { + "(ROS3) H5Pcreate() + valid VFD struct (FAILED)", + SUCCEED, + FAPL_CHOICE_CREATE, + "ros3", + &ros3_anon_fa_g, + }, + { + "(ROS3) H5P_DEFAULT + valid VFD struct (FAILED)", + SUCCEED, + FAPL_CHOICE_DEFAULT, + "ros3", + &ros3_anon_fa_g, + }}; #endif /* H5_HAVE_ROS3_VFD */ #ifdef H5_HAVE_LIBHDFS @@ -158,153 +159,166 @@ H5FD_hdfs_fapl_t hdfs_fa_g = { 2048, /* stream buffer size */ }; -fapl_testcase_t hdfs_cases_g[] = { - { "(HDFS) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)", - FAIL, - FAPL_CHOICE_INVALID, - "hdfs", - NULL, - }, - { "(HDFS) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)", - FAIL, - FAPL_CHOICE_INVALID, - "hdfs", - &hdfs_fa_g, - }, - { "(HDFS) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)", - FAIL, - FAPL_CHOICE_CREATE, - "hdfs", - NULL, - }, - { "(HDFS) H5Pcreate() + valid VFD struct (FAILED)", - SUCCEED, - FAPL_CHOICE_CREATE, - "hdfs", - &hdfs_fa_g, - }, - { "(HDFS) H5P_DEFAULT + valid VFD struct (FAILED)", - SUCCEED, - FAPL_CHOICE_DEFAULT, - "hdfs", - &hdfs_fa_g, - } -}; +fapl_testcase_t hdfs_cases_g[] = {{ + "(HDFS) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)", + FAIL, + FAPL_CHOICE_INVALID, + "hdfs", + NULL, + }, + { + "(HDFS) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)", + FAIL, + FAPL_CHOICE_INVALID, + "hdfs", + &hdfs_fa_g, + }, + { + "(HDFS) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)", + FAIL, + FAPL_CHOICE_CREATE, + "hdfs", + NULL, + }, + { + "(HDFS) H5Pcreate() + valid VFD struct (FAILED)", + SUCCEED, + FAPL_CHOICE_CREATE, + "hdfs", + &hdfs_fa_g, + }, + { + "(HDFS) H5P_DEFAULT + valid VFD struct (FAILED)", + SUCCEED, + FAPL_CHOICE_DEFAULT, + "hdfs", + &hdfs_fa_g, + }}; #endif /* H5_HAVE_LIBHDFS */ - typedef struct tuple_testcase_t { - const char *test_msg; /* info about test case */ - const char *in_str; /* input string */ - int sep; /* separator "character" */ + const char *test_msg; /* info about test case */ + const char *in_str; /* input string */ + int sep; /* separator "character" */ herr_t expected_result; /* expected SUCCEED / FAIL */ - unsigned exp_nelems; /* expected number of elements */ - /* (no more than 7!) */ - const char *exp_elems[7]; /* list of elements (no more than 7!) */ + unsigned exp_nelems; /* expected number of elements */ + /* (no more than 7!) */ + const char *exp_elems[7]; /* list of elements (no more than 7!) */ } tuple_testcase_t; tuple_testcase_t tuple_cases_g[] = { - { "bad start", + { + "bad start", "words(before)", ';', FAIL, 0, {NULL}, }, - { "tuple not closed", + { + "tuple not closed", "(not ok", ',', FAIL, 0, {NULL}, }, - { "empty tuple", + { + "empty tuple", "()", '-', SUCCEED, 1, {""}, }, - { "no separator", + { + "no separator", "(stuff keeps on going)", ',', SUCCEED, 1, {"stuff keeps on going"}, }, - { "4-ple, escaped seperator", + { + "4-ple, escaped seperator", "(elem0,elem1,el\\,em2,elem3)", /* "el\,em" */ ',', SUCCEED, 4, {"elem0", "elem1", "el,em2", "elem3"}, }, - { "5-ple, escaped escaped separator", + { + "5-ple, escaped escaped separator", "(elem0,elem1,el\\\\,em2,elem3)", ',', SUCCEED, 5, {"elem0", "elem1", "el\\", "em2", "elem3"}, }, - { "escaped non-comma separator", + { + "escaped non-comma separator", "(5-2-7-2\\-6-2)", '-', SUCCEED, 5, - {"5","2","7","2-6","2"}, + {"5", "2", "7", "2-6", "2"}, }, - { "embedded close-paren", + { + "embedded close-paren", "(be;fo)re)", ';', SUCCEED, 2, {"be", "fo)re"}, }, - { "embedded non-escaping backslash", + { + "embedded non-escaping backslash", "(be;fo\\re)", ';', SUCCEED, 2, {"be", "fo\\re"}, }, - { "double close-paren at end", + { + "double close-paren at end", "(be;fore))", ';', SUCCEED, 2, {"be", "fore)"}, }, - { "empty elements", + { + "empty elements", "(;a1;;a4;)", ';', SUCCEED, 5, {"", "a1", "", "a4", ""}, }, - { "nested tuples with different separators", + { + "nested tuples with different separators", "((4,e,a);(6,2,a))", ';', SUCCEED, 2, - {"(4,e,a)","(6,2,a)"}, + {"(4,e,a)", "(6,2,a)"}, }, - { "nested tuples with same separators", + { + "nested tuples with same separators", "((4,e,a),(6,2,a))", ',', SUCCEED, 6, - {"(4","e","a)","(6","2","a)"}, + {"(4", "e", "a)", "(6", "2", "a)"}, }, - { "real-world use case", + { + "real-world use case", "(us-east-2,AKIAIMC3D3XLYXLN5COA,ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+)", ',', SUCCEED, 3, - {"us-east-2", - "AKIAIMC3D3XLYXLN5COA", - "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"}, - } -}; + {"us-east-2", "AKIAIMC3D3XLYXLN5COA", "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"}, + }}; /*---------------------------------------------------------------------------- * @@ -323,14 +337,14 @@ tuple_testcase_t tuple_cases_g[] = { static herr_t test_parse_tuple(void) { - tuple_testcase_t tc; - unsigned n_tests = 14; - unsigned u = 0; - unsigned count = 0; - unsigned elem_u = 0; - char **parsed = NULL; - char *cpy = NULL; - herr_t ret; + tuple_testcase_t tc; + unsigned n_tests = 14; + unsigned u = 0; + unsigned count = 0; + unsigned elem_u = 0; + char ** parsed = NULL; + char * cpy = NULL; + herr_t ret; TESTING("arbitrary-count tuple parsing"); @@ -338,11 +352,11 @@ test_parse_tuple(void) tc = tuple_cases_g[u]; - ret = parse_tuple(tc.in_str, tc.sep, &cpy, &count, &parsed); + ret = parse_tuple(tc.in_str, tc.sep, &cpy, &count, &parsed); - if(tc.expected_result != ret) + if (tc.expected_result != ret) FAIL_PUTS_ERROR("unexpected result from parse_tuple()") - if(tc.exp_nelems != count) + if (tc.exp_nelems != count) FAIL_PUTS_ERROR("incorrect number of elements returned from parse_tupble()") if (ret == SUCCEED) { @@ -356,7 +370,7 @@ test_parse_tuple(void) } else { /* Failed return case checks */ - if(parsed != NULL) + if (parsed != NULL) FAIL_PUTS_ERROR("should not have returned elements on failure") } @@ -376,7 +390,6 @@ error: } /* test_parse_tuple */ - /*---------------------------------------------------------------------------- * * Function: test_populate_ros3_fa() @@ -394,7 +407,7 @@ error: static herr_t test_populate_ros3_fa(void) { - int bad_version = 0xf87a; /* arbitrarily wrong version number */ + int bad_version = 0xf87a; /* arbitrarily wrong version number */ TESTING("ros3 fapl population"); @@ -431,8 +444,8 @@ test_populate_ros3_fa(void) /* all-empty values yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; - const char *values[] = {"", "", ""}; + H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; + const char * values[] = {"", "", ""}; /* Should PASS */ if (FAIL == h5tools_populate_ros3_fapl(&fa, values)) @@ -454,8 +467,8 @@ test_populate_ros3_fa(void) * excess value is ignored */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "y", "z", "a"}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", "y", "z", "a"}; /* Should PASS */ if (FAIL == h5tools_populate_ros3_fapl(&fa, values)) @@ -477,8 +490,8 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {NULL, "y", "z", NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {NULL, "y", "z", NULL}; /* Should FAIL */ if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values)) @@ -500,8 +513,8 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"", "y", "z", NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"", "y", "z", NULL}; /* Should FAIL */ if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values)) @@ -523,12 +536,10 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = { - "somewhere over the rainbow not too high " \ - "there is another rainbow bounding some darkened sky", - "y", - "z"}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"somewhere over the rainbow not too high " + "there is another rainbow bounding some darkened sky", + "y", "z"}; HDassert(HDstrlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN); @@ -552,8 +563,8 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", NULL, "z", NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", NULL, "z", NULL}; /* Should FAIL */ if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values)) @@ -575,8 +586,8 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "", "z", NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", "", "z", NULL}; /* Should FAIL */ if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values)) @@ -598,20 +609,19 @@ test_populate_ros3_fa(void) * partial set: region */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = { - "x", - "Why is it necessary to solve the problem? " \ - "What benefits will you receive by solving the problem? " \ - "What is the unknown? " \ - "What is it you don't yet understand? " \ - "What is the information you have? " \ - "What isn't the problem? " \ - "Is the information insufficient, redundant, or contradictory? " \ - "Should you draw a diagram or figure of the problem? " \ - "What are the boundaries of the problem? " \ - "Can you separate the various parts of the problem?", - "z"}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", + "Why is it necessary to solve the problem? " + "What benefits will you receive by solving the problem? " + "What is the unknown? " + "What is it you don't yet understand? " + "What is the information you have? " + "What isn't the problem? " + "Is the information insufficient, redundant, or contradictory? " + "Should you draw a diagram or figure of the problem? " + "What are the boundaries of the problem? " + "Can you separate the various parts of the problem?", + "z"}; HDassert(HDstrlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN); @@ -635,8 +645,8 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "y", NULL, NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", "y", NULL, NULL}; /* Should FAIL */ if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values)) @@ -658,8 +668,8 @@ test_populate_ros3_fa(void) * yields authenticating fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "y", "", NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", "y", "", NULL}; /* Should PASS */ if (FAIL == h5tools_populate_ros3_fapl(&fa, values)) @@ -681,8 +691,8 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"", "y", "", NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"", "y", "", NULL}; /* Should FAIL */ if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values)) @@ -704,8 +714,8 @@ test_populate_ros3_fa(void) * yields default fapl */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "", "", NULL}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", "", "", NULL}; /* Should FAIL */ if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values)) @@ -727,20 +737,18 @@ test_populate_ros3_fa(void) * partial set: region, id */ { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = { - "x", - "y", - "Why is it necessary to solve the problem? " \ - "What benefits will you receive by solving the problem? " \ - "What is the unknown? " \ - "What is it you don't yet understand? " \ - "What is the information you have? " \ - "What isn't the problem? " \ - "Is the information insufficient, redundant, or contradictory? " \ - "Should you draw a diagram or figure of the problem? " \ - "What are the boundaries of the problem? " \ - "Can you separate the various parts of the problem?"}; + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char * values[] = {"x", "y", + "Why is it necessary to solve the problem? " + "What benefits will you receive by solving the problem? " + "What is the unknown? " + "What is it you don't yet understand? " + "What is the information you have? " + "What isn't the problem? " + "Is the information insufficient, redundant, or contradictory? " + "Should you draw a diagram or figure of the problem? " + "What are the boundaries of the problem? " + "Can you separate the various parts of the problem?"}; HDassert(HDstrlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN); @@ -763,12 +771,9 @@ test_populate_ros3_fa(void) /* use case */ { - H5FD_ros3_fapl_t fa = {0, 0, "", "", ""}; - const char *values[] = { - "us-east-2", - "AKIAIMC3D3XLYXLN5COA", - "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+" - }; + H5FD_ros3_fapl_t fa = {0, 0, "", "", ""}; + const char * values[] = {"us-east-2", "AKIAIMC3D3XLYXLN5COA", + "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"}; /* Should PASS */ if (FAIL == h5tools_populate_ros3_fapl(&fa, values)) @@ -790,7 +795,6 @@ error: } /* test_populate_ros3_fa */ #endif /* H5_HAVE_ROS3_VFD */ - /*---------------------------------------------------------------------------- * * Function: test_set_configured_fapl() @@ -807,9 +811,9 @@ error: static herr_t test_set_configured_fapl(vfd_tests_e test_type, fapl_testcase_t cases[], unsigned n_cases) { - hid_t in_fapl_id = H5I_INVALID_HID; - hid_t out_fapl_id = H5I_INVALID_HID; - unsigned u; + hid_t in_fapl_id = H5I_INVALID_HID; + hid_t out_fapl_id = H5I_INVALID_HID; + unsigned u; if (VFD_TESTS_COMMON == test_type) TESTING("set fapl vfd (common)") @@ -821,26 +825,26 @@ test_set_configured_fapl(vfd_tests_e test_type, fapl_testcase_t cases[], unsigne /* Loop over all test cases */ for (u = 0; u < n_cases; u++) { h5tools_vfd_info_t vfd_info; - fapl_testcase_t tc = cases[u]; + fapl_testcase_t tc = cases[u]; /* Setup */ if (tc.fapl_choice == FAPL_CHOICE_DEFAULT) { in_fapl_id = H5P_DEFAULT; } else if (tc.fapl_choice == FAPL_CHOICE_CREATE) { - if(H5I_INVALID_HID == (in_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) + if (H5I_INVALID_HID == (in_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) TEST_ERROR } else in_fapl_id = H5I_INVALID_HID; /* Test */ - if(!HDstrcmp("", tc.vfd_name)) + if (!HDstrcmp("", tc.vfd_name)) out_fapl_id = h5tools_get_fapl(in_fapl_id, NULL); else { vfd_info.info = tc.fa; vfd_info.name = tc.vfd_name; - out_fapl_id = h5tools_get_fapl(in_fapl_id, &vfd_info); + out_fapl_id = h5tools_get_fapl(in_fapl_id, &vfd_info); } /* Check */ @@ -858,16 +862,17 @@ test_set_configured_fapl(vfd_tests_e test_type, fapl_testcase_t cases[], unsigne PASSED(); return SUCCEED; -error : - H5E_BEGIN_TRY { +error: + H5E_BEGIN_TRY + { H5Pclose(in_fapl_id); H5Pclose(out_fapl_id); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } /* test_set_configured_fapl */ - /*---------------------------------------------------------------------------- * * Function: main() @@ -890,19 +895,18 @@ main(void) HDprintf("Testing tools VFD functionality.\n"); - nerrors += test_parse_tuple() < 0 ? 1 : 0; - nerrors += test_set_configured_fapl(VFD_TESTS_COMMON, common_cases_g, 7) < 0 ? 1 : 0; + nerrors += test_parse_tuple() < 0 ? 1 : 0; + nerrors += test_set_configured_fapl(VFD_TESTS_COMMON, common_cases_g, 7) < 0 ? 1 : 0; #ifdef H5_HAVE_ROS3_VFD - nerrors += test_populate_ros3_fa() < 0 ? 1 : 0; - nerrors += test_set_configured_fapl(VFD_TESTS_ROS3, ros3_cases_g, 5) < 0 ? 1 : 0; + nerrors += test_populate_ros3_fa() < 0 ? 1 : 0; + nerrors += test_set_configured_fapl(VFD_TESTS_ROS3, ros3_cases_g, 5) < 0 ? 1 : 0; #endif #ifdef H5_HAVE_LIBHDFS - nerrors += test_set_configured_fapl(VFD_TESTS_HDFS, hdfs_cases_g, 5) < 0 ? 1 : 0; + nerrors += test_set_configured_fapl(VFD_TESTS_HDFS, hdfs_cases_g, 5) < 0 ? 1 : 0; #endif - if(nerrors) { - HDprintf("***** %d tools VFD TEST%s FAILED! *****\n", - nerrors, nerrors > 1 ? "S" : ""); + if (nerrors) { + HDprintf("***** %d tools VFD TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return EXIT_FAILURE; } @@ -911,5 +915,3 @@ main(void) return EXIT_SUCCESS; } /* end main() */ - - |