Move cynara-tests packaging to a separate directory
authorRafal Krypa <r.krypa@samsung.com>
Thu, 3 Jul 2014 12:14:14 +0000 (14:14 +0200)
committerRafal Krypa <r.krypa@samsung.com>
Thu, 3 Jul 2014 12:19:10 +0000 (14:19 +0200)
No gmock dependency in main spec file
Cynara-tests package can be build by passing "--packaging-dir packaging_tests" to gbs build

Change-Id: I786ad78bae0bceca0ae6423f7bf33981435bd189

CMakeLists.txt
packaging/cynara.spec
packaging_tests/cynara-tests.manifest [moved from packaging/cynara-tests.manifest with 100% similarity]
packaging_tests/cynara-tests.spec [new file with mode: 0644]
test/CMakeLists.txt

index 7923083..85bcfdb 100644 (file)
@@ -57,9 +57,7 @@ SET(TARGET_CYNARA "cynara")
 SET(TARGET_LIB_CYNARA "cynara-client")
 SET(TARGET_LIB_CYNARA_ADMIN "cynara-admin")
 SET(TARGET_CYNARA_COMMON "cynara-commons")
-SET(TARGET_CYNARA_TESTS "cynara-tests")
 
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(build)
 ADD_SUBDIRECTORY(systemd)
-ADD_SUBDIRECTORY(test)
index 8ab687f..1d7b8c8 100644 (file)
@@ -8,7 +8,6 @@ Source0:    %{name}-%{version}.tar.gz
 Source1001:    cynara.manifest
 Source1002:    libcynara-client.manifest
 Source1003:    libcynara-admin.manifest
-Source1004:    cynara-tests.manifest
 BuildRequires: cmake
 BuildRequires: zip
 BuildRequires: pkgconfig(libsystemd-daemon)
@@ -74,21 +73,11 @@ Requires:   cynara = %{version}-%{release}
 %description -n cynara-devel
 service (devel version)
 
-#######################################################
-%package -n cynara-tests
-Summary:    Cynara tests
-BuildRequires: pkgconfig(gmock)
-
-%description -n cynara-tests
-cynara tests
-
-
 %prep
 %setup -q
 cp -a %{SOURCE1001} .
 cp -a %{SOURCE1002} .
 cp -a %{SOURCE1003} .
-cp -a %{SOURCE1004} .
 
 %build
 %if 0%{?sec_build_binary_debug_enable}
@@ -202,9 +191,5 @@ fi
 %files -n libcynara-admin-devel
 %defattr(-,root,root,-)
 %{_includedir}/cynara/cynara-admin.h
-%{_libdir}/pkgconfig/cynara-admin.pc
 %{_libdir}/libcynara-admin.so
-
-%files -n cynara-tests
-%manifest cynara-tests.manifest
-%attr(755,root,root) /usr/bin/cynara-tests
+%{_libdir}/pkgconfig/cynara-admin.pc
diff --git a/packaging_tests/cynara-tests.spec b/packaging_tests/cynara-tests.spec
new file mode 100644 (file)
index 0000000..8b1de31
--- /dev/null
@@ -0,0 +1,31 @@
+Name:       cynara-tests
+Summary:    Cynara tests
+Version:    0.0.1
+Release:    1
+Group:      Development/Testing
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+Source1001:    cynara-tests.manifest
+BuildRequires: cmake
+BuildRequires: pkgconfig(gmock)
+
+%description
+Cynara tests
+
+%global build_type %{?build_type:%build_type}%{!?build_type:RELEASE}
+
+%prep
+%setup -q
+cp -a %{SOURCE1001} .
+
+%build
+%cmake test -DCMAKE_BUILD_TYPE=%{?build_type} \
+            -DCMAKE_VERBOSE_MAKEFILE=ON
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+%files
+%manifest cynara-tests.manifest
+%attr(755,root,root) /usr/bin/cynara-tests
index 5828e62..0b6f913 100644 (file)
 # @brief       Cmake for tests
 #
 
+############################# Check minimum CMake version #####################
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
+PROJECT("cynara-tests")
+
+############################# cmake packages ##################################
+
+INCLUDE(FindPkgConfig)
+
+############################# compiler flags ##################################
+
+SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb")
+SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++0x -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
+SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
+SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++0x -O2")
+
+# Set compiler warning flags
+ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
+ADD_DEFINITIONS("-Wall")                        # Generate all warnings
+ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
+
+MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+
+SET(TARGET_CYNARA_TESTS "cynara-tests")
+
 PKG_CHECK_MODULES(PKGS REQUIRED gmock_main)
 
-SET(CYNARA_SRC ${PROJECT_SOURCE_DIR}/src)
+SET(CYNARA_SRC ${PROJECT_SOURCE_DIR}/../src)
 
 SET(CYNARA_SOURCES_FOR_TESTS
     ${CYNARA_SRC}/service/storage/Storage.cpp