From: Krzysztof Jackiewicz Date: Mon, 20 Apr 2020 11:50:39 +0000 (+0200) Subject: Cleanup namespace after app termination X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F231248%2F15;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git Cleanup namespace after app termination This API call is necessary to cleanup /var/run/user/ app links after app is terminated. Security-manager detects running apps basing on these links existence. Change-Id: If4feb5d158deac30098d05230c9f7fca928eacd2 --- diff --git a/src/security-manager-tests/common/scoped_app_launcher.cpp b/src/security-manager-tests/common/scoped_app_launcher.cpp index 8647535..a557f01 100644 --- a/src/security-manager-tests/common/scoped_app_launcher.cpp +++ b/src/security-manager-tests/common/scoped_app_launcher.cpp @@ -18,13 +18,14 @@ #include #include #include +#include using namespace SecurityManagerTest; -ScopedAppLauncher::ScopedAppLauncher(const AppInstallHelper& app) +ScopedAppLauncher::ScopedAppLauncher(const AppInstallHelper& app) : + m_uid(app.getUID()), + m_appId(app.getAppId()) { - SynchronizationPipe syncPipe; - m_pid = fork(); RUNNER_ASSERT_ERRNO_MSG(m_pid >= 0, "Fork failed"); if (m_pid != 0) { @@ -46,6 +47,9 @@ ScopedAppLauncher::ScopedAppLauncher(const AppInstallHelper& app) ScopedAppLauncher::~ScopedAppLauncher() { - m_syncPipe.post(); - waitPid(m_pid); + SafeCleanup::run([this]{ + m_syncPipe.post(); + waitPid(m_pid); + Api::cleanupApp(m_appId, m_uid, m_pid); + }); } diff --git a/src/security-manager-tests/common/scoped_app_launcher.h b/src/security-manager-tests/common/scoped_app_launcher.h index 496df68..5a43149 100644 --- a/src/security-manager-tests/common/scoped_app_launcher.h +++ b/src/security-manager-tests/common/scoped_app_launcher.h @@ -29,4 +29,6 @@ public: private: SynchronizationPipe m_syncPipe; pid_t m_pid; + const uid_t m_uid; + const std::string m_appId; };