From e68fd92dd23b11001347d1d03f91a15fb76a68bb Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Tue, 23 Apr 2024 10:07:53 +0100 Subject: [PATCH] SWDEV-457944 - Fixed Unit_hipDeviceName_gcnArchName_And_rocm_agent_enumerator Change-Id: I184af328177ad38072e4a20040a7f5d8b717baf1 --- catch/hipTestMain/config/config_amd_linux | 4 ---- catch/unit/device/hipDeviceGetName.cc | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/catch/hipTestMain/config/config_amd_linux b/catch/hipTestMain/config/config_amd_linux index b2ba8f7b40..3370e5899b 100644 --- a/catch/hipTestMain/config/config_amd_linux +++ b/catch/hipTestMain/config/config_amd_linux @@ -1586,8 +1586,6 @@ #if defined NAVI21 "=== SWDEV-445961: These tests hang in PSDB stress test on 09/02/2024 ===", "Unit_hipStreamBeginCapture_hipStreamPerThread", - "=== SWDEV-453412 : Below test failed in stress test on 22/03/24 ===", - "Unit_hipDeviceName_gcnArchName_And_rocm_agent_enumerator", #endif #if defined NAVI3X "=== Below tests soft hang in stress test on 13/09/23 ===", @@ -1613,8 +1611,6 @@ "Unit_hipDeviceSynchronize_Functional", "Unit_hipStreamPerThread_StreamQuery", "Unit_hipMultiThreadStreams1_AsyncAsync", - "=== SWDEV-453412 : Below test failed in stress test on 22/03/24 ===", - "Unit_hipDeviceName_gcnArchName_And_rocm_agent_enumerator", "=== SWDEV-453415 : Below tests hang in stress test on 22/03/24 ===", "Unit_Warp_Shfl_Down_Positive_Basic - __half", "Unit_hipExtModuleLaunchKernel_Functional", diff --git a/catch/unit/device/hipDeviceGetName.cc b/catch/unit/device/hipDeviceGetName.cc index 4f220f65e8..454fb361b9 100644 --- a/catch/unit/device/hipDeviceGetName.cc +++ b/catch/unit/device/hipDeviceGetName.cc @@ -216,12 +216,13 @@ TEST_CASE("Unit_hipDeviceName_gcnArchName_And_rocm_agent_enumerator") { int j = 0; std::map> dNameMap; while (fgets(command_op, BUFFER_LEN, fpipe)) { + command_op[strcspn(command_op, "\n")] = '\0'; std::string rocmCommand_line(command_op); int dNameLen = strlen(rocmCommand_line.c_str()); if (std::string::npos != rocmCommand_line.find(defCpu)) { // ignore CPU continue; } else { - std::vector dName(dNameLen, 0); + std::vector dName(dNameLen + 1, 0); std::memcpy(dName.data(), &rocmCommand_line[0], dNameLen); dNameMap[j] = dName; } @@ -239,7 +240,7 @@ TEST_CASE("Unit_hipDeviceName_gcnArchName_And_rocm_agent_enumerator") { HIP_CHECK(hipDeviceGet(&device, dev)); HIP_CHECK(hipGetDeviceProperties(&prop, device)); REQUIRE(strncmp(i.second.data(), prop.gcnArchName, - strlen(i.second.data()) - 1) == 0); + strlen(i.second.data())) == 0); } } #endif