From 1c00ed8ed79e638893d02a743e4670bc0d999a83 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Mon, 30 Nov 2020 11:39:54 +0900 Subject: [PATCH] Fix minor coding rule Change-Id: Ibbab34ace09323983b9d411b20746030b3b5c797 Signed-off-by: Junghyun Yeon --- src/pkg_upgrade/src/pkg_finder.cc | 2 +- src/pkg_upgrade/src/pkg_upgrader_factory.cc | 4 +++- src/pkg_upgrade/src/upgrader.cc | 7 +++++-- tests/mock/os_mock.cc | 6 +++--- tests/mock/os_mock.h | 2 +- tests/mock/pkgmgr_info_mock.cc | 6 +++--- tests/mock/pkgmgr_info_mock.h | 2 +- tests/mock/test_fixture.cc | 2 +- tests/mock/test_fixture.h | 2 +- tests/unit_tests/CMakeLists.txt | 2 +- tests/unit_tests/src/test_pkg_upgrader.cc | 10 ++++++---- 11 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/pkg_upgrade/src/pkg_finder.cc b/src/pkg_upgrade/src/pkg_finder.cc index eded528..2370742 100644 --- a/src/pkg_upgrade/src/pkg_finder.cc +++ b/src/pkg_upgrade/src/pkg_finder.cc @@ -39,7 +39,7 @@ "pkgmgr/fota") -using namespace std; +using std::string; namespace { constexpr char kOptZipFile[] = "/usr/system/RestoreDir/opt.zip"; diff --git a/src/pkg_upgrade/src/pkg_upgrader_factory.cc b/src/pkg_upgrade/src/pkg_upgrader_factory.cc index baabfb6..85c15a6 100644 --- a/src/pkg_upgrade/src/pkg_upgrader_factory.cc +++ b/src/pkg_upgrade/src/pkg_upgrader_factory.cc @@ -21,7 +21,9 @@ #include "rw_upgrader.hh" #include "simple_upgrader.hh" -using namespace std; +using std::list; +using std::string; +using std::unique_ptr; namespace common_fota { diff --git a/src/pkg_upgrade/src/upgrader.cc b/src/pkg_upgrade/src/upgrader.cc index acbe832..ea7f5b5 100644 --- a/src/pkg_upgrade/src/upgrader.cc +++ b/src/pkg_upgrade/src/upgrader.cc @@ -34,7 +34,10 @@ #include "pkg_upgrader_factory.hh" #include "upgrader.hh" -using namespace std; +using std::list; +using std::shared_ptr; +using std::string; +using std::unique_ptr; namespace { constexpr char kLogFileName[] = "/var/log/appfw/app-installers/fota.log"; @@ -46,7 +49,7 @@ constexpr char kAppfwUser[] = "app_fw"; class File { public: - File(const string& path) { + explicit File(const string& path) { fd_ = open(path.c_str(), O_RDONLY); } diff --git a/tests/mock/os_mock.cc b/tests/mock/os_mock.cc index 4596274..32c8560 100644 --- a/tests/mock/os_mock.cc +++ b/tests/mock/os_mock.cc @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "os_mock.h" -#include "mock_hook.h" -#include "test_fixture.h" +#include "mock/mock_hook.h" +#include "mock/os_mock.h" +#include "mock/test_fixture.h" extern "C" pid_t fork(void) { return MOCK_HOOK_P0(OsMock, fork); diff --git a/tests/mock/os_mock.h b/tests/mock/os_mock.h index 865213c..7744ba2 100644 --- a/tests/mock/os_mock.h +++ b/tests/mock/os_mock.h @@ -22,7 +22,7 @@ #include #include -#include "module_mock.h" +#include "mock/module_mock.h" class OsMock : public virtual ModuleMock { public: diff --git a/tests/mock/pkgmgr_info_mock.cc b/tests/mock/pkgmgr_info_mock.cc index 3ed9a7a..3177e32 100644 --- a/tests/mock/pkgmgr_info_mock.cc +++ b/tests/mock/pkgmgr_info_mock.cc @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "pkgmgr_info_mock.h" -#include "mock_hook.h" -#include "test_fixture.h" +#include "mock/mock_hook.h" +#include "mock/pkgmgr_info_mock.h" +#include "mock/test_fixture.h" extern "C" int pkgmgrinfo_pkginfo_filter_create( pkgmgrinfo_pkginfo_filter_h *handle) { diff --git a/tests/mock/pkgmgr_info_mock.h b/tests/mock/pkgmgr_info_mock.h index 64f145e..7e7fae6 100644 --- a/tests/mock/pkgmgr_info_mock.h +++ b/tests/mock/pkgmgr_info_mock.h @@ -21,7 +21,7 @@ #include #include -#include "module_mock.h" +#include "mock/module_mock.h" class PkgMgrInfoMock : public virtual ModuleMock { public: diff --git a/tests/mock/test_fixture.cc b/tests/mock/test_fixture.cc index 27f5666..4eceef4 100644 --- a/tests/mock/test_fixture.cc +++ b/tests/mock/test_fixture.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "test_fixture.h" +#include "mock/test_fixture.h" #include diff --git a/tests/mock/test_fixture.h b/tests/mock/test_fixture.h index 106f6a7..33643ce 100644 --- a/tests/mock/test_fixture.h +++ b/tests/mock/test_fixture.h @@ -24,7 +24,7 @@ #include #include -#include "module_mock.h" +#include "mock/module_mock.h" class TestFixture : public ::testing::Test { public: diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index b946e29..b9cc613 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -23,7 +23,7 @@ SET(CMAKE_CXX_FLAGS_RELEASE "-O2") ADD_DEFINITIONS("-DDB_PATH=\"${DB_PATH}\"") INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../src/pkg_upgrade/include) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mock) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/pkg_upgrade/src LIB_SOURCES) diff --git a/tests/unit_tests/src/test_pkg_upgrader.cc b/tests/unit_tests/src/test_pkg_upgrader.cc index 43f40c3..5b7d750 100644 --- a/tests/unit_tests/src/test_pkg_upgrader.cc +++ b/tests/unit_tests/src/test_pkg_upgrader.cc @@ -20,9 +20,9 @@ #include -#include "pkgmgr_info_mock.h" -#include "os_mock.h" -#include "test_fixture.h" +#include "mock/os_mock.h" +#include "mock/pkgmgr_info_mock.h" +#include "mock/test_fixture.h" #include "pkg_finder.hh" #include "pkg_upgrader_factory.hh" #include "upgrader.hh" @@ -35,7 +35,9 @@ using ::testing::SetArgPointee; using ::testing::InvokeArgument; using ::testing::SaveArg; -using namespace common_fota; +using common_fota::PkgFinder; +using common_fota::PkgUpgraderFactory; +using common_fota::Upgrader; class Mocks : public ::testing::NiceMock, public ::testing::NiceMock {}; -- 2.34.1