From 7349d64e9bbcac23cc00ea5e1c75ed83a4ef2a32 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 24 Mar 2020 15:20:40 +0900 Subject: [PATCH] Make smoke utils as a library This wgt-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: I7689f92e3699073fbd4c1836e917d06f7470784a Signed-off-by: Sangyoon Jang --- CMakeLists.txt | 1 + packaging/wgt-backend.spec | 2 ++ src/unit_tests/CMakeLists.txt | 16 ++++++++-------- src/unit_tests/extensive_smoke_test.cc | 2 +- src/unit_tests/smoke_test.cc | 2 +- src/unit_tests/{smoke_utils.cc => wgt_smoke_utils.cc} | 4 ++-- src/unit_tests/{smoke_utils.h => wgt_smoke_utils.h} | 12 +++++++----- 7 files changed, 22 insertions(+), 17 deletions(-) rename src/unit_tests/{smoke_utils.cc => wgt_smoke_utils.cc} (98%) rename src/unit_tests/{smoke_utils.h => wgt_smoke_utils.h} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86b3f98..ff9ec02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ SET(TARGET_SMOKE_TEST "smoke-test") SET(TARGET_SMOKE_TEST_EXTENSIVE "extensive-smoke-test") SET(TARGET_SMOKE_TEST_HELPER "smoke-test-helper") SET(TARGET_MANIFEST_TEST "manifest-test") +SET(TARGET_WGT_SMOKE_UTILS "wgt-smoke-utils") ADD_DEFINITIONS("-DPROJECT_TAG=\"WGT_BACKEND\"") diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 18a431e..e83df85 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -95,6 +95,8 @@ ln -s %{_bindir}/wgt-backend %{buildroot}%{_sysconfdir}/package-manager/backend/ %manifest wgt-installer-tests.manifest %{_bindir}/wgt-installer-ut/* %{_datadir}/wgt-installer-ut/* +%{_libdir}/libwgt-smoke-utils.so* +%{_includedir}/app-installers/unit_tests/wgt_smoke_utils.h %changelog * Thu Dec 18 2015 Pawel Sikorski 0.1-1 diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt index 380ad2d..203e3d7 100644 --- a/src/unit_tests/CMakeLists.txt +++ b/src/unit_tests/CMakeLists.txt @@ -4,13 +4,9 @@ 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} smoke_test_helper.cc @@ -18,6 +14,9 @@ ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER} ADD_EXECUTABLE(${TARGET_MANIFEST_TEST} manifest_test.cc ) +ADD_LIBRARY(${TARGET_WGT_SMOKE_UTILS} SHARED + wgt_smoke_utils.cc +) TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) @@ -30,13 +29,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 @@ -46,12 +43,15 @@ APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC # 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_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS}) -TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS}) +TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS}) +TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS}) TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_WGT}) TARGET_LINK_LIBRARIES(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${GTEST_MAIN_LIBRARIES}) +TARGET_LINK_LIBRARIES(${TARGET_WGT_SMOKE_UTILS} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${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_WGT_SMOKE_UTILS} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(FILES wgt_smoke_utils.h DESTINATION ${INCLUDEDIR}/app-installers/unit_tests/) diff --git a/src/unit_tests/extensive_smoke_test.cc b/src/unit_tests/extensive_smoke_test.cc index 92abb49..bc4ef46 100644 --- a/src/unit_tests/extensive_smoke_test.cc +++ b/src/unit_tests/extensive_smoke_test.cc @@ -10,7 +10,7 @@ #include #include -#include "unit_tests/smoke_utils.h" +#include "unit_tests/wgt_smoke_utils.h" namespace ci = common_installer; diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 53fc9eb..40a1304 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -11,7 +11,7 @@ #include -#include "unit_tests/smoke_utils.h" +#include "unit_tests/wgt_smoke_utils.h" namespace st = smoke_test; namespace bf = boost::filesystem; diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/wgt_smoke_utils.cc similarity index 98% rename from src/unit_tests/smoke_utils.cc rename to src/unit_tests/wgt_smoke_utils.cc index 44c8158..d467315 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/wgt_smoke_utils.cc @@ -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/wgt_smoke_utils.h" + #include #include @@ -11,8 +13,6 @@ #include "wgt/wgt_installer.h" #include "hybrid/hybrid_installer.h" -#include "unit_tests/smoke_utils.h" - namespace ci = common_installer; namespace st = smoke_test; diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/wgt_smoke_utils.h similarity index 96% rename from src/unit_tests/smoke_utils.h rename to src/unit_tests/wgt_smoke_utils.h index 14e0994..6de6b32 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/wgt_smoke_utils.h @@ -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_WGT_SMOKE_UTILS_H_ +#define UNIT_TESTS_WGT_SMOKE_UTILS_H_ #include #include @@ -38,7 +38,7 @@ class WgtBackendInterface: public BackendInterface { public: using BackendInterface::BackendInterface; - private: +// private: AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; @@ -50,7 +50,6 @@ class HybridBackendInterface: public BackendInterface { public: using BackendInterface::BackendInterface; - private: AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; @@ -58,6 +57,9 @@ class HybridBackendInterface: public BackendInterface { common_installer::PkgMgrPtr pkgmgr, int fail_at) const override; }; +#ifdef OVERRIDE_STEPS_BLOCK +#undef OVERRIDE_STEPS_BLOCK +#endif #define OVERRIDE_STEPS_BLOCK(TYPE, STEPS) \ void STEPS() override { \ TYPE::STEPS(); \ @@ -132,4 +134,4 @@ class FailExpectedHybridInstaller : public hybrid::HybridInstaller { } // namespace smoke_test -#endif // UNIT_TESTS_SMOKE_UTILS_H_ +#endif // UNIT_TESTS_WGT_SMOKE_UTILS_H_ -- 2.7.4