Repository: mesos Updated Branches: refs/heads/master 96a77ecd7 -> 3ecd54320
Added symlink test for /bin, lib, and /lib64 when preparing test root filesystem. Review: https://reviews.apache.org/r/37684 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3ecd5432 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3ecd5432 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3ecd5432 Branch: refs/heads/master Commit: 3ecd54320397c3a813d555f291b51778372e273b Parents: 96a77ec Author: Greg Mann <[email protected]> Authored: Fri Aug 21 13:21:10 2015 -0700 Committer: Jie Yu <[email protected]> Committed: Fri Aug 21 13:33:07 2015 -0700 ---------------------------------------------------------------------- src/tests/containerizer/rootfs.hpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/3ecd5432/src/tests/containerizer/rootfs.hpp ---------------------------------------------------------------------- diff --git a/src/tests/containerizer/rootfs.hpp b/src/tests/containerizer/rootfs.hpp index 961003f..56a205f 100644 --- a/src/tests/containerizer/rootfs.hpp +++ b/src/tests/containerizer/rootfs.hpp @@ -109,19 +109,20 @@ public: }; foreach (const std::string& directory, directories) { - Try<Nothing> result = rootfs->add(directory); - if (result.isError()) { - return Error("Failed to add '" + directory + - "' to rootfs: " + result.error()); + // Some linux distros are moving all binaries and libraries to + // /usr, in which case /bin, /lib, and /lib64 will be symlinks + // to their equivalent directories in /usr. + Result<std::string> realpath = os::realpath(directory); + if (!realpath.isSome()) { + return Error("Failed to get realpath for '" + + directory + "': " + (realpath.isError() ? + realpath.error() : "No such directory")); } - } - // 'sh' is under '/usr/bin' on CentOS 7.1. - if (os::exists("/usr/bin/sh")) { - Try<Nothing> result = rootfs->add("/usr/bin/sh"); + Try<Nothing> result = rootfs->add(realpath.get()); if (result.isError()) { - return Error("Failed to add '/usr/bin/sh' to rootfs: " + - result.error()); + return Error("Failed to add '" + realpath.get() + + "' to rootfs: " + result.error()); } }
