Merge branch 'tizen' into security-manager 23/156723/1
authorZofia Abramowska <z.abramowska@samsung.com>
Thu, 19 Oct 2017 15:39:54 +0000 (17:39 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Thu, 19 Oct 2017 15:41:29 +0000 (17:41 +0200)
Change-Id: I3fa314322c8005c432cbdcfca15043d3679622b9

src/common/CMakeLists.txt
src/common/tests_common.cpp
src/common/tests_common.h
src/cynara-tests/test_cases_helpers.cpp
src/framework/include/dpl/test/test_runner.h
src/security-manager-tests/common/sm_commons.cpp
src/security-manager-tests/common/sm_commons.h

index 0bfeb9b..caccd72 100644 (file)
@@ -7,6 +7,7 @@ PKG_CHECK_MODULES(COMMON_TARGET_DEP
     dbus-1
     sqlite3
     libgum
+    libtzplatform-config
     glib-2.0
     cynara-creds-socket
     cynara-creds-dbus
index d08893c..b5dff60 100644 (file)
@@ -246,3 +246,26 @@ void change_label(const char* label)
     int ret = smack_set_label_for_self(label);
     RUNNER_ASSERT_MSG(0 == ret, "Error in smack_set_label_for_self("<<label<<"). Error: " << ret);
 }
+
+pid_t runInChild(const std::function<void(void)> &process) {
+    pid_t pid = fork();
+    RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "fork failed");
+
+    if (pid == 0) {
+        process();
+        exit(EXIT_SUCCESS);
+    }
+    return pid;
+}
+
+void runInChildParentWait(const std::function<void(void)> &process) {
+    pid_t pid = fork();
+    RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "fork failed");
+    if (pid == 0) {
+        process();
+        exit(EXIT_SUCCESS);
+    } else {
+        waitPid(pid);
+    }
+}
+
index 251e111..3f109b9 100644 (file)
@@ -29,7 +29,8 @@
 #include <dpl/test/test_runner.h>
 #include <dpl/test/test_runner_child.h>
 #include <dpl/test/test_runner_multiprocess.h>
-#include <sys/smack.h>
+
+#include <algorithm>
 #include <sys/types.h>
 #include <string>
 #include <tuple>
@@ -59,6 +60,9 @@ void removeDir(const std::string &path);
 void waitPid(pid_t pid);
 void change_label(const char* label);
 
+pid_t runInChild(const std::function<void(void)> &process);
+void runInChildParentWait(const std::function<void(void)> &process);
+
 #define RUNNER_TEST_SMACK(Proc, ...)                                                        \
     void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                                  \
     static int Static##Proc##Init()                                                         \
index 06aa14d..33481a6 100644 (file)
@@ -66,18 +66,6 @@ private:
     std::string m_label = "cynara_helpers";
 };
 
-pid_t runInChild(const std::function<void(void)> &process) {
-    pid_t pid = fork();
-    RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "fork failed");
-
-    if (pid == 0) {
-        process();
-        exit(EXIT_SUCCESS);
-    }
-
-    return pid;
-}
-
 cynara_client_creds getClientDefaultMethod() {
     cynara_client_creds def;
     int ret = cynara_creds_get_default_client_method(&def);
index efa057d..93809ae 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef DPL_TEST_RUNNER_H
 #define DPL_TEST_RUNNER_H
 
+#include <cerrno>
 #include <chrono>
 #include <cstdlib>
 #include <cstring>
index d6b0ee8..acaf64d 100644 (file)
@@ -330,28 +330,6 @@ CapsSetsUniquePtr setCaps(const char *cap_string)
     return caps;
 }
 
-pid_t runInChild(const std::function<void(void)> &process) {
-    pid_t pid = fork();
-    RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "fork failed");
-
-    if (pid == 0) {
-        process();
-        exit(EXIT_SUCCESS);
-    }
-    return pid;
-}
-
-void runInChildParentWait(const std::function<void(void)> &process) {
-    pid_t pid = fork();
-    RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "fork failed");
-    if (pid == 0) {
-        process();
-        exit(EXIT_SUCCESS);
-    } else {
-        waitPid(pid);
-    }
-}
-
 static int getOppositeAccessType(int accessType) {
     return accessType ^ (R_OK | W_OK | X_OK);
 }
index 02e9a13..902d70c 100644 (file)
@@ -63,9 +63,6 @@ void check_exact_smack_accesses(const std::string &subject,
 
 CapsSetsUniquePtr setCaps(const char *cap_string);
 
-pid_t runInChild(const std::function<void(void)> &process);
-
-void runInChildParentWait(const std::function<void(void)> &process);
 void runAccessTest(const std::string &label, uid_t uid, gid_t gid,
                    const std::string &testPath, int accessType);
 void runAccessTest(const AppInstallHelper &app, const std::string &testPath, int accessType);