diff options
Diffstat (limited to 'tools/libtest')
-rw-r--r-- | tools/libtest/CMakeLists.txt | 9 | ||||
-rw-r--r-- | tools/libtest/CMakeTests.cmake | 2 | ||||
-rw-r--r-- | tools/libtest/Makefile.am | 18 | ||||
-rw-r--r-- | tools/libtest/Makefile.in | 81 | ||||
-rw-r--r-- | tools/libtest/h5tools_test_utils.c | 432 |
5 files changed, 300 insertions, 242 deletions
diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 3e0f671..1332099 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_LIBTEST C) #----------------------------------------------------------------------------- add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test_utils.c) target_compile_options(h5tools_test_utils PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5tools_test_utils STATIC) target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) @@ -16,6 +16,13 @@ else () endif () set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_H5TOOLS_TEST_SRC_FORMAT h5tools_test_utils) +endif () + if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/tools/libtest/CMakeTests.cmake b/tools/libtest/CMakeTests.cmake index 4feee9b..2d8e877 100644 --- a/tools/libtest/CMakeTests.cmake +++ b/tools/libtest/CMakeTests.cmake @@ -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. # diff --git a/tools/libtest/Makefile.am b/tools/libtest/Makefile.am index 0dc18e9..fde05a4 100644 --- a/tools/libtest/Makefile.am +++ b/tools/libtest/Makefile.am @@ -1,16 +1,16 @@ # -# Read-Only S3 Virtual File Driver (VFD) -# Copyright (c) 2017-2018, The HDF Group. -# +# Copyright by The HDF Group. # All rights reserved. # # NOTICE: -# All information contained herein is, and remains, the property of The HDF -# Group. The intellectual and technical concepts contained herein are -# proprietary to The HDF Group. Dissemination of this information or -# reproduction of this material is strictly forbidden unless prior written -# permission is obtained from The HDF Group. -## +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# ## Makefile.am ## Run automake to generate a Makefile.in from this file. # diff --git a/tools/libtest/Makefile.in b/tools/libtest/Makefile.in index 3798b7c..3c2587f 100644 --- a/tools/libtest/Makefile.in +++ b/tools/libtest/Makefile.in @@ -15,17 +15,18 @@ @SET_MAKE@ # -# Read-Only S3 Virtual File Driver (VFD) -# Copyright (c) 2017-2018, The HDF Group. -# +# Copyright by The HDF Group. # All rights reserved. # # NOTICE: -# All information contained herein is, and remains, the property of The HDF -# Group. The intellectual and technical concepts contained herein are -# proprietary to The HDF Group. Dissemination of this information or -# reproduction of this material is strictly forbidden unless prior written -# permission is obtained from The HDF Group. +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# # # HDF5 Library Makefile(.in) # @@ -115,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ $(top_srcdir)/m4/ax_check_junit.m4 \ $(top_srcdir)/m4/ax_java_options.m4 \ $(top_srcdir)/m4/ax_jni_include_dir.m4 \ + $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_prog_jar.m4 \ $(top_srcdir)/m4/ax_prog_java.m4 \ $(top_srcdir)/m4/ax_prog_java_works.m4 \ @@ -418,12 +420,12 @@ AMTAR = @AMTAR@ # AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ # Include src and tools/lib directories AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \ -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_JAVACFLAGS = @AM_JAVACFLAGS@ @@ -461,11 +463,56 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@ -DEV_WARNINGS = @DEV_WARNINGS@ +DIAGS = @DIAGS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ +DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@ +DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@ +DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@ +DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@ +DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@ +DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@ +DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@ +DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@ +DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@ +DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@ +DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@ +DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@ +DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@ +DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@ +DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@ +DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@ +DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@ +DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@ +DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@ +DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -497,8 +544,6 @@ H5_CFLAGS = @H5_CFLAGS@ H5_CLASSPATH = @H5_CLASSPATH@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ -H5_ECFLAGS = @H5_ECFLAGS@ -H5_ECXXFLAGS = @H5_ECXXFLAGS@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ H5_IS_DARWIN = @H5_IS_DARWIN@ @@ -512,7 +557,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_LIBHDFS = @HAVE_LIBHDFS@ HAVE_PTHREAD = @HAVE_PTHREAD@ +HDF5_DOXYGEN = @HDF5_DOXYGEN@ HDF5_HL = @HDF5_HL@ +HDF5_HL_TOOLS = @HDF5_HL_TOOLS@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF5_TESTS = @HDF5_TESTS@ HDF5_TOOLS = @HDF5_TOOLS@ @@ -522,6 +569,7 @@ HDF_JAVA = @HDF_JAVA@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ +HL_TOOLS = @HL_TOOLS@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@ @@ -715,7 +763,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la # Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at +# has been removed. According to the official description of DESTDIR by GNU at # http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is # prepended to the normal and complete install path that it precedes for the # purpose of installing in a temporary directory which is useful for building @@ -1223,8 +1271,9 @@ uninstall-am: # commands that should be executed even if a file with the same name already # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ - build-tests check-clean check-install check-p check-s check-vfd \ - install-doc lib progs tests uninstall-doc _exec_check-s _test help + build-tests check-clean check-install check-p check-s check-vfd \ + install-doc lib progs tests uninstall-doc \ + _exec_check-s _test help trace doxygen help: @$(top_srcdir)/bin/makehelp 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() */ - - |