From 1c08fb58d02cebda8f357858dad17c83842fbaf2 Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Sun, 7 Mar 2021 16:52:42 -0500 Subject: [PATCH] SWDEV-232428 - Fix hipPrintSpecifiers test failure on Windows The following snippets has different behaviour based on platform. printf("%p", 0x123abc); Linux -> 0x123abc Windows -> 123ABC printf("%p", nullptr); Linux -> (nil) Windows -> 0000000000000000 %p specifier according to C spec is implementation defined, so we need to adjust the reference string to be correct on Windows. Change-Id: I7059fa0f6cde611718bd76655637670fcbccf43c --- tests/src/printf/hipPrintfSpecifiers.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/src/printf/hipPrintfSpecifiers.cpp b/tests/src/printf/hipPrintfSpecifiers.cpp index fd7c5c30ff..2e427ea537 100644 --- a/tests/src/printf/hipPrintfSpecifiers.cpp +++ b/tests/src/printf/hipPrintfSpecifiers.cpp @@ -58,6 +58,7 @@ __global__ void test_kernel() { } int main(int argc, char **argv) { +#if !defined(_WIN32) std::string reference(R"here(xyzzy % hello % world @@ -78,6 +79,28 @@ x (nil) 3.14159000 hello 0xf01dab1eca55e77e )here"); +#else + std::string reference(R"here(xyzzy +% +hello % world +%s +%sF01DAB1ECA55E77E +%cxyzzy +sep +-42 +42 +123.456000 +-123.456000 +-1.234560e+02 +1.234560E+02 +123.456 +-123.456 +x + +0000000000000000 +3.14159000 hello F01DAB1ECA55E77E +)here"); +#endif CaptureStream captured(stdout); hipLaunchKernelGGL(test_kernel, dim3(1), dim3(1), 0, 0);