From 6d77b4b7839108ccf4e6d883260e778bb25d2e45 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Fri, 21 Feb 2025 11:05:30 +0000 Subject: [PATCH] SWDEV-517040 - Prevent segfault in Unit_hiprtc_includepath if can't open saxpy.h Change-Id: Ie26857fe5dc16c8053b67b145d88588ce209281c [ROCm/hip-tests commit: bae567a560bf749615323f373b25d1901a048ee9] --- projects/hip-tests/catch/unit/rtc/includepath.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/hip-tests/catch/unit/rtc/includepath.cc b/projects/hip-tests/catch/unit/rtc/includepath.cc index a72a8824f0..94e609b196 100644 --- a/projects/hip-tests/catch/unit/rtc/includepath.cc +++ b/projects/hip-tests/catch/unit/rtc/includepath.cc @@ -22,7 +22,7 @@ TEST_CASE("Unit_hiprtc_includepath") { string saxpy = ""; { - fstream f("saxpy.h"); + fstream f("saxpy.h" , std::ios::in); if (f.is_open()) { size_t sizeFile; f.seekg(0, fstream::end); @@ -32,6 +32,9 @@ TEST_CASE("Unit_hiprtc_includepath") { f.read(&saxpy[0], size); f.close(); } + else { + FAIL("Failed to open saxpy.h. Please ensure the file exists and is accessible."); + } } hiprtcProgram prog;