diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-06-19 17:23:54 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-06-19 17:23:54 +0000 |
commit | 4853a503371f39aa22e14adcdecea71c09841e34 (patch) | |
tree | b16ed6470fbbc4ea8eace7f836ae8e6448a369a3 /src | |
parent | ae3247986bbbafcc913b5fe6132090ad6f1c3f36 (diff) | |
download | googletest-4853a503371f39aa22e14adcdecea71c09841e34.tar.gz googletest-4853a503371f39aa22e14adcdecea71c09841e34.tar.bz2 googletest-4853a503371f39aa22e14adcdecea71c09841e34.zip |
Fixes compatibility with Windows CE and Symbian (By Tim Baverstock and Mika).
Diffstat (limited to 'src')
-rw-r--r-- | src/gtest-internal-inl.h | 4 | ||||
-rw-r--r-- | src/gtest-port.cc | 13 | ||||
-rw-r--r-- | src/gtest-typed-test.cc | 2 | ||||
-rw-r--r-- | src/gtest.cc | 6 |
4 files changed, 19 insertions, 6 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h index 94c9d7ee..f909a0ac 100644 --- a/src/gtest-internal-inl.h +++ b/src/gtest-internal-inl.h @@ -45,7 +45,9 @@ #error "It must not be included except by Google Test itself." #endif // GTEST_IMPLEMENTATION_ +#ifndef _WIN32_WCE #include <errno.h> +#endif // !_WIN32_WCE #include <stddef.h> #include <stdlib.h> // For strtoll/_strtoul64. @@ -1072,7 +1074,7 @@ class UnitTestImpl { original_working_dir_.Set(FilePath::GetCurrentDir()); if (original_working_dir_.IsEmpty()) { printf("%s\n", "Failed to get the current working directory."); - abort(); + posix::Abort(); } } diff --git a/src/gtest-port.cc b/src/gtest-port.cc index 7f6db79f..bc6d8f80 100644 --- a/src/gtest-port.cc +++ b/src/gtest-port.cc @@ -36,8 +36,10 @@ #include <stdio.h> #if GTEST_OS_WINDOWS +#ifndef _WIN32_WCE #include <io.h> #include <sys/stat.h> +#endif // _WIN32_WCE #else #include <unistd.h> #endif // GTEST_OS_WINDOWS @@ -425,7 +427,7 @@ void GTestLog(GTestLogSeverity severity, const char* file, fprintf(stderr, "\n%s %s:%d: %s\n", marker, file, line, msg); if (severity == GTEST_FATAL) { fflush(NULL); // abort() is not guaranteed to flush open file streams. - abort(); + posix::Abort(); } } @@ -444,6 +446,10 @@ class CapturedStderr { public: // The ctor redirects stderr to a temporary file. CapturedStderr() { +#ifdef _WIN32_WCE + // Not supported on Windows CE. + posix::Abort(); +#else uncaptured_fd_ = dup(kStdErrFileno); #if GTEST_OS_WINDOWS @@ -465,19 +471,24 @@ class CapturedStderr { fflush(NULL); dup2(captured_fd, kStdErrFileno); close(captured_fd); +#endif // _WIN32_WCE } ~CapturedStderr() { +#ifndef _WIN32_WCE remove(filename_.c_str()); +#endif // _WIN32_WCE } // Stops redirecting stderr. void StopCapture() { +#ifndef _WIN32_WCE // Restores the original stream. fflush(NULL); dup2(uncaptured_fd_, kStdErrFileno); close(uncaptured_fd_); uncaptured_fd_ = -1; +#endif // !_WIN32_WCE } // Returns the name of the temporary file holding the stderr output. diff --git a/src/gtest-typed-test.cc b/src/gtest-typed-test.cc index e45e2abb..4a0f657d 100644 --- a/src/gtest-typed-test.cc +++ b/src/gtest-typed-test.cc @@ -86,7 +86,7 @@ const char* TypedTestCasePState::VerifyRegisteredTestNames( fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), errors_str.c_str()); fflush(stderr); - abort(); + posix::Abort(); } return registered_tests; diff --git a/src/gtest.cc b/src/gtest.cc index c093bce9..84784883 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -3364,14 +3364,14 @@ int UnitTest::Run() { SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); #endif // _WIN32_WCE -#if defined(_MSC_VER) || defined(__MINGW32__) +#if (defined(_MSC_VER) || defined(__MINGW32__)) && !defined(_WIN32_WCE) // Death test children can be terminated with _abort(). On Windows, // _abort() can show a dialog with a warning message. This forces the // abort message to go to stderr instead. _set_error_mode(_OUT_TO_STDERR); #endif -#if _MSC_VER >= 1400 +#if _MSC_VER >= 1400 && !defined(_WIN32_WCE) // In the debug version, Visual Studio pops up a separate dialog // offering a choice to debug the aborted program. We need to suppress // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement @@ -3387,7 +3387,7 @@ int UnitTest::Run() { _set_abort_behavior( 0x0, // Clear the following flags: _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump. -#endif // _MSC_VER >= 1400 +#endif } __try { |