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.
| 8224 | // initialized from the GTEST_FLAG(internal_run_death_test) flag if |
| 8225 | // the flag is specified; otherwise returns NULL. |
| 8226 | InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() { |
| 8227 | if (GTEST_FLAG(internal_run_death_test) == "") return NULL; |
| 8228 | |
| 8229 | // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we |
| 8230 | // can use it here. |
| 8231 | int line = -1; |
| 8232 | int index = -1; |
| 8233 | ::std::vector< ::std::string> fields; |
| 8234 | SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields); |
| 8235 | int write_fd = -1; |
| 8236 | |
| 8237 | # if GTEST_OS_WINDOWS |
| 8238 | |
| 8239 | unsigned int parent_process_id = 0; |
| 8240 | size_t write_handle_as_size_t = 0; |
| 8241 | size_t event_handle_as_size_t = 0; |
| 8242 | |
| 8243 | if (fields.size() != 6 |
| 8244 | || !ParseNaturalNumber(fields[1], &line) |
| 8245 | || !ParseNaturalNumber(fields[2], &index) |
| 8246 | || !ParseNaturalNumber(fields[3], &parent_process_id) |
| 8247 | || !ParseNaturalNumber(fields[4], &write_handle_as_size_t) |
| 8248 | || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) { |
| 8249 | DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + |
| 8250 | GTEST_FLAG(internal_run_death_test)); |
| 8251 | } |
| 8252 | write_fd = GetStatusFileDescriptor(parent_process_id, |
| 8253 | write_handle_as_size_t, |
| 8254 | event_handle_as_size_t); |
| 8255 | # else |
| 8256 | |
| 8257 | if (fields.size() != 4 |
| 8258 | || !ParseNaturalNumber(fields[1], &line) |
| 8259 | || !ParseNaturalNumber(fields[2], &index) |
| 8260 | || !ParseNaturalNumber(fields[3], &write_fd)) { |
| 8261 | DeathTestAbort("Bad --gtest_internal_run_death_test flag: " |
| 8262 | + GTEST_FLAG(internal_run_death_test)); |
| 8263 | } |
| 8264 | |
| 8265 | # endif // GTEST_OS_WINDOWS |
| 8266 | |
| 8267 | return new InternalRunDeathTestFlag(fields[0], line, index, write_fd); |
| 8268 | } |
| 8269 | |
| 8270 | } // namespace internal |
| 8271 |
no test coverage detected