EXSWHTEC-20 - hipFreeAsync negative tests (#38)
- Added negative tests for hipFreeAsync
- nullptr check for pointer parameter
- invalid stream handle for stream parameter
- Update config_nvidia_linux_common.json
[ROCm/hip-tests commit: bf50c2d2d8]
Tá an tiomantas seo le fáil i:
tiomanta ag
GitHub
tuismitheoir
983aee310e
tiomantas
047d0370cd
+13
-11
@@ -8,16 +8,18 @@
|
||||
"=== Below test fails in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/85 ===",
|
||||
"Unit_hipFuncSetAttribute_Negative_Parameters",
|
||||
"=== Below test fails in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/215 ===",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - long",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - unsigned long",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - ulong1",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - signed long",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - long1",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_2D - ulong2",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_2D - long2",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_3D - ulong3",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_3D - long3",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_4D - ulong4",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_4D - long4"
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - long",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - unsigned long",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - ulong1",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - signed long",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_1D - long1",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_2D - ulong2",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_2D - long2",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_3D - ulong3",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_3D - long3",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_4D - ulong4",
|
||||
"Unit_ChannelDescriptor_Positive_Basic_4D - long4",
|
||||
"=== Below test fails in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/38 ===",
|
||||
"Unit_hipFreeAsync_negative"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ set(TEST_SRC
|
||||
hipMemAdvise_old.cc
|
||||
hipMemAdvise.cc
|
||||
hipMemRangeGetAttributes.cc
|
||||
hipFreeAsync.cc
|
||||
hipMallocAsync.cc
|
||||
hipStreamAttachMemAsync.cc
|
||||
hipMemRangeGetAttributes_old.cc
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
TEST_CASE("Unit_hipFreeAsync_negative") {
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
void* p = nullptr;
|
||||
hipStream_t stream{nullptr};
|
||||
hipStreamCreate(&stream);
|
||||
|
||||
SECTION("dev_ptr is nullptr") { REQUIRE(hipFreeAsync(nullptr, stream) != hipSuccess); }
|
||||
|
||||
SECTION("invalid stream handle") {
|
||||
HIP_CHECK(hipMallocAsync(static_cast<void**>(&p), 100, stream));
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
hipError_t error = hipFreeAsync(p, reinterpret_cast<hipStream_t>(-1));
|
||||
HIP_CHECK(hipFreeAsync(p, stream));
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
REQUIRE(error != hipSuccess);
|
||||
}
|
||||
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
HIP_CHECK(hipStreamDestroy(stream));
|
||||
}
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir