From 1f207e49d7b4b9e2d9d357ea18e27237fbde245b Mon Sep 17 00:00:00 2001 From: Zofia Abramowska Date: Tue, 7 Apr 2020 17:59:43 +0200 Subject: [PATCH] Remove package from pkgmgr-parser.db even when sm install fails Change-Id: I645fc92a632f60a5891759b92a1da51ee5d3300d --- src/common/sm_api.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/common/sm_api.cpp b/src/common/sm_api.cpp index 4516755..bc70ea0 100644 --- a/src/common/sm_api.cpp +++ b/src/common/sm_api.cpp @@ -38,22 +38,24 @@ void install(const InstallRequest &request, lib_retcode expectedResult) << " values ('" << request.getPkgId() << "', 'tpk', '" << request.getAppTizenVersion() << "', 'auto', '" << request.getPkgId() << "', '/opt/usr/globallapps/" << request.getPkgId() << "', 'installed_internal')\""; - int result = system(command.str().c_str()); - RUNNER_ASSERT_MSG(result == 0, "failed to set package_info: " << result); + int pkgmgrResult = system(command.str().c_str()); + RUNNER_ASSERT_MSG(pkgmgrResult == 0, "failed to set package_info: " << pkgmgrResult); - result = security_manager_app_install(request.get()); - RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult, - "installing app returned wrong value." - << " InstallRequest: [ " << request << "];" - << " Result: " << result << ";" - << " Expected result: " << expectedResult); + int result = security_manager_app_install(request.get()); command = std::ostringstream(); command << "/usr/bin/sqlite3 " << dbPath << ".pkgmgr_parser.db " << " \"delete from package_info where package='" << request.getPkgId() << "'\""; - result = system(command.str().c_str()); - RUNNER_ASSERT_MSG(result == 0, "failed to unset package_info: " << result); + pkgmgrResult = system(command.str().c_str()); + + RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult, + "installing app returned wrong value." + << " InstallRequest: [ " << request << "];" + << " Result: " << result << ";" + << " Expected result: " << expectedResult); + + RUNNER_ASSERT_MSG(pkgmgrResult == 0, "failed to unset package_info: " << pkgmgrResult); } void update(const InstallRequest &request, lib_retcode expectedResult) -- 2.7.4