MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / WriteToShardStatusFileIfNeeded

Function WriteToShardStatusFileIfNeeded

tests/gtest/gtest-all.cc:6823–6837  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

6821// function will write over it. If the variable is present, but the file cannot
6822// be created, prints an error and exits.
6823void WriteToShardStatusFileIfNeeded() {
6824 const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);
6825 if (test_shard_file != nullptr) {
6826 FILE* const file = posix::FOpen(test_shard_file, "w");
6827 if (file == nullptr) {
6828 ColoredPrintf(COLOR_RED,
6829 "Could not write to the test shard status file \"%s\" "
6830 "specified by the %s environment variable.\n",
6831 test_shard_file, kTestShardStatusFile);
6832 fflush(stdout);
6833 exit(EXIT_FAILURE);
6834 }
6835 fclose(file);
6836 }
6837}
6838
6839// Checks whether sharding is enabled by examining the relevant
6840// environment variable values. If the variables are present,

Callers 1

RunAllTestsMethod · 0.85

Calls 3

GetEnvFunction · 0.85
FOpenFunction · 0.85
ColoredPrintfFunction · 0.85

Tested by

no test coverage detected