Add option for building unit test package 05/236105/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 15 Jun 2020 02:49:39 +0000 (11:49 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 15 Jun 2020 02:49:39 +0000 (11:49 +0900)
Change-Id: I67ce612c200a669d056303204ad3605136abff33
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
CMakeLists.txt
packaging/capi-ui-inputmethod.spec

index b98c56a..5a13e3b 100644 (file)
@@ -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()
index f01d757..c098d6d 100644 (file)
@@ -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