}
app.checkAfterUninstall();
}
+
+RUNNER_CHILD_TEST(security_manager_26_3_security_manager_is_app_from_pid)
+{
+ SynchronizationPipe pipe;
+ TemporaryTestUser testUser("sm_test_26_3_user_name", GUM_USERTYPE_NORMAL);
+ testUser.create();
+
+ AppInstallHelperExt app("sm_test_26_3");
+ {
+ ScopedInstaller appInstall(app);
+
+ app.checkAfterInstall();
+
+ pid_t pid = fork();
+ RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "Fork failed");
+ if (pid != 0) {
+ pipe.claimParentEp();
+ // here we can check if function will return it is NOT an app
+ bool is_app;
+ RUNNER_ASSERT_MSG(security_manager_is_app_from_pid(getpid(), &is_app) == SECURITY_MANAGER_SUCCESS,
+ "failed security_manager_is_app_from_pid");
+ RUNNER_ASSERT_MSG(is_app == false, "this should not be an app");
+ pipe.wait(); //synchronization point of setting Smack label - A1
+ RUNNER_ASSERT_MSG(security_manager_is_app_from_pid(pid, &is_app) == SECURITY_MANAGER_SUCCESS,
+ "failed security_manager_is_app_from_pid");
+ RUNNER_ASSERT_MSG(is_app == true, "this should be an app");
+ waitPid(pid);
+ } else {
+ pipe.claimChildEp();
+ // here we can check if the function will return it IS an app
+ Api::setProcessLabel(app.getAppId());
+ pipe.post(); // A1
+ bool is_app;
+ RUNNER_ASSERT_MSG(security_manager_is_app_from_pid(getpid(), &is_app) == SECURITY_MANAGER_SUCCESS,
+ "failed security_manager_is_app_from_pid");
+ RUNNER_ASSERT_MSG(is_app == true, "this should be an app");
+ exit(0);
+ }
+ }
+ app.checkAfterUninstall();
+}