Improve code coverage of BinaryDecoder

This change contains ULTs for BinaryDecoder.
It is intended to improve code coverage.

Related-To: NEO-6834
Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
Patryk Wrobel
2022-04-26 16:43:47 +00:00
committed by Compute-Runtime-Automation
parent e007ba499f
commit e3b1d8b43c
4 changed files with 237 additions and 19 deletions

View File

@@ -44,7 +44,8 @@ int BinaryDecoder::decode() {
auto devBinPtr = getDevBinary();
if (devBinPtr == nullptr) {
argHelper->printf("Error! Device Binary section was not found.\n");
exit(1);
abortOclocExecution(1);
return -1;
}
return processBinary(devBinPtr, ptmFile);
}
@@ -74,7 +75,7 @@ void BinaryDecoder::dumpField(const void *&binaryPtr, const PTField &field, std:
}
default:
argHelper->printf("Error! Unknown size.\n");
exit(1);
abortOclocExecution(1);
}
binaryPtr = ptrOffset(binaryPtr, field.size);
}
@@ -215,28 +216,25 @@ void BinaryDecoder::parseTokens() {
size_t pos = findPos(patchList, "struct SProgramBinaryHeader");
if (pos == patchList.size()) {
argHelper->printf("While parsing patchtoken definitions: couldn't find SProgramBinaryHeader.");
exit(1);
abortOclocExecution(1);
}
pos = findPos(patchList, "enum PATCH_TOKEN");
if (pos == patchList.size()) {
size_t patchTokenEnumPos = findPos(patchList, "enum PATCH_TOKEN");
if (patchTokenEnumPos == patchList.size()) {
argHelper->printf("While parsing patchtoken definitions: couldn't find enum PATCH_TOKEN.");
exit(1);
abortOclocExecution(1);
}
pos = findPos(patchList, "struct SKernelBinaryHeader");
if (pos == patchList.size()) {
argHelper->printf("While parsing patchtoken definitions: couldn't find SKernelBinaryHeader.");
exit(1);
abortOclocExecution(1);
}
pos = findPos(patchList, "struct SKernelBinaryHeaderCommon :");
if (pos == patchList.size()) {
argHelper->printf("While parsing patchtoken definitions: couldn't find SKernelBinaryHeaderCommon.");
exit(1);
}
// Reading all Patch Tokens and according structs
size_t patchTokenEnumPos = findPos(patchList, "enum PATCH_TOKEN");
if (patchTokenEnumPos == patchList.size()) {
exit(1);
abortOclocExecution(1);
}
for (auto i = patchTokenEnumPos + 1; i < patchList.size(); ++i) {
@@ -396,7 +394,7 @@ void BinaryDecoder::processKernel(const void *&ptr, std::ostream &ptmFile) {
if (KernelNameSize == 0) {
argHelper->printf("Error! KernelNameSize was 0.\n");
exit(1);
abortOclocExecution(1);
}
ptmFile << "\tKernelName ";