SWDEV-306122 - [catch2][dtest] Added test for hipStreamBeginCapture API (#2760)

Change-Id: I9cbd9d05178587883a1a2258ebc2c3516a06d5cc


[ROCm/hip-tests commit: 117f4c484c]
このコミットが含まれているのは:
ROCm CI Service Account authored and GitHub committed 2022-06-24 15:55:59 -07:00
1 親 dbd4c2965f
コミット 205b9ddfde
1ファイル変更
+44 -1
+44 -1
ファイルの表示
@@ -18,7 +18,7 @@ THE SOFTWARE.
*/
/**
Testcase Scenarios :
Testcase Scenarios : Functional
1) Initiate stream capture with different modes on custom stream.
Capture stream sequence and replay the sequence in multiple iterations.
2) End capture and validate that API returns captured graph for
@@ -183,3 +183,46 @@ TEST_CASE("Unit_hipStreamBeginCapture_hipStreamPerThread") {
HIP_CHECK(hipFree(A_d));
HIP_CHECK(hipFree(C_d));
}
/* Test verifies hipStreamBeginCapture API Negative scenarios.
*/
TEST_CASE("Unit_hipStreamBeginCapture_Negative") {
hipError_t ret;
hipStream_t stream{};
HIP_CHECK(hipStreamCreate(&stream));
SECTION("Stream capture on legacy/null stream returns error code.") {
ret = hipStreamBeginCapture(nullptr, hipStreamCaptureModeGlobal);
REQUIRE(hipErrorStreamCaptureUnsupported == ret);
}
SECTION("Capturing hipStream status with same stream again") {
HIP_CHECK(hipStreamBeginCapture(stream, hipStreamCaptureModeGlobal));
ret = hipStreamBeginCapture(stream, hipStreamCaptureModeGlobal);
REQUIRE(hipErrorIllegalState == ret);
}
SECTION("Creating hipStream with invalid mode") {
ret = hipStreamBeginCapture(stream, hipStreamCaptureMode(-1));
REQUIRE(hipErrorInvalidValue == ret);
}
HIP_CHECK(hipStreamDestroy(stream));
}
TEST_CASE("Unit_hipStreamBeginCapture_Basic") {
hipStream_t s1, s2, s3;
HIP_CHECK(hipStreamCreate(&s1));
HIP_CHECK(hipStreamBeginCapture(s1, hipStreamCaptureModeGlobal));
HIP_CHECK(hipStreamCreate(&s2));
HIP_CHECK(hipStreamBeginCapture(s2, hipStreamCaptureModeThreadLocal));
HIP_CHECK(hipStreamCreate(&s3));
HIP_CHECK(hipStreamBeginCapture(s3, hipStreamCaptureModeRelaxed));
HIP_CHECK(hipStreamDestroy(s1));
HIP_CHECK(hipStreamDestroy(s2));
HIP_CHECK(hipStreamDestroy(s3));
}