SWDEV-563114 - User stack array instead to avoid delete gets skipped in case of assert failure. (#1553)

This commit is contained in:
Jaydeep
2025-12-03 23:03:50 +05:30
committed by GitHub
parent 47b80c011c
commit fa4a75a26c
@@ -17,7 +17,7 @@ OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <hip_test_common.hh>
#include <vector>
#include <cstring>
#include "../kernel/printf_common.h"
@@ -56,13 +56,11 @@ TEST_CASE("Unit_kernel_ChkPrintf", "[multigpu]") {
if (!HipTest::isPcieAtomicSupported()) continue;
hipLaunchKernelGGL(run_printf, dim3(1), dim3(1), 0, 0);
HIP_CHECK(hipDeviceSynchronize());
char* data = new char[st.size()];
;
std::vector<char> data(st.size() + 1); // +1 for null terminator
std::ifstream CapturedData = capture.getCapturedData();
CapturedData.getline(data, st.size() + 1);
int result = strcmp(data, check);
CapturedData.getline(data.data(), st.size() + 1);
int result = strcmp(data.data(), check);
REQUIRE(result == 0);
delete[] data;
}
}