From: Sangyoon Jang Date: Tue, 24 Mar 2020 06:18:09 +0000 (+0900) Subject: Make smoke utils as a library X-Git-Tag: accepted/tizen/unified/20200603.150220~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F228604%2F5;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Make smoke utils as a library 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ce42c94..6c01650 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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\"") diff --git a/packaging/tpk-backend.spec b/packaging/tpk-backend.spec index c3952fd..3fb2a7e 100644 --- a/packaging/tpk-backend.spec +++ b/packaging/tpk-backend.spec @@ -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 0.1-1 diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt index 759fe06..204ddb8 100644 --- a/src/unit_tests/CMakeLists.txt +++ b/src/unit_tests/CMakeLists.txt @@ -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/) diff --git a/src/unit_tests/extensive_smoke_test.cc b/src/unit_tests/extensive_smoke_test.cc index 7d6afdb..d042513 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/tpk_smoke_utils.h" namespace bpo = boost::program_options; namespace ci = common_installer; diff --git a/src/unit_tests/recovery_test.cc b/src/unit_tests/recovery_test.cc index 2cbcefc..eb5bf09 100644 --- a/src/unit_tests/recovery_test.cc +++ b/src/unit_tests/recovery_test.cc @@ -14,7 +14,7 @@ #include #include -#include "unit_tests/smoke_utils.h" +#include "unit_tests/tpk_smoke_utils.h" namespace bf = boost::filesystem; namespace bpo = boost::program_options; diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 95a044b..2923e7f 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -13,7 +13,7 @@ #include #include -#include "unit_tests/smoke_utils.h" +#include "unit_tests/tpk_smoke_utils.h" namespace st = smoke_test; namespace bf = boost::filesystem; diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/tpk_smoke_utils.cc similarity index 98% rename from src/unit_tests/smoke_utils.cc rename to src/unit_tests/tpk_smoke_utils.cc index 256f1d7..0d56e1d 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/tpk_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/tpk_smoke_utils.h" + #include #include @@ -9,8 +11,6 @@ #include "tpk/tpk_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/tpk_smoke_utils.h similarity index 95% rename from src/unit_tests/smoke_utils.h rename to src/unit_tests/tpk_smoke_utils.h index db77228..aeaa259 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/tpk_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_TPK_SMOKE_UTILS_H_ +#define UNIT_TESTS_TPK_SMOKE_UTILS_H_ #include #include @@ -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_