Go to the documentation of this file.
39 #include <sys/types.h>
58 using google::protobuf::io::win32::close;
59 using google::protobuf::io::win32::dup2;
60 using google::protobuf::io::win32::dup;
61 using google::protobuf::io::win32::mkdir;
62 using google::protobuf::io::win32::open;
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;
80 char* result = getenv(
"srcdir");
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
110 string GetTemporaryDirectoryName() {
113 char *from_environment = getenv(
"TEST_TMPDIR");
114 if (from_environment !=
NULL && from_environment[0] !=
'\0') {
115 return string(from_environment) +
"/protobuf_tmpdir";
121 char b[L_tmpnam + 1];
122 #pragma GCC diagnostic push
123 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
124 string result = tmpnam(
b);
125 #pragma GCC diagnostic pop
142 if (result[result.size() - 1] ==
'.') {
143 result[result.size() - 1] =
'_';
160 class TempDirDeleter {
164 if (!
name_.empty()) {
171 name_ = GetTemporaryDirectoryName();
185 TempDirDeleter temp_dir_deleter_;
190 return temp_dir_deleter_.GetTempDir();
206 O_WRONLY | O_CREAT | O_EXCL |
O_BINARY, 0777);
221 O_WRONLY | O_CREAT | O_EXCL |
O_BINARY, 0777);
280 int line,
const string&
message) {
293 struct ForceShutdown {
string GetCapturedTestStderr()
#define GOOGLE_CHECK_EQ(A, B)
virtual ~ScopedMemoryLog()
string GetCapturedTestStdout()
const std::vector< string > & GetMessages(LogLevel error)
static int original_stdout_
GLsizei const GLchar *const * string
static void WriteStringToFileOrDie(const string &contents, const string &name)
GLboolean GLboolean GLboolean b
LogHandler * old_handler_
static void HandleLog(LogLevel level, const char *filename, int line, const string &message)
static const char prefix[]
static void ReadFileToStringOrDie(const string &name, string *output)
#define GOOGLE_LOG(LEVEL)
static const LogLevel WARNING
bool HasPrefixString(const string &str, const string &prefix)
static const LogLevel ERROR
#define GOOGLE_CHECK_NE(A, B)
#define GOOGLE_CHECK(EXPRESSION)
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 string GetTempDir()
char * strerror(int errno)
static ScopedMemoryLog * active_log_
static int original_stderr_
void ShutdownProtobufLibrary()
GLenum GLuint GLenum GLsizei const GLchar * message
static void DeleteRecursively(const string &name, void *dummy1, void *dummy2)
static bool Exists(const string &name)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:52