Add support for compiling GoogleTest for Xbox
Support for Xbox platforms, requires the code to support compilation with the WINAPI_FAMILY_GAMES subset of the Win32 API. - Add support for WINAPI_FAMILY_GAMES to enable GTEST_OS_WINDOWS_GAMES platform. - Disable stream redirection (GTEST_HAS_STREAM_REDIRECTION = 0) and colored TTY printing for GTEST_OS_WINDOWS_GAMES platform. Both features currently require Win32 functions that don't exist in the WINAPI_FAMILY_GAMES subset. Misc fixes: - gtest-port.cc: Move GTEST_DISABLE_MSC_DEPRECATED_PUSH_ into GTEST_HAS_STREAM_REDIRECTION conditional section where the corresponding GTEST_DISABLE_MSC_DEPRECATED_POP_ is located. - googletest-port-test.cc: Switch stream redirection tests to be conditional on GTEST_HAS_STREAM_REDIRECTION instead of !defined(GTEST_OS_WINDOWS_MOBILE).
This commit is contained in:
parent
eff443c6ef
commit
f1269cc220
@ -56,6 +56,8 @@
|
|||||||
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
|
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
|
||||||
#define GTEST_OS_WINDOWS_PHONE 1
|
#define GTEST_OS_WINDOWS_PHONE 1
|
||||||
#define GTEST_OS_WINDOWS_TV_TITLE 1
|
#define GTEST_OS_WINDOWS_TV_TITLE 1
|
||||||
|
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_GAMES)
|
||||||
|
#define GTEST_OS_WINDOWS_GAMES 1
|
||||||
#else
|
#else
|
||||||
// WINAPI_FAMILY defined but no known partition matched.
|
// WINAPI_FAMILY defined but no known partition matched.
|
||||||
// Default to desktop.
|
// Default to desktop.
|
||||||
|
@ -658,9 +658,10 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
|||||||
// By default, we assume that stream redirection is supported on all
|
// By default, we assume that stream redirection is supported on all
|
||||||
// platforms except known mobile / embedded ones. Also, if the port doesn't have
|
// platforms except known mobile / embedded ones. Also, if the port doesn't have
|
||||||
// a file system, stream redirection is not supported.
|
// a file system, stream redirection is not supported.
|
||||||
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
|
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
|
||||||
defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_ESP8266) || \
|
defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_WINDOWS_GAMES) || \
|
||||||
defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
|
defined(GTEST_OS_ESP8266) || \
|
||||||
|
defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
|
||||||
!GTEST_HAS_FILE_SYSTEM
|
!GTEST_HAS_FILE_SYSTEM
|
||||||
#define GTEST_HAS_STREAM_REDIRECTION 0
|
#define GTEST_HAS_STREAM_REDIRECTION 0
|
||||||
#else
|
#else
|
||||||
@ -2108,7 +2109,8 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
|
|||||||
// defined there.
|
// defined there.
|
||||||
#if GTEST_HAS_FILE_SYSTEM
|
#if GTEST_HAS_FILE_SYSTEM
|
||||||
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
|
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
|
||||||
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_ESP8266) && \
|
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_GAMES) && \
|
||||||
|
!defined(GTEST_OS_ESP8266) && \
|
||||||
!defined(GTEST_OS_XTENSA) && !defined(GTEST_OS_QURT)
|
!defined(GTEST_OS_XTENSA) && !defined(GTEST_OS_QURT)
|
||||||
inline int ChDir(const char* dir) { return chdir(dir); }
|
inline int ChDir(const char* dir) { return chdir(dir); }
|
||||||
#endif
|
#endif
|
||||||
|
@ -1033,12 +1033,12 @@ GTestLog::~GTestLog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Disable Microsoft deprecation warnings for POSIX functions called from
|
// Disable Microsoft deprecation warnings for POSIX functions called from
|
||||||
// this class (creat, dup, dup2, and close)
|
// this class (creat, dup, dup2, and close)
|
||||||
GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
|
GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if defined(GTEST_OS_LINUX_ANDROID) || defined(GTEST_OS_IOS)
|
#if defined(GTEST_OS_LINUX_ANDROID) || defined(GTEST_OS_IOS)
|
||||||
|
@ -3184,8 +3184,9 @@ static void PrintTestPartResult(const TestPartResult& test_part_result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// class PrettyUnitTestResultPrinter
|
// class PrettyUnitTestResultPrinter
|
||||||
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
|
#if defined(GTEST_OS_WINDOWS) && \
|
||||||
!defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
|
!defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_GAMES) && \
|
||||||
|
!defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
|
||||||
!defined(GTEST_OS_WINDOWS_MINGW)
|
!defined(GTEST_OS_WINDOWS_MINGW)
|
||||||
|
|
||||||
// Returns the character attribute for the given color.
|
// Returns the character attribute for the given color.
|
||||||
@ -3313,8 +3314,9 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
|
#if defined(GTEST_OS_WINDOWS) && \
|
||||||
!defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
|
!defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_GAMES) && \
|
||||||
|
!defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
|
||||||
!defined(GTEST_OS_WINDOWS_MINGW)
|
!defined(GTEST_OS_WINDOWS_MINGW)
|
||||||
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
@ -5473,7 +5475,7 @@ int UnitTest::Run() {
|
|||||||
// about crashes - they are expected.
|
// about crashes - they are expected.
|
||||||
if (impl()->catch_exceptions() || in_death_test_child_process) {
|
if (impl()->catch_exceptions() || in_death_test_child_process) {
|
||||||
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
|
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
|
||||||
!defined(GTEST_OS_WINDOWS_RT)
|
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_GAMES)
|
||||||
// SetErrorMode doesn't exist on CE.
|
// SetErrorMode doesn't exist on CE.
|
||||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
|
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
|
||||||
SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
||||||
|
@ -918,7 +918,7 @@ TEST(RETest, PartialMatchWorks) {
|
|||||||
|
|
||||||
#endif // GTEST_USES_POSIX_RE
|
#endif // GTEST_USES_POSIX_RE
|
||||||
|
|
||||||
#ifndef GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
TEST(CaptureTest, CapturesStdout) {
|
TEST(CaptureTest, CapturesStdout) {
|
||||||
CaptureStdout();
|
CaptureStdout();
|
||||||
@ -960,7 +960,7 @@ TEST(CaptureDeathTest, CannotReenterStdoutCapture) {
|
|||||||
// themselves.
|
// themselves.
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
TEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) {
|
TEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) {
|
||||||
ThreadLocal<int> t1;
|
ThreadLocal<int> t1;
|
||||||
|
Loading…
Reference in New Issue
Block a user