Files
compute-runtime/opencl/test/unit_test/fixtures/program_fixture.h
Mateusz Jablonski 8afdb2d981 Correct clCreateProgramWithBinary
store proper devices
validate input devices, lengths and binary
return correct binaries

Related-To: NEO-5001
Change-Id: I3822c291a4430e64afe54f1486b0014f16de3d64
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2020-10-22 08:38:24 +02:00

56 lines
1.5 KiB
C++

/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/file_io.h"
#include "shared/test/unit_test/helpers/test_files.h"
#include "opencl/source/program/program.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
#include "gtest/gtest.h"
namespace NEO {
class ProgramFixture {
public:
void CreateProgramFromBinary(Context *pContext,
const ClDeviceVector &deviceVector,
const std::string &binaryFileName,
cl_int &retVal,
const std::string &options = "");
void CreateProgramFromBinary(Context *pContext,
const ClDeviceVector &deviceVector,
const std::string &binaryFileName,
const std::string &options = "");
void CreateProgramWithSource(cl_context pContext,
cl_device_id *pDeviceList,
const std::string &sourceFileName);
protected:
virtual void SetUp() {
}
virtual void TearDown() {
Cleanup();
}
void Cleanup() {
if (pProgram != nullptr) {
pProgram->release();
}
knownSource.reset();
}
MockProgram *pProgram = nullptr;
std::unique_ptr<char[]> knownSource;
size_t knownSourceSize = 0u;
};
} // namespace NEO