Fix groups issue in tests using perm_app_set_privilege api.
[platform/core/test/security-tests.git] / tests / libprivilege-control-tests / test_cases.cpp
index c4875c8..1a88592 100644 (file)
@@ -28,6 +28,7 @@
 #include <memory>
 #include <fstream>
 #include <sstream>
+#include <set>
 
 #include <fcntl.h>
 #include <errno.h>
@@ -268,6 +269,9 @@ void test_set_app_privilege(
     result = test_have_all_accesses(rules);
     RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
 
+    std::set<unsigned> groups_before;
+    read_user_gids(groups_before, APP_UID);
+
     result = perm_app_set_privilege(app_id, type, app_path);
     RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
             " Error in perm_app_set_privilege. Error: " << result);
@@ -283,7 +287,7 @@ void test_set_app_privilege(
     RUNNER_ASSERT_MSG_BT(result == 0,
             " Process label " << label << " is incorrect");
 
-    check_groups(dac_file);
+    check_groups(groups_before, dac_file);
 }
 
 /**