Perform code style checking fixes 87/143787/1
authorBartlomiej Kunikowski <b.kunikowski@partner.samsung.com>
Fri, 11 Aug 2017 08:43:00 +0000 (10:43 +0200)
committerBartlomiej Kunikowski <b.kunikowski@partner.samsung.com>
Fri, 11 Aug 2017 08:43:00 +0000 (10:43 +0200)
Change-Id: I3745fddee0bc058ad73c272fcc4bcb61b8d31beb

src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc
src/unit_tests/smoke_test.cc
src/unit_tests/smoke_utils.cc

index 5f0f5e55c1a32e492c16ade70a78b6acfaee1489..5f137a4aede5b5d2683df5154a228c8b963e9e5a 100644 (file)
@@ -24,9 +24,9 @@ ci::Step::Status StepTpkPreparePackageDirectory::BackupDirectory(
   if (!bf::exists(context_->pkg_path.get() / entry))
     return Status::OK;
   if (!ci::MoveDir(context_->pkg_path.get() / entry, backup_path,
-                 ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE)) {
-      LOG(ERROR) << "Failed to backup file";
-      return Status::APP_DIR_ERROR;
+      ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE)) {
+    LOG(ERROR) << "Failed to backup file";
+    return Status::APP_DIR_ERROR;
   }
 
   backupPath_ = backup_path;
index 049ca5f0492ede6a4a618d4d15c787f11a4836cd..51de2e1c134d36efad13dae0f59268893185f984 100644 (file)
@@ -17,9 +17,9 @@ class SmokeEnvironment : public testing::Environment {
   explicit SmokeEnvironment(ci::RequestMode mode) : request_mode_(mode) {
   }
   void SetUp() override {
-    if (request_mode_ == ci::RequestMode::USER)
+    if (request_mode_ == ci::RequestMode::USER) {
       ASSERT_TRUE(AddTestUser(kNormalUserName));
-    else {
+    else {
       kTestUserId = kGlobalUserUid;
       kTestGroupId = kGlobalUserGid;
       kTestUserIdStr = std::to_string(kTestUserId);
index 0a86f2072e9bcac59642e184e5f3f41c77f9bdd9..82e7ab6accb2613c262a94a63e0f78f393e7f696 100644 (file)
@@ -101,13 +101,12 @@ bool AddUser(const char *user_name) {
 bool DeleteUser(const char *user_name, bool rem_home_dir) {
   bool rval = FALSE;
   GumUser* guser = gum_user_get_by_name_sync(user_name, FALSE);
-  if(guser)
+  if (guser)
     rval = gum_user_delete_sync(guser, rem_home_dir);
   return rval;
 }
 
-}
-
+}  // namespace
 
 bool TouchFile(const bf::path& path) {
   FILE* f = fopen(path.c_str(), "w+");
@@ -185,14 +184,14 @@ bool DeleteTestUser(const char *user_name) {
     // User do not exist
     return true;
   DeleteUser(user_name, true);
-  if (boost::optional<uid_t> uid = ci::GetUidByUserName(user_name));
-  else {
+  if (boost::optional<uid_t> uid = ci::GetUidByUserName(user_name)) {
+    LOG(ERROR) << "Deleting test user failed";
+    return false;
+  } else {
     std::cout << "User deleted properly: user_name=" << user_name
               << " uid=" << test_uid << std::endl;
     return true;
   }
-  LOG(ERROR) << "Deleting test user failed";
-  return false;
 }
 
 void RemoveAllRecoveryFiles() {
@@ -304,7 +303,7 @@ bool ValidatePackageFS(const std::string& pkgid, const std::string&,
     if (bf::is_symlink(symlink_status(iter->path())))
       continue;
     bool is_rw_dir = false;
-    for(const auto rw_dir : rwDirectories) {
+    for (const auto rw_dir : rwDirectories) {
       bf::path rw_dir_path = rw_dir;
       bf::path relative_path = ci::MakeRelativePath(iter->path(), package_path);
       is_rw_dir |= (relative_path == rw_dir_path);
@@ -803,20 +802,19 @@ void UninstallAllSmokeApps(ci::RequestMode request_mode) {
   UninstallAllAppsInDirectory(apps_rw, false);
 }
 
-int GetAppInstalledTime(const char *appid, uid_t uid)
-{
-       int ret = 0;
-       int installed_time = 0;
-       pkgmgrinfo_appinfo_h handle = NULL;
-       ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle);
-       if (ret != PMINFO_R_OK)
-               return -1;
-       ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
-       if (ret != PMINFO_R_OK) {
-               pkgmgrinfo_appinfo_destroy_appinfo(handle);
-               return -1;
-       }
-       pkgmgrinfo_appinfo_destroy_appinfo(handle);
-       return installed_time;
+int GetAppInstalledTime(const char *appid, uid_t uid) {
+  int ret = 0;
+  int installed_time = 0;
+  pkgmgrinfo_appinfo_h handle = NULL;
+  ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle);
+  if (ret != PMINFO_R_OK)
+    return -1;
+  ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
+  if (ret != PMINFO_R_OK) {
+    pkgmgrinfo_appinfo_destroy_appinfo(handle);
+    return -1;
+  }
+  pkgmgrinfo_appinfo_destroy_appinfo(handle);
+  return installed_time;
 }