Skip to content

Commit

Permalink
refactor(coverage): documentation, register function reordering
Browse files Browse the repository at this point in the history
- added unit tests for code coverage

Signed-off-by: aw <[email protected]>
  • Loading branch information
a-w50 committed Jan 16, 2025
1 parent 3bf3834 commit 551b8f0
Show file tree
Hide file tree
Showing 33 changed files with 145 additions and 47 deletions.
5 changes: 5 additions & 0 deletions cmake/ev-targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set_target_properties(everest_targets
PROPERTIES
LIBRARIES ""
MODULES ""
TESTS ""
)

function(_ev_register_target TYPE NAME)
Expand All @@ -28,6 +29,10 @@ function(ev_register_module_target NAME)
_ev_register_target(MODULES ${NAME})
endfunction()

function(ev_register_test_target NAME)
_ev_register_target(TESTS ${NAME})
endfunction()

function(ev_get_targets NAME TYPE)
get_target_property(tmp everest_targets ${TYPE})
if (NOT tmp STREQUAL "" AND NOT tmp)
Expand Down
4 changes: 2 additions & 2 deletions lib/staging/can_dpm1000/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
add_library(can_dpm1000)
add_library(can_protocols::dpm1000 ALIAS can_dpm1000)
ev_register_library_target(can_dpm1000)

target_include_directories(can_dpm1000
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand All @@ -10,8 +12,6 @@ target_sources(can_dpm1000
src/dpm1000.cpp
)

ev_register_library_target(can_dpm1000)

if(BUILD_DEV_TESTS)
add_subdirectory(tests)
endif()
3 changes: 1 addition & 2 deletions lib/staging/evse_security/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_library(evse_security_conversions STATIC)
add_library(everest::evse_security_conversions ALIAS evse_security_conversions)
ev_register_library_target(evse_security_conversions)

target_sources(evse_security_conversions
PRIVATE
Expand All @@ -19,5 +20,3 @@ target_link_libraries(evse_security_conversions
everest::evse_security
everest::framework
)

ev_register_library_target(evse_security_conversions)
3 changes: 1 addition & 2 deletions lib/staging/external_energy_limits/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

add_library(external_energy_limits STATIC)
add_library(everest::external_energy_limits ALIAS external_energy_limits)
ev_register_library_target(external_energy_limits)

target_sources(external_energy_limits
PRIVATE
Expand All @@ -20,5 +21,3 @@ target_link_libraries(external_energy_limits
PRIVATE
everest::framework
)

ev_register_library_target(external_energy_limits)
4 changes: 1 addition & 3 deletions lib/staging/gpio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_library(gpio STATIC)
add_library(everest::gpio ALIAS gpio)
ev_register_library_target(gpio)

target_sources(gpio
PRIVATE
Expand All @@ -14,6 +15,3 @@ target_include_directories(gpio
target_link_libraries(gpio
PRIVATE
)

ev_register_library_target(gpio)

3 changes: 1 addition & 2 deletions lib/staging/helpers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

add_library(everest_staging_helpers STATIC)
add_library(everest::staging::helpers ALIAS everest_staging_helpers)
ev_register_library_target(everest_staging_helpers)

target_sources(everest_staging_helpers
PRIVATE
Expand Down Expand Up @@ -32,8 +33,6 @@ target_link_libraries(everest_staging_helpers

add_dependencies(everest_staging_helpers generate_cpp_files)

ev_register_library_target(everest_staging_helpers)

if (BUILD_TESTING)
add_subdirectory(tests)
endif()
2 changes: 2 additions & 0 deletions lib/staging/helpers/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ target_link_libraries(${TEST_TARGET_NAME}

include(GoogleTest)
gtest_discover_tests(${TEST_TARGET_NAME})

ev_register_test_target(${TEST_TARGET_NAME})
7 changes: 2 additions & 5 deletions lib/staging/ocpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

add_library(ocpp_evse_security STATIC)
add_library(everest::ocpp_evse_security ALIAS ocpp_evse_security)
ev_register_library_target(ocpp_evse_security)

target_sources(ocpp_evse_security
PRIVATE
Expand All @@ -28,13 +29,12 @@ target_link_libraries(ocpp_evse_security
everest::framework
)

ev_register_library_target(ocpp_evse_security)


# OCPP conversions

add_library(ocpp_conversions STATIC)
add_library(everest::ocpp_conversions ALIAS ocpp_conversions)
ev_register_library_target(ocpp_conversions)

target_sources(ocpp_conversions
PRIVATE
Expand All @@ -60,6 +60,3 @@ target_link_libraries(ocpp_conversions
everest::ocpp
everest::framework
)

ev_register_library_target(ocpp_conversions)

4 changes: 2 additions & 2 deletions lib/staging/slac/fsm/ev/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
add_library(slac_fsm_ev)
add_library(slac::fsm::ev ALIAS slac_fsm_ev)
ev_register_library_target(slac_fsm_ev)

target_include_directories(slac_fsm_ev
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand All @@ -17,5 +19,3 @@ target_link_libraries(slac_fsm_ev
slac::slac
fsm::fsm
)

ev_register_library_target(slac_fsm_ev)
3 changes: 1 addition & 2 deletions lib/staging/slac/fsm/evse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_library(slac_fsm_evse)
add_library(slac::fsm::evse ALIAS slac_fsm_evse)
ev_register_library_target(slac_fsm_evse)

target_include_directories(slac_fsm_evse
PUBLIC
Expand All @@ -20,5 +21,3 @@ target_link_libraries(slac_fsm_evse
slac::slac
fsm::fsm
)

ev_register_library_target(slac_fsm_evse)
3 changes: 1 addition & 2 deletions lib/staging/slac/io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_library(slac_io)
add_library(slac::io ALIAS slac_io)
ev_register_library_target(slac_io)

target_include_directories(slac_io
PUBLIC
Expand All @@ -15,5 +16,3 @@ target_link_libraries(slac_io
PUBLIC
slac::slac
)

ev_register_library_target(slac_io)
3 changes: 1 addition & 2 deletions lib/staging/tls/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_library(tls STATIC)
add_library(everest::tls ALIAS tls)
ev_register_library_target(tls)

find_package(OpenSSL 3)

Expand Down Expand Up @@ -35,5 +36,3 @@ target_link_libraries(tls
if(EVEREST_CORE_BUILD_TESTING)
add_subdirectory(tests)
endif()

ev_register_library_target(tls)
1 change: 1 addition & 0 deletions lib/staging/tls/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,4 @@ target_link_libraries(${TLS_PATCH_NAME}
)

add_test(${TLS_GTEST_NAME} ${TLS_GTEST_NAME})
ev_register_test_target(${TLS_GTEST_NAME})
3 changes: 1 addition & 2 deletions lib/staging/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_library(everest_staging_util INTERFACE)
add_library(everest::staging::util ALIAS everest_staging_util)
ev_register_library_target(everest_staging_helpers)

target_include_directories(everest_staging_util
INTERFACE
Expand All @@ -9,5 +10,3 @@ target_include_directories(everest_staging_util
if (BUILD_TESTING)
add_subdirectory(tests)
endif()

ev_register_library_target(everest_staging_helpers)
1 change: 1 addition & 0 deletions modules/API/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE
)

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})
3 changes: 1 addition & 2 deletions modules/Auth/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set(INCLUDE_DIR "${PROJECT_SOURCE_DIR}/modules/Auth/include")

add_library(auth_handler STATIC)
ev_register_library_target(auth_handler)

target_sources(auth_handler PRIVATE
AuthHandler.cpp
Expand Down Expand Up @@ -35,5 +36,3 @@ if(EVEREST_ENABLE_COMPILE_WARNINGS)
PRIVATE ${EVEREST_COMPILE_OPTIONS}
)
endif()

ev_register_library_target(auth_handler)
1 change: 1 addition & 0 deletions modules/Auth/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE
)

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})
1 change: 1 addition & 0 deletions modules/EnergyManager/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE
)

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})
1 change: 1 addition & 0 deletions modules/ErrorHistory/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ if(NOT DISABLE_EDM)
endif()

add_test(${TARGET_NAME} ${TARGET_NAME})
ev_register_test_target(${TARGET_NAME})
1 change: 1 addition & 0 deletions modules/EvManager/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ if (NOT DISABLE_EDM)
endif ()

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})
1 change: 1 addition & 0 deletions modules/EvseManager/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE
)

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})
1 change: 1 addition & 0 deletions modules/EvseV2G/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ target_link_libraries(${V2G_MAIN_NAME} PRIVATE

# runs fine locally, fails in CI
add_test(${TLS_GTEST_NAME} ${TLS_GTEST_NAME})
ev_register_test_target(${TLS_GTEST_NAME})
4 changes: 3 additions & 1 deletion modules/LemDCBM400600/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE


add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})

## Time sync helper test
set(TEST_TARGET_NAME ${PROJECT_NAME}_lem_time_sync_helper_tests)
Expand Down Expand Up @@ -65,6 +66,7 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE
)

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})


## http client integration client
Expand All @@ -80,7 +82,7 @@ target_include_directories(integration_test_http_client PRIVATE
${GENERATED_INCLUDE_DIR}
)

#

target_link_libraries(integration_test_http_client PRIVATE
GTest::gmock_main
everest::timer
Expand Down
4 changes: 2 additions & 2 deletions modules/MicroMegaWattBSP/umwc_comms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ find_package(Threads REQUIRED)

# add the executable
add_library(umwc_comms STATIC)
ev_register_library_target(umwc_comms)

target_sources(umwc_comms
PRIVATE
evSerial.cpp
Expand All @@ -32,5 +34,3 @@ target_link_libraries(umwc_comms
everest::framework
everest::gpio
)

ev_register_library_target(umwc_comms)
3 changes: 2 additions & 1 deletion modules/OCPP201/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(TEST_TARGET_NAME ${PROJECT_NAME}transaction_handler_tests)
set(TEST_TARGET_NAME ${PROJECT_NAME}_transaction_handler_tests)
add_executable(${TEST_TARGET_NAME} transaction_handler_tests.cpp)

set(INCLUDE_DIR
Expand All @@ -16,3 +16,4 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE
target_sources(${TEST_TARGET_NAME} PRIVATE "../transaction_handler.cpp")

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})
3 changes: 1 addition & 2 deletions modules/PN532TokenProvider/pn532_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ find_package(Threads REQUIRED)

# add the executable
add_library(pn532_serial STATIC PN532Serial.cpp)
ev_register_library_target(pn532_serial)

target_include_directories(pn532_serial PUBLIC "${PROJECT_BINARY_DIR}")
target_link_libraries(pn532_serial PRIVATE Threads::Threads everest::framework)

ev_register_library_target(pn532_serial)
4 changes: 2 additions & 2 deletions modules/PhyVersoBSP/phyverso_gpio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

add_library(phyverso_gpio STATIC)
ev_register_library_target(phyverso_gpio)

target_sources(phyverso_gpio
PRIVATE
evGpio.cpp
Expand All @@ -29,5 +31,3 @@ target_link_libraries(phyverso_gpio
phyverso_config
fmt::fmt
)

ev_register_library_target(phyverso_gpio)
8 changes: 4 additions & 4 deletions modules/PhyVersoBSP/phyverso_mcu_comms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

add_library(phyverso_config STATIC)
ev_register_library_target(phyverso_config)

target_sources(phyverso_config
PRIVATE
evConfig.cpp
Expand All @@ -25,9 +27,9 @@ target_link_libraries(phyverso_config
fmt::fmt
)

ev_register_library_target(phyverso_config)

add_library(phyverso_mcu_comms STATIC)
ev_register_library_target(phyverso_mcu_comms)

target_sources(phyverso_mcu_comms
PRIVATE
evSerial.cpp
Expand All @@ -51,5 +53,3 @@ target_link_libraries(phyverso_mcu_comms
everest::framework
phyverso_config
)

ev_register_library_target(phyverso_mcu_comms)
1 change: 1 addition & 0 deletions modules/Setup/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ target_link_libraries(${TEST_TARGET_NAME} PRIVATE
)

add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
ev_register_test_target(${TEST_TARGET_NAME})
4 changes: 2 additions & 2 deletions modules/YetiDriver/yeti_comms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)

# add the executable
add_library(yeti_comms STATIC)
ev_register_library_target(yeti_comms)

target_sources(yeti_comms
PRIVATE
evSerial.cpp
Expand All @@ -29,5 +31,3 @@ target_link_libraries(yeti_comms
everest::framework
everest::gpio
)

ev_register_library_target(yeti_comms)
4 changes: 2 additions & 2 deletions modules/YetiEvDriver/evyeti_comms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ configure_file(config.h.in config.h)

# add the executable
add_library(evyeti_comms STATIC)
ev_register_library_target(evyeti_comms)

target_sources(evyeti_comms
PRIVATE
evSerial.cpp
Expand All @@ -32,5 +34,3 @@ target_link_libraries(evyeti_comms
Pal::Sigslot
everest::framework
)

ev_register_library_target(evyeti_comms)
Loading

0 comments on commit 551b8f0

Please sign in to comment.