diff options
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/Makefile.in | 2 | ||||
-rw-r--r-- | c++/test/CMakeTests.cmake | 25 | ||||
-rw-r--r-- | c++/test/Makefile.am | 3 | ||||
-rw-r--r-- | c++/test/Makefile.in | 5 | ||||
-rw-r--r-- | c++/test/tcompound.cpp | 56 |
5 files changed, 61 insertions, 30 deletions
diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 78ea36f..2a39e46 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -469,7 +469,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 157 +LT_VERS_REVISION = 159 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index f2a10e2..3e4f6d9 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -4,8 +4,21 @@ ### T E S T I N G ### ############################################################################## ############################################################################## +# Remove any output file left over from previous test run +ADD_TEST ( + NAME cpp_testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tattr_basic.h5 + tattr_compound.h5 + tattr_dtype.h5 + tattr_multi.h5 + tattr_scalar.h5 + tfattrs.h5 +) ADD_TEST (NAME cpp_testhdf5 COMMAND $<TARGET_FILE:cpp_testhdf5>) +SET_TESTS_PROPERTIES (cpp_testhdf5 PROPERTIES DEPENDS cpp_testhdf5-clear-objects) IF (HDF5_TEST_VFD) @@ -25,6 +38,17 @@ IF (HDF5_TEST_VFD) MACRO (ADD_VFD_TEST vfdname resultcode) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( + NAME VFD-${vfdname}-cpp_testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tattr_basic.h5 + tattr_compound.h5 + tattr_dtype.h5 + tattr_multi.h5 + tattr_scalar.h5 + tfattrs.h5 + ) + ADD_TEST ( NAME VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>" @@ -35,6 +59,7 @@ IF (HDF5_TEST_VFD) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" ) + SET_TESTS_PROPERTIES (VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS VFD-${vfdname}-cpp_testhdf5-clear-objects) ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_VFD_TEST) diff --git a/c++/test/Makefile.am b/c++/test/Makefile.am index 687f0ca..3f62bda 100644 --- a/c++/test/Makefile.am +++ b/c++/test/Makefile.am @@ -51,5 +51,8 @@ mostlyclean-local: @if test -d ii_files; then \ $(RM) -rf ii_files; \ fi +# Temporary files +CHECK_CLEANFILES+=tattr_multi.h5 tfattrs.h5 tattr_scalar.h5 tattr_compound.h5 \ + tattr_dtype.h5 tattr_basic.h5 include $(top_srcdir)/config/conclude.am diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 3c4c645..0aad590 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -424,7 +424,10 @@ TRACE = perl $(top_srcdir)/bin/trace # .chkexe files are used to mark tests that have run successfully. # .chklog files are output from those tests. # *.clog are from the MPE option. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog +# Temporary files +CHECK_CLEANFILES = *.chkexe *.chklog *.clog tattr_multi.h5 tfattrs.h5 \ + tattr_scalar.h5 tattr_compound.h5 tattr_dtype.h5 \ + tattr_basic.h5 # Include src, test, and c++/src directories INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/c++/src diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 28d8a1e..6ae3f82 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -122,9 +122,9 @@ static void test_compound_2() SUBTEST("Compound Element Reordering"); try { // Sizes should be the same, but be careful just in case - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->a = i*8+0; @@ -190,9 +190,9 @@ static void test_compound_2() } } // Release resources - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -247,9 +247,9 @@ static void test_compound_3() SUBTEST("Compound Datatype Subset Conversions"); try { /* Initialize */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->a = i*8+0; @@ -312,9 +312,9 @@ static void test_compound_3() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -374,9 +374,9 @@ static void test_compound_4() SUBTEST("Compound Element Shrinking & Reordering"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->a = i*8+0; @@ -444,9 +444,9 @@ static void test_compound_4() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -499,8 +499,8 @@ static void test_compound_5() src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}}, {"two", 202, {204, 205, 206, 207}}}; dst_typ_t *dst; - void *buf = calloc(2, sizeof(dst_typ_t)); - void *bkg = calloc(2, sizeof(dst_typ_t)); + void *buf = HDcalloc(2, sizeof(dst_typ_t)); + void *bkg = HDcalloc(2, sizeof(dst_typ_t)); ArrayType* array_dt = NULL; // Output message about test being performed @@ -552,8 +552,8 @@ static void test_compound_5() { H5_FAILED(); } /* Free memory buffers */ - free(buf); - free(bkg); + HDfree(buf); + HDfree(bkg); dst = NULL; PASSED(); } // end of try block @@ -606,9 +606,9 @@ static void test_compound_6() SUBTEST("Compound Element Growing"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->b = (i*8+1) & 0x7fff; @@ -645,9 +645,9 @@ static void test_compound_6() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); |