You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/10/07 16:25:58 UTC

[2/5] mesos git commit: Added `ping` to test linux rootfs.

Added `ping` to test linux rootfs.

Review: https://reviews.apache.org/r/51931/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e7d1f536
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e7d1f536
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e7d1f536

Branch: refs/heads/master
Commit: e7d1f53621a09da47ee7dc5d6fcd6326cb72792d
Parents: 5e3648c
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Oct 5 21:28:12 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Oct 7 09:22:19 2016 -0700

----------------------------------------------------------------------
 src/tests/containerizer/rootfs.hpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e7d1f536/src/tests/containerizer/rootfs.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/rootfs.hpp b/src/tests/containerizer/rootfs.hpp
index f8fcfd4..6bc3835 100644
--- a/src/tests/containerizer/rootfs.hpp
+++ b/src/tests/containerizer/rootfs.hpp
@@ -67,12 +67,18 @@ public:
 
     // TODO(jieyu): Make sure 'path' is not under 'root'.
 
+    // Copy the files. We perserve all attributes so that e.g., `ping`
+    // keeps its file-based capabilities.
     if (os::stat::isdir(path)) {
-      if (os::system("cp -r '" + path + "' '" + target + "'") != 0) {
+      if (os::system(strings::format(
+              "cp -r --preserve=all '%s' '%s'",
+              path, target).get()) != 0) {
         return ErrnoError("Failed to copy '" + path + "' to rootfs");
       }
     } else {
-      if (os::system("cp '" + path + "' '" + target + "'") != 0) {
+      if (os::system(strings::format(
+              "cp --preserve=all '%s' '%s'",
+              path, target).get()) != 0) {
         return ErrnoError("Failed to copy '" + path + "' to rootfs");
       }
     }
@@ -104,6 +110,7 @@ public:
     std::vector<std::string> files = {
       "/bin/echo",
       "/bin/ls",
+      "/bin/ping",
       "/bin/sh",
       "/bin/sleep",
       "/usr/bin/sh",
@@ -111,6 +118,7 @@ public:
       "/lib64/ld-linux-x86-64.so.2",
       "/lib64/libc.so.6",
       "/lib64/libdl.so.2",
+      "/lib64/libidn.so.11",
       "/lib64/libtinfo.so.5",
       "/lib64/libselinux.so.1",
       "/lib64/libpcre.so.1",