2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-01-14 21:32:11 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cl_api_tests.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-03-18 20:08:45 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
2020-03-04 22:28:58 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_device.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-01-26 23:53:18 +08:00
|
|
|
|
|
|
|
void api_fixture_using_aligned_memory_manager::SetUp() {
|
|
|
|
retVal = CL_SUCCESS;
|
|
|
|
retSize = 0;
|
|
|
|
|
2020-01-14 21:32:11 +08:00
|
|
|
device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockAlignedMallocManagerDevice>(*platformDevices)};
|
|
|
|
cl_device_id deviceId = device;
|
2018-01-26 23:53:18 +08:00
|
|
|
|
2020-01-14 21:32:11 +08:00
|
|
|
context = Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal);
|
2018-01-26 23:53:18 +08:00
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
Context *ctxPtr = reinterpret_cast<Context *>(context);
|
|
|
|
|
2020-03-04 22:28:58 +08:00
|
|
|
commandQueue = new MockCommandQueue(context, device, 0);
|
2018-01-26 23:53:18 +08:00
|
|
|
|
2020-02-20 15:12:44 +08:00
|
|
|
program = new MockProgram(*device->getExecutionEnvironment(), ctxPtr, false, &device->getDevice());
|
2018-01-26 23:53:18 +08:00
|
|
|
Program *prgPtr = reinterpret_cast<Program *>(program);
|
|
|
|
|
2020-01-14 21:32:11 +08:00
|
|
|
kernel = new MockKernel(prgPtr, program->mockKernelInfo, *device);
|
2018-01-26 23:53:18 +08:00
|
|
|
ASSERT_NE(nullptr, kernel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void api_fixture_using_aligned_memory_manager::TearDown() {
|
|
|
|
delete kernel;
|
|
|
|
delete commandQueue;
|
|
|
|
context->release();
|
|
|
|
program->release();
|
|
|
|
delete device;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|