You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ka...@apache.org on 2016/05/11 22:24:48 UTC
[26/50] [abbrv] mesos git commit: Moved stout from
libprocess/3rdparty/ to 3rdparty/.
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp
deleted file mode 100644
index 6858735..0000000
--- a/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License
-
-#include <map>
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <stout/gtest.hpp>
-#include <stout/none.hpp>
-#include <stout/option.hpp>
-#include <stout/result.hpp>
-#include <stout/some.hpp>
-#include <stout/try.hpp>
-
-using std::string;
-
-TEST(SomeTest, Some)
-{
- Option<int> o1 = Some(42);
- EXPECT_SOME(o1);
- EXPECT_EQ(42, o1.get());
-
- Result<int> r1 = Some(42);
- EXPECT_SOME(r1);
- EXPECT_EQ(42, r1.get());
-
- Try<Option<int>> t1 = Some(42);
- ASSERT_SOME(t1);
- EXPECT_SOME(t1.get());
- EXPECT_EQ(42, t1.get().get());
- t1 = None();
- ASSERT_SOME(t1);
- EXPECT_NONE(t1.get());
-
- Try<Result<int>> t2 = Some(42);
- ASSERT_SOME(t2);
- EXPECT_SOME(t2.get());
- EXPECT_EQ(42, t2.get().get());
-
- Option<Result<int>> o2 = Some(42);
- ASSERT_SOME(o2);
- EXPECT_SOME(o2.get());
- EXPECT_EQ(42, o2.get().get());
-
- Option<Result<int>> o3 = Some(Some(42));
- ASSERT_SOME(o3);
- EXPECT_SOME(o3.get());
- EXPECT_EQ(42, o3.get().get());
-
- Result<Option<int>> r2 = Some(42);
- ASSERT_SOME(r2);
- EXPECT_SOME(r2.get());
- EXPECT_EQ(42, r2.get().get());
-
- Result<Option<int>> r3 = Some(Some(42));
- ASSERT_SOME(r3);
- EXPECT_SOME(r3.get());
- EXPECT_EQ(42, r3.get().get());
-
- Option<string> o4 = Some("hello");
- EXPECT_SOME(o4);
- EXPECT_EQ("hello", o4.get());
-
- Result<string> r4 = Some("world");
- EXPECT_SOME(r4);
- EXPECT_EQ("world", r4.get());
-
- std::map<string, Option<string>> values;
- values["no-debug"] = None();
- values["debug"] = None();
- values["debug"] = Some("true");
- values["debug"] = Some("false");
- values["name"] = Some("frank");
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp
deleted file mode 100644
index b54a9db..0000000
--- a/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp
+++ /dev/null
@@ -1,487 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License
-
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <gmock/gmock.h>
-
-#include <stout/format.hpp>
-#include <stout/gtest.hpp>
-#include <stout/strings.hpp>
-#include <stout/try.hpp>
-
-using std::map;
-using std::string;
-using std::vector;
-
-
-TEST(StringsTest, Format)
-{
- Try<string> result = strings::format("%s %s", "hello", "world");
- EXPECT_SOME_EQ("hello world", result);
-
- result = strings::format("hello %d", 42);
- EXPECT_SOME_EQ("hello 42", result);
-
- result = strings::format("hello %s", "fourty-two");
- EXPECT_SOME_EQ("hello fourty-two", result);
-
- string hello = "hello";
- result = strings::format("%s %s", hello, "fourty-two");
- EXPECT_SOME_EQ("hello fourty-two", result);
-}
-
-
-TEST(StringsTest, Remove)
-{
- EXPECT_EQ("heo word", strings::remove("hello world", "l"));
- EXPECT_EQ("hel world", strings::remove("hello world", "lo"));
- EXPECT_EQ("home/", strings::remove("/home/", "/", strings::PREFIX));
- EXPECT_EQ("/home", strings::remove("/home/", "/", strings::SUFFIX));
-}
-
-
-TEST(StringsTest, Replace)
-{
- EXPECT_EQ("hello*", strings::replace("hello/", "/", "*"));
- EXPECT_EQ("*hello", strings::replace("/hello", "/", "*"));
- EXPECT_EQ("*hello*world*", strings::replace("/hello/world/", "/", "*"));
- EXPECT_EQ("*", strings::replace("/", "/", "*"));
- EXPECT_EQ("hello world", strings::replace("hello world", "/", "*"));
- EXPECT_EQ("***1***2***3***", strings::replace("/1/2/3/", "/", "***"));
- EXPECT_EQ("123", strings::replace("/1/2/3/", "/", ""));
- EXPECT_EQ("/1/2/3**", strings::replace("***1***2***3**", "***", "/"));
- EXPECT_EQ("/1/2/3/", strings::replace("/1/2/3/", "", "*"));
-}
-
-
-TEST(StringsTest, Trim)
-{
- EXPECT_EQ("", strings::trim("", " "));
- EXPECT_EQ("", strings::trim(" ", " "));
- EXPECT_EQ("hello world", strings::trim("hello world", " "));
- EXPECT_EQ("hello world", strings::trim(" hello world", " "));
- EXPECT_EQ("hello world", strings::trim("hello world ", " "));
- EXPECT_EQ("hello world", strings::trim(" hello world ", " "));
- EXPECT_EQ("hello world", strings::trim(" \t hello world\t ", " \t"));
- EXPECT_EQ("hello world", strings::trim(" \t hello world\t \n\r "));
-
- // Also test trimming from just the prefix or suffix.
- EXPECT_EQ("hello world\t \n\r ",
- strings::trim(" \t hello world\t \n\r ", strings::PREFIX));
- EXPECT_EQ(" \t hello world",
- strings::trim(" \t hello world\t \n\r ", strings::SUFFIX));
- EXPECT_EQ("\t hello world\t \n\r ",
- strings::trim(" \t hello world\t \n\r ", strings::PREFIX, " "));
- EXPECT_EQ(" \t hello world\t \n",
- strings::trim(" \t hello world\t \n\r ", strings::SUFFIX, " \r"));
-}
-
-
-TEST(StringsTest, Tokenize)
-{
- vector<string> tokens = strings::tokenize("hello world, what's up?", " ");
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("hello", tokens[0]);
- EXPECT_EQ("world,", tokens[1]);
- EXPECT_EQ("what's", tokens[2]);
- EXPECT_EQ("up?", tokens[3]);
-}
-
-
-TEST(StringsTest, TokenizeStringWithDelimsAtStart)
-{
- vector<string> tokens = strings::tokenize(" hello world, what's up?", " ");
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("hello", tokens[0]);
- EXPECT_EQ("world,", tokens[1]);
- EXPECT_EQ("what's", tokens[2]);
- EXPECT_EQ("up?", tokens[3]);
-}
-
-
-TEST(StringsTest, TokenizeStringWithDelimsAtEnd)
-{
- vector<string> tokens =
- strings::tokenize("hello world, what's up? ", " ");
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("hello", tokens[0]);
- EXPECT_EQ("world,", tokens[1]);
- EXPECT_EQ("what's", tokens[2]);
- EXPECT_EQ("up?", tokens[3]);
-}
-
-
-TEST(StringsTest, TokenizeStringWithDelimsAtStartAndEnd)
-{
- vector<string> tokens =
- strings::tokenize(" hello world, what's up? ", " ");
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("hello", tokens[0]);
- EXPECT_EQ("world,", tokens[1]);
- EXPECT_EQ("what's", tokens[2]);
- EXPECT_EQ("up?", tokens[3]);
-}
-
-
-TEST(StringsTest, TokenizeWithMultipleDelims)
-{
- vector<string> tokens =
- strings::tokenize("hello\tworld, \twhat's up?", " \t");
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("hello", tokens[0]);
- EXPECT_EQ("world,", tokens[1]);
- EXPECT_EQ("what's", tokens[2]);
- EXPECT_EQ("up?", tokens[3]);
-}
-
-
-TEST(StringsTest, TokenizeEmptyString)
-{
- vector<string> tokens = strings::tokenize("", " ");
- ASSERT_EQ(0u, tokens.size());
-}
-
-
-TEST(StringsTest, TokenizeDelimOnlyString)
-{
- vector<string> tokens = strings::tokenize(" ", " ");
- ASSERT_EQ(0u, tokens.size());
-}
-
-
-TEST(StringsTest, TokenizeNullByteDelim)
-{
- string s;
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('h');
- s.push_back('e');
- s.push_back('l');
- s.push_back('l');
- s.push_back('o');
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('w');
- s.push_back('o');
- s.push_back('r');
- s.push_back('l');
- s.push_back('d');
- s.push_back('\0');
- s.push_back('\0');
- s.push_back('\0');
-
- vector<string> tokens = strings::tokenize(s, string(1, '\0'));
-
- ASSERT_EQ(2u, tokens.size());
- EXPECT_EQ("hello", tokens[0]);
- EXPECT_EQ("world", tokens[1]);
-}
-
-
-TEST(StringsTest, TokenizeNZero)
-{
- vector<string> tokens = strings::tokenize("foo,bar,,,", ",", 0);
- ASSERT_EQ(0u, tokens.size());
-}
-
-
-TEST(StringsTest, TokenizeNOne)
-{
- vector<string> tokens = strings::tokenize("foo,bar,,,", ",", 1);
- ASSERT_EQ(1u, tokens.size());
- EXPECT_EQ("foo,bar,,,", tokens[0]);
-}
-
-
-TEST(StringsTest, TokenizeNDelimOnlyString)
-{
- vector<string> tokens = strings::tokenize(",,,", ",", 2);
- ASSERT_EQ(0u, tokens.size());
-}
-
-
-TEST(StringsTest, TokenizeN)
-{
- vector<string> tokens = strings::tokenize("foo,bar,,baz", ",", 2);
- ASSERT_EQ(2u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar,,baz", tokens[1]);
-}
-
-
-TEST(StringsTest, TokenizeNStringWithDelimsAtStart)
-{
- vector<string> tokens = strings::tokenize(",,foo,bar,,baz", ",", 5);
- ASSERT_EQ(3u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("baz", tokens[2]);
-}
-
-
-TEST(StringsTest, TokenizeNStringWithDelimsAtEnd)
-{
- vector<string> tokens = strings::tokenize("foo,bar,,baz,,", ",", 4);
- ASSERT_EQ(3u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("baz", tokens[2]);
-}
-
-
-TEST(StringsTest, TokenizeNStringWithDelimsAtStartAndEnd)
-{
- vector<string> tokens = strings::tokenize(",,foo,bar,,", ",", 6);
- ASSERT_EQ(2u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
-}
-
-
-TEST(StringsTest, TokenizeNWithMultipleDelims)
-{
- vector<string> tokens = strings::tokenize("foo.bar,.,.baz.", ",.", 6);
- ASSERT_EQ(3u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("baz", tokens[2]);
-}
-
-
-TEST(StringsTest, SplitEmptyString)
-{
- vector<string> tokens = strings::split("", ",");
- ASSERT_EQ(1u, tokens.size());
- EXPECT_EQ("", tokens[0]);
-}
-
-
-TEST(StringsTest, SplitDelimOnlyString)
-{
- vector<string> tokens = strings::split(",,,", ",");
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("", tokens[0]);
- EXPECT_EQ("", tokens[1]);
- EXPECT_EQ("", tokens[2]);
- EXPECT_EQ("", tokens[3]);
-}
-
-
-TEST(StringsTest, Split)
-{
- vector<string> tokens = strings::split("foo,bar,,baz", ",");
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("", tokens[2]);
- EXPECT_EQ("baz", tokens[3]);
-}
-
-
-TEST(StringsTest, SplitStringWithDelimsAtStart)
-{
- vector<string> tokens = strings::split(",,foo,bar,,baz", ",");
- ASSERT_EQ(6u, tokens.size());
- EXPECT_EQ("", tokens[0]);
- EXPECT_EQ("", tokens[1]);
- EXPECT_EQ("foo", tokens[2]);
- EXPECT_EQ("bar", tokens[3]);
- EXPECT_EQ("", tokens[4]);
- EXPECT_EQ("baz", tokens[5]);
-}
-
-
-TEST(StringsTest, SplitStringWithDelimsAtEnd)
-{
- vector<string> tokens = strings::split("foo,bar,,baz,,", ",");
- ASSERT_EQ(6u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("", tokens[2]);
- EXPECT_EQ("baz", tokens[3]);
- EXPECT_EQ("", tokens[4]);
- EXPECT_EQ("", tokens[5]);
-}
-
-
-TEST(StringsTest, SplitStringWithDelimsAtStartAndEnd)
-{
- vector<string> tokens = strings::split(",,foo,bar,,", ",");
- ASSERT_EQ(6u, tokens.size());
- EXPECT_EQ("", tokens[0]);
- EXPECT_EQ("", tokens[1]);
- EXPECT_EQ("foo", tokens[2]);
- EXPECT_EQ("bar", tokens[3]);
- EXPECT_EQ("", tokens[4]);
- EXPECT_EQ("", tokens[5]);
-}
-
-
-TEST(StringsTest, SplitWithMultipleDelims)
-{
- vector<string> tokens = strings::split("foo.bar,.,.baz.", ",.");
- ASSERT_EQ(7u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("", tokens[2]);
- EXPECT_EQ("", tokens[3]);
- EXPECT_EQ("", tokens[4]);
- EXPECT_EQ("baz", tokens[5]);
- EXPECT_EQ("", tokens[6]);
-}
-
-
-TEST(StringsTest, SplitNZero)
-{
- vector<string> tokens = strings::split("foo,bar,,,", ",", 0);
- ASSERT_EQ(0u, tokens.size());
-}
-
-
-TEST(StringsTest, SplitNOne)
-{
- vector<string> tokens = strings::split("foo,bar,,,", ",", 1);
- ASSERT_EQ(1u, tokens.size());
- EXPECT_EQ("foo,bar,,,", tokens[0]);
-}
-
-
-TEST(StringsTest, SplitNDelimOnlyString)
-{
- vector<string> tokens = strings::split(",,,", ",", 2);
- ASSERT_EQ(2u, tokens.size());
- EXPECT_EQ("", tokens[0]);
- EXPECT_EQ(",,", tokens[1]);
-}
-
-
-TEST(StringsTest, SplitN)
-{
- vector<string> tokens = strings::split("foo,bar,,baz", ",", 2);
- ASSERT_EQ(2u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar,,baz", tokens[1]);
-}
-
-
-TEST(StringsTest, SplitNStringWithDelimsAtStart)
-{
- vector<string> tokens = strings::split(",,foo,bar,,baz", ",", 5);
- ASSERT_EQ(5u, tokens.size());
- EXPECT_EQ("", tokens[0]);
- EXPECT_EQ("", tokens[1]);
- EXPECT_EQ("foo", tokens[2]);
- EXPECT_EQ("bar", tokens[3]);
- EXPECT_EQ(",baz", tokens[4]);
-}
-
-
-TEST(StringsTest, SplitNStringWithDelimsAtEnd)
-{
- vector<string> tokens = strings::split("foo,bar,,baz,,", ",", 4);
- ASSERT_EQ(4u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("", tokens[2]);
- EXPECT_EQ("baz,,", tokens[3]);
-}
-
-
-TEST(StringsTest, SplitNStringWithDelimsAtStartAndEnd)
-{
- vector<string> tokens = strings::split(",,foo,bar,,", ",", 6);
- ASSERT_EQ(6u, tokens.size());
- EXPECT_EQ("", tokens[0]);
- EXPECT_EQ("", tokens[1]);
- EXPECT_EQ("foo", tokens[2]);
- EXPECT_EQ("bar", tokens[3]);
- EXPECT_EQ("", tokens[4]);
- EXPECT_EQ("", tokens[5]);
-}
-
-
-TEST(StringsTest, SplitNWithMultipleDelims)
-{
- vector<string> tokens = strings::split("foo.bar,.,.baz.", ",.", 6);
- ASSERT_EQ(6u, tokens.size());
- EXPECT_EQ("foo", tokens[0]);
- EXPECT_EQ("bar", tokens[1]);
- EXPECT_EQ("", tokens[2]);
- EXPECT_EQ("", tokens[3]);
- EXPECT_EQ("", tokens[4]);
- EXPECT_EQ("baz.", tokens[5]);
-}
-
-
-TEST(StringsTest, Pairs)
-{
- map<string, vector<string> > pairs = strings::pairs("one=1,two=2", ",", "=");
- ASSERT_EQ(2u, pairs.size());
- ASSERT_EQ(1u, pairs.count("one"));
- ASSERT_EQ(1u, pairs["one"].size());
- EXPECT_EQ("1", pairs["one"].front());
- ASSERT_EQ(1u, pairs.count("two"));
- ASSERT_EQ(1u, pairs["two"].size());
- EXPECT_EQ("2", pairs["two"].front());
-
- pairs = strings::pairs("foo=1;bar=2;baz;foo=3;bam=1=2", ";&", "=");
- ASSERT_EQ(2, pairs.size());
- ASSERT_EQ(1u, pairs.count("foo"));
- ASSERT_EQ(2u, pairs["foo"].size());
- ASSERT_EQ("1", pairs["foo"].front());
- ASSERT_EQ("3", pairs["foo"].back());
- ASSERT_EQ(1u, pairs.count("bar"));
- ASSERT_EQ("2", pairs["bar"].front());
-}
-
-
-TEST(StringsTest, Join)
-{
- EXPECT_EQ("a/b", strings::join("/", "a", "b"));
- EXPECT_EQ("a/b/c", strings::join("/", "a", "b", "c"));
- EXPECT_EQ("a\nb\nc\nd", strings::join("\n", "a", "b", "c", "d"));
- std::stringstream ss;
- EXPECT_EQ("a, b, c", strings::join(ss, ", ", "a", "b", "c").str());
- const string gnarly("gnarly");
- EXPECT_EQ("a/gnarly/c", strings::join("/", "a", gnarly, "c"));
- const bool is_true = true;
- const std::set<int32_t> my_set {1, 2, 3};
- EXPECT_EQ(
- "a/gnarly/true/{ 1, 2, 3 }/c",
- strings::join("/", "a", gnarly, is_true, my_set, "c"));
-}
-
-
-TEST(StringsTest, StartsWith)
-{
- EXPECT_TRUE(strings::startsWith("hello world", "hello"));
- EXPECT_FALSE(strings::startsWith("hello world", "no"));
- EXPECT_FALSE(strings::startsWith("hello world", "ello"));
-}
-
-
-TEST(StringsTest, Contains)
-{
- EXPECT_TRUE(strings::contains("hello world", "world"));
- EXPECT_FALSE(strings::contains("hello world", "no"));
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/tests/subcommand_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/subcommand_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/subcommand_tests.cpp
deleted file mode 100644
index 9213d6b..0000000
--- a/3rdparty/libprocess/3rdparty/stout/tests/subcommand_tests.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <string>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <stout/flags.hpp>
-#include <stout/foreach.hpp>
-#include <stout/subcommand.hpp>
-
-using std::string;
-using std::vector;
-
-
-class TestSubcommand : public Subcommand
-{
-public:
- struct Flags : public flags::FlagsBase
- {
- Flags()
- {
- add(&b, "b", "bool");
- add(&i, "i", "int");
- add(&s, "s", "string");
- add(&s2, "s2", "string with single quote");
- add(&s3, "s3", "string with double quote");
- add(&d, "d", "Duration");
- add(&y, "y", "Bytes");
- add(&j, "j", "JSON::Object");
- }
-
- void populate()
- {
- b = true;
- i = 42;
- s = "hello";
- s2 = "we're";
- s3 = "\"geek\"";
- d = Seconds(10);
- y = Bytes(100);
-
- JSON::Object object;
- object.values["strings"] = "string";
- object.values["integer1"] = 1;
- object.values["integer2"] = -1;
- object.values["double1"] = 1;
- object.values["double2"] = -1;
- object.values["double3"] = -1.42;
-
- JSON::Object nested;
- nested.values["string"] = "string";
- object.values["nested"] = nested;
-
- JSON::Array array;
- array.values.push_back(nested);
- object.values["array"] = array;
-
- j = object;
- }
-
- Option<bool> b;
- Option<int> i;
- Option<string> s;
- Option<string> s2;
- Option<string> s3;
- Option<Duration> d;
- Option<Bytes> y;
- Option<JSON::Object> j;
- };
-
- explicit TestSubcommand(const string& name) : Subcommand(name) {}
-
- Flags flags;
-
-protected:
- virtual int execute() { return 0; }
- virtual flags::FlagsBase* getFlags() { return &flags; }
-};
-
-
-// Generates a vector of arguments from flags.
-static vector<string> getArgv(const flags::FlagsBase& flags)
-{
- vector<string> argv;
- foreachpair (const string& name, const flags::Flag& flag, flags) {
- Option<string> value = flag.stringify(flags);
- if (value.isSome()) {
- argv.push_back("--" + name + "=" + value.get());
- }
- }
- return argv;
-}
-
-
-TEST(SubcommandTest, Flags)
-{
- TestSubcommand::Flags flags;
- flags.populate();
-
- // Construct the command line arguments.
- vector<string> _argv = getArgv(flags);
- int argc = _argv.size() + 2;
- char** argv = new char*[argc];
- argv[0] = (char*) "command";
- argv[1] = (char*) "subcommand";
- for (int i = 2; i < argc; i++) {
- argv[i] = ::strdup(_argv[i - 2].c_str());
- }
-
- TestSubcommand subcommand("subcommand");
-
- ASSERT_EQ(0, Subcommand::dispatch(
- None(),
- argc,
- argv,
- &subcommand));
-
- EXPECT_EQ(flags.b, subcommand.flags.b);
- EXPECT_EQ(flags.i, subcommand.flags.i);
- EXPECT_EQ(flags.s, subcommand.flags.s);
- EXPECT_EQ(flags.s2, subcommand.flags.s2);
- EXPECT_EQ(flags.s3, subcommand.flags.s3);
- EXPECT_EQ(flags.d, subcommand.flags.d);
- EXPECT_EQ(flags.y, subcommand.flags.y);
- EXPECT_EQ(flags.j, subcommand.flags.j);
-
- for (int i = 2; i < argc; i++) {
- ::free(argv[i]);
- }
- delete[] argv;
-}
-
-
-TEST(SubcommandTest, Dispatch)
-{
- TestSubcommand subcommand("subcommand");
- TestSubcommand subcommand2("subcommand2");
-
- int argc = 2;
- char* argv[] = {
- (char*) "command",
- (char*) "subcommand"
- };
-
- EXPECT_EQ(1, Subcommand::dispatch(
- None(),
- argc,
- argv,
- &subcommand2));
-
- // Duplicated subcommand names.
- EXPECT_EQ(1, Subcommand::dispatch(
- None(),
- argc,
- argv,
- &subcommand,
- &subcommand));
-
- EXPECT_EQ(0, Subcommand::dispatch(
- None(),
- argc,
- argv,
- &subcommand,
- &subcommand2));
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/tests/svn_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/svn_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/svn_tests.cpp
deleted file mode 100644
index d2020a3..0000000
--- a/3rdparty/libprocess/3rdparty/stout/tests/svn_tests.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <cstdlib> // For rand().
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <stout/bytes.hpp>
-#include <stout/gtest.hpp>
-#include <stout/svn.hpp>
-
-using std::string;
-
-
-TEST(SVNTest, DiffPatch)
-{
- string source;
-
- while (Bytes(source.size()) < Megabytes(1)) {
- source += (char) rand() % 256;
- }
-
- // Make the target string have 512 different bytes in the middle.
- string target = source;
-
- for (size_t index = 0; index < 512; index++) {
- target[1024 + index] = (char) rand() % 256;
- }
-
- ASSERT_NE(source, target);
-
- Try<svn::Diff> diff = svn::diff(source, target);
-
- ASSERT_SOME(diff);
-
- Try<string> result = svn::patch(source, diff.get());
-
- ASSERT_SOME_EQ(target, result);
- ASSERT_SOME_NE(source, result);
-}
-
-
-TEST(SVNTest, EmptyDiffPatch)
-{
- string source;
-
- while (Bytes(source.size()) < Megabytes(1)) {
- source += (char) rand() % 256;
- }
-
- // Make the target string equal the source string.
- string target = source;
-
- Try<svn::Diff> diff = svn::diff(source, target);
-
- ASSERT_SOME(diff);
-
- Try<string> result = svn::patch(source, diff.get());
-
- ASSERT_SOME_EQ(target, result);
- ASSERT_SOME_EQ(source, result);
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/tests/try_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/try_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/try_tests.cpp
deleted file mode 100644
index 99b7b2a..0000000
--- a/3rdparty/libprocess/3rdparty/stout/tests/try_tests.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <stout/try.hpp>
-
-using std::string;
-
-TEST(TryTest, ArrowOperator)
-{
- Try<string> s = string("hello");
- EXPECT_EQ(5u, s->size());
-
- s->clear();
- EXPECT_TRUE(s->empty());
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/tests/uuid_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/uuid_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/uuid_tests.cpp
deleted file mode 100644
index 50295ad..0000000
--- a/3rdparty/libprocess/3rdparty/stout/tests/uuid_tests.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License
-
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <gmock/gmock.h>
-
-#include <stout/uuid.hpp>
-
-using std::string;
-
-
-TEST(UUIDTest, Test)
-{
- UUID uuid1 = UUID::random();
- UUID uuid2 = UUID::fromBytes(uuid1.toBytes());
- UUID uuid3 = uuid2;
-
- EXPECT_EQ(uuid1, uuid2);
- EXPECT_EQ(uuid2, uuid3);
- EXPECT_EQ(uuid1, uuid3);
-
- string bytes1 = uuid1.toBytes();
- string bytes2 = uuid2.toBytes();
- string bytes3 = uuid3.toBytes();
-
- EXPECT_EQ(bytes1, bytes2);
- EXPECT_EQ(bytes2, bytes3);
- EXPECT_EQ(bytes1, bytes3);
-
- string string1 = uuid1.toString();
- string string2 = uuid2.toString();
- string string3 = uuid3.toString();
-
- EXPECT_EQ(string1, string2);
- EXPECT_EQ(string2, string3);
- EXPECT_EQ(string1, string3);
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
deleted file mode 100644
index 724ed22..0000000
--- a/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <gtest/gtest.h>
-
-#include <stout/gtest.hpp>
-#include <stout/stringify.hpp>
-#include <stout/version.hpp>
-
-
-// Verify version comparison operations.
-TEST(VersionTest, Comparison)
-{
- Version version1(0, 10, 4);
- Version version2(0, 20, 3);
- Try<Version> version3 = Version::parse("0.20.3");
-
- EXPECT_EQ(version2, version3.get());
- EXPECT_NE(version1, version2);
- EXPECT_LT(version1, version2);
- EXPECT_LE(version1, version2);
- EXPECT_LE(version2, version3.get());
- EXPECT_GT(version2, version1);
- EXPECT_GE(version2, version1);
- EXPECT_GE(version3.get(), version1);
-
- EXPECT_EQ(stringify(version2), "0.20.3");
-}
-
-
-// Verify version parser.
-TEST(VersionTest, Parse)
-{
- Try<Version> version1 = Version::parse("1.20.3");
- Try<Version> version2 = Version::parse("1.20");
- Try<Version> version3 = Version::parse("1");
-
- EXPECT_GT(version1.get(), version2.get());
- EXPECT_GT(version2.get(), version3.get());
- EXPECT_EQ(stringify(version2.get()), "1.20.0");
- EXPECT_EQ(stringify(version3.get()), "1.0.0");
-
- // Verify that tagged/labeled versions work.
- Try<Version> version4 = Version::parse("1.20.3-rc1");
- EXPECT_SOME(version4);
- EXPECT_EQ(version4.get(), version1.get());
- EXPECT_EQ(stringify(version4.get()), "1.20.3");
-
- EXPECT_ERROR(Version::parse("0.a.b"));
- EXPECT_ERROR(Version::parse(""));
- EXPECT_ERROR(Version::parse("a"));
- EXPECT_ERROR(Version::parse("1."));
- EXPECT_ERROR(Version::parse(".1.2"));
- EXPECT_ERROR(Version::parse("0.1.2.3"));
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/Makefile.am b/3rdparty/libprocess/Makefile.am
index a9646a3..fd846c1 100644
--- a/3rdparty/libprocess/Makefile.am
+++ b/3rdparty/libprocess/Makefile.am
@@ -21,11 +21,11 @@ LIBPROCESS_BUILD_DIR=@abs_top_builddir@
# NOTE: The libprocess headers were moved to the Makefile in "include"
# subdirectory to make it easy to preserve the directory structure of
# the header files during installation.
-SUBDIRS = 3rdparty . include
+SUBDIRS = . include
include ../versions.am
-STOUT = 3rdparty/stout
+STOUT = ../stout
BOOST = ../boost-$(BOOST_VERSION)
GLOG = ../glog-$(GLOG_VERSION)
GMOCK = ../gmock-$(GMOCK_VERSION)
@@ -242,7 +242,6 @@ $(LIB_GMOCK):
@cd .. && $(MAKE) $(AM_MAKEFLAGS) libgmock.la
tests: all libprocess-tests benchmarks
- @cd 3rdparty && $(MAKE) $(AM_MAKEFLAGS) tests
# TODO(benh): Fix shared builds (tests need libglog, libev, etc).
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/configure.ac
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/configure.ac b/3rdparty/libprocess/configure.ac
index 671c12f..1364c77 100644
--- a/3rdparty/libprocess/configure.ac
+++ b/3rdparty/libprocess/configure.ac
@@ -57,8 +57,6 @@ LT_OUTPUT
CONFIGURE_ARGS="$ac_configure_args"
AC_SUBST(CONFIGURE_ARGS)
-AC_CONFIG_SUBDIRS([3rdparty/stout])
-
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([include/Makefile])
AC_CONFIG_FILES([3rdparty/Makefile])
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/LICENSE
----------------------------------------------------------------------
diff --git a/3rdparty/stout/LICENSE b/3rdparty/stout/LICENSE
new file mode 100644
index 0000000..f433b1a
--- /dev/null
+++ b/3rdparty/stout/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/stout/Makefile.am b/3rdparty/stout/Makefile.am
new file mode 100644
index 0000000..eeaca48
--- /dev/null
+++ b/3rdparty/stout/Makefile.am
@@ -0,0 +1,172 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+# Makefile for stout.
+
+AUTOMAKE_OPTIONS = foreign
+
+# NOTE: The stout headers were moved to the Makefile in "include"
+# subdirectory to make it easy to preserve the directory structure of
+# the header files during installation.
+SUBDIRS = . include
+
+include ../versions.am
+
+BOOST = ../boost-$(BOOST_VERSION)
+GLOG = ../glog-$(GLOG_VERSION)
+GMOCK = ../gmock-$(GMOCK_VERSION)
+GTEST = $(GMOCK)/gtest
+PROTOBUF = ../protobuf-$(PROTOBUF_VERSION)
+PICOJSON = ../picojson-$(PICOJSON_VERSION)
+
+# We use "-isystem" instead of "-I" to add Boost to the include search
+# path. This disables compiler warnings inside Boost headers since we
+# can't easily fix them. See MESOS-3799.
+if WITH_BUNDLED_BOOST
+BOOST_INCLUDE_FLAGS = -isystem $(BOOST)
+endif
+
+if WITH_BUNDLED_GLOG
+GLOG_INCLUDE_FLAGS = -I$(GLOG)/src
+LIB_GLOG = $(GLOG)/libglog.la
+else
+LIB_GLOG = -lglog
+endif
+
+# TODO(kapil): Handle unbundled GMOCK.
+if WITH_BUNDLED_GMOCK
+GMOCK_INCLUDE_FLAGS = -I$(GMOCK)/include
+GTEST_INCLUDE_FLAGS = -I$(GTEST)/include
+LIB_GMOCK = ../libgmock.la
+endif
+
+# Enable the INT64 support for PicoJSON.
+PICOJSON_INCLUDE_FLAGS = \
+ -DPICOJSON_USE_INT64 \
+ -D__STDC_FORMAT_MACROS
+
+if WITH_BUNDLED_PICOJSON
+PICOJSON_INCLUDE_FLAGS += -I$(PICOJSON)
+endif
+
+if WITH_BUNDLED_PROTOBUF
+PROTOBUF_INCLUDE_FLAGS = -I$(PROTOBUF)/src
+LIB_PROTOBUF = $(PROTOBUF)/src/libprotobuf.la
+else
+LIB_PROTOBUF = -lprotobuf
+endif
+
+# Tests for stout.
+check_PROGRAMS = stout-tests
+
+stout_tests_SOURCES = \
+ tests/adaptor_tests.cpp \
+ tests/base64_tests.cpp \
+ tests/bits_tests.cpp \
+ tests/bytes_tests.cpp \
+ tests/cache_tests.cpp \
+ tests/duration_tests.cpp \
+ tests/dynamiclibrary_tests.cpp \
+ tests/error_tests.cpp \
+ tests/flags_tests.cpp \
+ tests/gzip_tests.cpp \
+ tests/hashmap_tests.cpp \
+ tests/hashset_tests.cpp \
+ tests/interval_tests.cpp \
+ tests/ip_tests.cpp \
+ tests/json_tests.cpp \
+ tests/jsonify_tests.cpp \
+ tests/linkedhashmap_tests.cpp \
+ tests/mac_tests.cpp \
+ tests/main.cpp \
+ tests/multimap_tests.cpp \
+ tests/none_tests.cpp \
+ tests/numify_tests.cpp \
+ tests/option_tests.cpp \
+ tests/os_tests.cpp \
+ tests/os/env_tests.cpp \
+ tests/os/filesystem_tests.cpp \
+ tests/os/process_tests.cpp \
+ tests/os/rmdir_tests.cpp \
+ tests/os/sendfile_tests.cpp \
+ tests/os/signals_tests.cpp \
+ tests/os/socket_tests.cpp \
+ tests/os/strerror_tests.cpp \
+ tests/os/systems_tests.cpp \
+ tests/path_tests.cpp \
+ tests/protobuf_tests.cpp \
+ tests/protobuf_tests.pb.cc \
+ tests/protobuf_tests.pb.h \
+ tests/protobuf_tests.proto \
+ tests/recordio_tests.cpp \
+ tests/result_tests.cpp \
+ tests/set_tests.cpp \
+ tests/some_tests.cpp \
+ tests/strings_tests.cpp \
+ tests/subcommand_tests.cpp \
+ tests/svn_tests.cpp \
+ tests/try_tests.cpp \
+ tests/uuid_tests.cpp \
+ tests/version_tests.cpp
+
+if OS_LINUX
+ stout_tests_SOURCES += tests/proc_tests.cpp
+endif
+
+# The order of include flags shouldn't matter because we are allowed to disable
+# some bundled dependencies in favor of system-installed ones. This would be a
+# concern if some headers were to have the same paths.
+stout_tests_CPPFLAGS = \
+ -I$(srcdir)/include \
+ $(BOOST_INCLUDE_FLAGS) \
+ $(GLOG_INCLUDE_FLAGS) \
+ $(GMOCK_INCLUDE_FLAGS) \
+ $(GTEST_INCLUDE_FLAGS) \
+ $(PICOJSON_INCLUDE_FLAGS) \
+ $(PROTOBUF_INCLUDE_FLAGS) \
+ $(AM_CPPFLAGS)
+
+# The order of LDADD flags would matter if the same symbol is provided by
+# multiple of these libraries. This is highly unlikely, especially, since we are
+# allowed to disable some bundled libraries in lieu of system-installed ones.
+stout_tests_LDADD = \
+ $(LIB_GMOCK) \
+ $(LIB_GLOG) \
+ $(LIB_PROTOBUF) \
+ -lsvn_subr-1 \
+ -lsvn_delta-1 \
+ -lapr-1
+
+# FreeBSD makes the dynamic linking interface available in libc
+if !OS_FREEBSD
+ stout_tests_LDADD += -ldl
+endif
+
+# Both libprocess-tests and benchmarks have a dependency on libgmock.la.
+$(LIB_GMOCK):
+ @cd .. && $(MAKE) $(AM_MAKEFLAGS) libgmock.la
+
+# We use a check-local target for now to avoid the parallel test
+# runner that ships with newer versions of autotools.
+# See the following discussion for the workaround:
+# http://lists.gnu.org/archive/html/automake/2013-01/msg00051.html
+check-local: tests
+ ./stout-tests
+
+tests: stout-tests
+
+all-local: Makefile
+
+EXTRA_DIST = $(stout_tests_SOURCES)
+if !OS_LINUX
+EXTRA_DIST += tests/proc_tests.cpp
+endif
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/README.md
----------------------------------------------------------------------
diff --git a/3rdparty/stout/README.md b/3rdparty/stout/README.md
new file mode 100644
index 0000000..45dd8f3
--- /dev/null
+++ b/3rdparty/stout/README.md
@@ -0,0 +1,626 @@
+## Stout Developer Guide
+
+Stout is a header-only C++ library. Simply add the `include` folder to your include path (i.e., `-I/path/to/stout/include`) during compilation (eventually we plan to support installation).
+
+> NOTE: Depending on which headers you'd like to use, you may require the following third party libraries:
+>
+> - Boost
+> - Google's glog (this dependency will be removed in the future)
+> - Google's protobuf (version 2.6.1 is required to run tests)
+> - Google's gmock/gtest
+
+There are a handful of data structures provided within the library (including some collections), as well as some namespaced and miscellaneous utilities. Also included are abstractions for [command line flags](#flags).
+
+Stout provides and heavily leverages some monadic structures including [Option](#option) and [Try](#try).
+
+Note that the library is designed to completely avoid exceptions. See [exceptions](#exceptions) for further discussion.
+
+* <a href="#option">Option, Some, and None</a>
+* <a href="#try">Try, Result, and Error</a>
+* <a href="#nothing">Nothing</a>
+* <a href="#fs">fs::</a>
+* <a href="#gzip">gzip::</a>
+* <a href="#json">JSON::</a>
+* <a href="#jsonify">`jsonify`</a>
+* <a href="#lambda">lambda::</a>
+* <a href="#net">net::</a>
+* <a href="#os">os::</a>
+* <a href="#path">path::</a>
+* <a href="#proc">proc::</a>
+* <a href="#protobuf">protobuf::</a>
+* <a href="#strings">strings::</a>
+* <a href="#flags">Command Line Flags</a>
+* <a href="#collections">Collections</a>
+* <a href="#miscellaneous">Miscellaneous</a>
+* <a href="#testing">Testing</a>
+* <a href="#philosophy">Philosophy</a>
+
+
+<a href="option"></a>
+
+## `Option`, `Some`, and `None`
+
+The `Option` type provides a safe alternative to using `NULL`. An `Option` can be constructed explicitly or implicitly:
+
+~~~{.cpp}
+ Option<bool> o(true);
+ Option<bool> o = true;
+~~~
+
+You can check if a value is present using `Option::isSome()` and `Option::isNone()` and retrieve the value using `Option::get()`:
+
+~~~{.cpp}
+ if (!o.isNone()) {
+ ... o.get() ...
+ }
+~~~
+
+Note that the current implementation *copies* the underlying values (see [Philosophy](#philosophy) for more discussion). Nothing prevents you from using pointers, however, *the pointer will not be deleted when the Option is destructed*:
+
+~~~{.cpp}
+ Option<std::string*> o = new std::string("hello world");
+~~~
+
+The `None` type acts as "syntactic sugar" to make using [Option](#option) less verbose. For example:
+
+~~~{.cpp}
+ Option<T> foo(const Option<T>& o)
+ {
+ return None(); // Can use 'None' here.
+ }
+
+ ...
+
+ foo(None()); // Or here.
+
+ ...
+
+ Option<int> o = None(); // Or here.
+~~~
+
+Similar to `None`, the `Some` type can be used to construct an `Option` as well. In most circumstances `Some` is unnecessary due to the implicit `Option` constructor, however, it can still be useful to remove any ambiguities as well as when embedded within collections:
+
+~~~{.cpp}
+ Option<Option<std::string>> o = Some("42");
+
+ std::map<std::string, Option<std::string>> values;
+ values["value1"] = None();
+ values["value2"] = Some("42");
+~~~
+
+
+<a href="try"></a>
+
+## `Try`, `Result`, and `Error`
+
+A `Try` provides a mechanism to return a value or an error without throwing exceptions. Like `Option`, you can explicitly or implicitly construct a `Try`:
+
+~~~{.cpp}
+ Try<bool> t(true);
+ Try<bool> t = true;
+~~~
+
+You can check if a value is present using `Try::isSome()` and `Try::isError()` and retrieve the value using `Try::get()` or the error via `Try::error`:
+
+~~~{.cpp}
+ if (!t.isError()) {
+ ... t.get() ...
+ } else {
+ ... t.error() ...
+ }
+~~~
+
+A `Result` is a combination of a `Try` and an `Option`; you can think of a `Result` as semantically being equivalent to `Try<Option<T>>`. In addition to `isSome()` and `isError()` a `Result` includes `isNone()`.
+
+The `Error` type acts as "syntactic sugar" for implicitly constructing a `Try` or `Result`. For example:
+
+~~~{.cpp}
+ Try<bool> parse(const std::string& s)
+ {
+ if (s == "true") {
+ return true;
+ } else if (s == "false") {
+ return false;
+ } else {
+ return Error("Failed to parse string as boolean");
+ }
+ }
+
+ Try<bool> t = parse("false");
+~~~
+
+You can also use `None` and `Some` with `Result` just like with `Option`:
+
+~~~{.cpp}
+ Result<bool> r = None();
+ Result<bool> r = Some(true);
+~~~
+
+
+
+
+<a href="nothing"></a>
+
+## `Nothing`
+
+A lot of functions that return `void` can also "return" an
+error. Since we don't use exceptions (see [Exceptions](#exceptions))
+we capture this pattern using `Try<Nothing>` (see [Try](#try)).
+
+
+
+<a href="fs"></a>
+
+## `fs::`
+
+A collection of utilities for working with a filesystem. Currently we provide `fs::size`, `fs::usage`, and `fs::symlink`.
+
+
+<a href="gzip"></a>
+
+## `gzip::`
+
+A collection of utilities for doing gzip compression and decompression using `gzip::compress` and `gzip::decompress`.
+
+~~~{.cpp}
+ gzip::decompress(gzip::compress("hello world"));
+~~~
+
+
+<a href="json"></a>
+
+## `JSON::`
+
+*Requires Boost.*
+
+Provides structures and rendering of the JavaScript Object Notation (JSON) grammar using `boost::variant`. A JSON "value" (`JSON::Value`) is one of (i.e., a variant of) `JSON::String`, `JSON::Number`, `JSON::Object`, `JSON::Array`, `JSON::True`, `JSON::False`, and `JSON::Null`.
+
+We explicitly define 'true' (`JSON::True`), 'false' (`JSON::False`), and 'null' (`JSON::Null`), for clarity and also because `boost::variant` "picks" the wrong type when we try and use `std::string`, `long` (or `int`), `double` (or `float`), and `bool` all in the same variant.
+
+We could have avoided using `JSON::String` or `JSON::Number` and just used `std::string` and `double` respectively, but we choose to include them for completeness (although, this does slow compilation due to the extra template instantiations). That being said, you can use the native types in place of constructing the `JSON` wrapper. For example:
+
+~~~{.cpp}
+ // {
+ // "foo": "value1",
+ // "bar": "value2",
+ // "baz": 42.0,
+ // "bam": 0.42,
+ // }
+ JSON::Object object;
+ object.values["foo"] = JSON::String("value1");
+ object.values["bar"] = "value2";
+ object.values["baz"] = JSON::Number(42.0);
+ object.values["bam"] = 0.42;
+~~~
+
+Of course, nesting of a `JSON::Value` is also permitted as per the JSON specification:
+
+~~~{.cpp}
+ // An array of objects:
+ // [
+ // { "first": "Benjamin", "last": "Hindman" },
+ // { "first": "Michael", "last": "Hindman" }
+ // ]
+ JSON::Array array;
+
+ JSON::Object object1;
+ object1.values["first"] = "Benjamin";
+ object1.values["last"] = "Hindman";
+
+ array.values.push_back(object1);
+
+ JSON::Object object2;
+ object2.values["first"] = "Michael";
+ object2.values["last"] = "Hindman";
+
+ array.values.push_back(object2);
+~~~
+
+You can "render" a JSON value using `std::ostream operator<<` (or by using `stringify` (see [here](#stringify)).
+
+
+<a href="jsonify"></a>
+
+## `jsonify`
+
+`jsonify` takes an instance of a C++ object and returns a representation of `JSON` string captured in a light-weight proxy object. The proxy object can either be implicitly converted to a `std::string`, or directly inserted into an output stream.
+
+`jsonify(const T&)` is implemented by calling the function `json`. We perform unqualified function call so that it can detect overloads via argument dependent lookup. That is, we will search for, and use a free function named `json` in the same namespace as `T`.
+
+> NOTE: This relationship is similar to `boost::hash` and `hash_value`.
+
+`json` takes two parameters: a pointer to a writer type, and the type of the object. The following are the available writers and their member functions:
+
+* `BooleanWriter` -- `set(value)`
+* `NumberWriter` -- `set(value)`
+* `StringWriter` -- `append(value)`
+* `ArrayWriter` -- `element(value)`
+* `ObjectWriter` -- `field(key, value)`
+
+~~~{.cpp}
+namespace store {
+
+struct Customer
+{
+ std::string first_name;
+ std::string last_name;
+ int age;
+};
+
+void json(JSON::ObjectWriter* writer, const Customer& customer)
+{
+ writer->field("first name", customer.first_name);
+ writer->field("last name", customer.last_name);
+ writer->field("age", customer.age);
+}
+
+} // namespace store {
+
+store::Customer customer{"michael", "park", 25};
+std::cout << jsonify(customer);
+// prints: {"first name":"michael","last name":"park","age":25}
+~~~
+
+`jsonify(const F&)` overload takes a function object `F` that takes a pointer to writer. This is useful in cases where we don't want to define a public `json` function out-of-line.
+
+~~~{.cpp}
+namespace store {
+
+struct Customer
+{
+ std::string first_name;
+ std::string last_name;
+ int age;
+};
+
+} // namespace store {
+
+store::Customer customer{"michael", "park", 25};
+std::cout << jsonify([&customer](JSON::ObjectWriter* writer) {
+ writer->field("first name", customer.first_name);
+ writer->field("last name", customer.last_name);
+ writer->field("age", customer.age);
+});
+// prints: {"first name":"michael","last name":"park","age":25}
+~~~
+
+<a href="lambda"></a>
+
+## `lambda::`
+
+To help deal with compatibility issues between C++98/03 and C++11 we wrap some of the TR1 types from `functional` in `lambda`. That way, when using `lambda::bind` you'll get `std::tr1::bind` where TR1 is available and `std::bind` when C++11 is available.
+
+
+<a href="net"></a>
+
+## `net::`
+
+A collection of utilities for working with the networking subsystem. Currently we provide `net::download` and `net::getHostname`.
+
+
+<a href="os"></a>
+
+## `os::`
+
+The `os` namespace provides numerous utilities for working with the operating system. Most of these utilities are simple wrappers around C-style functions that don't cleanly take or return C++ types, for example `os::getenv`, `os::setenv`, `os::realpath`, etc. The library also includes a handful of "shell familiars", such as `os::chown`, `os::touch`, `os::ls`, `os::find`, `os::su`, `os::glob`, etc. We call out a few of the special abstractions below.
+
+#### Reading and Writing `std::string`
+
+To make reading and writing from files easier there are implementations of `os::read` and `os::write` that take and return `std::string`.
+
+#### Files
+
+Most of the ways to get or set information about files requires complicated calls using the `stat` family of functions. We provide simple wrappers around `stat` via things like `os::exists`, `os::stat::isdir`, `os::stat::isfile`, and `os::stat::islink`.
+
+#### Processes
+
+There are some fairly extensive abstractions around getting process information from the operating system. There is an `os::Process` type that gets provided by utilities like `os::processes`. You can construct an arbitrary fork/exec process tree by constructing an `os::Fork`, get all the processes in a process tree using `os::pstree`, and kill all the processes in a process tree using `os::killtree` (the latter is similar to the shell command `kill` but strictly more powerful in that it can walk a process tree, following groups and sessions if requested).
+
+#### `sysctl`
+
+There is an `os::sysctl` abstraction for getting and setting kernel state on OS X.
+
+#### Signals
+
+There are a handful of wrappers that make working with signals easier, including `os::signals::pending`, `os::signals::block`, and `os::signals::unblock`. In addition, there is a suppression abstraction that enables executing a block of code while blocking a signal. Consider writing to a pipe which may raise a SIGPIPE if the pipe has been closed. Using `suppress` you can do:
+
+~~~{.cpp}
+ suppress (SIGPIPE) {
+ write(fd, data, size);
+ if (errno == EPIPE) {
+ // The pipe has been closed!
+ }
+ }
+~~~
+
+
+<a href="path"></a>
+
+## `path::`
+
+The `path` namespace provides the `path::join` function for joining together filesystem paths. Additionally to the `path` namespace there also exists the class `Path`. `Path` provides `basename()` and `dirname()` as thread safe replacements for standard `::basename()` and `::dirname()`.
+
+
+<a href="proc"></a>
+
+## `proc::`
+
+*Requires Linux.*
+
+The `proc` namespace provides some abstractions for working with the Linux `proc` filesystem. The key abstractions are `proc::ProcessStatus` which models the data provided in `/proc/[pid]/stat` and `proc::SystemStatus` which models the data provided in `/proc/stat`.
+
+
+<a href="protobuf"></a>
+
+## `protobuf::`
+
+*Requires protobuf.*
+
+Helpers for reading and writing protobufs from files and file descriptors are provided via `protobuf::read` and `protobuf::write`. These assume a "recordio" format where the length of the serialized data is read/written first followed by the actual data.
+
+There is also a protobuf to JSON converter via `JSON::protobuf` that enables serializing a protobuf into JSON:
+
+~~~{.cpp}
+ google::protobuf::Message message;
+ ... fill in message ...
+ JSON::Object o = JSON::protobuf(message);
+~~~
+
+
+<a href="strings"></a>
+
+## `strings::`
+
+Utilities for inspecting and manipulating strings are available in the `strings` namespace. This includes varying tokenization techniques via `strings::tokenize`, `strings::split`, and `strings::pairs`.
+
+String formatting is provided via `strings::format`. The `strings::format` functions produces strings based on the `printf` family of functions. Except, unlike the `printf` family of functions, the `strings::format` routines attempt to "stringify" (see [here](#stringify)) any arguments that are not POD types (i.e., "plain old data": primitives, pointers, certain structs/classes and unions, etc). This enables passing structs/classes to `strings::format` provided there is a definition/specialization of `std::ostream operator<<` available for that type. Note that the `%s` format specifier is expected for each argument that gets passed. A specialization for `std::string` is also provided so that `std::string::c_str` is not necessary (but again, `%s` is expected as the format specifier).
+
+
+
+<a href="flags"></a>
+
+## Command Line Flags
+
+One frustration with existing command line flags libraries was the burden they put on writing tests that attempted to have many different instantiations of the flags. For example, running two instances of the same component within a test where each instance was started with different command line flags. To solve this, we provide a command line flags abstraction called `Flags` (in the `flags` namespace) that you can extend to define your own flags:
+
+~~~{.cpp}
+ struct MyFlags : flags::Flags
+ {
+ MyFlags()
+ {
+ // A flag with a default value.
+ add(&MyFlags::foo,
+ "foo",
+ "Some information about foo",
+ DEFAULT_VALUE_FOR_FOO);
+
+ // A flag with out a default value,
+ // defined below with an `Option`.
+ add(&MyFlags::bar,
+ "bar",
+ "Some information about bar");
+ }
+
+ int foo;
+ Option<std::string> bar;
+ };
+~~~
+
+You can then load the flags via `argc` and `argv` via:
+
+~~~{.cpp}
+ MyFlags flags;
+ Try<Nothing> load = flags.load(None(), argc, argv);
+
+ if (load.isError()) { ... }
+
+ ... flags.foo ...
+ ... flags.bar.isSome() ... flags.bar.get() ...
+~~~
+
+You can load flags from the environment in addition to `argc` and `argv` by specifying a prefix to use when looking for flags:
+
+~~~{.cpp}
+ MyFlags flags;
+ Try<Nothing> load = flags.load("PREFIX_", argc, argv);
+~~~
+
+Then both PREFIX_foo and PREFIX_bar will be loaded from the environment as well as possibly from on the command line.
+
+There are various ways to deal with unknown flags (i.e., `--baz` in our example above) and duplicates (i.e., `--foo` on the command line twice or once in the environment and once on the command line). See the header files for the various `load` overloads.
+
+
+
+<a href="collections"></a>
+
+## Collections
+
+Many of the collections and containers provided either by Boost or the C++ standard are cumbersome to use or yield brittle, hard to maintain code. For many of the standard data structures we provide wrappers with modified interfaces often simplified or enhanced using types like `Try` and `Option`.
+
+> NOTE: The collections are not namespaced.
+
+Some of these wrappers use the Boost implementations of these data structures, including: `hashmap`, `hashset`, `linkedhashmap`, `multihashmap`, `multimap`.
+
+There is a `Set` abstraction for working with a `std::set` as well as some overloaded operators for doing set union (`|`), set intersection (`&`), and set appending (`+`).
+
+Finally, there is a `cache` implementation (also requires Boost) that provides a templated implementation of a least-recently used (LRU) cache. Note that the key type must be compatible with `boost::unordered_map`.
+
+
+
+<a href="miscellaneous"></a>
+
+## Miscellaneous
+
+There are a handful of types and utilities that fall into the miscellaneous category. Note that like the collections _these are not namespaced_.
+
+
+#### `Bytes`
+
+Used to represent some magnitude of bytes, i.e., kilobytes, megabytes, gigabytes, etc. The main way to construct a `Bytes` is to invoke `Bytes::parse` which expects a string made up of a number and a unit, i.e., `42B`, `42MB`, `42GB`, `42TB`. For each of the supported units there are associated types: `Megabytes`, `Gigabytes`, `Terabytes`. Each of these types inherit from `Bytes` and can be used anywhere a `Bytes` is expected, for example:
+
+~~~{.cpp}
+ Try<Bytes> bytes = Bytes::parse("32MB");
+
+ Bytes bytes = Megabytes(10);
+~~~
+
+There are operators for comparing (equal to, greater than or less than, etc) and manipulating (addition, subtraction, etc) `Bytes` objects, as well as a `std::ostream operator<<` overload (thus making them stringifiable, see [here](#stringify)). For example:
+
+~~~{.cpp}
+ Try<Bytes> bytes = Bytes::parse("32MB");
+
+ Bytes tengb = Gigabytes(10);
+ Bytes onegb = Megabytes(1024);
+
+ stringify(tengb + onegb); // Yields "11GB".
+~~~
+
+#### `Duration`
+
+Used to represent some duration of time. The main way to construct a `Duration` is to invoke `Duration::parse` which expects a string made up of a number and a unit, i.e., `42ns`, `42us`, `42ms`, `42secs`, `42mins`, `42hrs`, `42days`, `42weeks`. For each of the supported units there are associated types: `Nanoseconds`, `Microseconds`, `Milliseconds`, `Seconds`, `Minutes`, `Hours`, `Days`, `Weeks`. Each of these types inherit from `Duration` and can be used anywhere a `Duration` is expected, for example:
+
+~~~{.cpp}
+ Duration d = Seconds(5);
+~~~
+
+There are operators for comparing (equal to, greater than or less than, etc) and manipulating (addition, subtraction, etc) `Duration` objects, as well as a `std::ostream operator<<` overload (thus making them stringifiable, see [here](#stringify)). Note that the `std::ostream operator<<` overload formats the output (including the unit) based on the magnitude, for example:
+
+~~~{.cpp}
+ stringify(Seconds(42)); // Yields "42secs".
+ stringify(Seconds(120)); // Yields "2mins".
+~~~
+
+
+#### `Stopwatch`
+
+A data structure for recording elapsed time (according to the underlying operating system clock):
+
+~~~{.cpp}
+ Stopwatch stopwatch;
+ stopwatch.start();
+
+ Duration elapsed = stopwatch.elapsed();
+
+ stopwatch.stop();
+
+ assert(elapsed <= stopwatch.elapsed());
+~~~
+
+
+#### `UUID`
+
+*Requires Boost.*
+
+A wrapper around `boost::uuid` with a simpler interface.
+
+
+#### `EXIT`
+
+A macro for exiting an application without generating a signal (such as from `assert`) or a stack trace (such as from Google logging's `CHECK` family of macros). This is useful if you want to exit the program with an error message:
+
+~~~{.cpp}
+ EXIT(42) << "You've provided us bad input ...";
+~~~
+
+Note that a newline is automatically appended and the processes exit status is set to 42.
+
+
+#### `foreach`
+
+*Requires Boost.*
+
+Macros for looping over collections:
+
+~~~{.cpp}
+ std::list<std::string> l;
+
+ foreach (std::string s, l) {}
+ foreach (const std::string& s, l) {}
+
+ std::map<std::string, int> m;
+
+ foreachpair (std::string s, int i, m) {}
+ foreachpair (const std::string& s, int i, m) {}
+
+ foreachkey (const std::string& s, m) {}
+ foreachvalue (int i, m) {}
+~~~
+
+
+#### `numify`
+
+*Requires Boost.*
+
+Wraps `boost::lexical_cast` for converting strings to numbers but returns a `Try` rather than throwing exceptions.
+
+
+<a href="stringify"></a>
+
+#### `stringify`
+
+Converts arbitrary types into strings by attempting to use an overloaded `std::ostream operator<<` (otherwise compilation fails). Note that `stringify` aborts the program if the stringification process fails.
+
+
+#### `ThreadLocal`
+
+*Requires pthreads.*
+
+You can give every thread it's own copy of some data using the `ThreadLocal` abstraction:
+
+~~~{.cpp}
+ ThreadLocal<std::string> local;
+ local = new std::string("hello");
+ local->append(" world");
+ std::string* s = local;
+ assert(*s == "hello world");
+~~~
+
+
+<a href="testing"></a>
+
+## Testing
+
+
+There are some macros provided for integration with gtest that make the tests less verbose while providing better messages when tests do fail:
+
+~~~{.cpp}
+ Try<int> t = foo();
+
+ // Rather than:
+ ASSERT(t.isSome()) << "Error: " << t.error();
+
+ // Just do:
+ ASSERT_SOME(t);
+~~~
+
+There available macros include `ASSERT_SOME`, `EXPECT_SOME`, `ASSERT_NONE`, `EXPECT_NONE`, `ASSERT_ERROR`, `EXPECT_ERROR`, `ASSERT_SOME_EQ`, `EXPECT_SOME_EQ`, `ASSERT_SOME_TRUE`, `EXPECT_SOME_TRUE`, `ASSERT_SOME_FALSE`, `EXPECT_SOME_FALSE`.
+
+
+<a href="philosophy"></a>
+
+## Philosophy
+
+*"Premature optimization is the root of all evil."*
+
+You'll notice that the library is designed in a way that can lead to a
+lot of copying. This decision was deliberate. Capturing the semantics
+of pointer ownership is hard to enforce programmatically unless you
+copy, and in many instances these copies can be elided by an
+optimizing compiler. We've chosen safety rather than premature
+optimizations.
+
+Note, however, that we plan to liberally augment the library as we add
+C++11 support. In particular, we plan to use rvalue references and
+std::unique_ptr (although, likely wrapped as Owned) in order to
+explicitly express ownership semantics. Until then, it's unlikely that
+the performance overhead incurred via any extra copying is your
+bottleneck, and if it is we'd love to hear from you!
+
+
+<a href="exceptions"></a>
+
+### Exceptions
+
+The library WILL NEVER throw exceptions and will attempt to capture
+any exceptions thrown by underlying C++ functions and convert them
+into an [Error](#error).
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/bootstrap
----------------------------------------------------------------------
diff --git a/3rdparty/stout/bootstrap b/3rdparty/stout/bootstrap
new file mode 100755
index 0000000..89b9bc8
--- /dev/null
+++ b/3rdparty/stout/bootstrap
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Make sure that we are in the right directory.
+if test ! -f configure.ac; then
+ cat >&2 <<__EOF__
+You must run bootstrap from the root of the distribution.
+__EOF__
+ exit 1
+fi
+
+autoreconf --install -Wall --verbose "${@}"
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/cmake/FindApr.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/stout/cmake/FindApr.cmake b/3rdparty/stout/cmake/FindApr.cmake
new file mode 100644
index 0000000..9d55ba0
--- /dev/null
+++ b/3rdparty/stout/cmake/FindApr.cmake
@@ -0,0 +1,202 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+###############################################################
+# IMPORTANT NOTE: I (hausdorff) have copied a *lot* of stuff in this file from
+# code I found at in the Akumuli[1] project. The original version
+# of this file was also released under the Apache 2.0 license, and
+# licensed to the ASF, making it fully compatible with the Mesos
+# project.
+# [1] https://github.com/akumuli/Akumuli/blob/master/cmake/FindAPR.cmake
+
+# This module helps to find the Apache Portable Runtime (APR) and APR-Util
+# packages.
+#
+# USAGE: to use this module, add the following line to your CMake project:
+# find_package(Apr)
+#
+# To make linking to APR simple, this module defines:
+# * APR_FOUND and APRUTIL_FOUND (if false, linking build will fail)
+# * APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR (defineswhere to find apr.h, etc.)
+# * APR_LIBS and APRUTIL_LIBS (binaries for APR and friends)
+#
+# Also defined, but not for general use are:
+# * APR_LIB and APRUTIL_LIB (where to find the APR library)
+
+# CONFIGURE THE APR SEARCH. Specify what we're looking for, and which directories
+# we're going to look through to find them.
+#############################################################################
+unset(APRUTIL_LIB)
+unset(APRUTIL_INCLUDE_DIR)
+unset(APR_LIB)
+unset(APR_INCLUDE_DIR)
+unset(APR_LIBS)
+unset(APR_FOUND)
+
+set(POSSIBLE_APR_INCLUDE_DIRS
+ ${POSSIBLE_APR_INCLUDE_DIRS}
+ /opt/homebrew/opt/apr/include/apr-1
+ /usr/local/include/apr-1
+ /usr/local/include/apr-1.0
+ /usr/include/apr-1
+ /usr/include/apr-1.0
+ /usr/local/apr/include/apr-1
+ )
+
+set(APR_LIB_NAMES ${APR_LIB_NAMES} apr-1)
+
+set(POSSIBLE_APR_LIB_DIRS
+ ${POSSIBLE_APR_LIB_DIRS}
+ /usr/lib
+ /usr/local/lib
+ /usr/local/apr/lib
+ /opt/homebrew/opt/apr/lib
+ )
+
+# SEARCH FOR APR LIBRARIES.
+###########################
+find_path(APR_INCLUDE_DIR apr.h ${POSSIBLE_APR_INCLUDE_DIRS})
+
+find_library(
+ APR_LIB
+ NAMES ${APR_LIB_NAMES}
+ PATHS ${POSSIBLE_APR_LIB_DIRS}
+ )
+
+# Did we find the include directory?
+string(
+ COMPARE NOTEQUAL
+ "APR_INCLUDE_DIR-NOTFOUND"
+ ${APR_INCLUDE_DIR} # Value set to APR_INCLUDE_DIR-NOTFOUND if not found.
+ APR_INCLUDE_DIR_FOUND
+ )
+
+# Did we find the library?
+string(
+ COMPARE NOTEQUAL
+ "APR_LIB-NOTFOUND"
+ ${APR_LIB} # Value set to `APR_LIB-NOTFOUND` if not found.
+ APR_LIB_FOUND
+ )
+
+# APR is considered "found" if we've both an include directory and an APR binary.
+if ("${APR_LIB_FOUND}" AND "${APR_INCLUDE_DIR_FOUND}")
+ set(APR_LIBS ${APR_LIB})
+ set(APR_FOUND 1)
+else ("${APR_LIB_FOUND}" AND "${APR_INCLUDE_DIR_FOUND}")
+ set(APR_FOUND 0)
+endif ("${APR_LIB_FOUND}" AND "${APR_INCLUDE_DIR_FOUND}")
+
+# Results.
+if (APR_FOUND)
+ if (NOT Apr_FIND_QUIETLY)
+ message(STATUS "Found APR headers: ${APR_INCLUDE_DIR}")
+ message(STATUS "Found APR library: ${APR_LIBS}")
+ endif (NOT Apr_FIND_QUIETLY)
+else (APR_FOUND)
+ if (Apr_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find APR library")
+ endif (Apr_FIND_REQUIRED)
+endif (APR_FOUND)
+
+# (Deprecated declarations.)
+set(NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
+get_filename_component(NATIVE_APR_LIB_PATH ${APR_LIB} PATH)
+
+# Export libraries variables.
+mark_as_advanced(
+ APR_LIB
+ APR_INCLUDE_DIR
+ )
+
+# CONFIGURE THE APR-UTIL SEARCH. Specify what we're looking for, and which
+# directories we're going to look through to find them.
+#############################################################################
+set(POSSIBLE_APRUTIL_INCLUDE_DIRS
+ ${POSSIBLE_APRUTIL_INCLUDE_DIRS}
+ /opt/homebrew/opt/apr-util/include/apr-1
+ /usr/local/include/apr-1
+ /usr/local/include/apr-1.0
+ /usr/include/apr-1
+ /usr/include/apr-1.0
+ /usr/local/apr/include/apr-1
+ )
+
+set(APRUTIL_LIB_NAMES ${APRUTIL_LIB_NAMES} aprutil-1)
+
+set(POSSIBLE_APRURIL_LIB_DIRS
+ ${POSSIBLE_APRURIL_LIB_DIRS}
+ /usr/lib
+ /usr/local/lib
+ /usr/local/apr/lib
+ /opt/homebrew/opt/apr-util/lib
+ )
+
+# SEARCH FOR APR-UTIL LIBRARIES.
+################################
+find_path(APRUTIL_INCLUDE_DIR apu.h ${POSSIBLE_APRUTIL_INCLUDE_DIRS})
+
+find_library(
+ APRUTIL_LIB
+ NAMES ${APRUTIL_LIB_NAMES}
+ PATHS ${POSSIBLE_APRUTIL_LIB_DIRS}
+ )
+
+# Did we find the include directory?
+string(
+ COMPARE NOTEQUAL
+ "APRUTIL_INCLUDE_DIR-NOTFOUND"
+ ${APRUTIL_INCLUDE_DIR} # Value set to APR_INCLUDE_DIR-NOTFOUND if not found.
+ APRUTIL_INCLUDE_DIR_FOUND
+ )
+
+# Did we find the library?
+string(
+ COMPARE NOTEQUAL
+ "APRUTIL_LIB-NOTFOUND"
+ ${APRUTIL_LIB} # Value set to `APR_LIB-NOTFOUND` if not found.
+ APRUTIL_LIB_FOUND
+ )
+
+# APR-UTIL is "found" if we've both an include directory and an APR-UTIL binary.
+if ("${APRUTIL_LIB_FOUND}" AND "${APRUTIL_INCLUDE_DIR_FOUND}")
+ set(APRUTIL_LIBS ${APRUTIL_LIB})
+ set(APRUTIL_FOUND 1)
+else ("${APRUTIL_LIB_FOUND}" AND "${APRUTIL_INCLUDE_DIR_FOUND}")
+ set(APRUTIL_FOUND 0)
+endif ("${APRUTIL_LIB_FOUND}" AND "${APRUTIL_INCLUDE_DIR_FOUND}")
+
+# Results.
+if (APRUTIL_FOUND)
+ if (NOT Apr_FIND_QUIETLY)
+ message(STATUS "Found APRUTIL headers: ${APRUTIL_INCLUDE_DIR}")
+ message(STATUS "Found APRUTIL library: ${APRUTIL_LIBS}")
+ endif (NOT Apr_FIND_QUIETLY)
+else (APRUTIL_FOUND)
+ if (Apr_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find APRUTIL library")
+ endif (Apr_FIND_REQUIRED)
+endif (APRUTIL_FOUND)
+
+# (Deprecated declarations.)
+set(NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR})
+get_filename_component(NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIB} PATH)
+
+# Export libraries variables.
+mark_as_advanced(
+ APRUTIL_LIB
+ APRUTIL_INCLUDE_DIR
+ )
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/cmake/FindSvn.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/stout/cmake/FindSvn.cmake b/3rdparty/stout/cmake/FindSvn.cmake
new file mode 100644
index 0000000..e85e882
--- /dev/null
+++ b/3rdparty/stout/cmake/FindSvn.cmake
@@ -0,0 +1,119 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+###############################################################
+# IMPORTANT NOTE: Much of this file is taken almost-directly from the
+# FindApr.cmake file in this project. This file is itself taken
+# from an external source; see comments for details.
+
+# This module helps to find the Subversion packages.
+#
+# USAGE: to use this module, add the following line to your CMake project:
+# find_package(Svn)
+#
+# To make linking to Subversion simple, this module defines:
+# * SVN_FOUND (if false, linking build will fail)
+# * SVN_INCLUDE_DIR (defineswhere to find svn_client.h, etc.)
+# * SVN_LIBS (binaries for SVN and friends)
+#
+# Also defined, but not for general use are:
+# * SVN_LIB (where to find the APR library)
+
+# CONFIGURE OUR SEARCH. Specify what we're looking for, and which directories
+# we're going to look through to find them.
+#############################################################################
+unset(SVN_LIB)
+unset(SVN_INCLUDE_DIR)
+unset(SVN_LIBS)
+unset(SVN_FOUND)
+
+set(POSSIBLE_SVN_INCLUDE_DIRECTORIES
+ ${POSSIBLE_SVN_INCLUDE_DIRECTORIES}
+ /usr/local/include/subversion-1
+ /usr/include/subversion-1
+ )
+
+set(SVN_LIB_NAMES
+ ${SVN_LIB_NAMES}
+ svn_delta-1
+ svn_diff-1
+ svn_subr-1
+ )
+
+
+set(POSSIBLE_SVN_LIB_DIRECTORIES
+ ${POSSIBLE_SVN_LIB_DIRECTORIES}
+ /usr/lib
+ /usr/local/lib
+ )
+
+# SEARCH FOR SVN LIBRARIES.
+###########################
+find_path(SVN_INCLUDE_DIR svn_client.h ${POSSIBLE_SVN_INCLUDE_DIRECTORIES})
+
+# Did we find the include directory?
+string(
+ COMPARE NOTEQUAL
+ "SVN_INCLUDE_DIR-NOTFOUND"
+ ${SVN_INCLUDE_DIR} # Value set to `SVN_INCLUDE_DIR-NOTFOUND` if not found.
+ SVN_INCLUDE_DIR_FOUND
+ )
+
+foreach (LIB_NAME ${SVN_LIB_NAMES})
+ find_library(
+ ${LIB_NAME}_PATH
+ NAMES ${LIB_NAME}
+ PATHS ${POSSIBLE_SVN_LIB_DIRECTORIES}
+ )
+
+ # Did we find the library?
+ string(
+ COMPARE NOTEQUAL
+ "${LIB_NAME}_PATH-NOTFOUND"
+ ${${LIB_NAME}_PATH} # Value set to ${${LIB_NAME}_PATH}-NOTFOUND if not found.
+ ${LIB_NAME}_PATH_FOUND
+ )
+
+ if ("${${LIB_NAME}_PATH_FOUND}")
+ message(STATUS "Found SVN lib: ${${LIB_NAME}_PATH}")
+ list(APPEND SVN_LIBS ${${LIB_NAME}_PATH})
+ else ("${${LIB_NAME}_PATH_FOUND}")
+ message(FATAL_ERROR "Could not find SVN library ${${LIB_NAME}_PATH}")
+ endif ("${${LIB_NAME}_PATH_FOUND}")
+endforeach (LIB_NAME ${SVN_LIB_NAMES})
+
+list(LENGTH SVN_LIB_NAMES NUM_REQD_LIBS)
+list(LENGTH SVN_LIBS NUM_FOUND_LIBS)
+
+# Results.
+if ((NUM_FOUND_LIBS AND (NUM_REQD_LIBS EQUAL NUM_FOUND_LIBS)) AND
+ SVN_INCLUDE_DIR_FOUND)
+ if (NOT Svn_FIND_QUIETLY)
+ message(STATUS "Found SVN: ${SVN_LIBS}")
+ endif(NOT Svn_FIND_QUIETLY)
+else ((NUM_FOUND_LIBS AND (NUM_REQD_LIBS EQUAL NUM_FOUND_LIBS)) AND
+ SVN_INCLUDE_DIR_FOUND)
+ if (Svn_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find SVN library")
+ endif (Svn_FIND_REQUIRED)
+endif ((NUM_FOUND_LIBS AND (NUM_REQD_LIBS EQUAL NUM_FOUND_LIBS)) AND
+ SVN_INCLUDE_DIR_FOUND)
+
+# Export variables.
+mark_as_advanced(
+ SVN_LIB
+ SVN_INCLUDE_DIR
+ )
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/cmake/StoutConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/stout/cmake/StoutConfigure.cmake b/3rdparty/stout/cmake/StoutConfigure.cmake
new file mode 100644
index 0000000..aa28c1b
--- /dev/null
+++ b/3rdparty/stout/cmake/StoutConfigure.cmake
@@ -0,0 +1,125 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if (NOT WIN32)
+ # TODO(hausdorff): (cf. MESOS-3181) Add support for attempting to find these
+ # packages on Windows, and then if that fails, use CMake macros/functions to
+ # download, configure, and build them.
+ #
+ # WHY: Windows does not have a good package manager, so getting some of our
+ # dependencies can be really annoying in some circumstances. For this reason,
+ # we should support a CMake-based "distribution channel", even though this
+ # way is sure to be more hackish.
+ find_package(Apr REQUIRED)
+ find_package(Svn REQUIRED)
+endif (NOT WIN32)
+
+# DEFINE PROCESS LIBRARY DEPENDENCIES. Tells the process library build targets
+# download/configure/build all third-party libraries before attempting to build.
+################################################################################
+set(STOUT_DEPENDENCIES
+ ${STOUT_DEPENDENCIES}
+ ${BOOST_TARGET}
+ ${GLOG_TARGET}
+ ${PROTOBUF_TARGET}
+ ${PICOJSON_TARGET}
+ )
+
+if (WIN32)
+ set(STOUT_DEPENDENCIES
+ ${STOUT_DEPENDENCIES}
+ ${CURL_TARGET}
+ ${ZLIB_TARGET}
+ )
+endif (WIN32)
+
+# DEFINE THIRD-PARTY INCLUDE DIRECTORIES. Tells compiler toolchain where to get
+# headers for our third party libs (e.g., -I/path/to/glog on Linux).
+###############################################################################
+set(STOUT_INCLUDE_DIRS
+ ${STOUT_INCLUDE_DIRS}
+ ${STOUT_INCLUDE_DIR}
+ ${APR_INCLUDE_DIR}
+ ${BOOST_INCLUDE_DIR}
+ ${GLOG_INCLUDE_DIR}
+ ${PICOJSON_INCLUDE_DIR}
+ ${PROTOBUF_INCLUDE_DIR}
+ ${SVN_INCLUDE_DIR}
+ src
+ )
+
+if (WIN32)
+ set(STOUT_INCLUDE_DIRS
+ ${STOUT_INCLUDE_DIRS}
+ ${CURL_INCLUDE_DIR}
+ ${ZLIB_INCLUDE_DIR}
+ )
+endif (WIN32)
+
+# DEFINE THIRD-PARTY LIB INSTALL DIRECTORIES. Used to tell the compiler
+# toolchain where to find our third party libs (e.g., -L/path/to/glog on
+# Linux).
+########################################################################
+set(STOUT_LIB_DIRS
+ ${STOUT_LIB_DIRS}
+ ${APR_LIBS}
+ ${GLOG_LIB_DIR}
+ ${PROTOBUF_LIB_DIR}
+ ${SVN_LIBS}
+ )
+
+if (WIN32)
+ set(STOUT_LIB_DIRS
+ ${STOUT_LIB_DIRS}
+ ${CURL_LIB_DIR}
+ ${ZLIB_LIB_DIR}
+ )
+endif (WIN32)
+
+# DEFINE THIRD-PARTY LIBS. Used to generate flags that the linker uses to
+# include our third-party libs (e.g., -lglog on Linux).
+#########################################################################
+set(STOUT_LIBS
+ ${STOUT_LIBS}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${CURL_LFLAG}
+ ${GLOG_LFLAG}
+ ${SVN_LIBS}
+ ${PROTOBUF_LFLAG}
+ )
+
+if (WIN32)
+ set(STOUT_LIBS
+ ${STOUT_LIBS}
+ ${ZLIB_LFLAG}
+ ws2_32
+ Mswsock
+ )
+else (WIN32)
+ set(STOUT_LIBS
+ ${STOUT_LIBS}
+ ${DL_LFLAG}
+ apr-1
+ )
+endif (WIN32)
+
+# TODO(hausdorff): The `LINUX` flag comes from MesosConfigure; when we
+# port the bootstrap script to CMake, we should also copy this logic
+# into .cmake files in the Stout and Process libraries' folders
+# individually.
+if (LINUX)
+ set(STOUT_LIBS ${STOUT_LIBS} rt)
+endif (LINUX)
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/stout/cmake/StoutTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/stout/cmake/StoutTestsConfigure.cmake b/3rdparty/stout/cmake/StoutTestsConfigure.cmake
new file mode 100644
index 0000000..2c786c5
--- /dev/null
+++ b/3rdparty/stout/cmake/StoutTestsConfigure.cmake
@@ -0,0 +1,73 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set(
+ STOUT_TESTS_TARGET stout_tests
+ CACHE STRING "Target we use to refer to tests for the stout library")
+
+# COMPILER CONFIGURATION.
+#########################
+if (APPLE)
+ # GTEST on OSX needs its own tr1 tuple.
+ add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11)
+endif (APPLE)
+
+# DEFINE PROCESS LIBRARY DEPENDENCIES. Tells the process library build targets
+# download/configure/build all third-party libraries before attempting to build.
+################################################################################
+set(STOUT_TEST_DEPENDENCIES
+ ${STOUT_TEST_DEPENDENCIES}
+ ${STOUT_DEPENDENCIES}
+ ${GMOCK_TARGET}
+ ${GTEST_TARGET}
+ )
+
+# DEFINE THIRD-PARTY INCLUDE DIRECTORIES. Tells compiler toolchain where to get
+# headers for our third party libs (e.g., -I/path/to/glog on Linux)..
+###############################################################################
+set(STOUT_TEST_INCLUDE_DIRS
+ ${STOUT_TEST_INCLUDE_DIRS}
+ ${STOUT_INCLUDE_DIRS}
+ ${GMOCK_INCLUDE_DIR}
+ ${GTEST_INCLUDE_DIR}
+ )
+
+# DEFINE THIRD-PARTY LIB INSTALL DIRECTORIES. Used to tell the compiler
+# toolchain where to find our third party libs (e.g., -L/path/to/glog on
+# Linux).
+########################################################################
+set(STOUT_TEST_LIB_DIRS
+ ${STOUT_TEST_LIB_DIRS}
+ ${STOUT_LIB_DIRS}
+ ${GMOCK_LIB_DIR}
+ ${GTEST_LIB_DIR}
+ )
+
+# DEFINE THIRD-PARTY LIBS. Used to generate flags that the linker uses to
+# include our third-party libs (e.g., -lglog on Linux).
+#########################################################################
+set(STOUT_TEST_LIBS
+ ${STOUT_TEST_LIBS}
+ ${STOUT_LIBS}
+ ${GMOCK_LFLAG}
+ )
+
+if (NOT WIN32)
+ set(STOUT_TEST_LIBS
+ ${STOUT_TEST_LIBS}
+ ${GTEST_LFLAG}
+ )
+endif (NOT WIN32)