1b89a7cc2SEnji Cooper // Copyright 2005, Google Inc.
2b89a7cc2SEnji Cooper // All rights reserved.
3b89a7cc2SEnji Cooper //
4b89a7cc2SEnji Cooper // Redistribution and use in source and binary forms, with or without
5b89a7cc2SEnji Cooper // modification, are permitted provided that the following conditions are
6b89a7cc2SEnji Cooper // met:
7b89a7cc2SEnji Cooper //
8b89a7cc2SEnji Cooper //     * Redistributions of source code must retain the above copyright
9b89a7cc2SEnji Cooper // notice, this list of conditions and the following disclaimer.
10b89a7cc2SEnji Cooper //     * Redistributions in binary form must reproduce the above
11b89a7cc2SEnji Cooper // copyright notice, this list of conditions and the following disclaimer
12b89a7cc2SEnji Cooper // in the documentation and/or other materials provided with the
13b89a7cc2SEnji Cooper // distribution.
14b89a7cc2SEnji Cooper //     * Neither the name of Google Inc. nor the names of its
15b89a7cc2SEnji Cooper // contributors may be used to endorse or promote products derived from
16b89a7cc2SEnji Cooper // this software without specific prior written permission.
17b89a7cc2SEnji Cooper //
18b89a7cc2SEnji Cooper // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19b89a7cc2SEnji Cooper // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20b89a7cc2SEnji Cooper // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21b89a7cc2SEnji Cooper // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22b89a7cc2SEnji Cooper // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23b89a7cc2SEnji Cooper // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24b89a7cc2SEnji Cooper // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25b89a7cc2SEnji Cooper // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26b89a7cc2SEnji Cooper // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27b89a7cc2SEnji Cooper // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28b89a7cc2SEnji Cooper // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2928f6c2f2SEnji Cooper 
30b89a7cc2SEnji Cooper // The Google C++ Testing and Mocking Framework (Google Test)
31b89a7cc2SEnji Cooper //
32b89a7cc2SEnji Cooper // This header file defines internal utilities needed for implementing
33b89a7cc2SEnji Cooper // death tests.  They are subject to change without notice.
34b89a7cc2SEnji Cooper 
3528f6c2f2SEnji Cooper // IWYU pragma: private, include "gtest/gtest.h"
3628f6c2f2SEnji Cooper // IWYU pragma: friend gtest/.*
3728f6c2f2SEnji Cooper // IWYU pragma: friend gmock/.*
38b89a7cc2SEnji Cooper 
3928f6c2f2SEnji Cooper #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
4028f6c2f2SEnji Cooper #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
41b89a7cc2SEnji Cooper 
42b89a7cc2SEnji Cooper #include <stdio.h>
43b89a7cc2SEnji Cooper 
4428f6c2f2SEnji Cooper #include <memory>
4528f6c2f2SEnji Cooper #include <string>
4628f6c2f2SEnji Cooper 
4728f6c2f2SEnji Cooper #include "gtest/gtest-matchers.h"
4828f6c2f2SEnji Cooper #include "gtest/internal/gtest-internal.h"
49b89a7cc2SEnji Cooper 
50b89a7cc2SEnji Cooper GTEST_DECLARE_string_(internal_run_death_test);
51b89a7cc2SEnji Cooper 
5228f6c2f2SEnji Cooper namespace testing {
5328f6c2f2SEnji Cooper namespace internal {
5428f6c2f2SEnji Cooper 
55b89a7cc2SEnji Cooper // Names of the flags (needed for parsing Google Test flags).
56b89a7cc2SEnji Cooper const char kDeathTestStyleFlag[] = "death_test_style";
57b89a7cc2SEnji Cooper const char kDeathTestUseFork[] = "death_test_use_fork";
58b89a7cc2SEnji Cooper const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
59b89a7cc2SEnji Cooper 
6028f6c2f2SEnji Cooper #ifdef GTEST_HAS_DEATH_TEST
61b89a7cc2SEnji Cooper 
62b89a7cc2SEnji Cooper GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
63b89a7cc2SEnji Cooper /* class A needs to have dll-interface to be used by clients of class B */)
64b89a7cc2SEnji Cooper 
65b89a7cc2SEnji Cooper // DeathTest is a class that hides much of the complexity of the
66b89a7cc2SEnji Cooper // GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method
67b89a7cc2SEnji Cooper // returns a concrete class that depends on the prevailing death test
68b89a7cc2SEnji Cooper // style, as defined by the --gtest_death_test_style and/or
69b89a7cc2SEnji Cooper // --gtest_internal_run_death_test flags.
70b89a7cc2SEnji Cooper 
71b89a7cc2SEnji Cooper // In describing the results of death tests, these terms are used with
72b89a7cc2SEnji Cooper // the corresponding definitions:
73b89a7cc2SEnji Cooper //
74b89a7cc2SEnji Cooper // exit status:  The integer exit information in the format specified
75b89a7cc2SEnji Cooper //               by wait(2)
76b89a7cc2SEnji Cooper // exit code:    The integer code passed to exit(3), _exit(2), or
77b89a7cc2SEnji Cooper //               returned from main()
78b89a7cc2SEnji Cooper class GTEST_API_ DeathTest {
79b89a7cc2SEnji Cooper  public:
80b89a7cc2SEnji Cooper   // Create returns false if there was an error determining the
81b89a7cc2SEnji Cooper   // appropriate action to take for the current death test; for example,
82b89a7cc2SEnji Cooper   // if the gtest_death_test_style flag is set to an invalid value.
83b89a7cc2SEnji Cooper   // The LastMessage method will return a more detailed message in that
84b89a7cc2SEnji Cooper   // case.  Otherwise, the DeathTest pointer pointed to by the "test"
85b89a7cc2SEnji Cooper   // argument is set.  If the death test should be skipped, the pointer
86b89a7cc2SEnji Cooper   // is set to NULL; otherwise, it is set to the address of a new concrete
87b89a7cc2SEnji Cooper   // DeathTest object that controls the execution of the current test.
8828f6c2f2SEnji Cooper   static bool Create(const char* statement, Matcher<const std::string&> matcher,
89b89a7cc2SEnji Cooper                      const char* file, int line, DeathTest** test);
90b89a7cc2SEnji Cooper   DeathTest();
9128f6c2f2SEnji Cooper   virtual ~DeathTest() = default;
92b89a7cc2SEnji Cooper 
93b89a7cc2SEnji Cooper   // A helper class that aborts a death test when it's deleted.
94b89a7cc2SEnji Cooper   class ReturnSentinel {
95b89a7cc2SEnji Cooper    public:
ReturnSentinel(DeathTest * test)96b89a7cc2SEnji Cooper     explicit ReturnSentinel(DeathTest* test) : test_(test) {}
~ReturnSentinel()97b89a7cc2SEnji Cooper     ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
9828f6c2f2SEnji Cooper 
99b89a7cc2SEnji Cooper    private:
100b89a7cc2SEnji Cooper     DeathTest* const test_;
10128f6c2f2SEnji Cooper     ReturnSentinel(const ReturnSentinel&) = delete;
10228f6c2f2SEnji Cooper     ReturnSentinel& operator=(const ReturnSentinel&) = delete;
10328f6c2f2SEnji Cooper   };
104b89a7cc2SEnji Cooper 
105b89a7cc2SEnji Cooper   // An enumeration of possible roles that may be taken when a death
106b89a7cc2SEnji Cooper   // test is encountered.  EXECUTE means that the death test logic should
107b89a7cc2SEnji Cooper   // be executed immediately.  OVERSEE means that the program should prepare
108b89a7cc2SEnji Cooper   // the appropriate environment for a child process to execute the death
109b89a7cc2SEnji Cooper   // test, then wait for it to complete.
110b89a7cc2SEnji Cooper   enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
111b89a7cc2SEnji Cooper 
112b89a7cc2SEnji Cooper   // An enumeration of the three reasons that a test might be aborted.
113b89a7cc2SEnji Cooper   enum AbortReason {
114b89a7cc2SEnji Cooper     TEST_ENCOUNTERED_RETURN_STATEMENT,
115b89a7cc2SEnji Cooper     TEST_THREW_EXCEPTION,
116b89a7cc2SEnji Cooper     TEST_DID_NOT_DIE
117b89a7cc2SEnji Cooper   };
118b89a7cc2SEnji Cooper 
119b89a7cc2SEnji Cooper   // Assumes one of the above roles.
120b89a7cc2SEnji Cooper   virtual TestRole AssumeRole() = 0;
121b89a7cc2SEnji Cooper 
122b89a7cc2SEnji Cooper   // Waits for the death test to finish and returns its status.
123b89a7cc2SEnji Cooper   virtual int Wait() = 0;
124b89a7cc2SEnji Cooper 
125b89a7cc2SEnji Cooper   // Returns true if the death test passed; that is, the test process
126b89a7cc2SEnji Cooper   // exited during the test, its exit status matches a user-supplied
127b89a7cc2SEnji Cooper   // predicate, and its stderr output matches a user-supplied regular
128b89a7cc2SEnji Cooper   // expression.
129b89a7cc2SEnji Cooper   // The user-supplied predicate may be a macro expression rather
130b89a7cc2SEnji Cooper   // than a function pointer or functor, or else Wait and Passed could
131b89a7cc2SEnji Cooper   // be combined.
132b89a7cc2SEnji Cooper   virtual bool Passed(bool exit_status_ok) = 0;
133b89a7cc2SEnji Cooper 
134b89a7cc2SEnji Cooper   // Signals that the death test did not die as expected.
135b89a7cc2SEnji Cooper   virtual void Abort(AbortReason reason) = 0;
136b89a7cc2SEnji Cooper 
137b89a7cc2SEnji Cooper   // Returns a human-readable outcome message regarding the outcome of
138b89a7cc2SEnji Cooper   // the last death test.
139b89a7cc2SEnji Cooper   static const char* LastMessage();
140b89a7cc2SEnji Cooper 
141b89a7cc2SEnji Cooper   static void set_last_death_test_message(const std::string& message);
142b89a7cc2SEnji Cooper 
143b89a7cc2SEnji Cooper  private:
144b89a7cc2SEnji Cooper   // A string containing a description of the outcome of the last death test.
145b89a7cc2SEnji Cooper   static std::string last_death_test_message_;
146b89a7cc2SEnji Cooper 
14728f6c2f2SEnji Cooper   DeathTest(const DeathTest&) = delete;
14828f6c2f2SEnji Cooper   DeathTest& operator=(const DeathTest&) = delete;
149b89a7cc2SEnji Cooper };
150b89a7cc2SEnji Cooper 
GTEST_DISABLE_MSC_WARNINGS_POP_()151b89a7cc2SEnji Cooper GTEST_DISABLE_MSC_WARNINGS_POP_()  //  4251
152b89a7cc2SEnji Cooper 
153b89a7cc2SEnji Cooper // Factory interface for death tests.  May be mocked out for testing.
154b89a7cc2SEnji Cooper class DeathTestFactory {
155b89a7cc2SEnji Cooper  public:
15628f6c2f2SEnji Cooper   virtual ~DeathTestFactory() = default;
15728f6c2f2SEnji Cooper   virtual bool Create(const char* statement,
15828f6c2f2SEnji Cooper                       Matcher<const std::string&> matcher, const char* file,
15928f6c2f2SEnji Cooper                       int line, DeathTest** test) = 0;
160b89a7cc2SEnji Cooper };
161b89a7cc2SEnji Cooper 
162b89a7cc2SEnji Cooper // A concrete DeathTestFactory implementation for normal use.
163b89a7cc2SEnji Cooper class DefaultDeathTestFactory : public DeathTestFactory {
164b89a7cc2SEnji Cooper  public:
16528f6c2f2SEnji Cooper   bool Create(const char* statement, Matcher<const std::string&> matcher,
16628f6c2f2SEnji Cooper               const char* file, int line, DeathTest** test) override;
167b89a7cc2SEnji Cooper };
168b89a7cc2SEnji Cooper 
169b89a7cc2SEnji Cooper // Returns true if exit_status describes a process that was terminated
170b89a7cc2SEnji Cooper // by a signal, or exited normally with a nonzero exit code.
171b89a7cc2SEnji Cooper GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
172b89a7cc2SEnji Cooper 
17328f6c2f2SEnji Cooper // A string passed to EXPECT_DEATH (etc.) is caught by one of these overloads
17428f6c2f2SEnji Cooper // and interpreted as a regex (rather than an Eq matcher) for legacy
17528f6c2f2SEnji Cooper // compatibility.
MakeDeathTestMatcher(::testing::internal::RE regex)17628f6c2f2SEnji Cooper inline Matcher<const ::std::string&> MakeDeathTestMatcher(
17728f6c2f2SEnji Cooper     ::testing::internal::RE regex) {
17828f6c2f2SEnji Cooper   return ContainsRegex(regex.pattern());
17928f6c2f2SEnji Cooper }
MakeDeathTestMatcher(const char * regex)18028f6c2f2SEnji Cooper inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) {
18128f6c2f2SEnji Cooper   return ContainsRegex(regex);
18228f6c2f2SEnji Cooper }
MakeDeathTestMatcher(const::std::string & regex)18328f6c2f2SEnji Cooper inline Matcher<const ::std::string&> MakeDeathTestMatcher(
18428f6c2f2SEnji Cooper     const ::std::string& regex) {
18528f6c2f2SEnji Cooper   return ContainsRegex(regex);
18628f6c2f2SEnji Cooper }
18728f6c2f2SEnji Cooper 
18828f6c2f2SEnji Cooper // If a Matcher<const ::std::string&> is passed to EXPECT_DEATH (etc.), it's
18928f6c2f2SEnji Cooper // used directly.
MakeDeathTestMatcher(Matcher<const::std::string &> matcher)19028f6c2f2SEnji Cooper inline Matcher<const ::std::string&> MakeDeathTestMatcher(
19128f6c2f2SEnji Cooper     Matcher<const ::std::string&> matcher) {
19228f6c2f2SEnji Cooper   return matcher;
19328f6c2f2SEnji Cooper }
19428f6c2f2SEnji Cooper 
195b89a7cc2SEnji Cooper // Traps C++ exceptions escaping statement and reports them as test
196b89a7cc2SEnji Cooper // failures. Note that trapping SEH exceptions is not implemented here.
197b89a7cc2SEnji Cooper #if GTEST_HAS_EXCEPTIONS
198b89a7cc2SEnji Cooper #define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test)           \
199b89a7cc2SEnji Cooper   try {                                                                      \
200b89a7cc2SEnji Cooper     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement);               \
201b89a7cc2SEnji Cooper   } catch (const ::std::exception& gtest_exception) {                        \
202b89a7cc2SEnji Cooper     fprintf(                                                                 \
203b89a7cc2SEnji Cooper         stderr,                                                              \
204b89a7cc2SEnji Cooper         "\n%s: Caught std::exception-derived exception escaping the "        \
205b89a7cc2SEnji Cooper         "death test statement. Exception message: %s\n",                     \
206b89a7cc2SEnji Cooper         ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
207b89a7cc2SEnji Cooper         gtest_exception.what());                                             \
208b89a7cc2SEnji Cooper     fflush(stderr);                                                          \
209b89a7cc2SEnji Cooper     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
210b89a7cc2SEnji Cooper   } catch (...) {                                                            \
211b89a7cc2SEnji Cooper     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
212b89a7cc2SEnji Cooper   }
213b89a7cc2SEnji Cooper 
214b89a7cc2SEnji Cooper #else
215b89a7cc2SEnji Cooper #define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
216b89a7cc2SEnji Cooper   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
217b89a7cc2SEnji Cooper 
218b89a7cc2SEnji Cooper #endif
219b89a7cc2SEnji Cooper 
220b89a7cc2SEnji Cooper // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
221b89a7cc2SEnji Cooper // ASSERT_EXIT*, and EXPECT_EXIT*.
22228f6c2f2SEnji Cooper #define GTEST_DEATH_TEST_(statement, predicate, regex_or_matcher, fail)        \
223b89a7cc2SEnji Cooper   GTEST_AMBIGUOUS_ELSE_BLOCKER_                                                \
224b89a7cc2SEnji Cooper   if (::testing::internal::AlwaysTrue()) {                                     \
225b89a7cc2SEnji Cooper     ::testing::internal::DeathTest* gtest_dt;                                  \
22628f6c2f2SEnji Cooper     if (!::testing::internal::DeathTest::Create(                               \
22728f6c2f2SEnji Cooper             #statement,                                                        \
22828f6c2f2SEnji Cooper             ::testing::internal::MakeDeathTestMatcher(regex_or_matcher),       \
229b89a7cc2SEnji Cooper             __FILE__, __LINE__, &gtest_dt)) {                                  \
230b89a7cc2SEnji Cooper       goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__);                        \
231b89a7cc2SEnji Cooper     }                                                                          \
23228f6c2f2SEnji Cooper     if (gtest_dt != nullptr) {                                                 \
23328f6c2f2SEnji Cooper       std::unique_ptr< ::testing::internal::DeathTest> gtest_dt_ptr(gtest_dt); \
234b89a7cc2SEnji Cooper       switch (gtest_dt->AssumeRole()) {                                        \
235b89a7cc2SEnji Cooper         case ::testing::internal::DeathTest::OVERSEE_TEST:                     \
236b89a7cc2SEnji Cooper           if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) {                \
237b89a7cc2SEnji Cooper             goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__);                  \
238b89a7cc2SEnji Cooper           }                                                                    \
239b89a7cc2SEnji Cooper           break;                                                               \
240b89a7cc2SEnji Cooper         case ::testing::internal::DeathTest::EXECUTE_TEST: {                   \
24128f6c2f2SEnji Cooper           const ::testing::internal::DeathTest::ReturnSentinel gtest_sentinel( \
24228f6c2f2SEnji Cooper               gtest_dt);                                                       \
243b89a7cc2SEnji Cooper           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt);            \
244b89a7cc2SEnji Cooper           gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);   \
245b89a7cc2SEnji Cooper           break;                                                               \
246b89a7cc2SEnji Cooper         }                                                                      \
247b89a7cc2SEnji Cooper       }                                                                        \
248b89a7cc2SEnji Cooper     }                                                                          \
249b89a7cc2SEnji Cooper   } else                                                                       \
25028f6c2f2SEnji Cooper     GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__)                                \
25128f6c2f2SEnji Cooper         : fail(::testing::internal::DeathTest::LastMessage())
252b89a7cc2SEnji Cooper // The symbol "fail" here expands to something into which a message
253b89a7cc2SEnji Cooper // can be streamed.
254b89a7cc2SEnji Cooper 
255b89a7cc2SEnji Cooper // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
256b89a7cc2SEnji Cooper // NDEBUG mode. In this case we need the statements to be executed and the macro
257b89a7cc2SEnji Cooper // must accept a streamed message even though the message is never printed.
258b89a7cc2SEnji Cooper // The regex object is not evaluated, but it is used to prevent "unused"
259b89a7cc2SEnji Cooper // warnings and to avoid an expression that doesn't compile in debug mode.
26028f6c2f2SEnji Cooper #define GTEST_EXECUTE_STATEMENT_(statement, regex_or_matcher)    \
261b89a7cc2SEnji Cooper   GTEST_AMBIGUOUS_ELSE_BLOCKER_                                  \
262b89a7cc2SEnji Cooper   if (::testing::internal::AlwaysTrue()) {                       \
263b89a7cc2SEnji Cooper     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement);   \
264b89a7cc2SEnji Cooper   } else if (!::testing::internal::AlwaysTrue()) {               \
26528f6c2f2SEnji Cooper     ::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \
266b89a7cc2SEnji Cooper   } else                                                         \
267b89a7cc2SEnji Cooper     ::testing::Message()
268b89a7cc2SEnji Cooper 
269b89a7cc2SEnji Cooper // A class representing the parsed contents of the
270b89a7cc2SEnji Cooper // --gtest_internal_run_death_test flag, as it existed when
271b89a7cc2SEnji Cooper // RUN_ALL_TESTS was called.
272b89a7cc2SEnji Cooper class InternalRunDeathTestFlag {
273b89a7cc2SEnji Cooper  public:
InternalRunDeathTestFlag(const std::string & a_file,int a_line,int an_index,int a_write_fd)27428f6c2f2SEnji Cooper   InternalRunDeathTestFlag(const std::string& a_file, int a_line, int an_index,
275b89a7cc2SEnji Cooper                            int a_write_fd)
27628f6c2f2SEnji Cooper       : file_(a_file), line_(a_line), index_(an_index), write_fd_(a_write_fd) {}
277b89a7cc2SEnji Cooper 
~InternalRunDeathTestFlag()278b89a7cc2SEnji Cooper   ~InternalRunDeathTestFlag() {
27928f6c2f2SEnji Cooper     if (write_fd_ >= 0) posix::Close(write_fd_);
280b89a7cc2SEnji Cooper   }
281b89a7cc2SEnji Cooper 
file()282b89a7cc2SEnji Cooper   const std::string& file() const { return file_; }
line()283b89a7cc2SEnji Cooper   int line() const { return line_; }
index()284b89a7cc2SEnji Cooper   int index() const { return index_; }
write_fd()285b89a7cc2SEnji Cooper   int write_fd() const { return write_fd_; }
286b89a7cc2SEnji Cooper 
287b89a7cc2SEnji Cooper  private:
288b89a7cc2SEnji Cooper   std::string file_;
289b89a7cc2SEnji Cooper   int line_;
290b89a7cc2SEnji Cooper   int index_;
291b89a7cc2SEnji Cooper   int write_fd_;
292b89a7cc2SEnji Cooper 
29328f6c2f2SEnji Cooper   InternalRunDeathTestFlag(const InternalRunDeathTestFlag&) = delete;
29428f6c2f2SEnji Cooper   InternalRunDeathTestFlag& operator=(const InternalRunDeathTestFlag&) = delete;
295b89a7cc2SEnji Cooper };
296b89a7cc2SEnji Cooper 
297b89a7cc2SEnji Cooper // Returns a newly created InternalRunDeathTestFlag object with fields
298b89a7cc2SEnji Cooper // initialized from the GTEST_FLAG(internal_run_death_test) flag if
299b89a7cc2SEnji Cooper // the flag is specified; otherwise returns NULL.
300b89a7cc2SEnji Cooper InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
301b89a7cc2SEnji Cooper 
302b89a7cc2SEnji Cooper #endif  // GTEST_HAS_DEATH_TEST
303b89a7cc2SEnji Cooper 
304b89a7cc2SEnji Cooper }  // namespace internal
305b89a7cc2SEnji Cooper }  // namespace testing
306b89a7cc2SEnji Cooper 
30728f6c2f2SEnji Cooper #endif  // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
308