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.
| 9181 | // initialized from the GTEST_FLAG(internal_run_death_test) flag if |
| 9182 | // the flag is specified; otherwise returns NULL. |
| 9183 | InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() { |
| 9184 | if (GTEST_FLAG(internal_run_death_test) == "") return nullptr; |
| 9185 | |
| 9186 | // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we |
| 9187 | // can use it here. |
| 9188 | int line = -1; |
| 9189 | int index = -1; |
| 9190 | ::std::vector< ::std::string> fields; |
| 9191 | SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields); |
| 9192 | int write_fd = -1; |
| 9193 | |
| 9194 | # if GTEST_OS_WINDOWS |
| 9195 | |
| 9196 | unsigned int parent_process_id = 0; |
| 9197 | size_t write_handle_as_size_t = 0; |
| 9198 | size_t event_handle_as_size_t = 0; |
| 9199 | |
| 9200 | if (fields.size() != 6 |
| 9201 | || !ParseNaturalNumber(fields[1], &line) |
| 9202 | || !ParseNaturalNumber(fields[2], &index) |
| 9203 | || !ParseNaturalNumber(fields[3], &parent_process_id) |
| 9204 | || !ParseNaturalNumber(fields[4], &write_handle_as_size_t) |
| 9205 | || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) { |
| 9206 | DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + |
| 9207 | GTEST_FLAG(internal_run_death_test)); |
| 9208 | } |
| 9209 | write_fd = GetStatusFileDescriptor(parent_process_id, |
| 9210 | write_handle_as_size_t, |
| 9211 | event_handle_as_size_t); |
| 9212 | |
| 9213 | # elif GTEST_OS_FUCHSIA |
| 9214 | |
| 9215 | if (fields.size() != 3 |
| 9216 | || !ParseNaturalNumber(fields[1], &line) |
| 9217 | || !ParseNaturalNumber(fields[2], &index)) { |
| 9218 | DeathTestAbort("Bad --gtest_internal_run_death_test flag: " |
| 9219 | + GTEST_FLAG(internal_run_death_test)); |
| 9220 | } |
| 9221 | |
| 9222 | # else |
| 9223 | |
| 9224 | if (fields.size() != 4 |
| 9225 | || !ParseNaturalNumber(fields[1], &line) |
| 9226 | || !ParseNaturalNumber(fields[2], &index) |
| 9227 | || !ParseNaturalNumber(fields[3], &write_fd)) { |
| 9228 | DeathTestAbort("Bad --gtest_internal_run_death_test flag: " |
| 9229 | + GTEST_FLAG(internal_run_death_test)); |
| 9230 | } |
| 9231 | |
| 9232 | # endif // GTEST_OS_WINDOWS |
| 9233 | |
| 9234 | return new InternalRunDeathTestFlag(fields[0], line, index, write_fd); |
| 9235 | } |
| 9236 | |
| 9237 | } // namespace internal |
| 9238 |
no test coverage detected