* limitations under the License.
*/
+#include <unistd.h>
+#include <sys/types.h>
+
#include <sm_api.h>
#include <dpl/test/test_runner.h>
void install(const InstallRequest &request, lib_retcode expectedResult)
{
- int result = security_manager_app_install(request.get());
+ uid_t uid = getuid();
+ std::string dbPath = uid == 0 ? "/opt/dbspace/" : "/opt/dbspace/user/" + std::to_string(uid) + "/";
+
+ std::ostringstream command;
+ command << "/usr/bin/sqlite3 "
+ << dbPath << ".pkgmgr_parser.db "
+ << " \"insert into package_info (package, package_type, package_api_version,"
+ << " install_location, mainapp_id, root_path, installed_storage)"
+ << " 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);
+
+ 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);
+
+ 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);
}
void update(const InstallRequest &request, lib_retcode expectedResult)
void setAuthorId(std::string authorId, lib_retcode expectedResult= SECURITY_MANAGER_SUCCESS);
void setInstallType(const enum app_install_type &type, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
void setHybrid(lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
+ std::string getPkgId() const { return m_pkgId; }
std::string getAppTizenVersion() const { return m_tizenVer; }
app_inst_req *get() { return m_req; }
const app_inst_req *get() const { return m_req; }
*/
RUNNER_CHILD_TEST(security_manager_25e_unprivileged_install_type_global)
{
+ RUNNER_IGNORED_MSG("This test is turned off because multiuser feature is not supported by platform correctly");
+
TemporaryTestUser testUser("sm_test_25e_user_name", GUM_USERTYPE_NORMAL);
testUser.create();
RUNNER_CHILD_TEST(security_manager_25f_unprivileged_install_type_preloaded)
{
+ RUNNER_IGNORED_MSG("This test is turned off because multiuser feature is not supported by platform correctly");
+
TemporaryTestUser testUser("sm_test_25f_user_name", GUM_USERTYPE_NORMAL);
testUser.create();
Api::install(invalidReq, (lib_retcode)SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED);
}
-
RUNNER_CHILD_TEST(security_manager_25g_local_user_set_install_type_local)
{
std::vector<std::string> allowedPrivs = {