"Fossies" - the Fresh Open Source Software Archive

Member "irods-4.2.8/unit_tests/CMakeLists.txt" (14 May 2020, 3458 Bytes) of package /linux/misc/irods-4.2.8.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 4.2.7_vs_4.2.8.

    1 cmake_minimum_required(VERSION ${CMAKE_VERSION})
    2 project(unit_tests LANGUAGES C CXX)
    3 
    4 set(BUILD_UNIT_TESTS YES CACHE BOOL "Build unit tests")
    5 set(UNIT_TESTS_RUN_AFTER_BUILD NO CACHE BOOL "Run after building unit tests")
    6 set(UNIT_TESTS_REPORTING_STYLE "junit" CACHE STRING "The style of output used for unit test reporting [console, compact, junit, xml]")
    7 set(UNIT_TESTS_REPORT_FILENAME "report.xml" CACHE STRING "The filename of the unit test report")
    8 set(UNIT_TESTS_ENABLE_ALL NO CACHE BOOL "Enables all unit tests")
    9 
   10 if (NOT BUILD_UNIT_TESTS)
   11     return()
   12 endif()
   13 
   14 # Enable CTest support.
   15 enable_testing()
   16 
   17 IRODS_MACRO_CHECK_DEPENDENCY_SET_FULLPATH_ADD_TO_IRODS_PACKAGE_DEPENDENCIES_LIST(CATCH2 catch22.3.0-0)
   18 
   19 set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
   20 
   21 # Update the CMake module path so that the test compilation variables
   22 # can be found.  Prepends the new path to the beginning of the list.
   23 list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
   24 
   25 # Include helper functions and other utilities.
   26 include(utils)
   27 
   28 if (UNIT_TESTS_RUN_AFTER_BUILD)
   29     set(TEST_RUNNER_ARGS -r ${UNIT_TESTS_REPORTING_STYLE}
   30                          -o ${UNIT_TESTS_REPORT_FILENAME})
   31 endif()
   32 
   33 if (UNIT_TESTS_ENABLE_ALL)
   34     add_definitions(-DIRODS_ENABLE_ALL_UNIT_TESTS)
   35 endif()
   36 
   37 # List of cmake files defined under ./cmake/test_config.
   38 # Each file in the ./cmake/test_config directory defines variables for a specific test.
   39 # New tests should be added to this list.
   40 set(TEST_INCLUDE_LIST test_config/irods_atomic_apply_metadata_operations
   41                       test_config/irods_connection_pool
   42                       test_config/irods_data_object_modify_info
   43                       test_config/irods_dstream
   44                       test_config/irods_filesystem
   45                       test_config/irods_get_file_descriptor_info
   46                       test_config/irods_hierarchy_parser
   47                       test_config/irods_key_value_proxy
   48                       test_config/irods_lifetime_manager
   49                       test_config/irods_linked_list_iterator
   50                       test_config/irods_logical_paths_and_special_characters
   51                       test_config/irods_query_builder
   52                       test_config/irods_scoped_client_identity
   53                       test_config/irods_scoped_privileged_client
   54                       test_config/irods_shared_memory_object
   55                       test_config/irods_user_administration
   56                       test_config/irods_with_durability)
   57 
   58 foreach(IRODS_TEST_CONFIG ${TEST_INCLUDE_LIST})
   59     unset_irods_test_variables()
   60 
   61     include(${IRODS_TEST_CONFIG})
   62     add_executable(${IRODS_TEST_TARGET} ${IRODS_TEST_SOURCE_FILES})
   63     set_property(TARGET ${IRODS_TEST_TARGET} PROPERTY CXX_STANDARD ${IRODS_CXX_STANDARD})
   64     target_include_directories(${IRODS_TEST_TARGET} PRIVATE ${IRODS_TEST_INCLUDE_PATH})
   65     target_link_libraries(${IRODS_TEST_TARGET} PRIVATE ${IRODS_TEST_LINK_LIBRARIES})
   66 
   67     # =======================
   68     # Post Build Instructions
   69     # =======================
   70 
   71     if (UNIT_TESTS_RUN_AFTER_BUILD)
   72         # Run the test immediately following successful compilation.
   73         add_custom_command(TARGET ${IRODS_TEST_TARGET}
   74                            POST_BUILD
   75                            COMMAND ${IRODS_TEST_TARGET} ${TEST_RUNNER_ARGS})
   76     endif()
   77 
   78     # Make the new test available to CTest.
   79     add_test(NAME ${IRODS_TEST_TARGET} COMMAND ${IRODS_TEST_TARGET} ${TEST_RUNNER_ARGS})
   80 endforeach()
   81