2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-22 16:28:27 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2019-02-27 18:39:32 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/helpers/queue_helpers.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_event.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
TEST(ReleaseQueueTest, givenCommandQueueWithoutVirtualEventWhenReleaseQueueIsCalledThenCmdQInternalRefCountIsNotDecremented) {
|
|
|
|
cl_int retVal = CL_SUCCESS;
|
|
|
|
MockCommandQueue *cmdQ = new MockCommandQueue;
|
|
|
|
EXPECT_EQ(1, cmdQ->getRefInternalCount());
|
|
|
|
|
|
|
|
EXPECT_EQ(1, cmdQ->getRefInternalCount());
|
|
|
|
|
|
|
|
cmdQ->incRefInternal();
|
|
|
|
EXPECT_EQ(2, cmdQ->getRefInternalCount());
|
|
|
|
|
|
|
|
releaseQueue<CommandQueue>(cmdQ, retVal);
|
|
|
|
|
|
|
|
EXPECT_EQ(1, cmdQ->getRefInternalCount());
|
|
|
|
cmdQ->decRefInternal();
|
|
|
|
}
|