Merge pull request #794 from Arfrever/tests-TMPDIR
Tests: Respect TEST_TMPDIR, TMPDIR, TMP environmental variables
This commit is contained in:
commit
553ddaea85
@ -623,7 +623,7 @@ by :cpp:`InstallFailureFunction`.
|
|||||||
|
|
||||||
void YourFailureFunction() {
|
void YourFailureFunction() {
|
||||||
// Reports something...
|
// Reports something...
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|||||||
@ -1819,7 +1819,7 @@ GLOG_EXPORT const std::vector<std::string>& GetLoggingDirectories();
|
|||||||
void TestOnly_ClearLoggingDirectoriesList();
|
void TestOnly_ClearLoggingDirectoriesList();
|
||||||
|
|
||||||
// Returns a set of existing temporary directories, which will be a
|
// Returns a set of existing temporary directories, which will be a
|
||||||
// subset of the directories returned by GetLogginDirectories().
|
// subset of the directories returned by GetLoggingDirectories().
|
||||||
// Thread-safe.
|
// Thread-safe.
|
||||||
GLOG_EXPORT void GetExistingTempDirectories(
|
GLOG_EXPORT void GetExistingTempDirectories(
|
||||||
std::vector<std::string>* list);
|
std::vector<std::string>* list);
|
||||||
@ -1954,7 +1954,7 @@ class GLOG_EXPORT NullStreamFatal : public NullStream {
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4722)
|
#pragma warning(disable : 4722)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
@ac_cv___attribute___noreturn@ ~NullStreamFatal() throw () { _exit(1); }
|
@ac_cv___attribute___noreturn@ ~NullStreamFatal() throw () { _exit(EXIT_FAILURE); }
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|||||||
@ -124,7 +124,7 @@
|
|||||||
#define RAW_LOG_FATAL(...) \
|
#define RAW_LOG_FATAL(...) \
|
||||||
do { \
|
do { \
|
||||||
@ac_google_namespace@::RawLogStub__(0, __VA_ARGS__); \
|
@ac_google_namespace@::RawLogStub__(0, __VA_ARGS__); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif // STRIP_LOG <= 3
|
#endif // STRIP_LOG <= 3
|
||||||
|
|
||||||
|
|||||||
@ -76,13 +76,16 @@ _END_GOOGLE_NAMESPACE_
|
|||||||
#define GLOG_EXPORT
|
#define GLOG_EXPORT
|
||||||
|
|
||||||
static inline string GetTempDir() {
|
static inline string GetTempDir() {
|
||||||
#ifndef GLOG_OS_WINDOWS
|
vector<string> temp_directories_list;
|
||||||
return "/tmp";
|
google::GetExistingTempDirectories(&temp_directories_list);
|
||||||
#else
|
|
||||||
char tmp[MAX_PATH];
|
if (temp_directories_list.empty()) {
|
||||||
GetTempPathA(MAX_PATH, tmp);
|
fprintf(stderr, "No temporary directory found\n");
|
||||||
return tmp;
|
exit(EXIT_FAILURE);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
// Use first directory from list of existing temporary directories.
|
||||||
|
return temp_directories_list.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GLOG_OS_WINDOWS) && defined(_MSC_VER) && !defined(TEST_SRC_DIR)
|
#if defined(GLOG_OS_WINDOWS) && defined(_MSC_VER) && !defined(TEST_SRC_DIR)
|
||||||
@ -127,7 +130,7 @@ void InitGoogleTest(int*, char**) {}
|
|||||||
if (abs(val1 - val2) > abs_error) { \
|
if (abs(val1 - val2) > abs_error) { \
|
||||||
fprintf(stderr, "Check failed: %s within %s of %s\n", #val1, #abs_error, \
|
fprintf(stderr, "Check failed: %s within %s of %s\n", #val1, #abs_error, \
|
||||||
#val2); \
|
#val2); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -135,7 +138,7 @@ void InitGoogleTest(int*, char**) {}
|
|||||||
do { \
|
do { \
|
||||||
if (!(cond)) { \
|
if (!(cond)) { \
|
||||||
fprintf(stderr, "Check failed: %s\n", #cond); \
|
fprintf(stderr, "Check failed: %s\n", #cond); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -145,7 +148,7 @@ void InitGoogleTest(int*, char**) {}
|
|||||||
do { \
|
do { \
|
||||||
if (!((val1) op (val2))) { \
|
if (!((val1) op (val2))) { \
|
||||||
fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \
|
fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -158,7 +161,7 @@ void InitGoogleTest(int*, char**) {}
|
|||||||
do { \
|
do { \
|
||||||
if (!isnan(arg)) { \
|
if (!isnan(arg)) { \
|
||||||
fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \
|
fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -166,7 +169,7 @@ void InitGoogleTest(int*, char**) {}
|
|||||||
do { \
|
do { \
|
||||||
if (!isinf(arg)) { \
|
if (!isinf(arg)) { \
|
||||||
fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \
|
fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -174,7 +177,7 @@ void InitGoogleTest(int*, char**) {}
|
|||||||
do { \
|
do { \
|
||||||
if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \
|
if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \
|
||||||
fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \
|
fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -182,7 +185,7 @@ void InitGoogleTest(int*, char**) {}
|
|||||||
do { \
|
do { \
|
||||||
if (strcmp((val1), (val2)) != 0) { \
|
if (strcmp((val1), (val2)) != 0) { \
|
||||||
fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \
|
fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -236,7 +239,7 @@ static inline void CalledAbort() {
|
|||||||
g_logging_fail_func = original_logging_fail_func; \
|
g_logging_fail_func = original_logging_fail_func; \
|
||||||
if (!g_called_abort) { \
|
if (!g_called_abort) { \
|
||||||
fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \
|
fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \
|
||||||
exit(1); \
|
exit(EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -783,7 +783,7 @@ static void TestTwoProcessesWrite() {
|
|||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
LOG(INFO) << "message to new base, child - should only appear on STDERR not on the file";
|
LOG(INFO) << "message to new base, child - should only appear on STDERR not on the file";
|
||||||
ShutdownGoogleLogging(); //for children proc
|
ShutdownGoogleLogging(); //for children proc
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
} else if (pid > 0) {
|
} else if (pid > 0) {
|
||||||
wait(NULL);
|
wait(NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -778,7 +778,7 @@ static void TestTwoProcessesWrite() {
|
|||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
LOG(INFO) << "message to new base, child - should only appear on STDERR not on the file";
|
LOG(INFO) << "message to new base, child - should only appear on STDERR not on the file";
|
||||||
ShutdownGoogleLogging(); //for children proc
|
ShutdownGoogleLogging(); //for children proc
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
} else if (pid > 0) {
|
} else if (pid > 0) {
|
||||||
wait(NULL);
|
wait(NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user