EXSWHTEC-24 - Fix issues and refactor code in Stream Management tests (#2916)
- Fix bug in calculation of normal priority in Unit_hipStreamGetPriority_StreamsWithCUMask tests - Delete duplicate test Unit_hipStreamGetPriority_InvalidPriorityPointer - Separate Unit_hipStreamAddCallback_ParamTst into positive and negative test - Remove Unit_hipStreamDestroy_Negative_DoubleDestroy test for Nvidia devices due to error
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
26d316a250
Коммит
968e21cd1f
@@ -161,16 +161,52 @@ using hipStreaAddCallbackTest::Callback_ChkStreamValue;
|
||||
/*
|
||||
* Validates parameter list of hipStreamAddCallback.
|
||||
*/
|
||||
TEST_CASE("Unit_hipStreamAddCallback_ParamTst") {
|
||||
TEST_CASE("Unit_hipStreamAddCallback_ParamTst_Positive") {
|
||||
hipStream_t mystream;
|
||||
HIP_CHECK(hipStreamCreate(&mystream));
|
||||
|
||||
// Scenario1
|
||||
SECTION("callback is nullptr") {
|
||||
SECTION("userData pointer value validation") {
|
||||
gstream = mystream;
|
||||
gusrptr = ptr0xff;
|
||||
gPassed = true;
|
||||
gcbDone = false;
|
||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkUsrdataPtr,
|
||||
gusrptr, 0));
|
||||
while (!gcbDone) {
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||
}
|
||||
REQUIRE(gPassed);
|
||||
}
|
||||
// Scenario2
|
||||
SECTION("stream value validation") {
|
||||
gstream = mystream;
|
||||
gPassed = true;
|
||||
gcbDone = false;
|
||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkStreamValue,
|
||||
nullptr, 0));
|
||||
while (!gcbDone) {
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||
}
|
||||
REQUIRE(gPassed);
|
||||
}
|
||||
HIP_CHECK(hipStreamDestroy(mystream));
|
||||
}
|
||||
|
||||
/*
|
||||
* Negative tests for validation of hipStreamAddCallback parameter list.
|
||||
*/
|
||||
TEST_CASE("Unit_hipStreamAddCallback_ParamTst_Negative") {
|
||||
hipStream_t mystream;
|
||||
HIP_CHECK(hipStreamCreate(&mystream));
|
||||
|
||||
// Scenario1
|
||||
SECTION("callback is nullptr for non-default stream") {
|
||||
REQUIRE_FALSE(hipSuccess == hipStreamAddCallback(mystream, nullptr,
|
||||
nullptr, 0));
|
||||
}
|
||||
// Scenario2
|
||||
SECTION("stream is default") {
|
||||
SECTION("callback is nullptr for default stream") {
|
||||
REQUIRE_FALSE(hipSuccess == hipStreamAddCallback(0, nullptr,
|
||||
nullptr, 0));
|
||||
}
|
||||
@@ -184,31 +220,6 @@ TEST_CASE("Unit_hipStreamAddCallback_ParamTst") {
|
||||
REQUIRE_FALSE(hipSuccess == hipStreamAddCallback(0, Callback,
|
||||
nullptr, 10));
|
||||
}
|
||||
// Scenario5
|
||||
SECTION("userData pointer value validation") {
|
||||
gstream = mystream;
|
||||
gusrptr = ptr0xff;
|
||||
gPassed = true;
|
||||
gcbDone = false;
|
||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkUsrdataPtr,
|
||||
gusrptr, 0));
|
||||
while (!gcbDone) {
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||
}
|
||||
REQUIRE_FALSE(!gPassed);
|
||||
}
|
||||
// Scenario6
|
||||
SECTION("stream value validation") {
|
||||
gstream = mystream;
|
||||
gPassed = true;
|
||||
gcbDone = false;
|
||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkStreamValue,
|
||||
nullptr, 0));
|
||||
while (!gcbDone) {
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||
}
|
||||
REQUIRE_FALSE(!gPassed);
|
||||
}
|
||||
HIP_CHECK(hipStreamDestroy(mystream));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,16 +29,6 @@ priority should be clamped to the priority range.
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
/**
|
||||
* Check the error returned when an invalid pointer to a priority is used.
|
||||
*/
|
||||
TEST_CASE("Unit_hipStreamGetPriority_InvalidPriorityPointer") {
|
||||
hipStream_t stream{};
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
HIP_CHECK_ERROR(hipStreamGetPriority(stream, nullptr), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipStreamDestroy(stream));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create stream and check priority.
|
||||
*/
|
||||
@@ -145,7 +135,7 @@ TEST_CASE("Unit_hipStreamGetPriority_StreamsWithCUMask") {
|
||||
int priority_high = 0;
|
||||
// Test is to get the Stream Priority Range
|
||||
HIP_CHECK(hipDeviceGetStreamPriorityRange(&priority_low, &priority_high));
|
||||
priority_normal = priority_low + priority_high;
|
||||
priority_normal = (priority_low + priority_high) / 2;
|
||||
// Check if priorities are indeed supported
|
||||
REQUIRE_FALSE(priority_low == priority_high);
|
||||
// Creating a stream with hipExtStreamCreateWithCUMask and checking
|
||||
|
||||
Ссылка в новой задаче
Block a user