Adjust tests to security-manager API changes 32/179232/1
authorDariusz Michaluk <d.michaluk@samsung.com>
Wed, 16 May 2018 10:23:33 +0000 (12:23 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Wed, 16 May 2018 10:23:33 +0000 (12:23 +0200)
Change-Id: I807e00c96a22a5aed06dcebddc5402ff0b696d2c

src/common/sm_api.cpp
src/common/sm_api.h
src/security-manager-tests/test_cases_prepare_app.cpp

index ec1d817..b24b40c 100644 (file)
@@ -109,13 +109,14 @@ void prepareApp(const std::string &appId, lib_retcode expectedResult)
                           << " Expected result: " << expectedResult);
 }
 
-void cleanupApp(const std::string &appId, uid_t uid, lib_retcode expectedResult)
+void cleanupApp(const std::string &appId, uid_t uid, pid_t pid, lib_retcode expectedResult)
 {
-    int result = security_manager_cleanup_app(appId.c_str(), uid);
+    int result = security_manager_cleanup_app(appId.c_str(), uid, pid);
     RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
                       "cleanup app returned wrong value."
                           << " App id: " << appId << ";"
                           << " user id: " << uid << ";"
+                          << " process id: " << pid << ";"
                           << " Result: " << result << ";"
                           << " Expected result: " << expectedResult);
 }
index cef222c..1b4d2e1 100644 (file)
@@ -37,7 +37,7 @@ void setProcessLabel(const std::string &appId, lib_retcode expectedResult = SECU
 void setProcessGroups(const std::string &appId, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 void dropProcessPrivileges(lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 void prepareApp(const std::string &appId, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
-void cleanupApp(const std::string &appId, uid_t uid, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
+void cleanupApp(const std::string &appId, uid_t uid, pid_t pid, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 void addUser(const UserRequest &request, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 void deleteUser(const UserRequest &request, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 void sendPolicy(const PolicyRequest &request, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
index 844c4dc..79f75ad 100644 (file)
@@ -198,7 +198,7 @@ RUNNER_CHILD_TEST(security_manager_100_synchronize_credentials_test)
         exit(0);
     } else {
         waitPid(pid);
-        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid());
+        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid(), pid);
     }
 }
 
@@ -227,7 +227,7 @@ RUNNER_CHILD_TEST(security_manager_101_create_namespace_test)
         synchPipe.wait();
 
         std::string appBindPath = std::string("/var/run/user/") + std::to_string(tmpUser.getUid())
-                                  + "/apps/" + app.generateAppLabel();
+                                  + "/apps/" + app.generateAppLabel() + "/" + std::to_string(pid);
         std::string appProcPath = std::string("/proc/") + std::to_string(pid) + "/ns/mnt";
         std::string launcherProcPath = std::string("/proc/") + std::to_string(getpid()) + "/ns/mnt";
 
@@ -244,7 +244,7 @@ RUNNER_CHILD_TEST(security_manager_101_create_namespace_test)
 
         synchPipe.post();
         waitPid(pid);
-        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid());
+        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid(), pid);
     }
 }
 
@@ -288,7 +288,7 @@ RUNNER_CHILD_TEST(security_manager_102_check_propagation_test)
 
         synchPipe.post();
         waitPid(pid);
-        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid());
+        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid(), pid);
     }
 }
 
@@ -360,6 +360,6 @@ RUNNER_CHILD_TEST(security_manager_103_policy_change_test)
 
         synchPipe.post();
         waitPid(pid);
-        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid());
+        Api::cleanupApp(app.getAppId().c_str(), tmpUser.getUid(), pid);
     }
 }