53 lines
2.1 KiB
C++
53 lines
2.1 KiB
C++
/*
|
|
* Copyright (C) 2018 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "unit_tests/fixtures/execution_model_kernel_fixture.h"
|
|
#include "unit_tests/mocks/mock_device.h"
|
|
#include "unit_tests/mocks/mock_kernel.h"
|
|
#include "unit_tests/mocks/mock_program.h"
|
|
#include "test.h"
|
|
|
|
#include <memory>
|
|
|
|
using namespace OCLRT;
|
|
|
|
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) {
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
|
MockProgram program(*device->getExecutionEnvironment());
|
|
program.enableKernelDebug();
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockDebugKernel>(*device.get(), &program));
|
|
|
|
EXPECT_EQ(0, kernel->getDebugSurfaceBti());
|
|
}
|
|
|
|
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenCorrectValueIsReturned) {
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
|
MockProgram program(*device->getExecutionEnvironment());
|
|
program.enableKernelDebug();
|
|
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*device.get(), &program));
|
|
|
|
EXPECT_EQ(MockDebugKernel::perThreadSystemThreadSurfaceSize, kernel->getPerThreadSystemThreadSurfaceSize());
|
|
}
|
|
|
|
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledThenInvalidIndexValueIsReturned) {
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
|
MockProgram program(*device->getExecutionEnvironment());
|
|
program.enableKernelDebug();
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(*device.get(), &program));
|
|
|
|
EXPECT_EQ(-1, kernel->getDebugSurfaceBti());
|
|
}
|
|
|
|
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenZeroIsReturned) {
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
|
MockProgram program(*device->getExecutionEnvironment());
|
|
program.enableKernelDebug();
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(*device.get(), &program));
|
|
|
|
EXPECT_EQ(0u, kernel->getPerThreadSystemThreadSurfaceSize());
|
|
}
|