Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file if the variable is present. If a file already exists at this location, this function will write over it. If the variable is present, but the file cannot be created, prints an error and exits.
| 5841 | // function will write over it. If the variable is present, but the file cannot |
| 5842 | // be created, prints an error and exits. |
| 5843 | void WriteToShardStatusFileIfNeeded() { |
| 5844 | const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile); |
| 5845 | if (test_shard_file != NULL) { |
| 5846 | FILE* const file = posix::FOpen(test_shard_file, "w"); |
| 5847 | if (file == NULL) { |
| 5848 | ColoredPrintf(COLOR_RED, |
| 5849 | "Could not write to the test shard status file \"%s\" " |
| 5850 | "specified by the %s environment variable.\n", |
| 5851 | test_shard_file, kTestShardStatusFile); |
| 5852 | fflush(stdout); |
| 5853 | exit(EXIT_FAILURE); |
| 5854 | } |
| 5855 | fclose(file); |
| 5856 | } |
| 5857 | } |
| 5858 | |
| 5859 | // Checks whether sharding is enabled by examining the relevant |
| 5860 | // environment variable values. If the variables are present, |
no test coverage detected