From 8e4ad744154151aee46f6fdbc39077bf6a483c3a Mon Sep 17 00:00:00 2001 From: Damian Pietruchowski Date: Mon, 27 Mar 2017 14:21:35 +0200 Subject: [PATCH 01/16] [SmokeTest] Fix for recovery smoke tests Change-Id: I464fd123c34ddd4dac14a319e586a6e1c45c4dea Signed-off-by: Damian Pietruchowski --- src/unit_tests/smoke_test_helper.cc | 2 +- src/unit_tests/smoke_utils.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unit_tests/smoke_test_helper.cc b/src/unit_tests/smoke_test_helper.cc index 4501e89..156b64b 100644 --- a/src/unit_tests/smoke_test_helper.cc +++ b/src/unit_tests/smoke_test_helper.cc @@ -41,7 +41,7 @@ int main(int argc, char** argv) { ci::PkgmgrInstaller pkgmgr_installer; wgt::WgtAppQueryInterface query_interface; - auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer, + auto pkgmgr = ci::PkgMgrInterface::Create(backend_argc, argv, &pkgmgr_installer, &query_interface); if (!pkgmgr) { LOG(ERROR) << "Options of pkgmgr installer cannot be parsed"; diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index c88f3fa..24f92b3 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -515,7 +515,7 @@ void CrashAfterEachStep(std::vector args, args.push_back(std::to_string(stepCount)); int i; for (i = 0; i < stepCount; i++) { - ci::Subprocess backend_crash("/usr/bin/tpk-backend-ut/smoke-test-helper"); + ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper"); args.back() = std::to_string(i); backend_crash.Run(args); ASSERT_NE(backend_crash.Wait(), 0); -- 2.7.4 From 36493ef3231a513608a91d768345f40618301d47 Mon Sep 17 00:00:00 2001 From: Damian Pietruchowski Date: Thu, 6 Apr 2017 16:13:09 +0200 Subject: [PATCH 02/16] [SmokeTest] Add SIGINT and SIGSEGV handling Change-Id: I497435a6d89a7df26bbfe19e4fd308be2dd9b55d Signed-off-by: Damian Pietruchowski --- src/unit_tests/extensive_smoke_test.cc | 4 +++- src/unit_tests/smoke_test.cc | 6 +++--- src/unit_tests/smoke_utils.cc | 6 ++++++ src/unit_tests/smoke_utils.h | 5 +++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/unit_tests/extensive_smoke_test.cc b/src/unit_tests/extensive_smoke_test.cc index 58f11f6..043c293 100644 --- a/src/unit_tests/extensive_smoke_test.cc +++ b/src/unit_tests/extensive_smoke_test.cc @@ -382,7 +382,9 @@ int main(int argc, char** argv) { ::testing::GTEST_FLAG(filter) = "SmokeTest.*"; } testing::InitGoogleTest(&argc, argv); - testing::Environment *env = testing::AddGlobalTestEnvironment( + env = testing::AddGlobalTestEnvironment( new common_installer::SmokeEnvironment(request_mode)); + signal(SIGINT, signalHandler); + signal(SIGSEGV, signalHandler); return RUN_ALL_TESTS(); } diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 38c2b01..9b90c2a 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -3,10 +3,8 @@ // found in the LICENSE file. #include - #include -#include #include #include "unit_tests/smoke_utils.h" @@ -711,7 +709,9 @@ int main(int argc, char** argv) { ::testing::GTEST_FLAG(filter) = "SmokeTest.*"; } testing::InitGoogleTest(&argc, argv); - testing::Environment *env = testing::AddGlobalTestEnvironment( + env = testing::AddGlobalTestEnvironment( new common_installer::SmokeEnvironment(request_mode)); + signal(SIGINT, signalHandler); + signal(SIGSEGV, signalHandler); return RUN_ALL_TESTS(); } diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 24f92b3..2ef8402 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -75,6 +75,11 @@ const char kPreloadApps[] = "/usr/apps"; const char kPreloadManifestDir[] = "/usr/share/packages"; const char kPreloadIcons[] = "/usr/share/icons"; +testing::Environment *env = nullptr; +void signalHandler(int signum) { + env->TearDown(); + exit(signum); +} ci::RequestMode ParseRequestMode(int argc, char** argv) { bo::options_description desc("Available options"); @@ -817,6 +822,7 @@ void UninstallAllAppsInDirectory(bf::path dir, bool is_preload) { } void UninstallAllSmokeApps(ci::RequestMode request_mode) { + std::cout << "Uninstalling all smoke apps" << std::endl; if (getuid() == 0 && request_mode == ci::RequestMode::GLOBAL) { bf::path root_path = kPreloadApps; UninstallAllAppsInDirectory(root_path, true); diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/smoke_utils.h index d0a4b47..448b71f 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/smoke_utils.h @@ -16,6 +16,8 @@ #include #include +#include + #include #include #include @@ -84,6 +86,9 @@ extern const char kPreloadApps[]; extern const char kPreloadManifestDir[]; extern const char kPreloadIcons[]; +extern testing::Environment *env; +void signalHandler(int signum); + enum class RequestResult { NORMAL, FAIL -- 2.7.4 From 1ce595996ed65c28b72fd41d1ed220fd92bd7ad9 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Sat, 8 Apr 2017 15:51:26 +0900 Subject: [PATCH 03/16] Fix Mount Installation Failure Requires : https://review.tizen.org/gerrit/#/c/123947/ Change-Id: Icd0342eab4266467288d06cbe88f573e1a16ee63 Signed-off-by: jongmyeongko (cherry picked from commit 77476e84f50dd9b72a7e1cf2341c50dedd4d10cc) --- src/hybrid/hybrid_installer.cc | 4 ++-- src/wgt/wgt_installer.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 9c83f0b..ba50202 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -350,7 +350,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) ci::Plugin::ActionType::Install); AddStep( wgt::filesystem::HybridAdditionalSharedDirs); - AddStep(); + AddStep(true); AddStep(); break; case ci::RequestType::MountUpdate: @@ -399,7 +399,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep( ci::Plugin::ActionType::Upgrade); - AddStep(); + AddStep(true); AddStep(); break; case ci::RequestType::ManifestDirectInstall: diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index ee1f9b3..475c05e 100755 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -434,7 +434,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) ci::Plugin::ActionType::Install); AddStep( wgt::filesystem::WgtAdditionalSharedDirs); - AddStep(); + AddStep(true); AddStep(); } @@ -475,7 +475,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep( ci::Plugin::ActionType::Upgrade); - AddStep(); + AddStep(true); AddStep(); } -- 2.7.4 From 330a232445b9db00f63f3975a1338e7116bd570c Mon Sep 17 00:00:00 2001 From: Damian Pietruchowski Date: Fri, 7 Apr 2017 13:02:40 +0200 Subject: [PATCH 04/16] [SmokeTest] Fix restore backup When something goes wrong (for example unmount failed) then backup is not restored. After that fix, directory, which could not be removed, will be renamed to path with "trash" extension. User have to remove this directory manually.. Change-Id: Ie616f27f1bccbe2d5efbc31316f7b99cf6fec87b Signed-off-by: Damian Pietruchowski --- src/unit_tests/smoke_test.cc | 4 ++-- src/unit_tests/smoke_utils.cc | 42 +++++++++++++++++++++++++++++++++++------- src/unit_tests/smoke_utils.h | 4 ++-- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 9b90c2a..35bdfbc 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -27,7 +27,7 @@ class SmokeEnvironment : public testing::Environment { } backups_ = SetupBackupDirectories(); for (auto& path : backups_) - BackupPath(path); + ASSERT_TRUE(BackupPath(path)); } void TearDown() override { ASSERT_TRUE(request_mode_ == ci::RequestMode::GLOBAL || @@ -35,7 +35,7 @@ class SmokeEnvironment : public testing::Environment { kGlobalUserUid != kTestUserId)); UninstallAllSmokeApps(request_mode_); for (auto& path : backups_) - RestorePath(path); + ASSERT_TRUE(RestorePath(path)); if (request_mode_ == ci::RequestMode::USER) ASSERT_TRUE(DeleteTestUser(kNormalUserName)); } diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 2ef8402..ec50e82 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -729,7 +729,21 @@ ci::AppInstaller::Result Recover(const bf::path& recovery_file, return CallBackend(SIZEOFARRAY(argv), argv, type, mode); } -void BackupPath(const bf::path& path) { +namespace { + +boost::filesystem::path GetTrashPath(const boost::filesystem::path& path) { + return path.string() + ".trash"; +} + +} + +bool BackupPath(const bf::path& path) { + bf::path trash_path = GetTrashPath(path); + if (bf::exists(trash_path)) { + LOG(ERROR) << trash_path << " exists. Please remove " + << trash_path << " manually!"; + return false; + } bf::path backup_path = path.string() + ".bck"; std::cout << "Backup path: " << path << " to " << backup_path << std::endl; bs::error_code error; @@ -739,28 +753,42 @@ void BackupPath(const bf::path& path) { << " (" << error.message() << ")"; if (bf::exists(path)) { bf::rename(path, backup_path, error); - if (error) + if (error) { LOG(ERROR) << "Failed to setup test environment. Does some previous" << " test crashed? Path: " << backup_path << " should not exist."; + return false; + } assert(!error); } + return true; } -void RestorePath(const bf::path& path) { +bool RestorePath(const bf::path& path) { bf::path backup_path = path.string() + ".bck"; std::cout << "Restore path: " << path << " from " << backup_path << std::endl; bs::error_code error; bf::remove_all(path, error); - if (error) - LOG(ERROR) << "Remove failed: " << path - << " (" << error.message() << ")"; + if (error) { + bf::path trash_path = GetTrashPath(path); + LOG(ERROR) << "Remove failed: " << path << " (" << error.message() << ")"; + std::cout << "Moving " << path << " to " << trash_path << std::endl; + bf::rename(path, trash_path, error); + if (error) + LOG(ERROR) << "Failed to move " << path << " to " << trash_path + << " (" << error.message() << ")"; + else + LOG(ERROR) << trash_path << " should be removed manually!"; + } if (bf::exists(backup_path)) { bf::rename(backup_path, path, error); - if (error) + if (error) { LOG(ERROR) << "Failed to restore backup path: " << backup_path << " (" << error.message() << ")"; + return false; + } } + return true; } std::vector SetupBackupDirectories() { diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/smoke_utils.h index 448b71f..808e19b 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/smoke_utils.h @@ -263,9 +263,9 @@ ci::AppInstaller::Result Recover(const bf::path& recovery_file, PackageType type, RequestResult mode = RequestResult::NORMAL); -void BackupPath(const bf::path& path); +bool BackupPath(const bf::path& path); -void RestorePath(const bf::path& path); +bool RestorePath(const bf::path& path); std::vector SetupBackupDirectories(); -- 2.7.4 From 88fc2091153fda400934a7056617b8bc16e12383 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 19 Apr 2017 18:15:56 +0900 Subject: [PATCH 05/16] Fix crash issue when getting the locale was failed Change-Id: Id4c860204b942a636bbd6f01b00ae99551cbddc7 Signed-off-by: jongmyeongko --- src/lib/wgt_archive_info.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index 5e95b1f..eb508e1 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -28,7 +28,7 @@ namespace ci = common_installer; namespace { -const char kVconfLanguageKey[] = "db/menu_widget/language"; +const char kVconfLanguageKey[] = VCONFKEY_LANGSET; const char kConfigFileName[] = "config.xml"; const char kHybridConfigFileName[] = "res/wgt/config.xml"; @@ -226,6 +226,8 @@ bool WgtArchiveInfo::GetArchiveInfo(const char* file_path, } char* locale = vconf_get_str(kVconfLanguageKey); + if (!locale) + locale = strdup(""); if (!GetLabelInfo(parser, locale, info)) LOG(WARNING) << "Failed to get label info"; if (!GetDescriptionInfo(parser, locale, info)) -- 2.7.4 From c2fd87783a4f43f8e11f0bfb5f5144b737cb0e55 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 24 May 2017 14:38:17 +0900 Subject: [PATCH 06/16] Fix crash when parsing icon info from wgt archive Change-Id: Ifa4866a495af0764be72eb4e5d68d016642b931f Signed-off-by: Sangyoon Jang --- src/lib/wgt_archive_info.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index eb508e1..205ba5f 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -164,7 +164,7 @@ std::string GetIconInfo(const wgt::parse::WidgetConfigParser& parser) { auto icons_info = std::static_pointer_cast( parser.GetManifestData(wgt::parse::ApplicationIconsInfo::Key())); - if (!icons_info) + if (!icons_info || icons_info->icons().empty()) return {}; return std::string(icons_info->icons().front().path()); -- 2.7.4 From fef5e9e1ee8396fb3413d4cc2523c202dfe61f43 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Mon, 22 May 2017 10:43:28 +0900 Subject: [PATCH 07/16] Add update step of directories - shared/data directory of package should be created/removed when updating hybrid pkg Change-Id: Ib3f7bd0091f79d42472cc505c5bcf7ad96f69875 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index ba50202..28ef97c 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include #include @@ -185,6 +187,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(true); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -201,6 +204,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep( ci::Plugin::ActionType::Upgrade); + AddStep(); AddStep(); AddStep(); break; @@ -268,6 +272,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(true); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -284,6 +289,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep( ci::Plugin::ActionType::Upgrade); + AddStep(); AddStep(); AddStep(); break; @@ -384,6 +390,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -399,6 +406,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep( ci::Plugin::ActionType::Upgrade); + AddStep(); AddStep(true); AddStep(); break; @@ -463,6 +471,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep( ci::Plugin::ActionType::Upgrade); + AddStep(); AddStep(); AddStep(); break; @@ -507,6 +516,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep( ci::Plugin::ActionType::Upgrade); + AddStep(); AddStep(); break; } -- 2.7.4 From 88be41a3b7315837293bbf677f367000bade3cca Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 1 Jun 2017 09:47:27 +0900 Subject: [PATCH 08/16] Release version 0.4.3 Changes: - Fix crash when parsing icon info from wgt archive - Add update step of directories Change-Id: Id00bf427ae551510d7176b1c75f3ba8cf1f46019 Signed-off-by: Junghyun Yeon --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index b80b728..c674ac2 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.4.2 +Version: 0.4.3 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 128d8beb7b2ae2b32394d8ec62f7f8115c5bce6f Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 1 Jun 2017 15:18:01 +0900 Subject: [PATCH 09/16] Supress build warnings - Supress "unused parameter" build warnings Change-Id: Ic27d2298556ccbce75fc6a6fe4f06c1f3a544a8d Signed-off-by: Junghyun Yeon --- src/unit_tests/smoke_utils.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index ec50e82..3721b48 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -149,7 +149,7 @@ bool DeleteUser(const char *user_name, bool rem_home_dir) { bool AddTestUser(const char *user_name) { std::cout << "Adding test user: " << user_name << std::endl; - bool ret = AddUser(user_name); + AddUser(user_name); if (boost::optional uid = ci::GetUidByUserName(user_name)) { kTestUserId = *uid; kTestUserIdStr = std::to_string(kTestUserId); @@ -170,7 +170,7 @@ bool DeleteTestUser(const char *user_name) { uid_t test_uid; if (boost::optional uid = ci::GetUidByUserName(user_name)) test_uid = *uid; - bool ret = DeleteUser(user_name, true); + DeleteUser(user_name, true); if (!ci::GetUidByUserName(user_name)) { std::cout << "User deleted properly: user_name=" << user_name << " uid=" << test_uid << std::endl; -- 2.7.4 From 3a9647cc8e8e639dd2dc52ed3e8fd4b1e4979299 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 24 May 2017 21:35:05 +0900 Subject: [PATCH 10/16] Fix logic of 'update' attribute Requires and Refer to: https://review.tizen.org/gerrit/#/c/130948/ Change-Id: I408ec32d9cabd161217e4a462188c27e6366d712 Signed-off-by: jongmyeongko --- src/wgt/step/configuration/step_parse.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 01ae9bc..6157663 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -275,12 +275,14 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { // set update true if package is updated preload package ci::RequestType req_type = context_->request_type.get(); - if (req_type == ci::RequestType::ReadonlyUpdateInstall) + if (ci::QueryIsUpdatedPackage(context_->pkgid.get(), context_->uid.get())) manifest->update = strdup("true"); - else if (req_type == ci::RequestType::ReadonlyUpdateUninstall) - manifest->update = strdup("false"); - else if (ci::QueryIsUpdatedReadonlyPackage(context_->pkgid.get(), - context_->uid.get())) + else if (ci::QueryIsPreloadPackage(context_->pkgid.get(), + context_->uid.get()) && + (req_type == ci::RequestType::Update || + req_type == ci::RequestType::Delta || + req_type == ci::RequestType::MountUpdate || + req_type == ci::RequestType::ReadonlyUpdateInstall)) manifest->update = strdup("true"); else manifest->update = strdup("false"); -- 2.7.4 From ea510377447fc22afb1a7106ae566907ff7a1112 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Fri, 2 Jun 2017 17:05:13 +0200 Subject: [PATCH 11/16] Fix for ManifestTests Both properties in config are mandatory, regarding the documentation. So it is intuitive that te parsing process will fail in case of lack of such properies. Change-Id: I2f89a3aaa2098f942fb53002fb64fab54cb8c936 --- src/unit_tests/manifest_test.cc | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/unit_tests/manifest_test.cc b/src/unit_tests/manifest_test.cc index 52f9a81..009cf44 100644 --- a/src/unit_tests/manifest_test.cc +++ b/src/unit_tests/manifest_test.cc @@ -528,18 +528,7 @@ TEST_F(ManifestTest, MetadataElement_MissingValue) { TEST_F(ManifestTest, MetadataElement_MissingKey) { StepParseRunner runner(GetMyName()); - ASSERT_TRUE(runner.Run()); - manifest_x* m = runner.GetManifest(); - ASSERT_NE(m, nullptr); - auto apps = GListRange(m->application); - application_x* app = *apps.begin(); - - std::map meta_data_map; - for (metadata_x* meta_data : GListRange(app->metadata)) { - if (meta_data->key && meta_data->value) - meta_data_map[meta_data->key] = meta_data->value; - } - ASSERT_EQ(meta_data_map.size(), 0); + ASSERT_FALSE(runner.Run()); } TEST_F(ManifestTest, CategoryElement_Valid) { @@ -561,17 +550,7 @@ TEST_F(ManifestTest, CategoryElement_Valid) { TEST_F(ManifestTest, CategoryElement_MissingName) { StepParseRunner runner(GetMyName()); - ASSERT_TRUE(runner.Run()); - manifest_x* m = runner.GetManifest(); - ASSERT_NE(m, nullptr); - auto apps = GListRange(m->application); - application_x* app = *apps.begin(); - - std::vector categories; - for (const char* category : GListRange(app->category)) { - categories.push_back(category); - } - ASSERT_TRUE(categories.empty()); + ASSERT_FALSE(runner.Run()); } TEST_F(ManifestTest, CategoryElement_MultipleElements) { -- 2.7.4 From decd7bcdce31132fa2cbad71f98e6da6fec876a9 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Fri, 9 Jun 2017 11:30:29 +0900 Subject: [PATCH 12/16] Release version 0.4.4 Changes: - Supress build warnings - Fix logic of 'update' attribute - Fix for ManifestTests Change-Id: Ief985c4e3f6e3320e88475697d2db506d55ffe86 Signed-off-by: Sangyoon Jang --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index c674ac2..09189df 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.4.3 +Version: 0.4.4 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From e25408785ad84245a2e9d2eea53b445d900a0090 Mon Sep 17 00:00:00 2001 From: Bartlomiej Kunikowski Date: Wed, 24 May 2017 12:13:30 +0200 Subject: [PATCH 13/16] [SmokeTest] Fixes for smoke tests Add "System" exec label to extensive smoke test. Small fixes for RecoveryMode_ForDelta and MigrateLegacyExternalImageMode. Change-Id: I5e342a9e397e5c0ce72680037b1dcb667828c1e3 --- packaging/wgt-backend-tests.manifest | 1 + src/unit_tests/extensive_smoke_test.cc | 5 ++++- src/unit_tests/smoke_test.cc | 11 ++++++++--- src/unit_tests/smoke_utils.cc | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packaging/wgt-backend-tests.manifest b/packaging/wgt-backend-tests.manifest index 17bba51..8ea34c3 100644 --- a/packaging/wgt-backend-tests.manifest +++ b/packaging/wgt-backend-tests.manifest @@ -5,5 +5,6 @@ + diff --git a/src/unit_tests/extensive_smoke_test.cc b/src/unit_tests/extensive_smoke_test.cc index 043c293..34104de 100644 --- a/src/unit_tests/extensive_smoke_test.cc +++ b/src/unit_tests/extensive_smoke_test.cc @@ -107,12 +107,14 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta"; std::string pkgid = "smokewgt30"; std::string appid = "smokewgt30.RecoveryModeForDelta"; - bf::path recovery_file = FindRecoveryFile(); RemoveAllRecoveryFiles(); + ASSERT_EQ(Install(path_old, PackageType::WGT), ci::AppInstaller::Result::OK); + AddDataFiles(pkgid, kTestUserId); std::vector args = {"", "-i", path_new.string(), "-u", kTestUserIdStr.c_str()}; CrashAfterEachStep(args, [=](int step) -> bool { if (step >= 1) { + bf::path recovery_file = FindRecoveryFile(); EXTENDED_ASSERT_FALSE(recovery_file.empty()); EXTENDED_ASSERT_EQ(Recover(recovery_file, PackageType::WGT), ci::AppInstaller::Result::OK); @@ -120,6 +122,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/VERSION", "1\n")); + EXTENDED_ASSERT_TRUE(ValidateDataFiles(pkgid, kTestUserId)); } return true; }); diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 35bdfbc..c3dad25 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -583,9 +583,14 @@ TEST_F(SmokeTest, MigrateLegacyExternalImageMode) { std::string pkgid = "smokewgt36"; std::string appid = "smokewgt36.web"; bf::path legacy_path = kSmokePackagesDirectory / kLegacyExtImageDir; - ASSERT_EQ(MigrateLegacyExternalImage(pkgid, path, legacy_path, - PackageType::WGT), ci::AppInstaller::Result::OK); - ValidateExternalPackage(pkgid, {appid}); + if (kTestUserIdStr == kDefaultUserIdStr || kTestUserId == kGlobalUserUid) { + ASSERT_EQ(MigrateLegacyExternalImage(pkgid, path, legacy_path, + PackageType::WGT), ci::AppInstaller::Result::OK); + ValidateExternalPackage(pkgid, {appid}); + } else { + ASSERT_EQ(MigrateLegacyExternalImage(pkgid, path, legacy_path, + PackageType::WGT), ci::AppInstaller::Result::ERROR); + } } TEST_F(PreloadSmokeTest, InstallationMode_Preload) { diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 3721b48..08d617f 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -660,7 +660,7 @@ ci::AppInstaller::Result MigrateLegacyExternalImage(const std::string& pkgid, return ci::AppInstaller::Result::ERROR; } const char* argv[] = {"", "--migrate-extimg", pkgid.c_str(), - "-u", kDefaultUserIdStr.c_str()}; + "-u", kTestUserIdStr.c_str()}; return CallBackend(SIZEOFARRAY(argv), argv, type, mode); } -- 2.7.4 From 2a4847ba5155f13dd0572738b8c2cb4d07b1218f Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 5 Jul 2017 20:35:53 +0900 Subject: [PATCH 14/16] Release version 0.4.5 Changes: - [SmokeTest] Fixes for smoke tests Change-Id: Ic7c6e0fa3d64b9ffa0446c4b10f7e7e8355d8ce6 Signed-off-by: jongmyeongko --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 09189df..4710aad 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.4.4 +Version: 0.4.5 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 24e215ea88f933ab341c871f355b3d9ae8ef3e67 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 12 Jul 2017 15:42:29 +0900 Subject: [PATCH 15/16] Skip reading icon in case there is no icon file actually Change-Id: I653a8ac1d6fa1d496060adfd68ad8b1757814144 Signed-off-by: jongmyeongko --- src/lib/wgt_archive_info.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index 205ba5f..095b60d 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -140,6 +140,11 @@ bool ReadIcon(const bf::path& icon, const bf::path& tmp_dir, LOG(INFO) << "Icon file path: " << icon_path; + if (!bf::exists(icon_path)) { + LOG(WARNING) << "Icon file doesn't actually exist, skip reading icon"; + return true; + } + std::ifstream ifs(icon_path.c_str(), std::ifstream::in | std::ifstream::binary); ifs.seekg(0, ifs.end); -- 2.7.4 From 5ee35db0967c94419eddb7989311b55640f9ce62 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 11 Jul 2017 19:26:03 +0900 Subject: [PATCH 16/16] Invoke StepParsePreload when ReadonlyUpdateUninstall StepParsePreload should be invoked for setting system attributes properly. Change-Id: I9d40710a2a6a056031d77eeca52de7f7e91bba21 Signed-off-by: Sangyoon Jang --- src/wgt/wgt_installer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 475c05e..ef52922 100755 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -587,6 +587,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::NORMAL); + AddStep(); AddStep(); AddStep(); AddStep(); -- 2.7.4