From 35aa3bc513ab227c314e612f8e51bbe17631e372 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 15 Jun 2020 11:49:39 +0900 Subject: [PATCH] Add option for building unit test package Change-Id: I67ce612c200a669d056303204ad3605136abff33 Signed-off-by: Jihoon Kim --- CMakeLists.txt | 2 ++ packaging/capi-ui-inputmethod.spec | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b98c56a..5a13e3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,6 +181,7 @@ ADD_CUSTOM_COMMAND( ENDIF(UNIX) ## Test +IF(NOT "${TEST_TYPE}" STREQUAL "none") IF(NOT DEFINED MINIMUM_BUILD) ENABLE_TESTING() SET(UNITTEST_INPUTMETHOD inputmethod_unittests) @@ -189,3 +190,4 @@ ADD_TEST(NAME ${UNITTEST_INPUTMETHOD} COMMAND ${UNITTEST_INPUTMETHOD} ADD_SUBDIRECTORY(tests) ENDIF(NOT DEFINED MINIMUM_BUILD) +ENDIF() diff --git a/packaging/capi-ui-inputmethod.spec b/packaging/capi-ui-inputmethod.spec index f01d757..c098d6d 100644 --- a/packaging/capi-ui-inputmethod.spec +++ b/packaging/capi-ui-inputmethod.spec @@ -15,7 +15,9 @@ BuildRequires: pkgconfig(libscl-core) BuildRequires: pkgconfig(isf) BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(cynara-session) +%if %{defined _test_type} BuildRequires: pkgconfig(gmock) +%endif Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -59,6 +61,7 @@ Group: Graphics & UI Framework/Input Input Method gcov objects %endif +%if %{defined _test_type} %package unittests Summary: inputmethod tests Group: Development/Libraries @@ -66,6 +69,7 @@ Requires: %{name} = %{version}-%{release} %description unittests GTest for inputmethod manager +%endif %prep %setup -q @@ -87,7 +91,12 @@ export LDFLAGS+=" -lgcov" rm -rf CMakeFiles rm -rf CMakeCache.txt MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIB_INSTALL_DIR:PATH=%{_libdir} +%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIB_INSTALL_DIR:PATH=%{_libdir} \ +%if %{defined _test_type} + -DTEST_TYPE="%{_test_type}" \ +%else + -DTEST_TYPE="none" \ +%endif make %{?jobs:-j%jobs} @@ -142,5 +151,7 @@ genhtml gcov.info %{_datadir}/gcov/obj/* %endif +%if %{defined _test_type} %files unittests %{_bindir}/* +%endif -- 2.7.4