Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit af728e0

Browse files
committed
Add unit test to criterion lib
Signed-off-by: Jules Clero <julesx.clero@intel.com>
1 parent cd56779 commit af728e0

File tree

3 files changed

+593
-0
lines changed

3 files changed

+593
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ after_success:
4747
--exclude "skeleton-subsystem"
4848
--exclude "test/test-subsystem"
4949
--exclude "bindings/c/Test.cpp"
50+
--exclude "parameter/criterion/test/"
5051
--exclude "test/tokenizer"
5152
--gcov-options '\--long-file-names --preserve-paths'
5253

parameter/criterion/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,33 @@ include_directories(
3838
"${PROJECT_SOURCE_DIR}/xmlserializer/"
3939
"${PROJECT_SOURCE_DIR}/utility/")
4040

41+
target_link_libraries(criterion pfw_utility xmlserializer)
42+
4143
# '-fPIC' needed for linking against shared libraries (e.g. libparameter)
4244
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
4345

4446
# Client headers
4547
install(FILES
4648
include/criterion/client/CriterionInterface.h
4749
DESTINATION "include/parameter/criterion/client")
50+
51+
if(BUILD_TESTING)
52+
# Catch header provided by Ubuntu package is not up to date and need
53+
# CATCH_CONFIG_CPP11_NULLPTR flag activated to compare a pointer to nullptr
54+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCATCH_CONFIG_CPP11_NULLPTR")
55+
56+
find_path(CATCH_HEADER catch.hpp)
57+
include_directories(
58+
include
59+
${CATCH_HEADER})
60+
61+
# Add unit test
62+
add_executable(criterionUnitTest test/CriterionUnitTest.cpp)
63+
64+
target_link_libraries(criterionUnitTest criterion)
65+
add_test(NAME criterionUnitTest
66+
COMMAND criterionUnitTest)
67+
68+
# Custom function defined in the top-level CMakeLists
69+
set_test_env(criterionUnitTest)
70+
endif()

0 commit comments

Comments
 (0)