feat: Create unittests package 24/276024/1 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/7.0/unified/20221110.063651 accepted/tizen/7.0/unified/hotfix/20221116.105025 accepted/tizen/8.0/unified/20231005.093043 accepted/tizen/unified/20220620.030039 accepted/tizen/unified/20220620.131739 submit/tizen/20220609.004957 submit/tizen/20220614.074332 submit/tizen/20220617.014556 tizen_7.0_m2_release tizen_8.0_m2_release
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 9 Jun 2022 00:41:01 +0000 (09:41 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 9 Jun 2022 00:41:01 +0000 (09:41 +0900)
- Create unittests package

Change-Id: I8e6b90951393778f4630457210523d85e0ea089a

CMakeLists.txt
packaging/libslp-db-util.spec

index f12f9e1..20c79b4 100644 (file)
@@ -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)
index a5273ac..8953422 100644 (file)
@@ -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