MCPcopy Create free account
hub / github.com/apache/singa / WriteToShardStatusFileIfNeeded

Function WriteToShardStatusFileIfNeeded

test/gtest/gtest-all.cc:5843–5857  ·  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

5841// function will write over it. If the variable is present, but the file cannot
5842// be created, prints an error and exits.
5843void 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,

Callers 1

RunAllTestsMethod · 0.85

Calls 3

GetEnvFunction · 0.85
FOpenFunction · 0.85
ColoredPrintfFunction · 0.85

Tested by

no test coverage detected