From b3add2288587b9c4c24dbeb5815cd3d260cb204c Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sat, 1 Oct 2022 16:48:20 +0200 Subject: [PATCH] cmake: Move tests and CMakefiles to tests/ --- CMakeLists.txt | 23 ++--------------------- {Tests => tests}/Arduino.h | 0 tests/CMakeLists.txt | 19 +++++++++++++++++++ {Tests => tests}/Example_test.cpp | 0 {Tests => tests}/PrusaStatistics_test.cpp | 0 {Tests => tests}/Timer_test.cpp | 0 {Tests => tests}/tests.cpp | 0 7 files changed, 21 insertions(+), 21 deletions(-) rename {Tests => tests}/Arduino.h (100%) create mode 100644 tests/CMakeLists.txt rename {Tests => tests}/Example_test.cpp (100%) rename {Tests => tests}/PrusaStatistics_test.cpp (100%) rename {Tests => tests}/Timer_test.cpp (100%) rename {Tests => tests}/tests.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d721c44c..eac47610c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -475,25 +475,6 @@ if(CMAKE_CROSSCOMPILING) endif() if(NOT CMAKE_CROSSCOMPILING) - # do not build the firmware by default (tests are the focus if not crosscompiling) - project(cmake_test) - - # include catch_discover_tests function from Catch2 - include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake) - - # Make test executable - set(TEST_SOURCES - Tests/tests.cpp - Tests/Example_test.cpp - Tests/PrusaStatistics_test.cpp -# Tests/Timer_test.cpp -# Firmware/Timer.cpp - ) - add_executable(tests ${TEST_SOURCES}) - target_include_directories(tests PRIVATE Tests) - target_link_libraries(tests Catch2::Catch2) - - enable_testing() - catch_discover_tests(tests) - + enable_testing() + add_subdirectory(tests) endif() diff --git a/Tests/Arduino.h b/tests/Arduino.h similarity index 100% rename from Tests/Arduino.h rename to tests/Arduino.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000..67a8dc16f --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,19 @@ +# do not build the firmware by default (tests are the focus if not crosscompiling) +project(cmake_test) + +# include catch_discover_tests function from Catch2 +include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake) + +# Make test executable +set(TEST_SOURCES + tests.cpp + Example_test.cpp + PrusaStatistics_test.cpp + #Tests/Timer_test.cpp + #Firmware/Timer.cpp + ) + +add_executable(tests ${TEST_SOURCES}) +target_include_directories(tests PRIVATE Tests) +target_link_libraries(tests Catch2::Catch2) +catch_discover_tests(tests) diff --git a/Tests/Example_test.cpp b/tests/Example_test.cpp similarity index 100% rename from Tests/Example_test.cpp rename to tests/Example_test.cpp diff --git a/Tests/PrusaStatistics_test.cpp b/tests/PrusaStatistics_test.cpp similarity index 100% rename from Tests/PrusaStatistics_test.cpp rename to tests/PrusaStatistics_test.cpp diff --git a/Tests/Timer_test.cpp b/tests/Timer_test.cpp similarity index 100% rename from Tests/Timer_test.cpp rename to tests/Timer_test.cpp diff --git a/Tests/tests.cpp b/tests/tests.cpp similarity index 100% rename from Tests/tests.cpp rename to tests/tests.cpp