123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644 |
- #include "gtest/gtest-death-test.h"
- #include <functional>
- #include <utility>
- #include "gtest/internal/gtest-port.h"
- #include "gtest/internal/custom/gtest.h"
- #if GTEST_HAS_DEATH_TEST
- # if GTEST_OS_MAC
- # include <crt_externs.h>
- # endif
- # include <errno.h>
- # include <fcntl.h>
- # include <limits.h>
- # if GTEST_OS_LINUX
- # include <signal.h>
- # endif
- # include <stdarg.h>
- # if GTEST_OS_WINDOWS
- # include <windows.h>
- # else
- # include <sys/mman.h>
- # include <sys/wait.h>
- # endif
- # if GTEST_OS_QNX
- # include <spawn.h>
- # endif
- # if GTEST_OS_FUCHSIA
- # include <lib/fdio/fd.h>
- # include <lib/fdio/io.h>
- # include <lib/fdio/spawn.h>
- # include <lib/zx/channel.h>
- # include <lib/zx/port.h>
- # include <lib/zx/process.h>
- # include <lib/zx/socket.h>
- # include <zircon/processargs.h>
- # include <zircon/syscalls.h>
- # include <zircon/syscalls/policy.h>
- # include <zircon/syscalls/port.h>
- # endif
- #endif
- #include "gtest/gtest-message.h"
- #include "gtest/internal/gtest-string.h"
- #include "src/gtest-internal-inl.h"
- namespace testing {
- static const char kDefaultDeathTestStyle[] = GTEST_DEFAULT_DEATH_TEST_STYLE;
- GTEST_DEFINE_string_(
- death_test_style,
- internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
- "Indicates how to run a death test in a forked child process: "
- "\"threadsafe\" (child process re-executes the test binary "
- "from the beginning, running only the specific death test) or "
- "\"fast\" (child process runs the death test immediately "
- "after forking).");
- GTEST_DEFINE_bool_(
- death_test_use_fork,
- internal::BoolFromGTestEnv("death_test_use_fork", false),
- "Instructs to use fork()/_exit() instead of clone() in death tests. "
- "Ignored and always uses fork() on POSIX systems where clone() is not "
- "implemented. Useful when running under valgrind or similar tools if "
- "those do not support clone(). Valgrind 3.3.1 will just fail if "
- "it sees an unsupported combination of clone() flags. "
- "It is not recommended to use this flag w/o valgrind though it will "
- "work in 99% of the cases. Once valgrind is fixed, this flag will "
- "most likely be removed.");
- namespace internal {
- GTEST_DEFINE_string_(
- internal_run_death_test, "",
- "Indicates the file, line number, temporal index of "
- "the single death test to run, and a file descriptor to "
- "which a success code may be sent, all separated by "
- "the '|' characters. This flag is specified if and only if the "
- "current process is a sub-process launched for running a thread-safe "
- "death test. FOR INTERNAL USE ONLY.");
- }
- #if GTEST_HAS_DEATH_TEST
- namespace internal {
- # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
- static bool g_in_fast_death_test_child = false;
- # endif
- bool InDeathTestChild() {
- # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA
-
-
- return !GTEST_FLAG(internal_run_death_test).empty();
- # else
- if (GTEST_FLAG(death_test_style) == "threadsafe")
- return !GTEST_FLAG(internal_run_death_test).empty();
- else
- return g_in_fast_death_test_child;
- #endif
- }
- }
- ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
- }
- bool ExitedWithCode::operator()(int exit_status) const {
- # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA
- return exit_status == exit_code_;
- # else
- return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
- # endif
- }
- # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
- KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
- }
- bool KilledBySignal::operator()(int exit_status) const {
- # if defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_)
- {
- bool result;
- if (GTEST_KILLED_BY_SIGNAL_OVERRIDE_(signum_, exit_status, &result)) {
- return result;
- }
- }
- # endif
- return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
- }
- # endif
- namespace internal {
- static std::string ExitSummary(int exit_code) {
- Message m;
- # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA
- m << "Exited with exit status " << exit_code;
- # else
- if (WIFEXITED(exit_code)) {
- m << "Exited with exit status " << WEXITSTATUS(exit_code);
- } else if (WIFSIGNALED(exit_code)) {
- m << "Terminated by signal " << WTERMSIG(exit_code);
- }
- # ifdef WCOREDUMP
- if (WCOREDUMP(exit_code)) {
- m << " (core dumped)";
- }
- # endif
- # endif
- return m.GetString();
- }
- bool ExitedUnsuccessfully(int exit_status) {
- return !ExitedWithCode(0)(exit_status);
- }
- # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
- static std::string DeathTestThreadWarning(size_t thread_count) {
- Message msg;
- msg << "Death tests use fork(), which is unsafe particularly"
- << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
- if (thread_count == 0) {
- msg << "couldn't detect the number of threads.";
- } else {
- msg << "detected " << thread_count << " threads.";
- }
- msg << " See "
- "https://github.com/google/googletest/blob/master/docs/"
- "advanced.md#death-tests-and-threads"
- << " for more explanation and suggested solutions, especially if"
- << " this is the last message you see before your test times out.";
- return msg.GetString();
- }
- # endif
- static const char kDeathTestLived = 'L';
- static const char kDeathTestReturned = 'R';
- static const char kDeathTestThrew = 'T';
- static const char kDeathTestInternalError = 'I';
- #if GTEST_OS_FUCHSIA
- static const int kFuchsiaReadPipeFd = 3;
- #endif
- enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
- static void DeathTestAbort(const std::string& message) {
-
-
-
- const InternalRunDeathTestFlag* const flag =
- GetUnitTestImpl()->internal_run_death_test_flag();
- if (flag != nullptr) {
- FILE* parent = posix::FDOpen(flag->write_fd(), "w");
- fputc(kDeathTestInternalError, parent);
- fprintf(parent, "%s", message.c_str());
- fflush(parent);
- _exit(1);
- } else {
- fprintf(stderr, "%s", message.c_str());
- fflush(stderr);
- posix::Abort();
- }
- }
- # define GTEST_DEATH_TEST_CHECK_(expression) \
- do { \
- if (!::testing::internal::IsTrue(expression)) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression); \
- } \
- } while (::testing::internal::AlwaysFalse())
- # define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
- do { \
- int gtest_retval; \
- do { \
- gtest_retval = (expression); \
- } while (gtest_retval == -1 && errno == EINTR); \
- if (gtest_retval == -1) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression + " != -1"); \
- } \
- } while (::testing::internal::AlwaysFalse())
- std::string GetLastErrnoDescription() {
- return errno == 0 ? "" : posix::StrError(errno);
- }
- static void FailFromInternalError(int fd) {
- Message error;
- char buffer[256];
- int num_read;
- do {
- while ((num_read = posix::Read(fd, buffer, 255)) > 0) {
- buffer[num_read] = '\0';
- error << buffer;
- }
- } while (num_read == -1 && errno == EINTR);
- if (num_read == 0) {
- GTEST_LOG_(FATAL) << error.GetString();
- } else {
- const int last_error = errno;
- GTEST_LOG_(FATAL) << "Error while reading death test internal: "
- << GetLastErrnoDescription() << " [" << last_error << "]";
- }
- }
- DeathTest::DeathTest() {
- TestInfo* const info = GetUnitTestImpl()->current_test_info();
- if (info == nullptr) {
- DeathTestAbort("Cannot run a death test outside of a TEST or "
- "TEST_F construct");
- }
- }
- bool DeathTest::Create(const char* statement,
- Matcher<const std::string&> matcher, const char* file,
- int line, DeathTest** test) {
- return GetUnitTestImpl()->death_test_factory()->Create(
- statement, std::move(matcher), file, line, test);
- }
- const char* DeathTest::LastMessage() {
- return last_death_test_message_.c_str();
- }
- void DeathTest::set_last_death_test_message(const std::string& message) {
- last_death_test_message_ = message;
- }
- std::string DeathTest::last_death_test_message_;
- class DeathTestImpl : public DeathTest {
- protected:
- DeathTestImpl(const char* a_statement, Matcher<const std::string&> matcher)
- : statement_(a_statement),
- matcher_(std::move(matcher)),
- spawned_(false),
- status_(-1),
- outcome_(IN_PROGRESS),
- read_fd_(-1),
- write_fd_(-1) {}
-
- ~DeathTestImpl() override { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
- void Abort(AbortReason reason) override;
- bool Passed(bool status_ok) override;
- const char* statement() const { return statement_; }
- bool spawned() const { return spawned_; }
- void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
- int status() const { return status_; }
- void set_status(int a_status) { status_ = a_status; }
- DeathTestOutcome outcome() const { return outcome_; }
- void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; }
- int read_fd() const { return read_fd_; }
- void set_read_fd(int fd) { read_fd_ = fd; }
- int write_fd() const { return write_fd_; }
- void set_write_fd(int fd) { write_fd_ = fd; }
-
-
-
-
- void ReadAndInterpretStatusByte();
-
- virtual std::string GetErrorLogs();
- private:
-
-
- const char* const statement_;
-
- Matcher<const std::string&> matcher_;
-
- bool spawned_;
-
- int status_;
-
- DeathTestOutcome outcome_;
-
-
-
- int read_fd_;
-
-
-
- int write_fd_;
- };
- void DeathTestImpl::ReadAndInterpretStatusByte() {
- char flag;
- int bytes_read;
-
-
-
-
- do {
- bytes_read = posix::Read(read_fd(), &flag, 1);
- } while (bytes_read == -1 && errno == EINTR);
- if (bytes_read == 0) {
- set_outcome(DIED);
- } else if (bytes_read == 1) {
- switch (flag) {
- case kDeathTestReturned:
- set_outcome(RETURNED);
- break;
- case kDeathTestThrew:
- set_outcome(THREW);
- break;
- case kDeathTestLived:
- set_outcome(LIVED);
- break;
- case kDeathTestInternalError:
- FailFromInternalError(read_fd());
- break;
- default:
- GTEST_LOG_(FATAL) << "Death test child process reported "
- << "unexpected status byte ("
- << static_cast<unsigned int>(flag) << ")";
- }
- } else {
- GTEST_LOG_(FATAL) << "Read from death test child process failed: "
- << GetLastErrnoDescription();
- }
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));
- set_read_fd(-1);
- }
- std::string DeathTestImpl::GetErrorLogs() {
- return GetCapturedStderr();
- }
- void DeathTestImpl::Abort(AbortReason reason) {
-
-
-
- const char status_ch =
- reason == TEST_DID_NOT_DIE ? kDeathTestLived :
- reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));
-
-
-
-
-
-
-
-
- _exit(1);
- }
- static ::std::string FormatDeathTestOutput(const ::std::string& output) {
- ::std::string ret;
- for (size_t at = 0; ; ) {
- const size_t line_end = output.find('\n', at);
- ret += "[ DEATH ] ";
- if (line_end == ::std::string::npos) {
- ret += output.substr(at);
- break;
- }
- ret += output.substr(at, line_end + 1 - at);
- at = line_end + 1;
- }
- return ret;
- }
- bool DeathTestImpl::Passed(bool status_ok) {
- if (!spawned())
- return false;
- const std::string error_message = GetErrorLogs();
- bool success = false;
- Message buffer;
- buffer << "Death test: " << statement() << "\n";
- switch (outcome()) {
- case LIVED:
- buffer << " Result: failed to die.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case THREW:
- buffer << " Result: threw an exception.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case RETURNED:
- buffer << " Result: illegal return in test statement.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case DIED:
- if (status_ok) {
- if (matcher_.Matches(error_message)) {
- success = true;
- } else {
- std::ostringstream stream;
- matcher_.DescribeTo(&stream);
- buffer << " Result: died but not with expected error.\n"
- << " Expected: " << stream.str() << "\n"
- << "Actual msg:\n"
- << FormatDeathTestOutput(error_message);
- }
- } else {
- buffer << " Result: died but not with expected exit code:\n"
- << " " << ExitSummary(status()) << "\n"
- << "Actual msg:\n" << FormatDeathTestOutput(error_message);
- }
- break;
- case IN_PROGRESS:
- default:
- GTEST_LOG_(FATAL)
- << "DeathTest::Passed somehow called before conclusion of test";
- }
- DeathTest::set_last_death_test_message(buffer.GetString());
- return success;
- }
- # if GTEST_OS_WINDOWS
- class WindowsDeathTest : public DeathTestImpl {
- public:
- WindowsDeathTest(const char* a_statement, Matcher<const std::string&> matcher,
- const char* file, int line)
- : DeathTestImpl(a_statement, std::move(matcher)),
- file_(file),
- line_(line) {}
-
- virtual int Wait();
- virtual TestRole AssumeRole();
- private:
-
- const char* const file_;
-
- const int line_;
-
- AutoHandle write_handle_;
-
- AutoHandle child_handle_;
-
-
-
-
- AutoHandle event_handle_;
- };
- int WindowsDeathTest::Wait() {
- if (!spawned())
- return 0;
-
-
- const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
- switch (::WaitForMultipleObjects(2,
- wait_handles,
- FALSE,
- INFINITE)) {
- case WAIT_OBJECT_0:
- case WAIT_OBJECT_0 + 1:
- break;
- default:
- GTEST_DEATH_TEST_CHECK_(false);
- }
-
-
- write_handle_.Reset();
- event_handle_.Reset();
- ReadAndInterpretStatusByte();
-
-
-
-
- GTEST_DEATH_TEST_CHECK_(
- WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
- INFINITE));
- DWORD status_code;
- GTEST_DEATH_TEST_CHECK_(
- ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE);
- child_handle_.Reset();
- set_status(static_cast<int>(status_code));
- return status();
- }
- DeathTest::TestRole WindowsDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
- if (flag != nullptr) {
-
-
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
-
-
- SECURITY_ATTRIBUTES handles_are_inheritable = {sizeof(SECURITY_ATTRIBUTES),
- nullptr, TRUE};
- HANDLE read_handle, write_handle;
- GTEST_DEATH_TEST_CHECK_(
- ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,
- 0)
- != FALSE);
- set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),
- O_RDONLY));
- write_handle_.Reset(write_handle);
- event_handle_.Reset(::CreateEvent(
- &handles_are_inheritable,
- TRUE,
- FALSE,
- nullptr));
- GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != nullptr);
- const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ +
- kFilterFlag + "=" + info->test_suite_name() +
- "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag +
- "=" + file_ + "|" + StreamableToString(line_) + "|" +
- StreamableToString(death_test_index) + "|" +
- StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +
-
-
-
- "|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) +
- "|" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));
- char executable_path[_MAX_PATH + 1];
- GTEST_DEATH_TEST_CHECK_(_MAX_PATH + 1 != ::GetModuleFileNameA(nullptr,
- executable_path,
- _MAX_PATH));
- std::string command_line =
- std::string(::GetCommandLineA()) + " " + filter_flag + " \"" +
- internal_flag + "\"";
- DeathTest::set_last_death_test_message("");
- CaptureStderr();
-
- FlushInfoLog();
-
- STARTUPINFOA startup_info;
- memset(&startup_info, 0, sizeof(STARTUPINFO));
- startup_info.dwFlags = STARTF_USESTDHANDLES;
- startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);
- startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
- startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
- PROCESS_INFORMATION process_info;
- GTEST_DEATH_TEST_CHECK_(
- ::CreateProcessA(
- executable_path, const_cast<char*>(command_line.c_str()),
- nullptr,
- nullptr,
- TRUE,
- 0x0,
- nullptr,
- UnitTest::GetInstance()->original_working_dir(), &startup_info,
- &process_info) != FALSE);
- child_handle_.Reset(process_info.hProcess);
- ::CloseHandle(process_info.hThread);
- set_spawned(true);
- return OVERSEE_TEST;
- }
- # elif GTEST_OS_FUCHSIA
- class FuchsiaDeathTest : public DeathTestImpl {
- public:
- FuchsiaDeathTest(const char* a_statement, Matcher<const std::string&> matcher,
- const char* file, int line)
- : DeathTestImpl(a_statement, std::move(matcher)),
- file_(file),
- line_(line) {}
-
- int Wait() override;
- TestRole AssumeRole() override;
- std::string GetErrorLogs() override;
- private:
-
- const char* const file_;
-
- const int line_;
-
- std::string captured_stderr_;
- zx::process child_process_;
- zx::channel exception_channel_;
- zx::socket stderr_socket_;
- };
- class Arguments {
- public:
- Arguments() { args_.push_back(nullptr); }
- ~Arguments() {
- for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();
- ++i) {
- free(*i);
- }
- }
- void AddArgument(const char* argument) {
- args_.insert(args_.end() - 1, posix::StrDup(argument));
- }
- template <typename Str>
- void AddArguments(const ::std::vector<Str>& arguments) {
- for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
- i != arguments.end();
- ++i) {
- args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
- }
- }
- char* const* Argv() {
- return &args_[0];
- }
- int size() {
- return static_cast<int>(args_.size()) - 1;
- }
- private:
- std::vector<char*> args_;
- };
- int FuchsiaDeathTest::Wait() {
- const int kProcessKey = 0;
- const int kSocketKey = 1;
- const int kExceptionKey = 2;
- if (!spawned())
- return 0;
-
- zx_status_t status_zx;
- zx::port port;
- status_zx = zx::port::create(0, &port);
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
-
- status_zx = child_process_.wait_async(
- port, kProcessKey, ZX_PROCESS_TERMINATED, 0);
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
-
- status_zx = stderr_socket_.wait_async(
- port, kSocketKey, ZX_SOCKET_READABLE | ZX_SOCKET_PEER_CLOSED, 0);
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
-
- status_zx = exception_channel_.wait_async(
- port, kExceptionKey, ZX_CHANNEL_READABLE, 0);
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
- bool process_terminated = false;
- bool socket_closed = false;
- do {
- zx_port_packet_t packet = {};
- status_zx = port.wait(zx::time::infinite(), &packet);
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
- if (packet.key == kExceptionKey) {
-
-
-
- status_zx = child_process_.kill();
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
- } else if (packet.key == kProcessKey) {
-
- GTEST_DEATH_TEST_CHECK_(ZX_PKT_IS_SIGNAL_ONE(packet.type));
- GTEST_DEATH_TEST_CHECK_(packet.signal.observed & ZX_PROCESS_TERMINATED);
- process_terminated = true;
- } else if (packet.key == kSocketKey) {
- GTEST_DEATH_TEST_CHECK_(ZX_PKT_IS_SIGNAL_ONE(packet.type));
- if (packet.signal.observed & ZX_SOCKET_READABLE) {
-
- constexpr size_t kBufferSize = 1024;
- do {
- size_t old_length = captured_stderr_.length();
- size_t bytes_read = 0;
- captured_stderr_.resize(old_length + kBufferSize);
- status_zx = stderr_socket_.read(
- 0, &captured_stderr_.front() + old_length, kBufferSize,
- &bytes_read);
- captured_stderr_.resize(old_length + bytes_read);
- } while (status_zx == ZX_OK);
- if (status_zx == ZX_ERR_PEER_CLOSED) {
- socket_closed = true;
- } else {
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_ERR_SHOULD_WAIT);
- status_zx = stderr_socket_.wait_async(
- port, kSocketKey, ZX_SOCKET_READABLE | ZX_SOCKET_PEER_CLOSED, 0);
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
- }
- } else {
- GTEST_DEATH_TEST_CHECK_(packet.signal.observed & ZX_SOCKET_PEER_CLOSED);
- socket_closed = true;
- }
- }
- } while (!process_terminated && !socket_closed);
- ReadAndInterpretStatusByte();
- zx_info_process_t buffer;
- status_zx = child_process_.get_info(ZX_INFO_PROCESS, &buffer, sizeof(buffer),
- nullptr, nullptr);
- GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK);
- GTEST_DEATH_TEST_CHECK_(buffer.flags & ZX_INFO_PROCESS_FLAG_EXITED);
- set_status(static_cast<int>(buffer.return_code));
- return status();
- }
- DeathTest::TestRole FuchsiaDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
- if (flag != nullptr) {
-
-
- set_write_fd(kFuchsiaReadPipeFd);
- return EXECUTE_TEST;
- }
-
- FlushInfoLog();
-
- const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ +
- kFilterFlag + "=" + info->test_suite_name() +
- "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "="
- + file_ + "|"
- + StreamableToString(line_) + "|"
- + StreamableToString(death_test_index);
- Arguments args;
- args.AddArguments(GetInjectableArgvs());
- args.AddArgument(filter_flag.c_str());
- args.AddArgument(internal_flag.c_str());
-
- zx_status_t status;
- zx_handle_t child_pipe_handle;
- int child_pipe_fd;
- status = fdio_pipe_half(&child_pipe_fd, &child_pipe_handle);
- GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
- set_read_fd(child_pipe_fd);
-
- fdio_spawn_action_t spawn_actions[2] = {};
- fdio_spawn_action_t* add_handle_action = &spawn_actions[0];
- add_handle_action->action = FDIO_SPAWN_ACTION_ADD_HANDLE;
- add_handle_action->h.id = PA_HND(PA_FD, kFuchsiaReadPipeFd);
- add_handle_action->h.handle = child_pipe_handle;
-
- zx::socket stderr_producer_socket;
- status =
- zx::socket::create(0, &stderr_producer_socket, &stderr_socket_);
- GTEST_DEATH_TEST_CHECK_(status >= 0);
- int stderr_producer_fd = -1;
- status =
- fdio_fd_create(stderr_producer_socket.release(), &stderr_producer_fd);
- GTEST_DEATH_TEST_CHECK_(status >= 0);
-
- GTEST_DEATH_TEST_CHECK_(fcntl(stderr_producer_fd, F_SETFL, 0) == 0);
- fdio_spawn_action_t* add_stderr_action = &spawn_actions[1];
- add_stderr_action->action = FDIO_SPAWN_ACTION_CLONE_FD;
- add_stderr_action->fd.local_fd = stderr_producer_fd;
- add_stderr_action->fd.target_fd = STDERR_FILENO;
-
- zx_handle_t child_job = ZX_HANDLE_INVALID;
- status = zx_job_create(zx_job_default(), 0, & child_job);
- GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
- zx_policy_basic_t policy;
- policy.condition = ZX_POL_NEW_ANY;
- policy.policy = ZX_POL_ACTION_ALLOW;
- status = zx_job_set_policy(
- child_job, ZX_JOB_POL_RELATIVE, ZX_JOB_POL_BASIC, &policy, 1);
- GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
-
-
- status =
- zx_task_create_exception_channel(
- child_job, 0, exception_channel_.reset_and_get_address());
- GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
-
- status = fdio_spawn_etc(
- child_job, FDIO_SPAWN_CLONE_ALL, args.Argv()[0], args.Argv(), nullptr,
- 2, spawn_actions, child_process_.reset_and_get_address(), nullptr);
- GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
- set_spawned(true);
- return OVERSEE_TEST;
- }
- std::string FuchsiaDeathTest::GetErrorLogs() {
- return captured_stderr_;
- }
- #else
- class ForkingDeathTest : public DeathTestImpl {
- public:
- ForkingDeathTest(const char* statement, Matcher<const std::string&> matcher);
-
- int Wait() override;
- protected:
- void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
- private:
-
- pid_t child_pid_;
- };
- ForkingDeathTest::ForkingDeathTest(const char* a_statement,
- Matcher<const std::string&> matcher)
- : DeathTestImpl(a_statement, std::move(matcher)), child_pid_(-1) {}
- int ForkingDeathTest::Wait() {
- if (!spawned())
- return 0;
- ReadAndInterpretStatusByte();
- int status_value;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0));
- set_status(status_value);
- return status_value;
- }
- class NoExecDeathTest : public ForkingDeathTest {
- public:
- NoExecDeathTest(const char* a_statement, Matcher<const std::string&> matcher)
- : ForkingDeathTest(a_statement, std::move(matcher)) {}
- TestRole AssumeRole() override;
- };
- DeathTest::TestRole NoExecDeathTest::AssumeRole() {
- const size_t thread_count = GetThreadCount();
- if (thread_count != 1) {
- GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);
- }
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
- DeathTest::set_last_death_test_message("");
- CaptureStderr();
-
-
-
-
-
-
-
- FlushInfoLog();
- const pid_t child_pid = fork();
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- set_child_pid(child_pid);
- if (child_pid == 0) {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
- set_write_fd(pipe_fd[1]);
-
-
-
- LogToStderr();
-
-
- GetUnitTestImpl()->listeners()->SuppressEventForwarding();
- g_in_fast_death_test_child = true;
- return EXECUTE_TEST;
- } else {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
- }
- }
- class ExecDeathTest : public ForkingDeathTest {
- public:
- ExecDeathTest(const char* a_statement, Matcher<const std::string&> matcher,
- const char* file, int line)
- : ForkingDeathTest(a_statement, std::move(matcher)),
- file_(file),
- line_(line) {}
- TestRole AssumeRole() override;
- private:
- static ::std::vector<std::string> GetArgvsForDeathTestChildProcess() {
- ::std::vector<std::string> args = GetInjectableArgvs();
- # if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_)
- ::std::vector<std::string> extra_args =
- GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_();
- args.insert(args.end(), extra_args.begin(), extra_args.end());
- # endif
- return args;
- }
-
- const char* const file_;
-
- const int line_;
- };
- class Arguments {
- public:
- Arguments() { args_.push_back(nullptr); }
- ~Arguments() {
- for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();
- ++i) {
- free(*i);
- }
- }
- void AddArgument(const char* argument) {
- args_.insert(args_.end() - 1, posix::StrDup(argument));
- }
- template <typename Str>
- void AddArguments(const ::std::vector<Str>& arguments) {
- for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
- i != arguments.end();
- ++i) {
- args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
- }
- }
- char* const* Argv() {
- return &args_[0];
- }
- private:
- std::vector<char*> args_;
- };
- struct ExecDeathTestArgs {
- char* const* argv;
- int close_fd;
- };
- # if GTEST_OS_QNX
- extern "C" char** environ;
- # else
- static int ExecDeathTestChildMain(void* child_arg) {
- ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));
-
-
-
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
-
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
-
-
-
-
-
- execv(args->argv[0], args->argv);
- DeathTestAbort(std::string("execv(") + args->argv[0] + ", ...) in " +
- original_dir + " failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
- # endif
- # if GTEST_HAS_CLONE
- static void StackLowerThanAddress(const void* ptr,
- bool* result) GTEST_NO_INLINE_;
- GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
- GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
- static void StackLowerThanAddress(const void* ptr, bool* result) {
- int dummy = 0;
- *result = std::less<const void*>()(&dummy, ptr);
- }
- GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
- GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
- static bool StackGrowsDown() {
- int dummy = 0;
- bool result;
- StackLowerThanAddress(&dummy, &result);
- return result;
- }
- # endif
- static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
- ExecDeathTestArgs args = { argv, close_fd };
- pid_t child_pid = -1;
- # if GTEST_OS_QNX
-
-
- const int cwd_fd = open(".", O_RDONLY);
- GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));
-
-
-
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
-
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
- int fd_flags;
-
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,
- fd_flags | FD_CLOEXEC));
- struct inheritance inherit = {0};
-
- child_pid = spawn(args.argv[0], 0, nullptr, &inherit, args.argv, environ);
-
- GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
- # else
- # if GTEST_OS_LINUX
-
-
-
- struct sigaction saved_sigprof_action;
- struct sigaction ignore_sigprof_action;
- memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));
- sigemptyset(&ignore_sigprof_action.sa_mask);
- ignore_sigprof_action.sa_handler = SIG_IGN;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(
- SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));
- # endif
- # if GTEST_HAS_CLONE
- const bool use_fork = GTEST_FLAG(death_test_use_fork);
- if (!use_fork) {
- static const bool stack_grows_down = StackGrowsDown();
- const auto stack_size = static_cast<size_t>(getpagesize() * 2);
-
- void* const stack = mmap(nullptr, stack_size, PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
-
-
-
-
-
-
- const size_t kMaxStackAlignment = 64;
- void* const stack_top =
- static_cast<char*>(stack) +
- (stack_grows_down ? stack_size - kMaxStackAlignment : 0);
- GTEST_DEATH_TEST_CHECK_(
- static_cast<size_t>(stack_size) > kMaxStackAlignment &&
- reinterpret_cast<uintptr_t>(stack_top) % kMaxStackAlignment == 0);
- child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);
- GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
- }
- # else
- const bool use_fork = true;
- # endif
- if (use_fork && (child_pid = fork()) == 0) {
- ExecDeathTestChildMain(&args);
- _exit(0);
- }
- # endif
- # if GTEST_OS_LINUX
- GTEST_DEATH_TEST_CHECK_SYSCALL_(
- sigaction(SIGPROF, &saved_sigprof_action, nullptr));
- # endif
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- return child_pid;
- }
- DeathTest::TestRole ExecDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
- if (flag != nullptr) {
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
-
-
- GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
- const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ +
- kFilterFlag + "=" + info->test_suite_name() +
- "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "="
- + file_ + "|" + StreamableToString(line_) + "|"
- + StreamableToString(death_test_index) + "|"
- + StreamableToString(pipe_fd[1]);
- Arguments args;
- args.AddArguments(GetArgvsForDeathTestChildProcess());
- args.AddArgument(filter_flag.c_str());
- args.AddArgument(internal_flag.c_str());
- DeathTest::set_last_death_test_message("");
- CaptureStderr();
-
-
- FlushInfoLog();
- const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_child_pid(child_pid);
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
- }
- # endif
- bool DefaultDeathTestFactory::Create(const char* statement,
- Matcher<const std::string&> matcher,
- const char* file, int line,
- DeathTest** test) {
- UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const int death_test_index = impl->current_test_info()
- ->increment_death_test_count();
- if (flag != nullptr) {
- if (death_test_index > flag->index()) {
- DeathTest::set_last_death_test_message(
- "Death test count (" + StreamableToString(death_test_index)
- + ") somehow exceeded expected maximum ("
- + StreamableToString(flag->index()) + ")");
- return false;
- }
- if (!(flag->file() == file && flag->line() == line &&
- flag->index() == death_test_index)) {
- *test = nullptr;
- return true;
- }
- }
- # if GTEST_OS_WINDOWS
- if (GTEST_FLAG(death_test_style) == "threadsafe" ||
- GTEST_FLAG(death_test_style) == "fast") {
- *test = new WindowsDeathTest(statement, std::move(matcher), file, line);
- }
- # elif GTEST_OS_FUCHSIA
- if (GTEST_FLAG(death_test_style) == "threadsafe" ||
- GTEST_FLAG(death_test_style) == "fast") {
- *test = new FuchsiaDeathTest(statement, std::move(matcher), file, line);
- }
- # else
- if (GTEST_FLAG(death_test_style) == "threadsafe") {
- *test = new ExecDeathTest(statement, std::move(matcher), file, line);
- } else if (GTEST_FLAG(death_test_style) == "fast") {
- *test = new NoExecDeathTest(statement, std::move(matcher));
- }
- # endif
- else {
- DeathTest::set_last_death_test_message(
- "Unknown death test style \"" + GTEST_FLAG(death_test_style)
- + "\" encountered");
- return false;
- }
- return true;
- }
- # if GTEST_OS_WINDOWS
- static int GetStatusFileDescriptor(unsigned int parent_process_id,
- size_t write_handle_as_size_t,
- size_t event_handle_as_size_t) {
- AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
- FALSE,
- parent_process_id));
- if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
- DeathTestAbort("Unable to open parent process " +
- StreamableToString(parent_process_id));
- }
- GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));
- const HANDLE write_handle =
- reinterpret_cast<HANDLE>(write_handle_as_size_t);
- HANDLE dup_write_handle;
-
-
-
- if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,
- ::GetCurrentProcess(), &dup_write_handle,
- 0x0,
-
- FALSE,
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
- const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);
- HANDLE dup_event_handle;
- if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,
- ::GetCurrentProcess(), &dup_event_handle,
- 0x0,
- FALSE,
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the event handle " +
- StreamableToString(event_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
- const int write_fd =
- ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);
- if (write_fd == -1) {
- DeathTestAbort("Unable to convert pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " to a file descriptor");
- }
-
-
- ::SetEvent(dup_event_handle);
- return write_fd;
- }
- # endif
- InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
- if (GTEST_FLAG(internal_run_death_test) == "") return nullptr;
-
-
- int line = -1;
- int index = -1;
- ::std::vector< ::std::string> fields;
- SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
- int write_fd = -1;
- # if GTEST_OS_WINDOWS
- unsigned int parent_process_id = 0;
- size_t write_handle_as_size_t = 0;
- size_t event_handle_as_size_t = 0;
- if (fields.size() != 6
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &parent_process_id)
- || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)
- || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: " +
- GTEST_FLAG(internal_run_death_test));
- }
- write_fd = GetStatusFileDescriptor(parent_process_id,
- write_handle_as_size_t,
- event_handle_as_size_t);
- # elif GTEST_OS_FUCHSIA
- if (fields.size() != 3
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: "
- + GTEST_FLAG(internal_run_death_test));
- }
- # else
- if (fields.size() != 4
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &write_fd)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: "
- + GTEST_FLAG(internal_run_death_test));
- }
- # endif
- return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
- }
- }
- #endif
- }
|