google / googletest

GoogleTest - Google Testing and Mocking Framework

Home Page:https://google.github.io/googletest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FR]: Add support for building GoogleTest on Xbox platforms

to01z opened this issue · comments

Does the feature exist in the most recent commit?

No

Why do we need this feature?

It would be great to be able to use the same testing framework on PC and Xbox platforms.

Describe the proposal.

In order to use GoogleTest on Xbox platforms, the code must compile with WINAPI_FAMILY set to WINAPI_FAMILY_GAMES (see here).

I have done the work to make GoogleTest compile/ link and some basic testing on Xbox platforms to make sure it runs. You can see the necessary changes here. I would be happy to file a pull request, if you think the changes are acceptable.

Is the feature specific to an operating system, compiler, or build system version?

This feature is specific to the Windows OS. By compiling with WINAPI_FAMILY set to WINAPI_FAMILY_GAMES, the Win32 API is limited to a stricter subset which can successfully link and run on Xbox platforms. The feature as propose, does not alter behavior on existing platforms.

to01z/googletest@main...add-winapi-partition-games-support is simple enough that if it passes our tests I would accept it.

Minimal PR filed in #4505. The changes pass existing unit tests on tested platforms.

I noticed the existing tests don't compile on Windows when WINAPI_FAMILY is set to anything else than WINAPI_FAMILY_DESKTOP_APP. I spent a bit of time trying to make them compile for WINAPI_FAMILY = WINAPI_FAMILY_GAMES, but realized quite a few use #ifdef GTEST_OS_WINDOWS and then assume the WINAPI_FAMILY_DESKTOP_APP API subset is available. I would be happy to take another stab at making them work for WINAPI_FAMILY_GAMES, but it seems like something that will require deeper cleanup of above-mentioned assumption and probably also would be a larger change. I think that work should be handled in a different issue/ task.