From 7677f73338f9aa9364e31ce9fa3e5a1d824855c5 Mon Sep 17 00:00:00 2001 From: tbeu Date: Sun, 18 Aug 2024 10:30:31 +0200 Subject: [PATCH] Update test suite --- .github/workflows/checkCI.yml | 4 +- .../Resources/BuildProjects/CMake/test.cmake | 75 +++++++++++++------ .../Resources/Test/TablesFromMatFile.cc | 3 +- 3 files changed, 58 insertions(+), 24 deletions(-) diff --git a/.github/workflows/checkCI.yml b/.github/workflows/checkCI.yml index e647de8..279dd7f 100644 --- a/.github/workflows/checkCI.yml +++ b/.github/workflows/checkCI.yml @@ -49,7 +49,7 @@ jobs: elif [ "${{ matrix.compiler }}" == "mingw" ]; then cmake -S "$SRCDIR" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$TESTDIR" -DBUILD_TESTING=ON -DMODELICA_DEBUG_TIME_EVENTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -G "MinGW Makefiles" else - cmake -S "$SRCDIR" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$TESTDIR" -DBUILD_TESTING=ON -DMODELICA_DEBUG_TIME_EVENTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_C_FLAGS="-std=c89 -Wall -Wextra" + cmake -S "$SRCDIR" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$TESTDIR" -DBUILD_TESTING=ON -DMODELICA_DEBUG_TIME_EVENTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_C_FLAGS="-Wall -Wextra" fi env: SRCDIR: ${{ github.workspace }}/ModelicaTableAdditions/Resources @@ -74,7 +74,7 @@ jobs: build_cmake_windows-cygwin: name: build_cmake_windows-cygwin runs-on: windows-latest - timeout-minutes: 5 + timeout-minutes: 10 strategy: matrix: configuration: diff --git a/ModelicaTableAdditions/Resources/BuildProjects/CMake/test.cmake b/ModelicaTableAdditions/Resources/BuildProjects/CMake/test.cmake index ef5fe87..c48e4a3 100644 --- a/ModelicaTableAdditions/Resources/BuildProjects/CMake/test.cmake +++ b/ModelicaTableAdditions/Resources/BuildProjects/CMake/test.cmake @@ -1,38 +1,72 @@ project(${CMAKE_PROJECT_NAME} CXX) -# Set up GoogleTest include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.15.2 + GIT_SHALLOW TRUE ) -# For Windows: Prevent overriding the parent project's compiler/linker settings -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - -# Disable building GMock -set(BUILD_GMOCK OFF CACHE BOOL "" FORCE) - -# Do not install GTest -set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) - -FetchContent_MakeAvailable(googletest) - FetchContent_Declare( zlib GIT_REPOSITORY https://github.com/madler/zlib.git GIT_TAG v1.3.1 + GIT_SHALLOW TRUE +) + +FetchContent_Declare( + hdf5 + GIT_REPOSITORY https://github.com/HDFGroup/hdf5.git + GIT_TAG hdf5_1.14.4.3 + GIT_SHALLOW TRUE ) -# Do not build zlib examples +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +set(BUILD_GMOCK OFF CACHE BOOL "" FORCE) +set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) + set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +set(INSTALL_BIN_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "" FORCE) +set(INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "" FORCE) +set(SKIP_INSTALL_ALL OFF CACHE BOOL "" FORCE) +set(SKIP_INSTALL_FILES ON CACHE BOOL "" FORCE) +set(SKIP_INSTALL_HEADERS ON CACHE BOOL "" FORCE) +set(ZLIB_FOUND ON) +set(ZLIB_USE_EXTERNAL ON) + +set(HDF5_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +set(HDF5_BUILD_HL_LIB OFF CACHE BOOL "" FORCE) +set(HDF5_BUILD_PARALLEL_TOOLS OFF CACHE BOOL "" FORCE) +set(HDF5_BUILD_TOOLS OFF CACHE BOOL "" FORCE) +set(HDF5_BUILD_UTILS OFF CACHE BOOL "" FORCE) +set(HDF5_DISABLE_COMPILER_WARNINGS ON CACHE BOOL "" FORCE) +set(HDF5_ENABLE_ALL_WARNINGS OFF CACHE BOOL "" FORCE) +set(HDF5_ENABLE_DEPRECATED_SYMBOLS OFF CACHE BOOL "" FORCE) +set(HDF5_ENABLE_NONSTANDARD_FEATURES OFF CACHE BOOL "" FORCE) +set(HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE) +set(HDF5_ENABLE_WARNINGS_AS_ERRORS OFF CACHE BOOL "" FORCE) +set(HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "" FORCE) +set(HDF5_EXPORTED_TARGETS) +set(HDF5_EXTERNALLY_CONFIGURED ON CACHE BOOL "" FORCE) +set(HDF5_INSTALL_NO_DEVELOPMENT ON CACHE BOOL "" FORCE) +set(HDF5_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "" FORCE) +set(HDF5_LIB_DEPENDENCIES zlib) +set(HDF5_TEST_CPP OFF CACHE BOOL "" FORCE) +set(HDF5_TEST_EXAMPLES OFF CACHE BOOL "" FORCE) +set(HDF5_TEST_SERIAL OFF CACHE BOOL "" FORCE) +set(HDF5_TEST_SWMR OFF CACHE BOOL "" FORCE) +set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) -# Do not install zlib -set(SKIP_INSTALL_ALL TRUE CACHE BOOL "" FORCE) +FetchContent_MakeAvailable(googletest zlib) -FetchContent_MakeAvailable(zlib) +set(ZLIB_INCLUDE_DIR ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) +set(ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) + +FetchContent_MakeAvailable(hdf5) + +set(HDF5_INCLUDE_DIR "${hdf5_SOURCE_DIR}/src" "${hdf5_SOURCE_DIR}/src/H5FDsubfiling" "${hdf5_BINARY_DIR}/src") # Patch zlib1.rc file to avoid syntax error if(CYGWIN) @@ -41,9 +75,7 @@ if(CYGWIN) file(WRITE "${zlib_SOURCE_DIR}/win32/zlib1.rc" "${ZLIB_RC_CONTENT}") endif() -set(ZLIB_INCLUDE_DIR ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) - -set_target_properties(gtest gtest_main zlib zlibstatic PROPERTIES FOLDER "Test/Third-party") +set_target_properties(gtest gtest_main hdf5-static zlib zlibstatic PROPERTIES FOLDER "Test/Third-party") set(MODELICA_TABLE_ADDITIONS_TEST_DIR "${MODELICA_TABLE_ADDITIONS_RESOURCES_DIR}/Test") if(EXISTS "${MODELICA_TABLE_ADDITIONS_TEST_DIR}") @@ -82,8 +114,8 @@ if(EXISTS "${MODELICA_TABLE_ADDITIONS_TEST_DIR}") if(MSVC) target_compile_options(ModelicaTableAdditionsTestCommon PRIVATE /wd4267) endif() - target_compile_definitions(ModelicaTableAdditionsTestCommon PRIVATE -DHAVE_ZLIB=1) - target_include_directories(ModelicaTableAdditionsTestCommon PRIVATE ${ZLIB_INCLUDE_DIR}) + target_compile_definitions(ModelicaTableAdditionsTestCommon PRIVATE -DHAVE_ZLIB=1 -DHAVE_HDF5=1) + target_include_directories(ModelicaTableAdditionsTestCommon PRIVATE ${ZLIB_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}) set(MODELICA_TESTS Tables @@ -106,6 +138,7 @@ if(EXISTS "${MODELICA_TABLE_ADDITIONS_TEST_DIR}") ModelicaTableAdditionsTestCommon parson gtest + hdf5-static zlibstatic ) if(UNIX) diff --git a/ModelicaTableAdditions/Resources/Test/TablesFromMatFile.cc b/ModelicaTableAdditions/Resources/Test/TablesFromMatFile.cc index 9bfaac8..d18678d 100644 --- a/ModelicaTableAdditions/Resources/Test/TablesFromMatFile.cc +++ b/ModelicaTableAdditions/Resources/Test/TablesFromMatFile.cc @@ -33,7 +33,8 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values( std::make_pair("../Data/Tables/test_v4.mat", "tab1"), std::make_pair("../Data/Tables/test_v6.mat", "tab1"), - std::make_pair("../Data/Tables/test_v7.mat", "tab1")) + std::make_pair("../Data/Tables/test_v7.mat", "tab1"), + std::make_pair("../Data/Tables/test_v7.3.mat", "tab1")) ); } // namespace