Fixing regression in progvar_prog_scope_init

Change-Id: I20424ce9e0c9a295bb8b9d5608252c3d4802e9da
This commit is contained in:
Chodor, Jaroslaw
2019-07-12 13:34:54 +02:00
committed by sys_ocldev
parent f7e04a897b
commit ab74b606e9
2 changed files with 47 additions and 30 deletions

View File

@@ -43,7 +43,6 @@ class ProgramDataTestBase : public testing::Test,
void buildAndDecodeProgramPatchList();
protected:
void SetUp() override {
PlatformFixture::SetUp();
cl_device_id device = pPlatform->getDevice(0);
@@ -120,6 +119,8 @@ class ProgramDataTestBase : public testing::Test,
SProgramBinaryHeader programBinaryHeader;
void *pProgramPatchList;
uint32_t programPatchListSize;
cl_int patchlistDecodeErrorCode = 0;
bool allowDecodeFailure = false;
};
template <typename ProgramType>
@@ -153,7 +154,10 @@ void ProgramDataTestBase<ProgramType>::buildAndDecodeProgramPatchList() {
pProgram->storeGenBinary(pProgramData, headerSize + programBinaryHeader.PatchListSize);
error = pProgram->processGenBinary();
EXPECT_EQ(CL_SUCCESS, error);
patchlistDecodeErrorCode = error;
if (allowDecodeFailure == false) {
EXPECT_EQ(CL_SUCCESS, error);
}
delete[] pProgramData;
}
@@ -363,8 +367,11 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
pProgramPatchList = (void *)pGlobalPointer;
programPatchListSize = globalPointer.Size;
this->allowDecodeFailure = true;
buildAndDecodeProgramPatchList();
EXPECT_EQ(nullptr, pProgram->getGlobalSurface());
EXPECT_EQ(CL_INVALID_BINARY, this->patchlistDecodeErrorCode);
this->allowDecodeFailure = false;
delete[] pGlobalPointer;
@@ -552,8 +559,11 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) {
pProgramPatchList = (void *)pConstantPointer;
programPatchListSize = constantPointer.Size;
this->allowDecodeFailure = true;
buildAndDecodeProgramPatchList();
EXPECT_EQ(nullptr, pProgram->getConstantSurface());
EXPECT_EQ(CL_INVALID_BINARY, this->patchlistDecodeErrorCode);
this->allowDecodeFailure = false;
delete[] pConstantPointer;