Make smoke utils as a library 04/228604/5
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 24 Mar 2020 06:18:09 +0000 (15:18 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Fri, 17 Apr 2020 03:22:57 +0000 (03:22 +0000)
This tpk-smoke-utils library is used at smoke test of unified-installer.

Requires:
 - https://review.tizen.org/gerrit/c/platform/core/appfw/app-installers/+/228720

Change-Id: I342c1827141c3331459a2d752c133aa86ee408dd
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
CMakeLists.txt
packaging/tpk-backend.spec
src/unit_tests/CMakeLists.txt
src/unit_tests/extensive_smoke_test.cc
src/unit_tests/recovery_test.cc
src/unit_tests/smoke_test.cc
src/unit_tests/tpk_smoke_utils.cc [moved from src/unit_tests/smoke_utils.cc with 98% similarity]
src/unit_tests/tpk_smoke_utils.h [moved from src/unit_tests/smoke_utils.h with 95% similarity]

index ce42c94..6c01650 100644 (file)
@@ -34,6 +34,7 @@ SET(TARGET_SMOKE_TEST_EXTENSIVE "extensive-smoke-test")
 SET(TARGET_SMOKE_TEST_HELPER "smoke-test-helper")
 SET(TARGET_MANIFEST_TEST "manifest-test")
 SET(TARGET_RECOVERY_TEST "recovery-test")
+SET(TARGET_TPK_SMOKE_UTILS "tpk-smoke-utils")
 
 ADD_DEFINITIONS("-DPROJECT_TAG=\"TPK_BACKEND\"")
 
index c3952fd..3fb2a7e 100644 (file)
@@ -99,6 +99,8 @@ ln -s %{_bindir}/tpk-backend %{buildroot}%{_sysconfdir}/package-manager/backend/
 %manifest tpk-installer-tests.manifest
 %{_bindir}/tpk-installer-ut/*
 %{_datadir}/tpk-installer-ut/*
+%{_libdir}/libtpk-smoke-utils.so*
+%{_includedir}/app-installers/unit_tests/tpk_smoke_utils.h
 
 %changelog
 * Thu Dec 18 2015 Pawel Sikorski <p.sikorski@samsung.com> 0.1-1
index 759fe06..204ddb8 100644 (file)
@@ -4,14 +4,10 @@ SET(TARGET_SMOKE_UTILS smoke-utils)
 # Executables
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST}
   smoke_test.cc
-  smoke_utils.h
-  smoke_utils.cc
 )
 
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST_EXTENSIVE}
   extensive_smoke_test.cc
-  smoke_utils.h
-  smoke_utils.cc
 )
 
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER}
@@ -29,8 +25,10 @@ ADD_EXECUTABLE(${TARGET_MANIFEST_TEST}
 
 ADD_EXECUTABLE(${TARGET_RECOVERY_TEST}
   recovery_test.cc
-  smoke_utils.h
-  smoke_utils.cc
+)
+
+ADD_LIBRARY(${TARGET_TPK_SMOKE_UTILS} SHARED
+  tpk_smoke_utils.cc
 )
 
 TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
@@ -45,13 +43,11 @@ APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC
   Boost
@@ -61,20 +57,22 @@ APPLY_PKG_CONFIG(${TARGET_RECOVERY_TEST} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 
 # FindGTest module do not sets all needed libraries in GTEST_LIBRARIES and
 # GTest main libraries is still missing, so additional linking of
 # GTEST_MAIN_LIBRARIES is needed.
-TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
-TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS})
 TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_TPK})
 TARGET_LINK_LIBRARIES(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES})
-TARGET_LINK_LIBRARIES(${TARGET_RECOVERY_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_RECOVERY_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_TPK_SMOKE_UTILS} PRIVATE ${TARGET_LIBNAME_TPK} ${TARGET_SMOKE_UTILS})
 
 INSTALL(TARGETS ${TARGET_SMOKE_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_SMOKE_TEST_EXTENSIVE} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_SMOKE_TEST_HELPER} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_MANIFEST_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_RECOVERY_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
+INSTALL(TARGETS ${TARGET_TPK_SMOKE_UTILS} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES tpk_smoke_utils.h DESTINATION ${INCLUDEDIR}/app-installers/unit_tests/)
index 7d6afdb..d042513 100644 (file)
@@ -10,7 +10,7 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest-death-test.h>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/tpk_smoke_utils.h"
 
 namespace bpo = boost::program_options;
 namespace ci = common_installer;
index 2cbcefc..eb5bf09 100644 (file)
@@ -14,7 +14,7 @@
 #include <string>
 #include <vector>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/tpk_smoke_utils.h"
 
 namespace bf = boost::filesystem;
 namespace bpo = boost::program_options;
index 95a044b..2923e7f 100644 (file)
@@ -13,7 +13,7 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest-death-test.h>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/tpk_smoke_utils.h"
 
 namespace st = smoke_test;
 namespace bf = boost::filesystem;
similarity index 98%
rename from src/unit_tests/smoke_utils.cc
rename to src/unit_tests/tpk_smoke_utils.cc
index 256f1d7..0d56e1d 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by an apache-2.0 license that can be
 // found in the LICENSE file.
 
+#include "unit_tests/tpk_smoke_utils.h"
+
 #include <unit_tests/common/smoke_utils.h>
 
 #include <string>
@@ -9,8 +11,6 @@
 
 #include "tpk/tpk_installer.h"
 
-#include "unit_tests/smoke_utils.h"
-
 namespace ci = common_installer;
 namespace st = smoke_test;
 
similarity index 95%
rename from src/unit_tests/smoke_utils.h
rename to src/unit_tests/tpk_smoke_utils.h
index db77228..aeaa259 100644 (file)
@@ -2,8 +2,8 @@
 // Use of this source code is governed by an apache-2.0 license that can be
 // found in the LICENSE file.
 
-#ifndef UNIT_TESTS_SMOKE_UTILS_H_
-#define UNIT_TESTS_SMOKE_UTILS_H_
+#ifndef UNIT_TESTS_TPK_SMOKE_UTILS_H_
+#define UNIT_TESTS_TPK_SMOKE_UTILS_H_
 
 #include <common/app_installer.h>
 #include <common/pkgmgr_interface.h>
@@ -45,7 +45,6 @@ class TpkBackendInterface: public BackendInterface {
   CommandResult MountInstallSuccessWithTEP(const bf::path& path,
       const bf::path& tep) const;
 
- private:
   AppQueryInterfacePtr CreateQueryInterface() const override;
   AppInstallerPtr CreateInstaller(
       common_installer::PkgMgrPtr pkgmgr) const override;
@@ -61,6 +60,9 @@ class TpkSmokeTestHelperRunner : public SmokeTestHelperRunner {
   }
 };
 
+#ifdef OVERRIDE_STEPS_BLOCK
+#undef OVERRIDE_STEPS_BLOCK
+#endif
 #define OVERRIDE_STEPS_BLOCK(STEPS)                                            \
   void STEPS() override {                                                      \
     tpk::TpkInstaller::STEPS();                                                \
@@ -104,4 +106,4 @@ class FailExpectedTpkInstaller : public tpk::TpkInstaller {
 }  // namespace smoke_test
 
 
-#endif  // UNIT_TESTS_SMOKE_UTILS_H_
+#endif  // UNIT_TESTS_TPK_SMOKE_UTILS_H_