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.
| 4690 | // function will write over it. If the variable is present, but the file cannot |
| 4691 | // be created, prints an error and exits. |
| 4692 | void WriteToShardStatusFileIfNeeded() { |
| 4693 | const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile); |
| 4694 | if (test_shard_file != NULL) { |
| 4695 | FILE* const file = posix::FOpen(test_shard_file, "w"); |
| 4696 | if (file == NULL) { |
| 4697 | ColoredPrintf(COLOR_RED, |
| 4698 | "Could not write to the test shard status file \"%s\" " |
| 4699 | "specified by the %s environment variable.\n", |
| 4700 | test_shard_file, kTestShardStatusFile); |
| 4701 | fflush(stdout); |
| 4702 | exit(EXIT_FAILURE); |
| 4703 | } |
| 4704 | fclose(file); |
| 4705 | } |
| 4706 | } |
| 4707 | |
| 4708 | // Checks whether sharding is enabled by examining the relevant |
| 4709 | // environment variable values. If the variables are present, |
no test coverage detected