Skip to content

Commit 65b7501

Browse files
[NFC][SYCL] Convert test-suite/.../in_order_property_trace.cpp to unittest (#7610)
Needed for #7599 as the LIT trace using SYCL_PI_TRACE wouldn't be possible after it due to extra indirection level when passing PI_QUEUE_* flags.
1 parent efadcc6 commit 65b7501

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

sycl/unittests/queue/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ add_sycl_unittest(QueueTests OBJECT
55
Wait.cpp
66
GetProfilingInfo.cpp
77
ShortcutFunctions.cpp
8+
InOrderQueue.cpp
89
)

sycl/unittests/queue/InOrderQueue.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <gtest/gtest.h>
2+
#include <helpers/PiMock.hpp>
3+
#include <sycl/properties/queue_properties.hpp>
4+
#include <sycl/queue.hpp>
5+
6+
using namespace sycl;
7+
8+
static bool InOrderFlagSeen = false;
9+
pi_result piQueueCreateRedefineBefore(pi_context context, pi_device device,
10+
pi_queue_properties properties,
11+
pi_queue *queue) {
12+
InOrderFlagSeen = !(properties & PI_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
13+
return PI_SUCCESS;
14+
}
15+
16+
TEST(InOrderQueue, CheckFlagIsPassed) {
17+
unittest::PiMock Mock;
18+
platform Plt = Mock.getPlatform();
19+
20+
Mock.redefineBefore<detail::PiApiKind::piQueueCreate>(
21+
piQueueCreateRedefineBefore);
22+
23+
EXPECT_FALSE(InOrderFlagSeen);
24+
queue q1{};
25+
EXPECT_FALSE(InOrderFlagSeen);
26+
queue q2{property::queue::in_order{}};
27+
EXPECT_TRUE(InOrderFlagSeen);
28+
}

0 commit comments

Comments
 (0)