Go to the documentation of this file.
34 #include <google/protobuf/testing/googletest.h>
35 #include <google/protobuf/testing/file.h>
36 #include <google/protobuf/io/io_win32.h>
37 #include <google/protobuf/stubs/strutil.h>
39 #include <sys/types.h>
59 using google::protobuf::io::win32::dup2;
60 using google::protobuf::io::win32::dup;
61 using google::protobuf::io::win32::mkdir;
67 #define O_BINARY _O_BINARY
69 #define O_BINARY 0 // If this isn't defined, the platform doesn't need it.
74 #ifndef GOOGLE_THIRD_PARTY_PROTOBUF
75 #ifdef GOOGLE_PROTOBUF_TEST_SOURCE_PATH
76 return GOOGLE_PROTOBUF_TEST_SOURCE_PATH;
96 <<
"Could not find protobuf source code. Please run tests from "
97 "somewhere within the protobuf source package.";
102 #endif // GOOGLE_PROTOBUF_TEST_SOURCE_PATH
104 return "third_party/protobuf/src";
105 #endif // GOOGLE_THIRD_PARTY_PROTOBUF
113 char *from_environment =
getenv(
"TEST_TMPDIR");
114 if (from_environment != NULL && from_environment[0] !=
'\0') {
115 return std::string(from_environment) +
"/protobuf_tmpdir";
121 char b[L_tmpnam + 1];
122 #pragma GCC diagnostic push
123 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
125 #pragma GCC diagnostic pop
160 class TempDirDeleter {
164 if (!
name_.empty()) {
171 name_ = GetTemporaryDirectoryName();
185 TempDirDeleter temp_dir_deleter_;
204 O_WRONLY | O_CREAT | O_EXCL |
O_BINARY, 0777);
219 O_WRONLY | O_CREAT | O_EXCL |
O_BINARY, 0777);
291 struct ForceShutdown {
string GetCapturedTestStdout()
virtual ~ScopedMemoryLog()
static ScopedMemoryLog * active_log_
LogHandler * old_handler_
static int original_stdout_
#define GOOGLE_CHECK_EQ(A, B)
static void WriteStringToFileOrDie(const string &contents, const string &name)
string GetCapturedTestStderr()
static void HandleLog(LogLevel level, const char *filename, int line, const string &message)
const std::vector< string > & GetMessages(LogLevel error)
static void ReadFileToStringOrDie(const string &name, string *output)
static const LogLevel WARNING
bool HasPrefixString(const string &str, const string &prefix)
static const LogLevel ERROR
void StringReplace(const string &s, const string &oldsub, const string &newsub, bool replace_all, string *res)
static string stderr_capture_filename_
std::map< LogLevel, std::vector< string > > messages_
static string stdout_capture_filename_
LogHandler * SetLogHandler(LogHandler *new_func)
static const char prefix[]
#define GOOGLE_CHECK(EXPRESSION)
#define GOOGLE_CHECK_NE(A, B)
static int original_stderr_
void ShutdownProtobufLibrary()
#define GOOGLE_LOG(LEVEL)
static void DeleteRecursively(const string &name, void *dummy1, void *dummy2)
static bool Exists(const string &name)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:43