2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 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
|
|
|
*
|
|
|
|
*/
|
2018-09-18 15:11:08 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "test.h"
|
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
|
|
|
|
|
|
|
class ScenarioTest : public ::testing::Test,
|
2018-04-17 03:54:19 +08:00
|
|
|
public PlatformFixture {
|
2017-12-21 07:45:38 +08:00
|
|
|
using PlatformFixture::SetUp;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void SetUp() override {
|
2018-11-27 15:28:58 +08:00
|
|
|
DebugManager.flags.EnableTimestampPacket.set(false);
|
2018-06-26 16:51:01 +08:00
|
|
|
PlatformFixture::SetUp();
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-01-14 21:32:11 +08:00
|
|
|
auto pDevice = pPlatform->getClDevice(0);
|
2017-12-21 07:45:38 +08:00
|
|
|
ASSERT_NE(nullptr, pDevice);
|
|
|
|
|
|
|
|
cl_device_id clDevice = pDevice;
|
2020-01-14 21:32:11 +08:00
|
|
|
context = Context::create<MockContext>(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal);
|
2017-12-21 07:45:38 +08:00
|
|
|
commandQueue = new MockCommandQueue(context, pDevice, 0);
|
2020-10-16 21:00:28 +08:00
|
|
|
program = new MockProgram(context, false, toClDeviceVector(*pDevice));
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
kernelInternals = new MockKernelWithInternals(*pDevice, context);
|
|
|
|
kernel = kernelInternals->mockKernel;
|
|
|
|
|
|
|
|
ASSERT_NE(nullptr, kernel);
|
|
|
|
}
|
|
|
|
void TearDown() override {
|
|
|
|
delete kernelInternals;
|
|
|
|
delete commandQueue;
|
|
|
|
context->release();
|
|
|
|
program->release();
|
|
|
|
|
|
|
|
PlatformFixture::TearDown();
|
|
|
|
}
|
|
|
|
|
|
|
|
cl_int retVal;
|
2018-11-27 15:28:58 +08:00
|
|
|
DebugManagerStateRestore dbgRestorer;
|
2017-12-21 07:45:38 +08:00
|
|
|
MockCommandQueue *commandQueue = nullptr;
|
|
|
|
MockContext *context = nullptr;
|
|
|
|
MockKernelWithInternals *kernelInternals = nullptr;
|
|
|
|
MockKernel *kernel = nullptr;
|
|
|
|
MockProgram *program = nullptr;
|
|
|
|
};
|