Commit db5defd6 authored by Alberto Miranda's avatar Alberto Miranda ♨️ Committed by Marc Vef
Browse files

Allow tests to be installed

parent 6b70d1cd
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -54,6 +54,23 @@ function(gkfs_enable_python_testing)
    configure_file(conftest.py.in conftest.py @ONLY)
    configure_file(harness/cli.py harness/cli.py COPYONLY)

    if(GKFS_INSTALL_TESTS)
        configure_file(pytest.install.ini.in pytest.install.ini @ONLY)
        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pytest.install.ini
            DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests
            RENAME pytest.ini
        )

        install(FILES conftest.py
            DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests
        )

        install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pytest-venv
            DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests
            USE_SOURCE_PERMISSIONS
        )
    endif()

    # enable testing
    set(GKFS_PYTHON_TESTING_ENABLED ON PARENT_SCOPE)

+3 −0
Original line number Diff line number Diff line
@@ -213,6 +213,9 @@ add_subdirectory(src/client)

option(GKFS_BUILD_TESTS "Build GekkoFS self tests" OFF)

include(CMakeDependentOption)
cmake_dependent_option(GKFS_INSTALL_TESTS "Install GekkoFS self tests" OFF "GKFS_BUILD_TESTS" OFF)

if(GKFS_BUILD_TESTS)
    message(STATUS "[gekkofs] Preparing tests...")
    add_subdirectory(tests)
+27 −0
Original line number Diff line number Diff line
@@ -35,3 +35,30 @@ gkfs_add_python_test(
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    SOURCE tests/shell/
)

if(GKFS_INSTALL_TESTS)
    install(DIRECTORY harness
        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests
        FILES_MATCHING
            REGEX ".*\\.py"
            PATTERN "__pycache__" EXCLUDE
            PATTERN ".pytest_cache" EXCLUDE
            PATTERN "gkfs.io" EXCLUDE
    )

    install(DIRECTORY directories
        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests
        FILES_MATCHING
            REGEX ".*\\.py"
            PATTERN "__pycache__" EXCLUDE
            PATTERN ".pytest_cache" EXCLUDE
    )

    install(DIRECTORY shell
        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests
        FILES_MATCHING
            REGEX ".*\\.py"
            PATTERN "__pycache__" EXCLUDE
            PATTERN ".pytest_cache" EXCLUDE
    )
endif()
+6 −0
Original line number Diff line number Diff line
@@ -72,3 +72,9 @@ target_link_libraries(gkfs.io
    nlohmann_json::nlohmann_json
    fmt::fmt
)

if(GKFS_INSTALL_TESTS)
    install(TARGETS gkfs.io
        DESTINATION ${CMAKE_INSTALL_BINDIR}
    )
endif()
+17 −0
Original line number Diff line number Diff line
################################################################################
#  Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain           #
#  Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany         #
#                                                                              #
#  This software was partially supported by the                                #
#  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).   #
#                                                                              #
#  This software was partially supported by the                                #
#  ADA-FS project under the SPPEXA project funded by the DFG.                  #
#                                                                              #
#  SPDX-License-Identifier: MIT                                                #
################################################################################

[pytest]
testpaths = @CMAKE_INSTALL_FULL_DATAROOTDIR@/gkfs/tests
addopts = --bin-dir=@CMAKE_INSTALL_FULL_BINDIR@ --bin-dir=@CMAKE_INSTALL_FULL_LIBDIR@ --lib-dir=@CMAKE_INSTALL_FULL_LIBDIR@
enable_assertion_pass_hook = true
Loading