Skip to content

Commit

Permalink
Merge pull request #44 from andreiosg/refactor
Browse files Browse the repository at this point in the history
Add interface interface unit tests
  • Loading branch information
zinccyy authored Dec 12, 2022
2 parents 95a9466 + 652bf85 commit 8fc31b0
Show file tree
Hide file tree
Showing 6 changed files with 505 additions and 69 deletions.
6 changes: 6 additions & 0 deletions src/interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,9 @@ if(AUGYANG_FOUND)
else(AUGYANG_FOUND)
message(WARNING "AUGYANG not found - augeas support will be disabled")
endif()

if(ENABLE_BUILD_TESTS)
find_package(CMOCKA REQUIRED)
include(CTest)
include(tests/CMakeLists.txt)
endif()
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
set(INTERFACES_UTEST_NAME "interfaces_utest")
set(UTILS_MEMORY_LIBRARY_NAME "utils_memory")
# for wrapping cmocka mock functions
set(
INTERFACES_UTEST_LINKER_OPTIONS
#"-Wl,--wrap=function_foo"
)

add_executable(
${INTERFACES_UTEST_NAME}

"interfaces_utest.c"
${CMAKE_SOURCE_DIR}/src/interfaces/tests/interfaces_utest.c
)
target_include_directories(
${INTERFACES_UTEST_NAME}
PUBLIC ${CMAKE_SOURCE_DIR}/src/interfaces/src
)
add_library(
${UTILS_MEMORY_LIBRARY_NAME}
STATIC
${CMAKE_SOURCE_DIR}/src/utils/memory.c
target_link_options(
${INTERFACES_UTEST_NAME}
PRIVATE ${INTERFACES_UTEST_LINKER_OPTIONS}
)
target_link_libraries(
${INTERFACES_UTEST_NAME}

${CMOCKA_LIBRARIES}
${PLUGIN_LIBRARY_NAME}
${SYSREPO_LIBRARIES}
${LIBYANG_LIBRARIES}
${UTILS_MEMORY_LIBRARY_NAME}
)
add_test(
NAME ${INTERFACES_UTEST_NAME}
Expand Down
Loading

0 comments on commit 8fc31b0

Please sign in to comment.