proxygen
|
#include <folly/Subprocess.h>
#include <sys/types.h>
#include <chrono>
#include <boost/container/flat_set.hpp>
#include <glog/logging.h>
#include <folly/Exception.h>
#include <folly/FileUtil.h>
#include <folly/Format.h>
#include <folly/String.h>
#include <folly/experimental/TestUtil.h>
#include <folly/experimental/io/FsUtil.h>
#include <folly/gen/Base.h>
#include <folly/gen/File.h>
#include <folly/gen/String.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Unistd.h>
Go to the source code of this file.
Classes | |
struct | WriteFileAfterFork |
Macros | |
#define | EXPECT_SPAWN_OPT_ERROR(err, errMsg, options, cmd, ...) |
#define | EXPECT_SPAWN_ERROR(err, errMsg, cmd, ...) EXPECT_SPAWN_OPT_ERROR(err, errMsg, Subprocess::Options(), cmd, ##__VA_ARGS__) |
Functions | |
TEST (SimpleSubprocessTest, ExitsSuccessfully) | |
TEST (SimpleSubprocessTest, ExitsSuccessfullyChecked) | |
TEST (SimpleSubprocessTest, CloneFlagsWithVfork) | |
TEST (SimpleSubprocessTest, CloneFlagsWithFork) | |
TEST (SimpleSubprocessTest, CloneFlagsSubprocessCtorExitsAfterExec) | |
TEST (SimpleSubprocessTest, ExitsWithError) | |
TEST (SimpleSubprocessTest, ExitsWithErrorChecked) | |
TEST (SimpleSubprocessTest, DefaultConstructibleProcessReturnCode) | |
TEST (SimpleSubprocessTest, MoveSubprocess) | |
TEST (SimpleSubprocessTest, DefaultConstructor) | |
TEST (SimpleSubprocessTest, ExecFails) | |
TEST (SimpleSubprocessTest, ShellExitsSuccesssfully) | |
TEST (SimpleSubprocessTest, ShellExitsWithError) | |
TEST (SimpleSubprocessTest, ChangeChildDirectorySuccessfully) | |
TEST (SimpleSubprocessTest, ChangeChildDirectoryWithError) | |
TEST (SimpleSubprocessTest, FdLeakTest) | |
TEST (SimpleSubprocessTest, Detach) | |
TEST (SimpleSubprocessTest, DetachExecFails) | |
TEST (ParentDeathSubprocessTest, ParentDeathSignal) | |
TEST (PopenSubprocessTest, PopenRead) | |
TEST (AfterForkCallbackSubprocessTest, TestAfterForkCallbackSuccess) | |
TEST (AfterForkCallbackSubprocessTest, TestAfterForkCallbackError) | |
TEST (CommunicateSubprocessTest, SimpleRead) | |
TEST (CommunicateSubprocessTest, BigWrite) | |
TEST (CommunicateSubprocessTest, Duplex) | |
TEST (CommunicateSubprocessTest, ProcessGroupLeader) | |
TEST (CommunicateSubprocessTest, Duplex2) | |
TEST (CommunicateSubprocessTest, Chatty) | |
TEST (CommunicateSubprocessTest, TakeOwnershipOfPipes) | |
#define EXPECT_SPAWN_ERROR | ( | err, | |
errMsg, | |||
cmd, | |||
... | |||
) | EXPECT_SPAWN_OPT_ERROR(err, errMsg, Subprocess::Options(), cmd, ##__VA_ARGS__) |
Definition at line 128 of file SubprocessTest.cpp.
Referenced by TEST().
#define EXPECT_SPAWN_OPT_ERROR | ( | err, | |
errMsg, | |||
options, | |||
cmd, | |||
... | |||
) |
Definition at line 113 of file SubprocessTest.cpp.
Referenced by TEST().
TEST | ( | SimpleSubprocessTest | , |
ExitsSuccessfully | |||
) |
Definition at line 42 of file SubprocessTest.cpp.
References EXPECT_EQ.
TEST | ( | SimpleSubprocessTest | , |
ExitsSuccessfullyChecked | |||
) |
Definition at line 47 of file SubprocessTest.cpp.
References folly::Subprocess::waitChecked().
TEST | ( | SimpleSubprocessTest | , |
CloneFlagsWithVfork | |||
) |
Definition at line 52 of file SubprocessTest.cpp.
References EXPECT_EQ.
TEST | ( | SimpleSubprocessTest | , |
CloneFlagsWithFork | |||
) |
Definition at line 59 of file SubprocessTest.cpp.
References EXPECT_EQ.
TEST | ( | SimpleSubprocessTest | , |
CloneFlagsSubprocessCtorExitsAfterExec | |||
) |
Definition at line 66 of file SubprocessTest.cpp.
References folly::checkUnixError(), and EXPECT_TRUE.
TEST | ( | SimpleSubprocessTest | , |
ExitsWithError | |||
) |
Definition at line 75 of file SubprocessTest.cpp.
References EXPECT_EQ.
TEST | ( | SimpleSubprocessTest | , |
ExitsWithErrorChecked | |||
) |
Definition at line 80 of file SubprocessTest.cpp.
References EXPECT_THROW.
TEST | ( | SimpleSubprocessTest | , |
DefaultConstructibleProcessReturnCode | |||
) |
Definition at line 85 of file SubprocessTest.cpp.
References EXPECT_TRUE, and folly::ProcessReturnCode::notStarted().
TEST | ( | SimpleSubprocessTest | , |
MoveSubprocess | |||
) |
Definition at line 90 of file SubprocessTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, and folly::gen::move.
TEST | ( | SimpleSubprocessTest | , |
DefaultConstructor | |||
) |
Definition at line 100 of file SubprocessTest.cpp.
References folly::ProcessReturnCode::exitStatus(), EXPECT_EQ, EXPECT_TRUE, folly::gen::move, folly::ProcessReturnCode::notStarted(), folly::Subprocess::returnCode(), folly::ProcessReturnCode::running(), gmock_test_utils::Subprocess, and folly::Subprocess::wait().
TEST | ( | SimpleSubprocessTest | , |
ExecFails | |||
) |
Definition at line 131 of file SubprocessTest.cpp.
References EXPECT_SPAWN_ERROR.
TEST | ( | SimpleSubprocessTest | , |
ShellExitsSuccesssfully | |||
) |
Definition at line 141 of file SubprocessTest.cpp.
References folly::ProcessReturnCode::exitStatus(), EXPECT_EQ, and folly::Subprocess::wait().
TEST | ( | SimpleSubprocessTest | , |
ShellExitsWithError | |||
) |
Definition at line 146 of file SubprocessTest.cpp.
References folly::ProcessReturnCode::exitStatus(), EXPECT_EQ, and folly::Subprocess::wait().
TEST | ( | SimpleSubprocessTest | , |
ChangeChildDirectorySuccessfully | |||
) |
Definition at line 151 of file SubprocessTest.cpp.
References folly::ProcessReturnCode::exitStatus(), EXPECT_EQ, EXPECT_SPAWN_ERROR, and folly::Subprocess::wait().
TEST | ( | SimpleSubprocessTest | , |
ChangeChildDirectoryWithError | |||
) |
Definition at line 160 of file SubprocessTest.cpp.
References ADD_FAILURE, folly::Subprocess::Options::chdir(), folly::SubprocessSpawnError::errnoValue(), EXPECT_EQ, and string.
TEST | ( | SimpleSubprocessTest | , |
FdLeakTest | |||
) |
Definition at line 206 of file SubprocessTest.cpp.
References ADD_FAILURE, folly::Subprocess::communicate(), folly::SubprocessSpawnError::errnoValue(), folly::ProcessReturnCode::exitStatus(), EXPECT_EQ, EXPECT_SPAWN_ERROR, folly::Subprocess::wait(), and folly::Subprocess::waitChecked().
TEST | ( | SimpleSubprocessTest | , |
Detach | |||
) |
Definition at line 239 of file SubprocessTest.cpp.
References folly::Subprocess::Options::detach(), folly::test::end(), EXPECT_EQ, EXPECT_LE, now(), s, and start.
TEST | ( | SimpleSubprocessTest | , |
DetachExecFails | |||
) |
Definition at line 255 of file SubprocessTest.cpp.
References EXPECT_SPAWN_OPT_ERROR.
TEST | ( | ParentDeathSubprocessTest | , |
ParentDeathSignal | |||
) |
Definition at line 265 of file SubprocessTest.cpp.
References ASSERT_EQ, folly::fs::executable_path(), folly::ProcessReturnCode::killSignal(), and folly::Subprocess::wait().
TEST | ( | PopenSubprocessTest | , |
PopenRead | |||
) |
Definition at line 291 of file SubprocessTest.cpp.
References folly::gen::byLine(), EXPECT_EQ, folly::Subprocess::stdoutFd(), and folly::Subprocess::waitChecked().
TEST | ( | AfterForkCallbackSubprocessTest | , |
TestAfterForkCallbackSuccess | |||
) |
Definition at line 320 of file SubprocessTest.cpp.
References folly::Subprocess::Options::dangerousPostForkPreExecCallback(), EXPECT_EQ, EXPECT_TRUE, WriteFileAfterFork::filename_, folly::readFile(), s, and string.
TEST | ( | AfterForkCallbackSubprocessTest | , |
TestAfterForkCallbackError | |||
) |
Definition at line 334 of file SubprocessTest.cpp.
References folly::Subprocess::Options::dangerousPostForkPreExecCallback(), EXPECT_FALSE, EXPECT_THROW, and WriteFileAfterFork::filename_.
TEST | ( | CommunicateSubprocessTest | , |
SimpleRead | |||
) |
Definition at line 346 of file SubprocessTest.cpp.
References folly::Subprocess::communicate(), EXPECT_EQ, and folly::Subprocess::Options::pipeStdout().
TEST | ( | CommunicateSubprocessTest | , |
BigWrite | |||
) |
Definition at line 355 of file SubprocessTest.cpp.
References folly::Subprocess::communicate(), data, EXPECT_EQ, folly::format(), i, string, and folly::Subprocess::waitChecked().
TEST | ( | CommunicateSubprocessTest | , |
Duplex | |||
) |
Definition at line 370 of file SubprocessTest.cpp.
References folly::Subprocess::communicate(), EXPECT_EQ, string, and folly::Subprocess::waitChecked().
TEST | ( | CommunicateSubprocessTest | , |
ProcessGroupLeader | |||
) |
Definition at line 383 of file SubprocessTest.cpp.
References EXPECT_THROW, and folly::Subprocess::waitChecked().
TEST | ( | CommunicateSubprocessTest | , |
Duplex2 | |||
) |
Definition at line 391 of file SubprocessTest.cpp.
References folly::IOBufQueue::append(), cmd, folly::Subprocess::communicateIOBuf(), fizz::test::copyBuffer(), upload::dest, EXPECT_EQ, folly::gen::move, folly::Subprocess::Options::pipeStderr(), folly::Subprocess::Options::pipeStdin(), folly::Subprocess::Options::pipeStdout(), fizz::detail::read(), folly::gen::split(), string, folly::Subprocess::Options::usePath(), and folly::Subprocess::waitChecked().
TEST | ( | CommunicateSubprocessTest | , |
Chatty | |||
) |
Definition at line 491 of file SubprocessTest.cpp.
References cmd, folly::Subprocess::communicate(), folly::Subprocess::enableNotifications(), folly::ProcessReturnCode::exitStatus(), EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, folly::Subprocess::Options::pipeStderr(), folly::Subprocess::Options::pipeStdin(), folly::Subprocess::Options::pipeStdout(), string, folly::Subprocess::Options::usePath(), folly::Subprocess::wait(), and folly::writeFull().
TEST | ( | CommunicateSubprocessTest | , |
TakeOwnershipOfPipes | |||
) |
Definition at line 575 of file SubprocessTest.cpp.
References EXPECT_EQ, pipe(), folly::readFull(), string, folly::Subprocess::takeOwnershipOfPipes(), and folly::Subprocess::waitChecked().