From 0f5160fe2c4d01e09a2d9c9bbfcdf2fd84676f5a Mon Sep 17 00:00:00 2001 From: Kamil Nowac Date: Wed, 8 May 2013 11:08:38 +0200 Subject: [PATCH] [Daily Tests] wrt-commons tests [Issue#] LINUXWRT-214 [Problem] Tests do not pass in 100% [Cause] Tests in one directory must fail so it looks bad in daily tests [Solution] Adding proper condition to CMake [Verification] 1. Build wrt-commons repository with --define "WITH_TESTS ON" and --define "WITH_CHILD ON". There is proper a signal during build: "Additional test subdirectory is being added" Change-Id: I1533ac05a3e7406b5f4c67c9ba382381898b0481 --- CMakeLists.txt | 2 ++ packaging/wrt-commons.spec | 8 +++++++- tests/CMakeLists.txt | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd7e778..746e7b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") OPTION(WITH_TESTS "Build tests" OFF) +OPTION(WITH_CHILD "Build additional test subdirectory. WITH_TEST must be ON" OFF) # Compiler flags SET(CMAKE_C_FLAGS_PROFILING "-O2") @@ -108,6 +109,7 @@ MESSAGE(STATUS "CMAKE_COMPILER_IS_GNUCXX : " ${CMAKE_COMPILER_IS_GNUCXX}) MESSAGE(STATUS "CMAKE_AR: " ${CMAKE_AR}) MESSAGE(STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB}) MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS}) +MESSAGE(STATUS "WITH_CHILD: " ${WITH_CHILD}) MESSAGE(STATUS "========================================") # Compiler flags diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 2671365..93e1313 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -47,6 +47,11 @@ Wrt common library development headers %define with_tests 1 %endif +%define with_child 0 +%if "%{WITH_CHILD}" == "ON" || "%{WITH_CHILD}" == "Y" || "%{WITH_CHILD}" == "YES" || "%{WITH_CHILD}" == "TRUE" || "%{WITH_CHILD}" == "1" + %define with_child 1 +%endif + %build export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed" @@ -55,7 +60,8 @@ cmake . -DVERSION=%{version} \ -DDPL_LOG="OFF" \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \ - %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS} + %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS} \ + %{?WITH_CHILD:-DWITH_CHILD=%WITH_CHILD} make %{?jobs:-j%jobs} %install diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d3a9edf..b271d5c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,7 +19,11 @@ ADD_SUBDIRECTORY(event) ADD_SUBDIRECTORY(files_localization) ADD_SUBDIRECTORY(localizationTagsProvider) ADD_SUBDIRECTORY(utils) -ADD_SUBDIRECTORY(test) + +IF(WITH_CHILD) + MESSAGE(STATUS "Additional test subdirectory is being added") + ADD_SUBDIRECTORY(test) +ENDIF(WITH_CHILD) # Rollback CXX flags #SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_BACKUP}) -- 2.34.1