Commit 33585c71 by Corentin Wallez

Use named value-parameterized tests for angle_end2end_tests

This replace the non-descriptive digit at the end of the test name by the name of the configuration being tested. Reland with a fix for gtest initialization on Windows caused by ProgramBinaryTest having the same parameter name twice. BUG=angleproject:1153 Change-Id: I9b0f661a535b760793d9d87ef0c8298f6b83830d Reviewed-on: https://chromium-review.googlesource.com/297701Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 9bbad18e
...@@ -185,6 +185,18 @@ struct PlatformsWithLinkResult : PlatformParameters ...@@ -185,6 +185,18 @@ struct PlatformsWithLinkResult : PlatformParameters
bool expectedLinkResult; bool expectedLinkResult;
}; };
// Provide a custom gtest parameter name function for PlatformsWithLinkResult
// to avoid returning the same parameter name twice. Such a conflict would happen
// between ES2_D3D11_to_ES2D3D11 and ES2_D3D11_to_ES3D3D11 as they were both
// named ES2_D3D11
std::ostream &operator<<(std::ostream& stream, const PlatformsWithLinkResult &platform)
{
const PlatformParameters &platform1 = platform;
const PlatformParameters &platform2 = platform.loadParams;
stream << platform1 << "_to_" << platform2;
return stream;
}
class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWithLinkResult> class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWithLinkResult>
{ {
public: public:
......
...@@ -7,6 +7,13 @@ ...@@ -7,6 +7,13 @@
#ifndef ANGLE_TEST_CONFIGS_H_ #ifndef ANGLE_TEST_CONFIGS_H_
#define ANGLE_TEST_CONFIGS_H_ #define ANGLE_TEST_CONFIGS_H_
// On Linux EGL/egl.h includes X.h which does defines for some very common
// names that are used by gtest (like None and Bool) and causes a lot of
// compilation errors. To work around this, even if this file doesn't use it,
// we include gtest before EGL so that it compiles fine in other files that
// want to use gtest.
#include <gtest/gtest.h>
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#ifndef ANGLE_TEST_INSTANTIATE_H_ #ifndef ANGLE_TEST_INSTANTIATE_H_
#define ANGLE_TEST_INSTANTIATE_H_ #define ANGLE_TEST_INSTANTIATE_H_
#include <gtest/gtest.h>
#include "common/debug.h" #include "common/debug.h"
namespace angle namespace angle
...@@ -41,7 +43,9 @@ std::vector<T> FilterTestParams(const T *params, size_t numParams) ...@@ -41,7 +43,9 @@ std::vector<T> FilterTestParams(const T *params, size_t numParams)
// arguments must match, and getRenderer must be implemented for that type. // arguments must match, and getRenderer must be implemented for that type.
#define ANGLE_INSTANTIATE_TEST(testName, firstParam, ...) \ #define ANGLE_INSTANTIATE_TEST(testName, firstParam, ...) \
const decltype(firstParam) testName##params[] = { firstParam, ##__VA_ARGS__ }; \ const decltype(firstParam) testName##params[] = { firstParam, ##__VA_ARGS__ }; \
INSTANTIATE_TEST_CASE_P(, testName, testing::ValuesIn(::angle::FilterTestParams(testName##params, ArraySize(testName##params)))); INSTANTIATE_TEST_CASE_P(, testName, \
testing::ValuesIn(::angle::FilterTestParams(testName##params, ArraySize(testName##params))), \
testing::PrintToStringParamName());
} // namespace angle } // namespace angle
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment