Returns a newly created InternalRunDeathTestFlag object with fields initialized from the GTEST_FLAG(internal_run_death_test) flag if the flag is specified; otherwise returns NULL.
| 7788 | // initialized from the GTEST_FLAG(internal_run_death_test) flag if |
| 7789 | // the flag is specified; otherwise returns NULL. |
| 7790 | InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() { |
| 7791 | if (GTEST_FLAG(internal_run_death_test) == "") return NULL; |
| 7792 | |
| 7793 | // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we |
| 7794 | // can use it here. |
| 7795 | int line = -1; |
| 7796 | int index = -1; |
| 7797 | ::std::vector< ::std::string> fields; |
| 7798 | SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields); |
| 7799 | int write_fd = -1; |
| 7800 | |
| 7801 | # if GTEST_OS_WINDOWS |
| 7802 | |
| 7803 | unsigned int parent_process_id = 0; |
| 7804 | size_t write_handle_as_size_t = 0; |
| 7805 | size_t event_handle_as_size_t = 0; |
| 7806 | |
| 7807 | if (fields.size() != 6 |
| 7808 | || !ParseNaturalNumber(fields[1], &line) |
| 7809 | || !ParseNaturalNumber(fields[2], &index) |
| 7810 | || !ParseNaturalNumber(fields[3], &parent_process_id) |
| 7811 | || !ParseNaturalNumber(fields[4], &write_handle_as_size_t) |
| 7812 | || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) { |
| 7813 | DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + |
| 7814 | GTEST_FLAG(internal_run_death_test)); |
| 7815 | } |
| 7816 | write_fd = GetStatusFileDescriptor(parent_process_id, |
| 7817 | write_handle_as_size_t, |
| 7818 | event_handle_as_size_t); |
| 7819 | # else |
| 7820 | |
| 7821 | if (fields.size() != 4 |
| 7822 | || !ParseNaturalNumber(fields[1], &line) |
| 7823 | || !ParseNaturalNumber(fields[2], &index) |
| 7824 | || !ParseNaturalNumber(fields[3], &write_fd)) { |
| 7825 | DeathTestAbort("Bad --gtest_internal_run_death_test flag: " |
| 7826 | + GTEST_FLAG(internal_run_death_test)); |
| 7827 | } |
| 7828 | |
| 7829 | # endif // GTEST_OS_WINDOWS |
| 7830 | |
| 7831 | return new InternalRunDeathTestFlag(fields[0], line, index, write_fd); |
| 7832 | } |
| 7833 | |
| 7834 | } // namespace internal |
| 7835 |
no test coverage detected