X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fexperimental%2FTestUtil.cpp;h=91410a55a81a940a58b1001121da2466ced24f54;hp=100ed1ae28e102ec031b849bb38b2abcc081dfaf;hb=7c9e64a0cf44be563abdad056e45e8268e99ee0a;hpb=c7b4aca63bb20a1d177c1a333d222ec390fae613 diff --git a/folly/experimental/TestUtil.cpp b/folly/experimental/TestUtil.cpp index 100ed1ae..91410a55 100644 --- a/folly/experimental/TestUtil.cpp +++ b/folly/experimental/TestUtil.cpp @@ -20,15 +20,12 @@ #include #include -#include #include #include #include #include #include #include -#include -#include #ifdef _WIN32 #include @@ -105,7 +102,7 @@ TemporaryDirectory::TemporaryDirectory( fs::path dir, Scope scope) : scope_(scope), - path_(folly::make_unique( + path_(std::make_unique( generateUniquePath(std::move(dir), namePrefix))) { fs::create_directory(path()); } @@ -217,35 +214,5 @@ std::string CaptureFD::readIncremental() { return std::string(buf.get(), size); } -static std::map getEnvVarMap() { - std::map data; - for (auto it = environ; *it != nullptr; ++it) { - std::string key, value; - split("=", *it, key, value); - if (key.empty()) { - continue; - } - CHECK(!data.count(key)) << "already contains: " << key; - data.emplace(move(key), move(value)); - } - return data; -} - -EnvVarSaver::EnvVarSaver() { - saved_ = getEnvVarMap(); -} - -EnvVarSaver::~EnvVarSaver() { - for (const auto& kvp : getEnvVarMap()) { - if (saved_.count(kvp.first)) { - continue; - } - PCHECK(0 == unsetenv(kvp.first.c_str())); - } - for (const auto& kvp : saved_) { - PCHECK(0 == setenv(kvp.first.c_str(), kvp.second.c_str(), (int)true)); - } -} - } // namespace test } // namespace folly