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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/compiler_interface/compiler_interface.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/fixtures/context_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/fixtures/memory_management_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/fixtures/program_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/helpers/kernel_binary_helper.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
// ProgramFromSource Test Fixture
|
|
|
|
// Used to test the Program class
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
class ProgramFromSourceTest : public ContextFixture,
|
|
|
|
public PlatformFixture,
|
|
|
|
public ProgramFixture,
|
|
|
|
public testing::TestWithParam<std::tuple<const char *, const char *, const char *>> {
|
|
|
|
|
|
|
|
using ContextFixture::SetUp;
|
|
|
|
using PlatformFixture::SetUp;
|
|
|
|
|
|
|
|
protected:
|
2020-03-13 16:17:01 +08:00
|
|
|
void SetUp() override {
|
2017-12-21 07:45:38 +08:00
|
|
|
std::tie(SourceFileName, BinaryFileName, KernelName) = GetParam();
|
|
|
|
kbHelper = new KernelBinaryHelper(BinaryFileName);
|
|
|
|
|
2018-06-26 16:51:01 +08:00
|
|
|
PlatformFixture::SetUp();
|
2020-01-14 21:32:11 +08:00
|
|
|
cl_device_id device = pPlatform->getClDevice(0);
|
2017-12-21 07:45:38 +08:00
|
|
|
ContextFixture::SetUp(1, &device);
|
|
|
|
ProgramFixture::SetUp();
|
|
|
|
|
|
|
|
CreateProgramWithSource(
|
|
|
|
pContext,
|
|
|
|
&device,
|
|
|
|
SourceFileName);
|
|
|
|
}
|
|
|
|
|
2020-03-13 16:17:01 +08:00
|
|
|
void TearDown() override {
|
2019-08-29 21:10:51 +08:00
|
|
|
knownSource.reset();
|
2017-12-21 07:45:38 +08:00
|
|
|
ProgramFixture::TearDown();
|
|
|
|
ContextFixture::TearDown();
|
|
|
|
PlatformFixture::TearDown();
|
|
|
|
delete kbHelper;
|
|
|
|
}
|
|
|
|
|
2020-03-13 16:17:01 +08:00
|
|
|
KernelBinaryHelper *kbHelper = nullptr;
|
|
|
|
const char *SourceFileName = nullptr;
|
|
|
|
const char *BinaryFileName = nullptr;
|
|
|
|
const char *KernelName = nullptr;
|
|
|
|
cl_int retVal = CL_SUCCESS;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|