mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 23:24:53 +08:00
Mock method for reading elf binary file
Change-Id: Ifda051bf93fca6b63c6e99ab9e91740c5049504c
This commit is contained in:
committed by
sys_ocldev
parent
599b79320e
commit
6c521a7936
@@ -26,6 +26,7 @@
|
||||
#include "runtime/compiler_interface/compiler_interface.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/elflib/elf_binary_simulator.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
#include "unit_tests/helpers/kernel_binary_helper.h"
|
||||
|
||||
@@ -113,28 +114,21 @@ TEST_F(clGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledT
|
||||
TEST_F(clGetProgramBuildInfoTests, givenElfBinaryWhenclGetProgramBuildInfoIsCalledThenReturnClBuildNone) {
|
||||
cl_program pProgram = nullptr;
|
||||
cl_int binaryStatus = CL_INVALID_VALUE;
|
||||
void *pBinary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
ASSERT_EQ(true, fileExists(testFile));
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
pBinary);
|
||||
|
||||
ASSERT_NE(0u, binarySize);
|
||||
ASSERT_NE(nullptr, pBinary);
|
||||
CLElfLib::ElfBinaryStorage elfBinary;
|
||||
MockElfBinary(elfBinary);
|
||||
|
||||
const size_t binarySize = elfBinary.size();
|
||||
const unsigned char *elfBinaryTemp = reinterpret_cast<unsigned char *>(elfBinary.data());
|
||||
pProgram = clCreateProgramWithBinary(
|
||||
pContext,
|
||||
num_devices,
|
||||
devices,
|
||||
&binarySize,
|
||||
(const unsigned char **)&pBinary,
|
||||
&elfBinaryTemp,
|
||||
&binaryStatus,
|
||||
&retVal);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, pProgram);
|
||||
EXPECT_EQ(CL_SUCCESS, binaryStatus);
|
||||
@@ -144,8 +138,6 @@ TEST_F(clGetProgramBuildInfoTests, givenElfBinaryWhenclGetProgramBuildInfoIsCall
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(CL_BUILD_NONE, buildStatus);
|
||||
|
||||
deleteDataReadFromFile(pBinary);
|
||||
|
||||
retVal = clReleaseProgram(pProgram);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
CompilerInterface::shutdown();
|
||||
|
||||
Reference in New Issue
Block a user