Skip to content

Commit f7c2a32

Browse files
committed
Fix skipping tests when record&replay is not available
1 parent 174de49 commit f7c2a32

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

unified-runtime/test/adapters/level_zero/v2/batched_queue_test.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,12 @@ struct urBatchedQueueTest : uur::urContextTest {
117117
}
118118
}
119119

120-
void skipIfNoGraphSupport() {
120+
bool isGraphSupported() {
121121
ur_bool_t graph_supported = false;
122-
ASSERT_SUCCESS(urDeviceGetInfo(
122+
auto result = urDeviceGetInfo(
123123
device, UR_DEVICE_INFO_GRAPH_RECORD_AND_REPLAY_SUPPORT_EXP,
124-
sizeof(graph_supported), &graph_supported, nullptr));
125-
126-
if (!graph_supported) {
127-
GTEST_SKIP() << "EXP graph record and replay feature is not supported.";
128-
}
124+
sizeof(graph_supported), &graph_supported, nullptr);
125+
return result == UR_RESULT_SUCCESS && graph_supported;
129126
}
130127

131128
ur_queue_properties_t batched_queue_properties = {
@@ -556,7 +553,9 @@ TEST_P(urBatchedQueueTest, FlushBatchAfterEnqueuedOperationsLimitIsReached) {
556553

557554
// Graph capture is not active by default
558555
TEST_P(urBatchedQueueTest, GraphCaptureActiveReturnsFalseByDefault) {
559-
ASSERT_NO_FATAL_FAILURE(skipIfNoGraphSupport());
556+
if (!isGraphSupported()) {
557+
GTEST_SKIP() << "EXP graph record and replay feature is not supported.";
558+
}
560559

561560
bool isEnabled = false;
562561
ASSERT_SUCCESS(urQueueIsGraphCaptureEnabledExp(queue1, &isEnabled));
@@ -565,7 +564,9 @@ TEST_P(urBatchedQueueTest, GraphCaptureActiveReturnsFalseByDefault) {
565564

566565
// After beginning graph capture, isGraphCaptureActive should return true.
567566
TEST_P(urBatchedQueueTest, GraphCaptureActiveReturnsTrueAfterBeginCapture) {
568-
ASSERT_NO_FATAL_FAILURE(skipIfNoGraphSupport());
567+
if (!isGraphSupported()) {
568+
GTEST_SKIP() << "EXP graph record and replay feature is not supported.";
569+
}
569570

570571
ASSERT_SUCCESS(urQueueBeginGraphCaptureExp(queue1));
571572

@@ -581,7 +582,9 @@ TEST_P(urBatchedQueueTest, GraphCaptureActiveReturnsTrueAfterBeginCapture) {
581582

582583
// After ending graph capture, isGraphCaptureActive should return false again.
583584
TEST_P(urBatchedQueueTest, GraphCaptureActiveReturnsFalseAfterEndCapture) {
584-
ASSERT_NO_FATAL_FAILURE(skipIfNoGraphSupport());
585+
if (!isGraphSupported()) {
586+
GTEST_SKIP() << "EXP graph record and replay feature is not supported.";
587+
}
585588

586589
ASSERT_SUCCESS(urQueueBeginGraphCaptureExp(queue1));
587590

@@ -600,7 +603,9 @@ TEST_P(urBatchedQueueTest, GraphCaptureActiveReturnsFalseAfterEndCapture) {
600603
// list (not the regular batch). Events created for operations on the immediate
601604
// list have no batch generation number (getBatch() == std::nullopt).
602605
TEST_P(urBatchedQueueTest, EnqueueDuringGraphCaptureUsesImmediateList) {
603-
ASSERT_NO_FATAL_FAILURE(skipIfNoGraphSupport());
606+
if (!isGraphSupported()) {
607+
GTEST_SKIP() << "EXP graph record and replay feature is not supported.";
608+
}
604609

605610
ASSERT_SUCCESS(urQueueBeginGraphCaptureExp(queue1));
606611

0 commit comments

Comments
 (0)