From e48a5714409d12d2e8bd4ab496855ff330fcc0f3 Mon Sep 17 00:00:00 2001 From: Slawomir Cygan Date: Mon, 10 Dec 2018 17:08:05 +0100 Subject: [PATCH] Fix logging of 8-bit integer values The values were 'streamed' using << to std::stream, so they were treated as characters, instead of integer values. Components: Vulkan VK-GL-CTS Issue: 1505 Affects: dEQP-VK.spirv_assembly.type.scalar.*8.* Change-Id: I34e697eb5b1c554b98a2fe556368bd6485fb406f --- .../spirv_assembly/vktSpvAsmTypeTests.cpp | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmTypeTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmTypeTests.cpp index f80a4dc81..445e031c7 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmTypeTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmTypeTests.cpp @@ -1484,6 +1484,30 @@ void SpvAsmTypeTests::createStageTests (const char* testName, createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, noExtensions, features, this, requiredFeatures); } +template +std::string valueToStr(const T v) +{ + std::stringstream s; + s << v; + return s.str(); +} + +template <> +std::string valueToStr (const deUint8 v) +{ + std::stringstream s; + s << (deUint16)v; + return s.str(); +} + +template <> +std::string valueToStr ( const deInt8 v) +{ + std::stringstream s; + s << (deInt16)v; + return s.str(); +} + template bool SpvAsmTypeTests::verifyResult (const vector& inputs, const vector& outputAllocations, @@ -1521,15 +1545,15 @@ bool SpvAsmTypeTests::verifyResult (const vector& inputs, inputStream << "("; for (deUint32 ndxIndex = 0 ; ndxIndex < inputs.size(); ++ndxIndex) { - inputStream << input[ndxIndex][ndxCount]; + inputStream << valueToStr(input[ndxIndex][ndxCount]); if (ndxIndex < inputs.size() - 1) inputStream << ","; } inputStream << ")"; log << tcu::TestLog::Message << "Error: found unexpected result for inputs " << inputStream.str() - << ": expected " << expected[ndxCount] << ", obtained " - << obtained[ndxCount] << tcu::TestLog::EndMessage; + << ": expected " << valueToStr(expected[ndxCount]) << ", obtained " + << valueToStr(obtained[ndxCount]) << tcu::TestLog::EndMessage; return false; } } -- 2.34.1