Skip to content

Commit

Permalink
Test installation interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Aug 22, 2023
1 parent 3042dc4 commit abe8278
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(Catch2 3.4.0 REQUIRED)
find_package(range-v3 REQUIRED)

# Test library
add_executable(test-rsl
algorithm.cpp
monad.cpp
Expand All @@ -20,3 +21,31 @@ target_link_libraries(test-rsl PRIVATE
range-v3::range-v3
)
catch_discover_tests(test-rsl)

# Test install interface
add_test(NAME "Install RSL" COMMAND
${CMAKE_COMMAND}
--install ${PROJECT_BINARY_DIR}
--prefix ${CMAKE_CURRENT_BINARY_DIR}/install/RSL
--config $<CONFIG>)
set_tests_properties("Install RSL" PROPERTIES FIXTURES_SETUP install-rsl)

add_test(NAME "Configure installation test" COMMAND
${CMAKE_COMMAND}
-S ${CMAKE_CURRENT_SOURCE_DIR}/install
-B ${CMAKE_CURRENT_BINARY_DIR}/install/build
-G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=$<CONFIG>
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-Drsl_ROOT=${CMAKE_CURRENT_BINARY_DIR}/install/RSL)
set_tests_properties("Configure installation test" PROPERTIES FIXTURES_SETUP configure-test-project FIXTURES_REQUIRED install-rsl)

add_test(NAME "Build installation test" COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/install/build --config $<CONFIG>)
set_tests_properties("Build installation test" PROPERTIES FIXTURES_REQUIRED configure-test-project)

add_test(NAME "Delete installation" COMMAND ${CMAKE_COMMAND} -E rm -r ${CMAKE_CURRENT_BINARY_DIR}/install/RSL ${CMAKE_CURRENT_BINARY_DIR}/install/build)
set_tests_properties("Delete installation" PROPERTIES FIXTURES_CLEANUP "install-rsl;configure-test-project")

# Build install test project
add_subdirectory(install)
9 changes: 9 additions & 0 deletions tests/install/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.22)
project(rsl-install-test)

if(PROJECT_IS_TOP_LEVEL)
find_package(rsl REQUIRED)
endif()

add_executable(test-rsl-install install.cpp)
target_link_libraries(test-rsl-install PRIVATE rsl::rsl)
6 changes: 6 additions & 0 deletions tests/install/install.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <rsl/monad.hpp>

int main()
{

}

0 comments on commit abe8278

Please sign in to comment.