summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-08-07 04:59:31 (GMT)
committerGitHub <noreply@github.com>2022-08-07 04:59:31 (GMT)
commit956282fa6f5f5b7df92be6f14c12681f7ecabbc9 (patch)
tree262418febb0a037f752e577ab632accd358edd93 /c++
parent7127d8912c8fa601d59b4e8ce522eaf149c02344 (diff)
downloadhdf5-956282fa6f5f5b7df92be6f14c12681f7ecabbc9.zip
hdf5-956282fa6f5f5b7df92be6f14c12681f7ecabbc9.tar.gz
hdf5-956282fa6f5f5b7df92be6f14c12681f7ecabbc9.tar.bz2
Develop cmake clean (#1971)
Diffstat (limited to 'c++')
-rw-r--r--c++/examples/CMakeTests.cmake63
-rw-r--r--c++/test/CMakeTests.cmake18
-rw-r--r--c++/test/CMakeVFDTests.cmake20
-rw-r--r--c++/test/dsets.cpp1
-rw-r--r--c++/test/tobject.cpp3
-rw-r--r--c++/test/ttypes.cpp21
6 files changed, 72 insertions, 54 deletions
diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake
index a7fc9b8..2a3bef5 100644
--- a/c++/examples/CMakeTests.cmake
+++ b/c++/examples/CMakeTests.cmake
@@ -16,17 +16,31 @@
##############################################################################
##############################################################################
# Remove any output file left over from previous test run
+set (CPP_EX_CLEANFILES
+ Group.h5
+ SDS.h5
+ SDScompound.h5
+ SDSextendible.h5
+ Select.h5
+)
add_test (
NAME CPP_ex-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- Group.h5
- SDS.h5
- SDScompound.h5
- SDSextendible.h5
- Select.h5
+ -E remove ${CPP_EX_CLEANFILES}
+)
+set_tests_properties (CPP_ex-clear-objects PROPERTIES
+ FIXTURES_SETUP clear_cppex
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+)
+add_test (
+ NAME CPP_ex-clean-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${CPP_EX_CLEANFILES}
+)
+set_tests_properties (CPP_ex-clean-objects PROPERTIES
+ FIXTURES_CLEANUP clear_cppex
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
-set_tests_properties (CPP_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex)
foreach (example ${examples})
if (HDF5_ENABLE_USING_MEMCHECKER)
@@ -53,19 +67,32 @@ endforeach ()
#the following dependencies are handled by the order of the files
# SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create)
# SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds)
-
+set (CPP_EX_TUTR_CLEANFILES
+ h5tutr_cmprss.h5
+ h5tutr_dset.h5
+ h5tutr_extend.h5
+ h5tutr_group.h5
+ h5tutr_groups.h5
+ h5tutr_subset.h5
+)
add_test (
NAME CPP_ex_tutr-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- h5tutr_cmprss.h5
- h5tutr_dset.h5
- h5tutr_extend.h5
- h5tutr_group.h5
- h5tutr_groups.h5
- h5tutr_subset.h5
+ -E remove ${CPP_EX_TUTR_CLEANFILES}
+)
+set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES
+ FIXTURES_SETUP clear_cppex_tutr
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+)
+add_test (
+ NAME CPP_ex_tutr-clean-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${CPP_EX_TUTR_CLEANFILES}
+)
+set_tests_properties (CPP_ex_tutr-clean-objects PROPERTIES
+ FIXTURES_CLEANUP clear_cppex_tutr
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
-set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex_tutr)
foreach (example ${tutr_examples})
if (HDF5_ENABLE_USING_MEMCHECKER)
@@ -77,8 +104,8 @@ foreach (example ${tutr_examples})
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=cpp_ex_${example}.txt"
- #-D "TEST_REFERENCE=cpp_ex_${example}.out"
+ -D "TEST_OUTPUT=tutr_cpp_ex_${example}.txt"
+ #-D "TEST_REFERENCE=cpp_ex_tutr_${example}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake
index 2a0a6be..098c606 100644
--- a/c++/test/CMakeTests.cmake
+++ b/c++/test/CMakeTests.cmake
@@ -17,20 +17,6 @@ add_custom_target(cpp_testhdf5_files ALL COMMENT "Copying files needed by cpp_te
### 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
- titerate.h5
-)
-
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME CPP_testhdf5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cpp_testhdf5>)
else ()
@@ -46,7 +32,9 @@ else ()
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
-set_tests_properties (CPP_testhdf5 PROPERTIES DEPENDS CPP_testhdf5-clear-objects)
+set_tests_properties (CPP_testhdf5 PROPERTIES
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+)
##############################################################################
##############################################################################
diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake
index ced9b0c..92b7340 100644
--- a/c++/test/CMakeVFDTests.cmake
+++ b/c++/test/CMakeVFDTests.cmake
@@ -22,19 +22,15 @@ H5_CREATE_VFD_DIR()
### T H E T E S T S M A C R O S ###
##############################################################################
##############################################################################
-
+set (CPP_VFD_CLEANFILES
+ *-cpp_testhdf5.out
+ *-cpp_testhdf5.out.err
+)
macro (ADD_VFD_TEST vfdname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME CPP_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
- titerate.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${CPP_VFD_CLEANFILES}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname}
)
add_test (
@@ -51,6 +47,12 @@ macro (ADD_VFD_TEST vfdname resultcode)
)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT})
+ add_test (
+ NAME CPP_VFD-${vfdname}-cpp_testhdf5-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${CPP_VFD_CLEANFILES}
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname}
+ )
+ set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5-clean-objects PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5)
endif ()
endmacro ()
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 6d2753e..389d26c 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -1446,4 +1446,5 @@ extern "C" void
cleanup_dsets()
{
HDremove(FILE1.c_str());
+ HDremove(FILE_ACCPLIST.c_str());
} // cleanup_dsets
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index f040007..2f8220c 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -761,4 +761,7 @@ extern "C" void
cleanup_object()
{
HDremove(FILE_OBJECTS.c_str());
+ HDremove(FILE_OBJHDR.c_str());
+ HDremove(FILE_OBJINFO.c_str());
+ HDremove(FILE_INTERGRPS.c_str());
} // cleanup_objects
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index c488f0e..b731d37 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -45,7 +45,8 @@ using namespace H5;
/* #include "H5Tpkg.h"
*/
-const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", NULL};
+const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5",
+ "encode_decode.h5", "h5_type_operators.h5", NULL};
typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t;
@@ -557,7 +558,6 @@ test_query()
* January, 2007
*-------------------------------------------------------------------------
*/
-const char *filename1 = "dtypes1.h5";
static void
test_transient()
@@ -568,7 +568,7 @@ test_transient()
try {
// Create the file and the dataspace.
- H5File file(filename1, H5F_ACC_TRUNC);
+ H5File file(FILENAME[0], H5F_ACC_TRUNC);
DataSpace space(2, ds_size, ds_size);
// Copying a predefined type results in a modifiable copy
@@ -637,7 +637,6 @@ test_transient()
* January, 2007
*-------------------------------------------------------------------------
*/
-const H5std_string filename2("dtypes2.h5");
static void
test_named()
@@ -649,7 +648,7 @@ test_named()
SUBTEST("Named datatypes");
try {
// Create the file.
- H5File file(filename2, H5F_ACC_TRUNC);
+ H5File file(FILENAME[1], H5F_ACC_TRUNC);
// Create a simple dataspace.
DataSpace space(2, ds_size, ds_size);
@@ -805,9 +804,8 @@ test_named()
* August, 2017
*-------------------------------------------------------------------------
*/
-const H5std_string filename3("encode_decode.h5");
-const int ARRAY1_RANK = 1;
-const int ARRAY1_DIM = 10;
+const int ARRAY1_RANK = 1;
+const int ARRAY1_DIM = 10;
static void
test_encode_decode()
@@ -817,7 +815,7 @@ test_encode_decode()
SUBTEST("DataType::encode() and DataType::decode()");
try {
// Create the file.
- H5File file(filename3, H5F_ACC_TRUNC);
+ H5File file(FILENAME[4], H5F_ACC_TRUNC);
//
// Test with CompType
@@ -1026,7 +1024,6 @@ test_encode_decode()
* August, 2017
*-------------------------------------------------------------------------
*/
-const H5std_string filename4("h5_type_operators.h5");
static void
test_operators()
@@ -1036,7 +1033,7 @@ test_operators()
SUBTEST("DataType::operator== and DataType::operator!=");
try {
// Create the file.
- H5File file(filename4, H5F_ACC_TRUNC);
+ H5File file(FILENAME[5], H5F_ACC_TRUNC);
//
// Test with CompType
@@ -1140,6 +1137,6 @@ test_types()
extern "C" void
cleanup_types()
{
- for (int i = 0; i < 3; i++)
+ for (int i = 0; i < 6; i++)
HDremove(FILENAME[i]);
} // cleanup_types