diff options
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/CMakeLists.txt | 7 | ||||
-rw-r--r-- | c++/test/Makefile.in | 62 | ||||
-rw-r--r-- | c++/test/dsets.cpp | 4 | ||||
-rw-r--r-- | c++/test/h5cpputil.h | 2 | ||||
-rw-r--r-- | c++/test/tarray.cpp | 13 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 4 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 4 | ||||
-rw-r--r-- | c++/test/titerate.cpp | 12 | ||||
-rw-r--r-- | c++/test/tobject.cpp | 2 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 2 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 10 |
11 files changed, 71 insertions, 51 deletions
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 75efc3b..ca2295e 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.12) project (HDF5_CPP_TEST CXX) # -------------------------------------------------------------------- @@ -39,6 +39,7 @@ configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @O add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(cpp_testhdf5 PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") target_compile_definitions(cpp_testhdf5 PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) @@ -56,4 +57,6 @@ else () endif () set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) -include (CMakeTests.cmake) +if (HDF5_TEST_CPP AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 875f653..dced075 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -419,15 +419,15 @@ AMTAR = @AMTAR@ # H5_CFLAGS holds flags that should be used when building hdf5, # but which should not be exported to h5cc for building other programs. -# AM_CFLAGS is an automake construct which should be used by Makefiles +# 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@ +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ # Include src, test, and c++/src directories AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \ -I$(top_srcdir)/test -I$(top_srcdir)/c++/src -AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_JAVACFLAGS = @AM_JAVACFLAGS@ @@ -447,6 +447,7 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CC_VERSION = @CC_VERSION@ CFLAGS = @CFLAGS@ +CLANG_SANITIZE_CHECKS = @CLANG_SANITIZE_CHECKS@ CODESTACK = @CODESTACK@ CONFIG_DATE = @CONFIG_DATE@ CONFIG_MODE = @CONFIG_MODE@ @@ -463,6 +464,7 @@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ +DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@ DEV_WARNINGS = @DEV_WARNINGS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ @@ -499,8 +501,11 @@ 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@ H5_JAVACFLAGS = @H5_JAVACFLAGS@ H5_JAVAFLAGS = @H5_JAVAFLAGS@ H5_JNIFLAGS = @H5_JNIFLAGS@ @@ -523,6 +528,7 @@ HL = @HL@ HL_FOR = @HL_FOR@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ +IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -559,6 +565,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@ +MIRROR_VFD = @MIRROR_VFD@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ NM = @NM@ @@ -618,6 +625,7 @@ TIME = @TIME@ TR = @TR@ TRACE_API = @TRACE_API@ UNAME_INFO = @UNAME_INFO@ +USE_FILE_LOCKING = @USE_FILE_LOCKING@ USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ USE_FILTER_SZIP = @USE_FILTER_SZIP@ USINGMEMCHECKER = @USINGMEMCHECKER@ @@ -653,6 +661,7 @@ docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ enable_static = @enable_static@ +examplesdir = @examplesdir@ exec_prefix = @exec_prefix@ fortran_linux_linker_option = @fortran_linux_linker_option@ host = @host@ @@ -709,15 +718,15 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la 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 -# 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 -# rpms and other packages. The '/' after ${DESTDIR} will be followed by another -# '/' at the beginning of the normal install path. When DESTDIR is empty the -# path then begins with '//', which is incorrect and causes problems at least for -# Cygwin. +# 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 +# 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 +# rpms and other packages. The '/' after ${DESTDIR} will be followed by another +# '/' at the beginning of the normal install path. When DESTDIR is empty the +# path then begins with '//', which is incorrect and causes problems at least for +# Cygwin. # Scripts used to build examples # If only shared libraries have been installed, have h5cc build examples with @@ -767,7 +776,7 @@ LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ $(EXTRA_PROG) -chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) +chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) TEST_EXTENSIONS = .sh SH_LOG_COMPILER = $(SHELL) AM_SH_LOG_FLAGS = @@ -1354,28 +1363,37 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: echo "============================" > $${log}; \ fi; \ if test "X$(FORTRAN_API)" = "Xyes"; then \ - echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ if test -n "$(REALTIMEOUTPUT)"; then \ - echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \ + echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \ else \ - echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \ fi; \ elif test "X$(CXX_API)" = "Xyes"; then \ - echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ if test -n "$(REALTIMEOUTPUT)"; then \ - echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log};\ + echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log};\ else \ - echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ + echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" >> $${log};\ fi; \ else \ - echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "Testing: $${tname} $(TEST_FLAGS)"; \ if test -n "$(REALTIMEOUTPUT)"; then \ - echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \ + echo "Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \ else \ - echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + echo "Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \ fi; \ fi; \ if test -n "$(REALTIMEOUTPUT)"; then \ + if test -n "$(HDF5_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_DRIVER)" | tee -a $${log}; \ + fi; \ + else \ + if test -n "$(HDF5_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_DRIVER)" >> $${log}; \ + fi; \ + fi; \ + if test -n "$(REALTIMEOUTPUT)"; then \ echo "============================" | tee -a $${log}; \ else \ echo "============================" >> $${log}; \ diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 14f1bd4..956aa21 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -268,7 +268,7 @@ static herr_t test_simple_io( H5File& file) /*------------------------------------------------------------------------- * Function: test_datasize * - * Purpose Tests DataSet::getInMemDataSize(). + * Purpose Tests DataSet::getInMemDataSize(). * * Return Success: 0 * @@ -901,7 +901,7 @@ static herr_t test_multiopen (H5File& file) if (cur_size[0]!=tmp_size[0]) { cerr << " Got " << static_cast<int>(tmp_size[0]) - << " instead of " << static_cast<int>(cur_size[0]) + << " instead of " << static_cast<int>(cur_size[0]) << "!" << endl; throw Exception("test_multiopen", "Failed in multi-open with extending"); } diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 18fd44f..6664d0c 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -55,7 +55,7 @@ class TestFailedException : public Exception { // Overloaded/Template functions to verify values and display proper info -// Verifies +// Verifies void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name); template <class Type1, class Type2> diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index fccc556..d80de16 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -210,7 +210,7 @@ static void test_array_compound_array() // Verify the compound datatype info CompType ctype_check(base_type.getId()); base_type.close(); - + // Check the number of members nmemb = ctype_check.getNmembers(); verify_val(nmemb, 2, "ctype_check.getNmembers", __LINE__, __FILE__); @@ -282,11 +282,11 @@ static void test_array_compound_array() */ H5::DataType getArr() { - hsize_t *dims = new hsize_t; - *dims = 5; - H5::ArrayType ret; - ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims); - delete dims; + hsize_t *dims = new hsize_t; + *dims = 5; + H5::ArrayType ret; + ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims); + delete dims; return ret; } @@ -368,7 +368,6 @@ static void test_array_info() float f[ARRAY1_DIM1]; } s1_t; s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write - s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in hsize_t sdims1[] = {SPACE1_DIM1}; hsize_t tdims1[] = {ARRAY1_DIM1}; int ii; // counting variables diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index bdf6d80..626a99f 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -282,7 +282,7 @@ static void test_attr_getname() if (attr_exists == false) throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); - // Open attribute + // Open attribute Attribute fattr1(fid1.openAttribute(FATTR1_NAME)); // A. Get attribute name with @@ -1221,7 +1221,7 @@ static void test_attr_delete() attr_name = fattr.getName(); verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__); fattr.close(); - + // Test deleting non-existing attribute // Open the dataset diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index a2bf1c2..8b874cb 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -575,7 +575,7 @@ static void test_file_attribute() verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_DATATYPE)", __LINE__, __FILE__); num_objs = file5.getObjCount(H5F_OBJ_FILE); verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_FILE)", __LINE__, __FILE__); - + // Get the file name using the attributes H5std_string fname = fattr1.getFileName(); verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); @@ -926,7 +926,7 @@ static void test_file_info() /* ret=H5Pget_shared_mesg_nindexes(fcpl2,&nindexes); CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes"); VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes"); - */ + */ // Get and verify the file space info from the creation property list */ fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold); diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index e77ebcc..616dc00 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -400,7 +400,7 @@ static void test_HDFFV_9920() { int attr_data[2] = { 100, 200}; hsize_t dims[1] = { DIM1 }; - + try { // Create a new file and a group in it @@ -414,13 +414,13 @@ static void test_HDFFV_9920() DataSet fds = file.createDataSet(FDATASET_NAME, PredType::STD_I32BE, dspace); DataSet gds = gr1.createDataSet(GDATASET_NAME, PredType::STD_I32BE, dspace); - // Create a file attribute and a group attribute. - Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE, + // Create a file attribute and a group attribute. + Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE, dspace); - Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE, + Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE, dspace); - - // Write the attribute data. + + // Write the attribute data. fa1.write( PredType::NATIVE_INT, attr_data); ga1.write( PredType::NATIVE_INT, attr_data); diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 232ece2..138c4ca 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -430,7 +430,6 @@ const H5std_string DSETNAME("dataset"); static void test_open_object_header() { hsize_t dims[2]; - H5G_info_t ginfo; /* Group info struct */ // Output message about test being performed SUBTEST("Group::getObjId"); @@ -485,6 +484,7 @@ static void test_open_object_header() dset.setId(obj_dset); dspace = dset.getSpace(); bool is_simple = dspace.isSimple(); + verify_val(is_simple, true, "isSimple", __LINE__, __FILE__); dspace.close(); // Open datatype object from the group diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 562b127..b2b65ce 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -476,7 +476,7 @@ static void test_reference_group() // Check getting file name given the group dereferenced via constructor H5std_string fname = refgroup.getFileName(); verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); - + // Check getting file name given the group dereferenced by ::reference fname = group.getFileName(); verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 0de66d7..b8846f4 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -54,7 +54,7 @@ using namespace H5; H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL) #endif /* #include "H5Tpkg.h" - */ + */ const char *FILENAME[] = { "dtypes1.h5", @@ -392,7 +392,7 @@ static void test_vltype() try { VarLenType vltype(PredType::NATIVE_INT); - + bool in_class = vltype.detectClass(H5T_VLEN); verify_val(in_class, true, "VarLenType::detectClass() with H5T_VLEN", __LINE__, __FILE__); in_class = vltype.detectClass(H5T_INTEGER); @@ -403,7 +403,7 @@ static void test_vltype() // Verify that the copied type has a valid id bool is_valid = IdComponent::isValid(vltype2.getId()); - verify_val(in_class, true, "isValid on vltype2", __LINE__, __FILE__); + verify_val(is_valid, true, "isValid on vltype2", __LINE__, __FILE__); in_class = vltype2.detectClass(H5T_VLEN); verify_val(in_class, true, "VarLenType::detectClass() with H5T_VLEN for vltype2", __LINE__, __FILE__); @@ -1010,8 +1010,8 @@ static void test_encode_decode() FloatType decoded_flttyp(decoded_flt_ptr->getId()); verify_val(flttyp == decoded_flttyp, true, "DataType::decode", __LINE__, __FILE__); - H5std_string norm_string; - H5T_norm_t mant_norm = decoded_flttyp.getNorm(norm_string); + //H5std_string norm_string; + //H5T_norm_t mant_norm = decoded_flttyp.getNorm(norm_string); //verify_val(decoded_flttyp.isVariableStr(), true, "DataType::decode", __LINE__, __FILE__); delete decoded_flt_ptr; |