summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2022-06-09 09:41:01 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2022-06-09 09:41:01 +0900
commit3a05784b7e8d34555b631ec3ca2fc9d67d609fd2 (patch)
tree18f3f34a805a4525089818fa14b58f95645e3a59
parentadd328b06e622f936b82dd6ea637150d39465b9e (diff)
downloadlibslp-db-util-3a05784b7e8d34555b631ec3ca2fc9d67d609fd2.tar.gz
libslp-db-util-3a05784b7e8d34555b631ec3ca2fc9d67d609fd2.tar.bz2
libslp-db-util-3a05784b7e8d34555b631ec3ca2fc9d67d609fd2.zip
- Create unittests package Change-Id: I8e6b90951393778f4630457210523d85e0ea089a
-rw-r--r--CMakeLists.txt4
-rw-r--r--packaging/libslp-db-util.spec42
2 files changed, 40 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f12f9e1..20c79b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,4 @@ INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
FILE(GLOB HEADERS include/*.h)
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME})
-IF(BUILD_GCOV)
- ADD_SUBDIRECTORY(tests)
-ENDIF()
+ADD_SUBDIRECTORY(tests)
diff --git a/packaging/libslp-db-util.spec b/packaging/libslp-db-util.spec
index a5273ac..8953422 100644
--- a/packaging/libslp-db-util.spec
+++ b/packaging/libslp-db-util.spec
@@ -12,11 +12,10 @@ BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(icu-i18n)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(vconf)
+BuildRequires: gtest-devel
%if 0%{?gcov:1}
-BuildRequires: gtest-devel
BuildRequires: lcov
-BuildRequires: tar
%endif
%description
@@ -31,11 +30,15 @@ Devel package for libslp-db-util (devel)
%if 0%{?gcov:1}
%package gcov
Summary: DB Utility(gcov)
-Group: Application Framework/Database
%description gcov
libslp-db-util gcov objects
%endif
+%package unittests
+Summary: %{name} unittests binary
+%description unittests
+unittests binary
+
%prep
%setup -q
cp %{SOURCE1001} ./%{name}.manifest
@@ -63,6 +66,35 @@ mkdir -p "$gcno_obj_dir"
find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
%endif
+cat << EOF > run-unittest.sh
+#!/bin/sh
+setup() {
+ echo "setup start"
+}
+
+test_main() {
+ echo "test_main start"
+ /usr/bin/db-util-gtest
+}
+
+teardown() {
+ echo "teardown start"
+}
+
+main() {
+ setup
+ test_main
+ teardown
+}
+
+main "\$*"
+EOF
+
+mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
+install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
+install -m 0755 ./tests/db-util-gtest %{buildroot}%{_bindir}
+
+
%check
%if 0%{?gcov:1}
pushd tests
@@ -91,3 +123,7 @@ genhtml %{name}.info -o out --legend --show-details
%files gcov
%{_datadir}/gcov/*
%endif
+
+%files unittests
+%{_bindir}/db-util-gtest
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh