Skip to content

Commit 1fd6d4b

Browse files
committed
Check context before popping in cudaMemoryTest.
1 parent 109800c commit 1fd6d4b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/adapters/cuda/memory_tests.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ TEST_P(cudaMemoryTest, urMemBufferNoActiveContext) {
1414
constexpr size_t memSize = 1024u;
1515

1616
CUcontext current = nullptr;
17-
do {
17+
ASSERT_SUCCESS_CUDA(cuCtxGetCurrent(&current));
18+
while (current != nullptr) {
1819
CUcontext oldContext = nullptr;
1920
ASSERT_SUCCESS_CUDA(cuCtxPopCurrent(&oldContext));
2021
ASSERT_SUCCESS_CUDA(cuCtxGetCurrent(&current));
21-
} while (current != nullptr);
22+
}
2223

2324
uur::raii::Mem mem;
2425
ASSERT_SUCCESS(urMemBufferCreate(context, UR_MEM_FLAG_READ_WRITE, memSize,

0 commit comments

Comments
 (0)