Skip to content

Commit

Permalink
Allow testing::Combine in ANGLE_INSTANTIATE_TEST
Browse files Browse the repository at this point in the history
In most tests, ANGLE_INSTANTIATE_TEST is sufficient.  This macro takes a
a variable number of angle::PlatformParameters and instantiates that
many tests.  angle::PlatformParameters already aggregates multiple
configurations.

In a number of cases, however, it would be useful to have even more
configurations in conjunction with angle::PlatformParameters.
gl_tests/MultiviewDrawTest.cpp solves this by creating a custom class
that combines angle::PlatformParameters with test-specific
configurations.  gl_tests/CopyTextureTest.cpp included numerous tests
with hardcoded values for its configurations.

This change introduces ANGLE_INSTANTIATE_TEST_COMBINE_N.  These macros
take N testing::* parameter generators followed by the list of
angle::PlatformParameters as per ANGLE_INSTANTIATE_TEST.  They then
testing::Combine these generators, placing the angle::PlatformParameters
list first.

Tests that use this functionality would inherit from
ANGLETestWithParams<std::tuple<angle::PlatformParameters, ...>> instead
of ANGLETest, and instantiate their tests as such:

ANGLE_INSTANTIATE_TEST_COMBINE_3(TestName,
                                 PrettyPrintFunction,
                                 testing::ValuesIn(listOfParameters),
                                 testing::Values(some, other, parameters),
                                 testing::Bool(),
                                 ES2_D3D9(),
                                 ES2_D3D11(),
                                 ES2_OPENGL(),
                                 ES2_OPENGLES(),
                                 ES2_VULKAN());

The name of the test, as used by --gtest_filter, will be suffixed with
the output of the PrettyPrintFunction.  Assuming the tuple type given to
ANGLETestWithParams is Params, this function takes a
::testing::TestParamInfo<Params> input to pretty-print the name of the
test variation.  It is recommended to output the platform first for
consistency with other tests.

gl_tests/CopyTextureTest.cpp is modified to use this macro.

Bug: angleproject:3125
Change-Id: I0311b84659578bf3c7b5e9673b41cc3a3adfc50d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1506236
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
  • Loading branch information
ShabbyX authored and Commit Bot committed Mar 12, 2019
1 parent c9bc33c commit b6eb341
Show file tree
Hide file tree
Showing 4 changed files with 407 additions and 2,151 deletions.

0 comments on commit b6eb341

Please sign in to comment.