From abe82784d749b98b10d505e2e110c90b4a91750f Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 22 Aug 2023 10:05:03 -0600 Subject: [PATCH] Test installation interface --- tests/CMakeLists.txt | 29 +++++++++++++++++++++++++++++ tests/install/CMakeLists.txt | 9 +++++++++ tests/install/install.cpp | 6 ++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/install/CMakeLists.txt create mode 100644 tests/install/install.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cc0676c..d575a9f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 @@ -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 $) +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=$ + -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 $) +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) diff --git a/tests/install/CMakeLists.txt b/tests/install/CMakeLists.txt new file mode 100644 index 0000000..8a525b3 --- /dev/null +++ b/tests/install/CMakeLists.txt @@ -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) diff --git a/tests/install/install.cpp b/tests/install/install.cpp new file mode 100644 index 0000000..0df382f --- /dev/null +++ b/tests/install/install.cpp @@ -0,0 +1,6 @@ +#include + +int main() +{ + +} \ No newline at end of file