Improve coverage of ocloc_api

This change contains ULTs, which test the code
which was not covered.

Related-To: NEO-6834
Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
Patryk Wrobel
2022-04-13 16:11:21 +00:00
committed by Compute-Runtime-Automation
parent 5ea45c52e0
commit 4bebb477d4
4 changed files with 197 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -16,6 +16,12 @@
#include <algorithm>
#include <fstream>
void (*abortOclocExecution)(int) = abortOclocExecutionDefaultHandler;
void abortOclocExecutionDefaultHandler(int errorCode) {
exit(errorCode);
}
void addSlash(std::string &path) {
if (!path.empty()) {
auto lastChar = *path.rbegin();
@ -37,7 +43,9 @@ std::vector<char> readBinaryFile(const std::string &fileName) {
return binary;
} else {
printf("Error! Couldn't open %s\n", fileName.c_str());
exit(1);
abortOclocExecution(1);
return {};
}
}

View File

@ -16,6 +16,10 @@
#include <string>
#include <vector>
extern void (*abortOclocExecution)(int);
void abortOclocExecutionDefaultHandler(int errorCode);
void addSlash(std::string &path);
std::vector<char> readBinaryFile(const std::string &fileName);