CMake: correct test kernels naming + minor improvements

- For test kernels compiled with options passed, change their naming to
following convention:
{basename}_{options_passed}_{suffix}.
- Correct CMake variables naming.
- Refactor logic of retrieving test kernels' data (also in compilers
mock)
- In relation to previous changes: do not generate unnecessary
.gen binary for L0 test kernel

Related-To: NEO-7285
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
Kacper Nowak
2022-08-31 19:16:06 +00:00
committed by Compute-Runtime-Automation
parent ceff16084d
commit b41eed8438
8 changed files with 76 additions and 55 deletions

View File

@@ -420,30 +420,41 @@ void translate(bool usingIgc, CIF::Builtins::BufferSimple *src, CIF::Builtins::B
}
}
std::string inputFile = "";
inputFile.append(debugVars.fileName);
std::string debugFile;
auto pos = inputFile.rfind(".");
debugFile = inputFile.substr(0, pos);
debugFile.append(".dbg");
if (debugVars.appendOptionsToFileName &&
options->GetSizeRaw()) {
std::string opts(options->GetMemory<char>(), options->GetMemory<char>() + options->GetSize<char>());
// handle special option "-create-library" - just erase it
size_t pos = opts.find(CompilerOptions::createLibrary.data(), 0);
if (pos != std::string::npos) {
opts.erase(pos, CompilerOptions::createLibrary.length());
std::string inputFile{}, debugFile{};
std::string opts(options->GetMemory<char>(), options->GetMemory<char>() + options->GetSize<char>());
if (false == debugVars.fileName.empty()) {
auto fileBaseName = debugVars.fileName;
auto pos = debugVars.fileName.rfind(".");
auto extension = debugVars.fileName.substr(pos, debugVars.fileName.length());
if (false == debugVars.fileNameSuffix.empty()) {
pos = debugVars.fileName.rfind(debugVars.fileNameSuffix);
}
std::replace(opts.begin(), opts.end(), ' ', '_');
inputFile.append(opts);
fileBaseName = fileBaseName.substr(0, pos);
if (debugVars.debugDataToReturn == nullptr) {
debugFile.append(opts);
if (debugVars.appendOptionsToFileName && false == opts.empty()) {
// handle special option "-create-library" - just erase it
auto optPos = opts.find(CompilerOptions::createLibrary.data(), 0);
if (optPos != std::string::npos) {
opts.erase(optPos, CompilerOptions::createLibrary.length());
}
std::replace(opts.begin(), opts.end(), ' ', '_');
}
inputFile.append(fileBaseName);
debugFile.append(fileBaseName);
if (debugVars.appendOptionsToFileName && false == opts.empty()) {
auto optString = opts + "_";
inputFile.append(optString);
debugFile.append(optString);
}
if (false == debugVars.fileNameSuffix.empty()) {
inputFile.append(debugVars.fileNameSuffix);
debugFile.append(debugVars.fileNameSuffix);
}
inputFile.append(extension);
debugFile.append(".dbg");
}
if ((debugVars.binaryToReturn != nullptr) || (debugVars.binaryToReturnSize != 0)) {
out->setOutput(debugVars.binaryToReturn, debugVars.binaryToReturnSize);
} else {