diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 938c943469..41902a40f5 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -93,6 +93,17 @@ DawnTestParam ForceWorkarounds(const DawnTestParam& originParam, return newTestParam; } +std::ostream& operator<<(std::ostream& os, const DawnTestParam& param) { + os << ParamName(param.backendType); + for (const char* forceEnabledWorkaround : param.forceEnabledWorkarounds) { + os << "__e_" << forceEnabledWorkaround; + } + for (const char* forceDisabledWorkaround : param.forceDisabledWorkarounds) { + os << "__d_" << forceDisabledWorkaround; + } + return os; +} + // Implementation of DawnTestEnvironment void InitDawnEnd2EndTestEnvironment(int argc, char** argv) { @@ -710,17 +721,6 @@ namespace detail { return backends; } - std::string GetParamName(const testing::TestParamInfo& info) { - std::ostringstream ostream; - ostream << ParamName(info.param.backendType); - - for (const char* forceEnabledWorkaround : info.param.forceEnabledWorkarounds) { - ostream << "_" << forceEnabledWorkaround; - } - - return ostream.str(); - } - // Helper classes to set expectations template diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index 34a066946f..46337167dc 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -83,6 +83,8 @@ struct DawnTestParam { std::vector forceDisabledWorkarounds; }; +std::ostream& operator<<(std::ostream& os, const DawnTestParam& param); + // Shorthands for backend types used in the DAWN_INSTANTIATE_TEST extern const DawnTestParam D3D12Backend; extern const DawnTestParam MetalBackend; @@ -269,7 +271,7 @@ class DawnTest : public ::testing::TestWithParam { , testName, \ testing::ValuesIn(::detail::FilterBackends( \ testName##params, sizeof(testName##params) / sizeof(firstParam))), \ - ::detail::GetParamName) + testing::PrintToStringParamName()) // Skip a test when the given condition is satisfied. #define DAWN_SKIP_TEST_IF(condition) \ @@ -282,7 +284,6 @@ namespace detail { // Helper functions used for DAWN_INSTANTIATE_TEST bool IsBackendAvailable(dawn_native::BackendType type); std::vector FilterBackends(const DawnTestParam* params, size_t numParams); - std::string GetParamName(const testing::TestParamInfo& info); // All classes used to implement the deferred expectations should inherit from this. class Expectation {