2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-22 16:28:27 +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/helpers/file_io.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/program/program.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/helpers/test_files.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_program.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
class ProgramFixture {
|
|
|
|
public:
|
|
|
|
void CreateProgramFromBinary(cl_context context,
|
|
|
|
cl_device_id *pDeviceList,
|
|
|
|
const std::string &binaryFileName,
|
|
|
|
cl_int &retVal,
|
|
|
|
const std::string &options = "");
|
|
|
|
|
|
|
|
void CreateProgramFromBinary(cl_context pContext,
|
|
|
|
cl_device_id *pDeviceList,
|
|
|
|
const std::string &binaryFileName,
|
|
|
|
const std::string &options = "");
|
|
|
|
|
|
|
|
void CreateProgramWithSource(cl_context pContext,
|
|
|
|
cl_device_id *pDeviceList,
|
2020-03-12 14:54:21 +08:00
|
|
|
const std::string &sourceFileName);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void SetUp() {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void TearDown() {
|
|
|
|
Cleanup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Cleanup() {
|
|
|
|
if (pProgram != nullptr) {
|
2019-02-04 20:08:47 +08:00
|
|
|
pProgram->release();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2019-08-29 21:10:51 +08:00
|
|
|
knownSource.reset();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2020-03-13 21:59:00 +08:00
|
|
|
MockProgram *pProgram = nullptr;
|
2019-08-29 21:10:51 +08:00
|
|
|
std::unique_ptr<char[]> knownSource;
|
2020-03-13 21:59:00 +08:00
|
|
|
size_t knownSourceSize = 0u;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|