E2EE: Require e2ee-tests to be ran by default user
[platform/core/test/security-tests.git] / src / ckm / unprivileged / main.cpp
index 883a4fe..93ccd11 100644 (file)
@@ -13,8 +13,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License
  */
-#include <unistd.h>
-#include <sys/types.h>
 
 #include <fstream>
 #include <iostream>
@@ -38,8 +36,6 @@
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
 
-#include <tzplatform_config.h>
-
 namespace {
 const int USER_APP = 5001;
 
@@ -2927,16 +2923,7 @@ RUNNER_TEST(T1905_deinit)
 
 int main(int argc, char *argv[])
 {
-    uid_t expected_uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER);
-    if (expected_uid != geteuid()) {
-        std::string userStr("owner");
-        const char* user = tzplatform_getenv(TZ_SYS_DEFAULT_USER);
-        if (user)
-            userStr = user;
-
-        std::cerr << argv[0] << " should be executed as " << userStr << ". Aborting" << std::endl;
-        return -1;
-    }
+    require_default_user(argv);
 
     int exitCode = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);