EXSWHTEC-224 - Test cases ID clean up and documentation for Error Handling (#72)
- Test cases ID clean up and documentation for Error Handling
[ROCm/hip-tests commit: 93751460f7]
This commit is contained in:
@@ -50,6 +50,13 @@ THE SOFTWARE.
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup ErrorTest Error Handling
|
||||
* @{
|
||||
* This section describes tests for the error handling functions of HIP runtime API.
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup ShflTest warp shuffle function Management
|
||||
* @{
|
||||
|
||||
@@ -25,6 +25,26 @@ THE SOFTWARE.
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip/hip_runtime_api.h>
|
||||
|
||||
/**
|
||||
* @addtogroup hipGetErrorName hipGetErrorName
|
||||
* @{
|
||||
* @ingroup ErrorTest
|
||||
* `hipGetErrorName(hipError_t hip_error)` -
|
||||
* Return hip error as text string form.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate that a non-empty string is returned for each supported
|
||||
* device error enumeration.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipGetErrorName.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGetErrorName_Positive_Basic") {
|
||||
const char* error_string = nullptr;
|
||||
const auto enumerator =
|
||||
@@ -36,6 +56,20 @@ TEST_CASE("Unit_hipGetErrorName_Positive_Basic") {
|
||||
REQUIRE(strlen(error_string) > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate handling of invalid arguments:
|
||||
* -# When error enumerator is invalid (-1)
|
||||
* - AMD expected output: return "hipErrorUnknown"
|
||||
* - NVIDIA expected output: return "cudaErrorUnknown"
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipGetErrorName.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGetErrorName_Negative_Parameters") {
|
||||
const char* error_string = hipGetErrorName(static_cast<hipError_t>(-1));
|
||||
REQUIRE(error_string != nullptr);
|
||||
|
||||
@@ -24,6 +24,26 @@ THE SOFTWARE.
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip/hip_runtime_api.h>
|
||||
|
||||
/**
|
||||
* @addtogroup hipGetErrorString hipGetErrorString
|
||||
* @{
|
||||
* @ingroup ErrorTest
|
||||
* `hipGetErrorString(hipError_t hipError)` -
|
||||
* Return handy text string message to explain the error which occurred.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate that a non-empty string is returned for each supported
|
||||
* device error enumeration.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipGetErrorString.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGetErrorString_Positive_Basic") {
|
||||
const char* error_string = nullptr;
|
||||
const auto enumerator =
|
||||
@@ -35,6 +55,19 @@ TEST_CASE("Unit_hipGetErrorString_Positive_Basic") {
|
||||
REQUIRE(strlen(error_string) > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate handling of invalid arguments:
|
||||
* -# When error enumerator is invalid (-1)
|
||||
* - Expected output: do not return `nullptr`
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipGetErrorString.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGetErrorString_Negative_Parameters") {
|
||||
const char* error_string = hipGetErrorString(static_cast<hipError_t>(-1));
|
||||
REQUIRE(error_string != nullptr);
|
||||
|
||||
@@ -24,6 +24,27 @@ THE SOFTWARE.
|
||||
#include <hip/hip_runtime_api.h>
|
||||
#include <threaded_zig_zag_test.hh>
|
||||
|
||||
/**
|
||||
* @addtogroup hipGetLastError hipGetLastError
|
||||
* @{
|
||||
* @ingroup ErrorTest
|
||||
* `hipGetLastError(void)` -
|
||||
* Return last error returned by any HIP runtime API call and resets the stored error code to
|
||||
* `hipSuccess`.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate that `hipErrorInvalidValue` is returned after invalid `hipMalloc` call.
|
||||
* - Validate that `hipSuccess` is returned afterwards.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipGetLastError.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGetLastError_Positive_Basic") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMalloc(nullptr, 1), hipErrorInvalidValue);
|
||||
@@ -31,6 +52,18 @@ TEST_CASE("Unit_hipGetLastError_Positive_Basic") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate that appropriate error is returned when working with multiple threads.
|
||||
* - Cause error on purpose within one of the threads.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipGetLastError.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGetLastError_Positive_Threaded") {
|
||||
class HipGetLastErrorThreadedTest : public ThreadedZigZagTest<HipGetLastErrorThreadedTest> {
|
||||
public:
|
||||
|
||||
@@ -24,6 +24,26 @@ THE SOFTWARE.
|
||||
#include <hip/hip_runtime_api.h>
|
||||
#include <threaded_zig_zag_test.hh>
|
||||
|
||||
/**
|
||||
* @addtogroup hipPeekAtLastError hipPeekAtLastError
|
||||
* @{
|
||||
* @ingroup ErrorTest
|
||||
* `hipPeekAtLastError(void)` -
|
||||
* Return last error returned by any HIP runtime API call.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate that `hipErrorInvalidValue` is returned after invalid `hipMalloc` call.
|
||||
* - Validate that `hipSuccess` is returned again for getting the last error.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipPeekAtLastError.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipPeekAtLastError_Positive_Basic") {
|
||||
HIP_CHECK(hipPeekAtLastError());
|
||||
HIP_CHECK_ERROR(hipMalloc(nullptr, 1), hipErrorInvalidValue);
|
||||
@@ -32,6 +52,19 @@ TEST_CASE("Unit_hipPeekAtLastError_Positive_Basic") {
|
||||
HIP_CHECK(hipPeekAtLastError());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Validate that appropriate error is returned when working with multiple threads.
|
||||
* - Validate that appropriate error is returned for getting the last erro when working with multiple threads.
|
||||
* - Cause error on purpose within one of the threads.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/errorHandling/hipPeekAtLastError.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipPeekAtLastError_Positive_Threaded") {
|
||||
class HipPeekAtLastErrorTest : public ThreadedZigZagTest<HipPeekAtLastErrorTest> {
|
||||
public:
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user