From bc435bc2888d0a3ebb2adf9ec13786cb9bd72598 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Nov 2023 15:33:14 -0500 Subject: Tests: Update HIP.MathFunctions case for nodiscard enforcement --- Tests/HIP/MathFunctions/main.hip | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Tests/HIP/MathFunctions/main.hip b/Tests/HIP/MathFunctions/main.hip index 8a6e77f..dae89fc 100644 --- a/Tests/HIP/MathFunctions/main.hip +++ b/Tests/HIP/MathFunctions/main.hip @@ -18,11 +18,15 @@ bool verify(F f, T expected) { std::unique_ptr cpu_T(new T); T* gpu_T = nullptr; - hipMalloc((void**)&gpu_T, sizeof(T)); + if (hipMalloc((void**)&gpu_T, sizeof(T)) != hipSuccess) { + return false; + } + bool result = true; hipLaunchKernelGGL(global_entry_point, 1, 1, 0, 0, f, gpu_T); - hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost); - hipFree(gpu_T); - return (*cpu_T == expected); + result = hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost) == hipSuccess && result; + result = hipFree(gpu_T) == hipSuccess && result; + result = *cpu_T == expected && result; + return result; } } -- cgit v0.12