mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
refactor: ocloc - folding error codes to lib api header
These error codes are used as return codes from ocloc api. As such, it's useful to have them defined in the ocloc api header. Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8a66ac7097
commit
49edbc3b60
@@ -52,7 +52,7 @@ struct MockZebinDecoder : public NEO::Zebin::Manipulator::ZebinDecoder<numBits>
|
||||
|
||||
bool callBaseGetIntelGTNotes = false;
|
||||
bool callBaseDecodeZebin = false;
|
||||
ErrorCode returnValueDecodeZebin = NEO::OclocErrorCode::SUCCESS;
|
||||
ErrorCode returnValueDecodeZebin = OCLOC_SUCCESS;
|
||||
std::vector<NEO::Zebin::Manipulator::SectionInfo> returnValueDumpElfSections;
|
||||
std::vector<NEO::Zebin::Elf::IntelGTNote> returnValueGetIntelGTNotes;
|
||||
bool getIntelGTNotesCalled = false;
|
||||
|
||||
@@ -76,9 +76,9 @@ struct MockZebinEncoder : public NEO::Zebin::Manipulator::ZebinEncoder<numBits>
|
||||
|
||||
MockIgaWrapper *mockIga;
|
||||
std::vector<NEO::Zebin::Elf::IntelGTNote> retValGetIntelGTNotes;
|
||||
ErrorCode retValLoadSectionsInfo = NEO::OclocErrorCode::SUCCESS;
|
||||
ErrorCode retValCheckIfAllFilesExist = NEO::OclocErrorCode::SUCCESS;
|
||||
ErrorCode retValAppendSections = NEO::OclocErrorCode::SUCCESS;
|
||||
ErrorCode retValLoadSectionsInfo = OCLOC_SUCCESS;
|
||||
ErrorCode retValCheckIfAllFilesExist = OCLOC_SUCCESS;
|
||||
ErrorCode retValAppendSections = OCLOC_SUCCESS;
|
||||
bool callBaseGetIntelGTNotesSection = false;
|
||||
bool callBaseGetIntelGTNotes = false;
|
||||
bool callBaseLoadSectionsInfo = false;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "shared/offline_compiler/source/decoder/zebin_manipulator.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/source/device_binary_format/elf/elf.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
@@ -132,7 +131,7 @@ TEST(ZebinManipulatorTests, GivenValidZebinWhenItIsDisassembledAndAssembledBackT
|
||||
numSources, dataSources, lenSources, nameSources,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
&disasmNumOutputs, &disasmDataOutputs, &disasmLenOutputs, &disasmNameOutputs);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
|
||||
// Assemble
|
||||
std::array asmArgs = {
|
||||
@@ -150,7 +149,7 @@ TEST(ZebinManipulatorTests, GivenValidZebinWhenItIsDisassembledAndAssembledBackT
|
||||
disasmNumOutputs, const_cast<const uint8_t **>(disasmDataOutputs), disasmLenOutputs, (const char **)disasmNameOutputs,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
&asmNumOutputs, &asmDataOutputs, &asmLenOutputs, &asmNameOutputs);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
|
||||
// Check
|
||||
ArrayRef<uint8_t> rebuiltZebin(asmDataOutputs[0], static_cast<size_t>(asmLenOutputs[0]));
|
||||
@@ -188,7 +187,7 @@ TEST_F(ZebinManipulatorValidateInputTests, GivenValidInputWhenValidatingInputThe
|
||||
"-skip-asm-translation"};
|
||||
|
||||
auto retVal = NEO::Zebin::Manipulator::validateInput(args, &iga, &argHelper, arguments);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
|
||||
EXPECT_EQ("zebin.bin", arguments.binaryFile);
|
||||
EXPECT_EQ("./dump/", arguments.pathToDump);
|
||||
@@ -202,7 +201,7 @@ TEST_F(ZebinManipulatorValidateInputTests, GivenHelpArgumentWhenValidatingInputT
|
||||
"asm/disasm",
|
||||
"--help"};
|
||||
auto retVal = NEO::Zebin::Manipulator::validateInput(args, &iga, &argHelper, arguments);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_TRUE(arguments.showHelp);
|
||||
}
|
||||
|
||||
@@ -215,7 +214,7 @@ TEST_F(ZebinManipulatorValidateInputTests, GivenInvalidInputWhenValidatingInputT
|
||||
auto retVal = NEO::Zebin::Manipulator::validateInput(args, &iga, &argHelper, arguments);
|
||||
const auto output{testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ("Unknown argument -unknown_arg\n", output);
|
||||
}
|
||||
|
||||
@@ -229,7 +228,7 @@ TEST_F(ZebinManipulatorValidateInputTests, GivenMissingFileWhenValidatingInputTh
|
||||
auto retVal = NEO::Zebin::Manipulator::validateInput(args, &iga, &argHelper, arguments);
|
||||
const auto output{testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ("Error: Missing -file argument\n", output);
|
||||
}
|
||||
|
||||
@@ -243,7 +242,7 @@ TEST_F(ZebinManipulatorValidateInputTests, GivenMissingSecondPartOfTheArgumentWh
|
||||
auto retVal = NEO::Zebin::Manipulator::validateInput(args, &iga, &argHelper, arguments);
|
||||
const auto output{testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
const auto expectedOutput = "Unknown argument " + std::string(halfArg) + "\n";
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
}
|
||||
@@ -258,7 +257,7 @@ TEST_F(ZebinManipulatorValidateInputTests, GivenValidArgsButDumpNotSpecifiedWhen
|
||||
auto retVal = NEO::Zebin::Manipulator::validateInput(args, &iga, &argHelper, arguments);
|
||||
const auto output{testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_EQ("Warning: Path to dump -dump not specified. Using \"./dump/\" as dump folder.\n", output);
|
||||
}
|
||||
|
||||
@@ -271,7 +270,7 @@ TEST(ZebinManipulatorTests, GivenIntelGTNotesWithProductFamilyWhenParsingIntelGT
|
||||
|
||||
auto iga = std::make_unique<MockIgaWrapper>();
|
||||
auto retVal = NEO::Zebin::Manipulator::parseIntelGTNotesSectionForDevice(intelGTnotes, iga.get(), nullptr);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_TRUE(iga->setProductFamilyWasCalled);
|
||||
}
|
||||
|
||||
@@ -284,7 +283,7 @@ TEST(ZebinManipulatorTests, GivenIntelGTNotesWithGfxCoreFamilyWhenParsingIntelGT
|
||||
|
||||
auto iga = std::make_unique<MockIgaWrapper>();
|
||||
auto retVal = NEO::Zebin::Manipulator::parseIntelGTNotesSectionForDevice(intelGTnotes, iga.get(), nullptr);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_TRUE(iga->setGfxCoreWasCalled);
|
||||
}
|
||||
|
||||
@@ -302,7 +301,7 @@ TEST(ZebinManipulatorTests, GivenIntelGTNotesWithValidProductConfigWhenParsingIn
|
||||
|
||||
auto iga = std::make_unique<MockIgaWrapper>();
|
||||
auto retVal = NEO::Zebin::Manipulator::parseIntelGTNotesSectionForDevice(intelGTnotes, iga.get(), &argHelper);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_TRUE(iga->setProductFamilyWasCalled);
|
||||
}
|
||||
|
||||
@@ -319,7 +318,7 @@ TEST(ZebinManipulatorTests, GivenIntelGTNotesWithInvalidProductConfigWhenParsing
|
||||
|
||||
auto iga = std::make_unique<MockIgaWrapper>();
|
||||
auto retVal = NEO::Zebin::Manipulator::parseIntelGTNotesSectionForDevice(intelGTnotes, iga.get(), &argHelper);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_DEVICE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
TEST(ZebinManipulatorTests, GivenIntelGTNotesWithoutProductFamilyOrGfxCoreFamilyEntryWhenParsingIntelGTNoteSectionsForDeviceThenReturnError) {
|
||||
@@ -327,7 +326,7 @@ TEST(ZebinManipulatorTests, GivenIntelGTNotesWithoutProductFamilyOrGfxCoreFamily
|
||||
|
||||
auto iga = std::make_unique<MockIgaWrapper>();
|
||||
auto retVal = NEO::Zebin::Manipulator::parseIntelGTNotesSectionForDevice(intelGTnotes, iga.get(), nullptr);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_DEVICE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
TEST(ZebinManipulatorTests, GivenNonZebinBinaryWhenGetBinaryFormatForDisassembleThenReturnPatchTokensFormat) {
|
||||
@@ -370,7 +369,7 @@ struct ZebinDecoderFixture {
|
||||
|
||||
using ZebinDecoderTests = Test<ZebinDecoderFixture<NEO::Elf::EI_CLASS_64>>;
|
||||
TEST_F(ZebinDecoderTests, GivenErrorWhenDecodingZebinWhenDecodeThenErrorIsReturned) {
|
||||
decoder.returnValueDecodeZebin = NEO::OclocErrorCode::INVALID_FILE;
|
||||
decoder.returnValueDecodeZebin = OCLOC_INVALID_FILE;
|
||||
const auto retVal = decoder.decode();
|
||||
EXPECT_EQ(decoder.returnValueDecodeZebin, retVal);
|
||||
EXPECT_EQ("Error while decoding zebin.\n", getOutput());
|
||||
@@ -379,7 +378,7 @@ TEST_F(ZebinDecoderTests, GivenErrorWhenDecodingZebinWhenDecodeThenErrorIsReturn
|
||||
TEST_F(ZebinDecoderTests, GivenNoIntelGTNotesWhenDecodeThenErrorIsReturned) {
|
||||
decoder.returnValueGetIntelGTNotes = {};
|
||||
const auto retVal = decoder.decode();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
EXPECT_EQ("Error missing or invalid Intel GT Notes section.\n", getOutput());
|
||||
}
|
||||
|
||||
@@ -391,7 +390,7 @@ TEST_F(ZebinDecoderTests, GivenInvalidIntelGTNotesWhenDecodeThenErrorIsReturned)
|
||||
decoder.returnValueGetIntelGTNotes[0].data = ArrayRef<const uint8_t>::fromAny(zebinVersion.data(), zebinVersion.length());
|
||||
|
||||
const auto retVal = decoder.decode();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_DEVICE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_DEVICE, retVal);
|
||||
EXPECT_EQ("Error while parsing Intel GT Notes section for device.\n", getOutput());
|
||||
}
|
||||
|
||||
@@ -439,7 +438,7 @@ TEST_F(ZebinDecoderTests, GivenSkipIGADisassemblyWhenDecodeThenDoNotParseIntelGT
|
||||
decoder.arguments.skipIGAdisassembly = true;
|
||||
|
||||
const auto retVal = decoder.decode();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_FALSE(decoder.callBaseDecodeZebin);
|
||||
}
|
||||
|
||||
@@ -451,7 +450,7 @@ TEST_F(ZebinDecoderTests, GivenNoFailsWhenDecodeThenSuccessIsReturned) {
|
||||
decoder.returnValueGetIntelGTNotes[0].data = ArrayRef<const uint8_t>::fromAny(&productFamily, 1U);
|
||||
|
||||
const auto retVal = decoder.decode();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(ZebinDecoderTests, GivenInvalidZebinWhenDecodeZebinThenErrorIsReturned) {
|
||||
@@ -459,7 +458,7 @@ TEST_F(ZebinDecoderTests, GivenInvalidZebinWhenDecodeZebinThenErrorIsReturned) {
|
||||
uint8_t invalidFile[16] = {0};
|
||||
NEO::Elf::Elf<NEO::Elf::EI_CLASS_64> elf;
|
||||
const auto retVal = decoder.decodeZebin(ArrayRef<const uint8_t>::fromAny(invalidFile, 16), elf);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
EXPECT_EQ("decodeElf error: Invalid or missing ELF header\n", getOutput());
|
||||
}
|
||||
|
||||
@@ -517,14 +516,14 @@ struct ZebinEncoderFixture {
|
||||
|
||||
using ZebinEncoderTests = Test<ZebinEncoderFixture<NEO::Elf::EI_CLASS_64>>;
|
||||
TEST_F(ZebinEncoderTests, GivenErrorOnLoadSectionsInfoWhenEncodeThenErrorIsReturned) {
|
||||
encoder.retValLoadSectionsInfo = NEO::OclocErrorCode::INVALID_FILE;
|
||||
encoder.retValLoadSectionsInfo = OCLOC_INVALID_FILE;
|
||||
auto retVal = encoder.encode();
|
||||
EXPECT_EQ(encoder.retValLoadSectionsInfo, retVal);
|
||||
EXPECT_EQ("Error while loading sections file.\n", getOutput());
|
||||
}
|
||||
|
||||
TEST_F(ZebinEncoderTests, GivenErrorOnCheckIfAllFilesExistWhenEncodeThenErrorIsReturned) {
|
||||
encoder.retValCheckIfAllFilesExist = NEO::OclocErrorCode::INVALID_FILE;
|
||||
encoder.retValCheckIfAllFilesExist = OCLOC_INVALID_FILE;
|
||||
auto retVal = encoder.encode();
|
||||
EXPECT_EQ(encoder.retValCheckIfAllFilesExist, retVal);
|
||||
EXPECT_EQ("Error: Missing one or more section files.\n", getOutput());
|
||||
@@ -533,14 +532,14 @@ TEST_F(ZebinEncoderTests, GivenErrorOnCheckIfAllFilesExistWhenEncodeThenErrorIsR
|
||||
TEST_F(ZebinEncoderTests, GivenMissingIntelGTNotesWhenEncodeThenErrorIsReturned) {
|
||||
encoder.retValGetIntelGTNotes = {};
|
||||
auto retVal = encoder.encode();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_DEVICE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_DEVICE, retVal);
|
||||
EXPECT_EQ("Error while parsing Intel GT Notes section for device.\n", getOutput());
|
||||
}
|
||||
|
||||
TEST_F(ZebinEncoderTests, GivenErrorOnAppendingSectionsWhenEncodeThenErrorIsReturned) {
|
||||
encoder.retValAppendSections = NEO::OclocErrorCode::INVALID_FILE;
|
||||
encoder.retValAppendSections = OCLOC_INVALID_FILE;
|
||||
auto retVal = encoder.encode();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
EXPECT_EQ("Error while appending elf sections.\n", getOutput());
|
||||
}
|
||||
|
||||
@@ -556,7 +555,7 @@ TEST_F(ZebinEncoderTests, GivenInvalidSectionsInfoFileWhenLoadSectionsInfoThenEr
|
||||
encoder.callBaseLoadSectionsInfo = true;
|
||||
std::vector<NEO::Zebin::Manipulator::SectionInfo> sectionInfos;
|
||||
auto retVal = encoder.loadSectionsInfo(sectionInfos);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
EXPECT_TRUE(sectionInfos.empty());
|
||||
}
|
||||
|
||||
@@ -574,7 +573,7 @@ TEST_F(ZebinEncoderTests, GivenInvalidSymtabFileWhenAppendSymtabThenErrorIsRetur
|
||||
sectionInfo.type = NEO::Elf::SHT_SYMTAB;
|
||||
std::unordered_map<std::string, size_t> secNameToId;
|
||||
auto retVal = encoder.appendSymtab(elfEncoder, sectionInfo, 0U, secNameToId);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
EXPECT_EQ("Error: Empty symtab file: .symtab\n", getOutput());
|
||||
}
|
||||
|
||||
@@ -585,7 +584,7 @@ TEST_F(ZebinEncoderTests, GivenInvalidRelFileWhenAppendRelThenErrorIsReturned) {
|
||||
sectionInfo.type = NEO::Elf::SHT_REL;
|
||||
std::unordered_map<std::string, size_t> secNameToId;
|
||||
auto retVal = encoder.appendRel(elfEncoder, sectionInfo, 1U, 2U);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
EXPECT_EQ("Error: Empty relocations file: .rel.text\n", getOutput());
|
||||
}
|
||||
|
||||
@@ -596,7 +595,7 @@ TEST_F(ZebinEncoderTests, GivenInvalidRelaFileWhenAppendRelaThenErrorIsReturned)
|
||||
sectionInfo.type = NEO::Elf::SHT_RELA;
|
||||
std::unordered_map<std::string, size_t> secNameToId;
|
||||
auto retVal = encoder.appendRela(elfEncoder, sectionInfo, 1U, 2U);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
EXPECT_EQ("Error: Empty relocations file: .rela.text\n", getOutput());
|
||||
}
|
||||
|
||||
@@ -608,7 +607,7 @@ TEST_F(ZebinEncoderTests, GivenAsmFileWhenAppendKernelThenTranslateItToBinaryFil
|
||||
filesMap.insert({sectionInfo.name + ".asm", "assembly"});
|
||||
|
||||
auto retVal = encoder.appendKernel(elfEncoder, sectionInfo);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_TRUE(encoder.parseKernelAssemblyCalled);
|
||||
}
|
||||
|
||||
@@ -619,7 +618,7 @@ TEST_F(ZebinEncoderTests, GivenAsmFileMissingWhenAppendKernelThenUseBinaryFile)
|
||||
sectionInfo.type = NEO::Elf::SHT_PROGBITS;
|
||||
filesMap.insert({sectionInfo.name, "kernelData"});
|
||||
auto retVal = encoder.appendKernel(elfEncoder, sectionInfo);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_FALSE(encoder.parseKernelAssemblyCalled);
|
||||
}
|
||||
|
||||
@@ -644,7 +643,7 @@ TEST_F(ZebinEncoderTests, GivenMissingFileWhenCheckIfAllFilesExistThenErrorIsRet
|
||||
sectionInfos[0].name = ".text.kernel";
|
||||
sectionInfos[0].type = NEO::Elf::SHT_PROGBITS;
|
||||
auto retVal = encoder.checkIfAllFilesExist(sectionInfos);
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
}
|
||||
|
||||
TEST_F(ZebinEncoderTests, WhenPrintHelpIsCalledThenHelpIsPrinted) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -46,7 +46,7 @@ class MockMultiCommand : public MultiCommand {
|
||||
return MultiCommand::singleBuild(args);
|
||||
}
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> filesMap{};
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_concat.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/queries.h"
|
||||
#include "shared/offline_compiler/source/utilities/get_git_version_info.h"
|
||||
#include "shared/source/device_binary_format/ar/ar_decoder.h"
|
||||
@@ -58,7 +57,7 @@ TEST(OclocApiTests, WhenGoodArgsAreGivenThenSuccessIsReturned) {
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
EXPECT_EQ(std::string::npos, output.find("Command was: ocloc -file test_files/copybuffer.cl -device "s + argv[4]));
|
||||
EXPECT_NE(std::string::npos, output.find("Build succeeded.\n"));
|
||||
}
|
||||
@@ -81,7 +80,7 @@ TEST(OclocApiTests, GivenQuietModeAndValidArgumentsWhenRunningOclocThenSuccessIs
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_EQ(std::string::npos, output.find("Command was: ocloc -file test_files/copybuffer.cl -device "s + argv[4]));
|
||||
EXPECT_EQ(std::string::npos, output.find("Build succeeded.\n"));
|
||||
}
|
||||
@@ -100,7 +99,7 @@ TEST(OclocApiTests, GivenNeoRevisionQueryWhenQueryingThenNeoRevisionIsReturned)
|
||||
0, nullptr, nullptr, nullptr,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
&numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
EXPECT_EQ(numOutputs, 2u);
|
||||
|
||||
int queryOutputIndex = -1;
|
||||
@@ -131,7 +130,7 @@ TEST(OclocApiTests, GivenOclDriverVersionQueryWhenQueryingThenNeoRevisionIsRetur
|
||||
0, nullptr, nullptr, nullptr,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
&numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
EXPECT_EQ(numOutputs, 2u);
|
||||
|
||||
int queryOutputIndex = -1;
|
||||
@@ -160,7 +159,7 @@ TEST(OclocApiTests, GivenNoQueryWhenQueryingThenErrorIsReturned) {
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::INVALID_COMMAND_LINE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_COMMAND_LINE);
|
||||
EXPECT_STREQ("Error: Invalid command line. Expected ocloc query <argument>", output.c_str());
|
||||
}
|
||||
|
||||
@@ -177,7 +176,7 @@ TEST(OclocApiTests, GivenInvalidQueryWhenQueryingThenErrorIsReturned) {
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::INVALID_COMMAND_LINE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_COMMAND_LINE);
|
||||
EXPECT_STREQ("Error: Invalid command line. Unknown argument unknown_query.", output.c_str());
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ TEST(OclocApiTests, givenNoAcronymWhenIdsCommandIsInvokeThenErrorIsReported) {
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::INVALID_COMMAND_LINE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_COMMAND_LINE);
|
||||
EXPECT_STREQ("Error: Invalid command line. Expected ocloc ids <acronym>.\n", output.c_str());
|
||||
}
|
||||
|
||||
@@ -210,7 +209,7 @@ TEST(OclocApiTests, givenUnknownAcronymWhenIdsCommandIsInvokeThenErrorIsReported
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::INVALID_COMMAND_LINE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_COMMAND_LINE);
|
||||
EXPECT_STREQ("Error: Invalid command line. Unknown acronym unk.\n", output.c_str());
|
||||
}
|
||||
|
||||
@@ -248,7 +247,7 @@ TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) {
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
EXPECT_EQ(std::string::npos, output.find("Command was: ocloc -file " + clFileName + " -device " + family));
|
||||
}
|
||||
|
||||
@@ -269,7 +268,7 @@ TEST(OclocApiTests, WhenArgsWithMissingFileAreGivenThenErrorMessageIsProduced) {
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::INVALID_FILE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_FILE);
|
||||
EXPECT_NE(std::string::npos, output.find("Command was: ocloc -q -file test_files/IDoNotExist.cl -device "s + argv[5]));
|
||||
}
|
||||
|
||||
@@ -290,7 +289,7 @@ TEST(OclocApiTests, givenInputOptionsAndInternalOptionsWhenCmdlineIsPrintedThenB
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_NE(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_NE(retVal, OCLOC_SUCCESS);
|
||||
EXPECT_TRUE(output.find("Command was: ocloc -q -file test_files/IDoNotExist.cl -device " +
|
||||
gEnvironment->devicePrefix +
|
||||
" -options \"-D DEBUG -cl-kernel-arg-info\" -internal_options \"-internalOption1 -internal-option-2\"") != std::string::npos);
|
||||
@@ -316,7 +315,7 @@ TEST(OclocApiTests, givenInputOptionsCalledOptionsWhenCmdlineIsPrintedThenQuotes
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_NE(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_NE(retVal, OCLOC_SUCCESS);
|
||||
EXPECT_TRUE(output.find("Command was: ocloc -q -file test_files/IDoNotExist.cl -device " +
|
||||
gEnvironment->devicePrefix +
|
||||
" -options \"-options\" -internal_options \"-internalOption\"") != std::string::npos);
|
||||
@@ -346,7 +345,7 @@ TEST(OclocApiTests, givenInvalidInputOptionsAndInternalOptionsFilesWhenCmdlineIs
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_NE(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_NE(retVal, OCLOC_SUCCESS);
|
||||
|
||||
EXPECT_TRUE(output.find("Compiling options read from file were:\n"
|
||||
"-shouldfailOptions") != std::string::npos);
|
||||
@@ -379,7 +378,7 @@ TEST(OclocApiTests, GivenInvalidOptionsAndInternalOptionsCommandArgumentsWhenCmd
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_NE(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_NE(OCLOC_SUCCESS, retVal);
|
||||
|
||||
EXPECT_FALSE(output.find("Compiling options read from file were:\n"
|
||||
"-shouldfailOptions") != std::string::npos);
|
||||
@@ -408,7 +407,7 @@ TEST(OclocApiTests, givenInvalidOclocOptionsFileWhenCmdlineIsPrintedThenTheyAreP
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_NE(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_NE(retVal, OCLOC_SUCCESS);
|
||||
|
||||
EXPECT_TRUE(output.find("Failed with ocloc options from file:\n"
|
||||
"-invalid_ocloc_option") != std::string::npos);
|
||||
@@ -435,7 +434,7 @@ TEST(OclocApiTests, givenInvalidOclocOptionsFileWhenCmdlineIsPrintedThenTheyAreN
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_NE(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_NE(retVal, OCLOC_SUCCESS);
|
||||
|
||||
EXPECT_FALSE(output.find("Failed with ocloc options from file:\n"
|
||||
"-invalid_ocloc_option") != std::string::npos);
|
||||
@@ -550,7 +549,7 @@ TEST(OclocApiTests, GivenHelpParameterWhenDecodingThenHelpMsgIsPrintedAndSuccess
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_FALSE(output.empty());
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, GivenNonExistingFileWhenDecodingThenAbortIsCalled) {
|
||||
@@ -608,7 +607,7 @@ TEST(OclocApiTests, GivenHelpParameterWhenCompilingThenHelpMsgIsPrintedAndSucces
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_FALSE(output.empty());
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, GivenHelpParameterWhenEncodingThenHelpMsgIsPrintedAndSuccessIsReturned) {
|
||||
@@ -625,7 +624,7 @@ TEST(OclocApiTests, GivenHelpParameterWhenEncodingThenHelpMsgIsPrintedAndSuccess
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_FALSE(output.empty());
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, GivenMissingDumpFileNameWhenEncodingThenErrorIsReturned) {
|
||||
@@ -718,7 +717,7 @@ TEST(OclocApiTests, GivenCommandWithoutArgsWhenOclocIsInvokedThenHelpIsPrinted)
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
|
||||
const auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_FALSE(output.empty());
|
||||
}
|
||||
|
||||
@@ -738,7 +737,7 @@ TEST(OclocApiTests, GivenHelpArgumentWhenOclocIsInvokedThenHelpIsPrinted) {
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
|
||||
const auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_FALSE(output.empty());
|
||||
}
|
||||
}
|
||||
@@ -757,7 +756,7 @@ TEST(OclocApiTests, GivenHelpParameterWhenLinkingThenHelpMsgIsPrintedAndSuccessI
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_FALSE(output.empty());
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, GivenInvalidParameterWhenLinkingThenErrorIsReturned) {
|
||||
@@ -773,7 +772,7 @@ TEST(OclocApiTests, GivenInvalidParameterWhenLinkingThenErrorIsReturned) {
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
|
||||
const std::string expectedInitError{"Invalid option (arg 2): --dummy_param\n"};
|
||||
const std::string expectedExecuteError{"Error: Linker cannot be executed due to unsuccessful initialization!\n"};
|
||||
@@ -792,7 +791,7 @@ TEST(OclocApiTests, GivenInvalidCommandLineWhenConcatenatingThenErrorIsReturned)
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
const std::string emptyCommandLineError = "No files to concatenate were provided.\n";
|
||||
const std::string expectedErrorMessage = emptyCommandLineError + NEO::OclocConcat::helpMessage.str();
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -842,7 +841,7 @@ TEST(OclocApiTests, GivenValidCommandLineAndFatBinariesWhenConcatenatingThenNewF
|
||||
0, nullptr, nullptr, nullptr,
|
||||
&numOutputs, &outputData, &outputLen, &outputName);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(NEO::OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_TRUE(output.empty());
|
||||
|
||||
uint32_t fatBinaryIdx = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/source/device_binary_format/ar/ar_encoder.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
#include "shared/test/common/mocks/mock_modules_zebin.h"
|
||||
@@ -28,7 +28,7 @@ TEST(OclocConcatTest, GivenNoArgumentsWhenInitializingThenErrorIsReturned) {
|
||||
auto error = oclocConcat.initialize(args);
|
||||
const auto output = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::INVALID_COMMAND_LINE), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_INVALID_COMMAND_LINE), error);
|
||||
const std::string expectedOutput = "No files to concatenate were provided.\n";
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ TEST(OclocConcatTest, GivenMissingFilesWhenInitializingThenErrorIsReturned) {
|
||||
auto error = oclocConcat.initialize(args);
|
||||
const auto output = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::INVALID_COMMAND_LINE), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_INVALID_COMMAND_LINE), error);
|
||||
const std::string expectedOutput = "fatBinary1.ar doesn't exist!\nfatBinary2.ar doesn't exist!\n";
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ TEST(OclocConcatTest, GivenValidArgsWhenInitializingThenFileNamesToConcatAndOutp
|
||||
auto error = oclocConcat.initialize(args);
|
||||
const auto output = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::SUCCESS), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_SUCCESS), error);
|
||||
EXPECT_TRUE(output.empty());
|
||||
|
||||
EXPECT_EQ(args[2], oclocConcat.fileNamesToConcat[0]);
|
||||
@@ -78,7 +78,7 @@ TEST(OclocConcatTest, GivenMissingOutFileNameAfterOutArgumentWhenInitalizingThen
|
||||
auto error = oclocConcat.initialize(args);
|
||||
const auto output = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::INVALID_COMMAND_LINE), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_INVALID_COMMAND_LINE), error);
|
||||
const std::string expectedOutput = "Missing out file name after \"-out\" argument\n";
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ TEST(OclocConcatTest, GivenErrorDuringDecodingArWhenConcatenatingThenErrorIsRetu
|
||||
"fatBinary2.ar"};
|
||||
auto error = oclocConcat.concatenate();
|
||||
const auto output = mockArgHelper.messagePrinter.getLog().str();
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::INVALID_FILE), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_INVALID_FILE), error);
|
||||
EXPECT_EQ("fatBinary1.ar : Error while decoding AR file\n", output);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ TEST(OclocConcatTest, GivenBinaryFileNonZebinWhenConcatenatingThenErrorIsReturne
|
||||
oclocConcat.fileNamesToConcat = {"binary.bin"};
|
||||
auto error = oclocConcat.concatenate();
|
||||
const auto output = mockArgHelper.messagePrinter.getLog().str();
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::INVALID_FILE), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_INVALID_FILE), error);
|
||||
EXPECT_EQ("binary.bin : Not a zebin file\n", output);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ TEST(OclocConcatTest, GivenZebinWithoutAOTProductConfigWhenConcatenatingThenErro
|
||||
oclocConcat.fileNamesToConcat = {"zebin.bin"};
|
||||
auto error = oclocConcat.concatenate();
|
||||
const auto output = mockArgHelper.messagePrinter.getLog().str();
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::INVALID_FILE), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_INVALID_FILE), error);
|
||||
EXPECT_EQ("zebin.bin : Couldn't find AOT product configuration in intelGTNotes section.\n", output);
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ TEST(OclocConcatTest, GivenZebinWithAOTNoteAndFatBinaryWhenConcatenatingThenCorr
|
||||
auto error = oclocConcat.concatenate();
|
||||
const auto output = mockArgHelper.messagePrinter.getLog().str();
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(OclocErrorCode::SUCCESS), error);
|
||||
EXPECT_EQ(static_cast<uint32_t>(OCLOC_SUCCESS), error);
|
||||
EXPECT_TRUE(output.empty());
|
||||
EXPECT_EQ(1U, mockArgHelper.interceptedFiles.size());
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/source/compiler_interface/compiler_options.h"
|
||||
#include "shared/source/device_binary_format/ar/ar.h"
|
||||
#include "shared/source/device_binary_format/ar/ar_decoder.h"
|
||||
@@ -330,7 +330,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenClosedRangeTooExtensiveWhenProdu
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_NE(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_NE(retVal, OCLOC_SUCCESS);
|
||||
resString << "Invalid range : " << acronymsString.str() << " - should be from:to or :to or from:\n";
|
||||
resString << "Failed to parse target devices from : " << target << "\n";
|
||||
EXPECT_STREQ(output.c_str(), resString.str().c_str());
|
||||
@@ -388,7 +388,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfProductsWhenFatBinar
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -425,7 +425,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoVersionsOfProductConfigsWhenF
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -459,7 +459,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsAcronymsWithoutDashesWhe
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -495,7 +495,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenBinaryOutputNameOptionWhenBuildi
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
EXPECT_EQ(1u, NEO::virtualFileList.size());
|
||||
EXPECT_TRUE(NEO::virtualFileList.find("expected_output.bin") != NEO::virtualFileList.end());
|
||||
@@ -603,7 +603,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfReleasesWhenFatBinar
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -644,7 +644,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfFamiliesWhenFatBinar
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -689,7 +689,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsClosedRangeWhenFatBinary
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -728,7 +728,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsClosedRangeWithoutDashes
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -821,7 +821,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesClosedRangeWhenFatBinary
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -855,7 +855,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromProductWhenFatBinar
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -891,7 +891,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromProductWithoutDashe
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -924,7 +924,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToProductWhenFatBinaryB
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -1067,7 +1067,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromReleaseWhenFatBinar
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -1206,7 +1206,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToReleaseWhenFatBinaryB
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -1392,7 +1392,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromFamilyWhenFatBinary
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -1434,7 +1434,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToFamilyWhenFatBinaryBu
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(retVal, OCLOC_SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
@@ -1472,7 +1472,7 @@ TEST_F(OclocFatBinaryTest, givenSpirvInputWhenFatBinaryIsRequestedThenArchiveCon
|
||||
|
||||
mockArgHelper.getPrinterRef().setSuppressMessages(true);
|
||||
const auto buildResult = buildFatBinary(args, &mockArgHelper);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
|
||||
|
||||
const auto &rawArchive = mockArgHelper.interceptedFiles[outputArchiveName];
|
||||
@@ -1525,7 +1525,7 @@ TEST_F(OclocFatBinaryTest, givenSpirvInputWhenFatBinaryIsRequestedThenArchiveCon
|
||||
|
||||
mockArgHelper.getPrinterRef().setSuppressMessages(true);
|
||||
const auto buildResult = buildFatBinary(args, &mockArgHelper);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
|
||||
|
||||
const auto &rawArchive = mockArgHelper.interceptedFiles[outputArchiveName];
|
||||
@@ -1568,7 +1568,7 @@ TEST_F(OclocFatBinaryTest, givenDeviceFlagWithoutConsecutiveArgumentWhenBuilding
|
||||
const auto result = buildFatBinary(args, &mockArgHelper);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Command does not contain device argument!\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -1592,7 +1592,7 @@ TEST_F(OclocFatBinaryTest, givenFlagsWhichRequireMoreArgsWithoutThemWhenBuilding
|
||||
const auto result = buildFatBinary(args, &mockArgHelper);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
const std::string expectedErrorMessage{"Invalid option (arg 3): " + flag + "\nError! Couldn't create OfflineCompiler. Exiting.\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -1628,7 +1628,7 @@ TEST_F(OclocFatBinaryTest, givenBitFlagsWhenBuildingFatbinaryThenFilesInArchiveH
|
||||
|
||||
mockArgHelper.getPrinterRef().setSuppressMessages(true);
|
||||
const auto buildResult = buildFatBinary(args, &mockArgHelper);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
|
||||
|
||||
const auto &rawArchive = mockArgHelper.interceptedFiles[outputArchiveName];
|
||||
@@ -1668,7 +1668,7 @@ TEST_F(OclocFatBinaryTest, givenOutputDirectoryFlagWhenBuildingFatbinaryThenArch
|
||||
|
||||
mockArgHelper.getPrinterRef().setSuppressMessages(true);
|
||||
const auto buildResult = buildFatBinary(args, &mockArgHelper);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
|
||||
const auto expectedArchivePath{outputDirectory + "/" + outputArchiveName};
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(expectedArchivePath));
|
||||
@@ -1693,7 +1693,7 @@ TEST_F(OclocFatBinaryTest, givenSpirvInputAndExcludeIrFlagWhenFatBinaryIsRequest
|
||||
|
||||
mockArgHelper.getPrinterRef().setSuppressMessages(true);
|
||||
const auto buildResult = buildFatBinary(args, &mockArgHelper);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
|
||||
|
||||
const auto &rawArchive = mockArgHelper.interceptedFiles[outputArchiveName];
|
||||
@@ -1732,7 +1732,7 @@ TEST_F(OclocFatBinaryTest, givenClInputFileWhenFatBinaryIsRequestedThenArchiveDo
|
||||
|
||||
mockArgHelper.getPrinterRef().setSuppressMessages(true);
|
||||
const auto buildResult = buildFatBinary(args, &mockArgHelper);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
|
||||
|
||||
const auto &rawArchive = mockArgHelper.interceptedFiles[outputArchiveName];
|
||||
@@ -1761,7 +1761,7 @@ TEST_F(OclocFatBinaryTest, givenEmptyFileWhenAppendingGenericIrThenInvalidFileIs
|
||||
const auto errorCode{appendGenericIr(ar, emptyFile, &mockArgHelper, dummyOptions)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, errorCode);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, errorCode);
|
||||
EXPECT_EQ("Error! Couldn't read input file!\n", output);
|
||||
}
|
||||
|
||||
@@ -1775,7 +1775,7 @@ TEST_F(OclocFatBinaryTest, givenInvalidIrFileWhenAppendingGenericIrThenInvalidFi
|
||||
const auto errorCode{appendGenericIr(ar, dummyFile, &mockArgHelper, dummyOptions)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, errorCode);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, errorCode);
|
||||
|
||||
const auto expectedErrorMessage{"Error! Input file is not in supported generic IR format! "
|
||||
"Currently supported format is SPIR-V.\n"};
|
||||
@@ -1797,17 +1797,17 @@ TEST(OclocFatBinaryHelpersTest, givenPreviousCompilationErrorWhenBuildingFatbina
|
||||
// We expect that nothing is done and error is returned.
|
||||
// Therefore, if offline compiler is used, ensure that it just returns error code,
|
||||
// which is different than expected one.
|
||||
mockOfflineCompiler.buildReturnValue = OclocErrorCode::SUCCESS;
|
||||
mockOfflineCompiler.buildReturnValue = OCLOC_SUCCESS;
|
||||
|
||||
Ar::ArEncoder ar;
|
||||
const std::string pointerSize{"32"};
|
||||
const auto mockArgHelper = mockOfflineCompiler.uniqueHelper.get();
|
||||
const auto deviceConfig = getDeviceConfig(mockOfflineCompiler, mockArgHelper);
|
||||
|
||||
const int previousReturnValue{OclocErrorCode::INVALID_FILE};
|
||||
const int previousReturnValue{OCLOC_INVALID_FILE};
|
||||
const auto buildResult = buildFatBinaryForTarget(previousReturnValue, argv, pointerSize, ar, &mockOfflineCompiler, mockArgHelper, deviceConfig);
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, buildResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, buildResult);
|
||||
EXPECT_EQ(0, mockOfflineCompiler.buildCalledCount);
|
||||
}
|
||||
|
||||
@@ -1822,7 +1822,7 @@ TEST(OclocFatBinaryHelpersTest, givenPreviousCompilationSuccessAndFailingBuildWh
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
|
||||
mockOfflineCompiler.buildReturnValue = OclocErrorCode::INVALID_FILE;
|
||||
mockOfflineCompiler.buildReturnValue = OCLOC_INVALID_FILE;
|
||||
|
||||
Ar::ArEncoder ar;
|
||||
const std::string pointerSize{"32"};
|
||||
@@ -1830,11 +1830,11 @@ TEST(OclocFatBinaryHelpersTest, givenPreviousCompilationSuccessAndFailingBuildWh
|
||||
const auto deviceConfig = getDeviceConfig(mockOfflineCompiler, mockArgHelper);
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const int previousReturnValue{OclocErrorCode::SUCCESS};
|
||||
const int previousReturnValue{OCLOC_SUCCESS};
|
||||
const auto buildResult = buildFatBinaryForTarget(previousReturnValue, argv, pointerSize, ar, &mockOfflineCompiler, mockArgHelper, deviceConfig);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, buildResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, buildResult);
|
||||
EXPECT_EQ(1, mockOfflineCompiler.buildCalledCount);
|
||||
|
||||
std::string commandString{};
|
||||
@@ -1865,7 +1865,7 @@ TEST(OclocFatBinaryHelpersTest, givenNonEmptyBuildLogWhenBuildingFatbinaryForTar
|
||||
|
||||
const char buildWarning[] = "warning: This is a build log!";
|
||||
mockOfflineCompiler.updateBuildLog(buildWarning, sizeof(buildWarning));
|
||||
mockOfflineCompiler.buildReturnValue = OclocErrorCode::SUCCESS;
|
||||
mockOfflineCompiler.buildReturnValue = OCLOC_SUCCESS;
|
||||
|
||||
// Dummy value
|
||||
mockOfflineCompiler.elfBinary = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
@@ -1876,11 +1876,11 @@ TEST(OclocFatBinaryHelpersTest, givenNonEmptyBuildLogWhenBuildingFatbinaryForTar
|
||||
const auto deviceConfig = getDeviceConfig(mockOfflineCompiler, mockArgHelper);
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const int previousReturnValue{OclocErrorCode::SUCCESS};
|
||||
const int previousReturnValue{OCLOC_SUCCESS};
|
||||
const auto buildResult = buildFatBinaryForTarget(previousReturnValue, argv, pointerSize, ar, &mockOfflineCompiler, mockArgHelper, deviceConfig);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
EXPECT_EQ(1, mockOfflineCompiler.buildCalledCount);
|
||||
|
||||
const std::string expectedOutput{buildWarning + "\nBuild succeeded for : "s + deviceConfig + ".\n"s};
|
||||
@@ -1906,14 +1906,14 @@ TEST(OclocFatBinaryHelpersTest, givenNonEmptyBuildLogWhenBuildingFatbinaryForTar
|
||||
|
||||
const char buildWarning[] = "Warning: this is a build log!";
|
||||
mockOfflineCompiler.updateBuildLog(buildWarning, sizeof(buildWarning));
|
||||
mockOfflineCompiler.buildReturnValue = OclocErrorCode::SUCCESS;
|
||||
mockOfflineCompiler.buildReturnValue = OCLOC_SUCCESS;
|
||||
|
||||
mockOfflineCompiler.elfBinary = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
Ar::ArEncoder ar;
|
||||
const std::string pointerSize{"32"};
|
||||
|
||||
const int previousReturnValue{OclocErrorCode::SUCCESS};
|
||||
const int previousReturnValue{OCLOC_SUCCESS};
|
||||
buildFatBinaryForTarget(previousReturnValue, argv, pointerSize, ar, &mockOfflineCompiler, mockArgHelper, deviceConfig);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
@@ -1936,7 +1936,7 @@ TEST(OclocFatBinaryHelpersTest, givenQuietModeWhenBuildingFatbinaryForTargetThen
|
||||
|
||||
// Dummy value
|
||||
mockOfflineCompiler.elfBinary = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
mockOfflineCompiler.buildReturnValue = OclocErrorCode::SUCCESS;
|
||||
mockOfflineCompiler.buildReturnValue = OCLOC_SUCCESS;
|
||||
|
||||
Ar::ArEncoder ar;
|
||||
const std::string pointerSize{"32"};
|
||||
@@ -1944,11 +1944,11 @@ TEST(OclocFatBinaryHelpersTest, givenQuietModeWhenBuildingFatbinaryForTargetThen
|
||||
const auto deviceConfig = getDeviceConfig(mockOfflineCompiler, mockArgHelper);
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const int previousReturnValue{OclocErrorCode::SUCCESS};
|
||||
const int previousReturnValue{OCLOC_SUCCESS};
|
||||
const auto buildResult = buildFatBinaryForTarget(previousReturnValue, argv, pointerSize, ar, &mockOfflineCompiler, mockArgHelper, deviceConfig);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
EXPECT_EQ(1, mockOfflineCompiler.buildCalledCount);
|
||||
|
||||
EXPECT_TRUE(output.empty()) << output;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "ocloc_fcl_facade_tests.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/os_interface/os_inc_base.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
@@ -26,7 +26,7 @@ TEST_F(OclocFclFacadeTest, GivenMissingFclLibraryWhenPreparingFclThenFailureIsRe
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_FALSE(mockFclFacade.isInitialized());
|
||||
|
||||
std::stringstream expectedErrorMessage;
|
||||
@@ -43,7 +43,7 @@ TEST_F(OclocFclFacadeTest, GivenFailingLoadingOfFclSymbolsWhenPreparingFclThenFa
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_FALSE(mockFclFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Cannot load required functions from FCL library.\n"};
|
||||
@@ -58,7 +58,7 @@ TEST_F(OclocFclFacadeTest, GivenFailingCreationOfFclMainWhenPreparingFclThenFail
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_FALSE(mockFclFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Cannot create FCL main component!\n"};
|
||||
@@ -77,7 +77,7 @@ TEST_F(OclocFclFacadeTest, GivenIncompatibleFclInterfacesWhenPreparingFclThenFai
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_FALSE(mockFclFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Incompatible interface in FCL: SomeImportantInterface\n"};
|
||||
@@ -92,7 +92,7 @@ TEST_F(OclocFclFacadeTest, GivenFailingCreationOfFclDeviceContextWhenPreparingFc
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_FALSE(mockFclFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Cannot create FCL device context!\n"};
|
||||
@@ -107,7 +107,7 @@ TEST_F(OclocFclFacadeTest, GivenNoneErrorsSetAndNotPopulateFclInterfaceWhenPrepa
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, fclPreparationResult);
|
||||
EXPECT_TRUE(output.empty()) << output;
|
||||
EXPECT_TRUE(mockFclFacade.isInitialized());
|
||||
EXPECT_EQ(0, mockFclFacade.populateFclInterfaceCalledCount);
|
||||
@@ -122,7 +122,7 @@ TEST_F(OclocFclFacadeTest, GivenPopulateFclInterfaceAndInvalidFclDeviceContextWh
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, fclPreparationResult);
|
||||
EXPECT_FALSE(mockFclFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! FCL device context has not been properly created!\n"};
|
||||
@@ -139,7 +139,7 @@ TEST_F(OclocFclFacadeTest, GivenPopulateFclInterfaceWhenPreparingFclThenSuccessI
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, fclPreparationResult);
|
||||
EXPECT_TRUE(output.empty()) << output;
|
||||
EXPECT_TRUE(mockFclFacade.isInitialized());
|
||||
|
||||
@@ -153,7 +153,7 @@ TEST_F(OclocFclFacadeTest, GivenNoneErrorsSetWhenPreparingFclThenSuccessIsReport
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, fclPreparationResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, fclPreparationResult);
|
||||
EXPECT_TRUE(output.empty()) << output;
|
||||
EXPECT_TRUE(mockFclFacade.isInitialized());
|
||||
|
||||
@@ -168,7 +168,7 @@ TEST_F(OclocFclFacadeTest, GivenInitializedFclWhenGettingIncompatibleInterfaceTh
|
||||
const auto fclPreparationResult{mockFclFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, fclPreparationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, fclPreparationResult);
|
||||
|
||||
const auto incompatibleInterface = mockFclFacade.getIncompatibleInterface();
|
||||
EXPECT_TRUE(incompatibleInterface.empty()) << incompatibleInterface;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "ocloc_igc_facade_tests.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/os_interface/os_inc_base.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
@@ -26,7 +26,7 @@ TEST_F(OclocIgcFacadeTest, GivenMissingIgcLibraryWhenPreparingIgcThenFailureIsRe
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_FALSE(mockIgcFacade.isInitialized());
|
||||
|
||||
std::stringstream expectedErrorMessage;
|
||||
@@ -43,7 +43,7 @@ TEST_F(OclocIgcFacadeTest, GivenFailingLoadingOfIgcSymbolsWhenPreparingIgcThenFa
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_FALSE(mockIgcFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Cannot load required functions from IGC library.\n"};
|
||||
@@ -58,7 +58,7 @@ TEST_F(OclocIgcFacadeTest, GivenFailingCreationOfIgcMainWhenPreparingIgcThenFail
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_FALSE(mockIgcFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Cannot create IGC main component!\n"};
|
||||
@@ -77,7 +77,7 @@ TEST_F(OclocIgcFacadeTest, GivenIncompatibleIgcInterfacesWhenPreparingIgcThenFai
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_FALSE(mockIgcFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Incompatible interface in IGC: SomeImportantInterface\n"};
|
||||
@@ -92,7 +92,7 @@ TEST_F(OclocIgcFacadeTest, GivenMissingPatchtokenInterfaceWhenPreparingIgcThenFa
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_FALSE(mockIgcFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Patchtoken interface is missing.\n"};
|
||||
@@ -107,7 +107,7 @@ TEST_F(OclocIgcFacadeTest, GivenFailingCreationOfIgcDeviceContextWhenPreparingIg
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_FALSE(mockIgcFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Cannot create IGC device context!\n"};
|
||||
@@ -128,7 +128,7 @@ TEST_F(OclocIgcFacadeTest, GivenInvalidIgcDeviceContextWhenPreparingIgcThenFailu
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, igcPreparationResult);
|
||||
EXPECT_FALSE(mockIgcFacade.isInitialized());
|
||||
|
||||
const std::string expectedErrorMessage{"Error! IGC device context has not been properly created!\n"};
|
||||
@@ -143,7 +143,7 @@ TEST_F(OclocIgcFacadeTest, GivenNoneErrorsSetWhenPreparingIgcThenSuccessIsReport
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, igcPreparationResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, igcPreparationResult);
|
||||
EXPECT_TRUE(output.empty()) << output;
|
||||
EXPECT_TRUE(mockIgcFacade.isInitialized());
|
||||
}
|
||||
@@ -155,7 +155,7 @@ TEST_F(OclocIgcFacadeTest, GivenInitializedIgcWhenGettingIncompatibleInterfaceTh
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, igcPreparationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, igcPreparationResult);
|
||||
|
||||
const std::vector<CIF::InterfaceId_t> interfacesToIgnore{};
|
||||
const auto incompatibleInterface = mockIgcFacade.getIncompatibleInterface(interfacesToIgnore);
|
||||
@@ -171,7 +171,7 @@ TEST_F(OclocIgcFacadeTest, GivenFailingCreationOfIgcDeviceContext3WhenGettingRev
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, igcPreparationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, igcPreparationResult);
|
||||
|
||||
EXPECT_STREQ(mockIgcFacade.getIgcRevision(), "");
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/os_interface/os_library.h"
|
||||
|
||||
@@ -40,7 +40,7 @@ TEST_P(OclocProductConfigTests, givenProductConfigAsDeviceNameWhenInitHwInfoThen
|
||||
config << aotConfig.value;
|
||||
mockOfflineCompiler.deviceName = config.str();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(OCLOC_SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(aotConfig.value, mockOfflineCompiler.deviceConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ TEST_F(MultiCommandTests, GivenMissingTextFileWithArgsWhenBuildingMultiCommandTh
|
||||
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pMultiCommand);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
DebugManager.flags.PrintDebugMessages.set(false);
|
||||
}
|
||||
TEST_F(MultiCommandTests, GivenLackOfClFileWhenBuildingMultiCommandThenInvalidFileErrorIsReturned) {
|
||||
@@ -280,7 +280,7 @@ TEST_F(MultiCommandTests, GivenLackOfClFileWhenBuildingMultiCommandThenInvalidFi
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(nullptr, pMultiCommand);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
DebugManager.flags.PrintDebugMessages.set(false);
|
||||
|
||||
deleteFileWithArgs();
|
||||
@@ -326,16 +326,16 @@ TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuc
|
||||
|
||||
TEST(MultiCommandWhiteboxTest, GivenVerboseModeWhenShowingResultsThenLogsArePrintedForEachBuild) {
|
||||
MockMultiCommand mockMultiCommand{};
|
||||
mockMultiCommand.retValues = {OclocErrorCode::SUCCESS, OclocErrorCode::INVALID_FILE};
|
||||
mockMultiCommand.retValues = {OCLOC_SUCCESS, OCLOC_INVALID_FILE};
|
||||
mockMultiCommand.quiet = false;
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto result = mockMultiCommand.showResults();
|
||||
const auto output = testing::internal::GetCapturedStdout();
|
||||
|
||||
const auto maskedResult = result | OclocErrorCode::INVALID_FILE;
|
||||
EXPECT_NE(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, maskedResult);
|
||||
const auto maskedResult = result | OCLOC_INVALID_FILE;
|
||||
EXPECT_NE(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, maskedResult);
|
||||
|
||||
const auto expectedOutput{"Build command 0: successful\n"
|
||||
"Build command 1: failed. Error code: -5151\n"};
|
||||
@@ -411,7 +411,7 @@ TEST(MultiCommandWhiteboxTest, GivenCommandLineWithApostrophesWhenSplittingLineI
|
||||
const auto result = mockMultiCommand.splitLineInSeparateArgs(outputArgs, commandLine, numberOfBuild);
|
||||
const auto output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_TRUE(output.empty()) << output;
|
||||
|
||||
ASSERT_EQ(4u, outputArgs.size());
|
||||
@@ -435,7 +435,7 @@ TEST(MultiCommandWhiteboxTest, GivenCommandLineWithMissingApostropheWhenSplittin
|
||||
const auto result = mockMultiCommand.splitLineInSeparateArgs(outputArgs, commandLine, numberOfBuild);
|
||||
const auto output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, result);
|
||||
|
||||
const auto expectedOutput = "One of the quotes is open in build number 1\n";
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
@@ -451,7 +451,7 @@ TEST(MultiCommandWhiteboxTest, GivenCommandLineWithMissingApostropheWhenRunningB
|
||||
EXPECT_EQ(0, mockMultiCommand.singleBuildCalledCount);
|
||||
|
||||
ASSERT_EQ(1u, mockMultiCommand.retValues.size());
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, mockMultiCommand.retValues[0]);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, mockMultiCommand.retValues[0]);
|
||||
}
|
||||
|
||||
TEST(MultiCommandWhiteboxTest, GivenTwoValidCommandLinesAndVerboseModeWhenRunningBuildsThenBuildsAreStartedReturnValuesAreStoredAndLogsArePrinted) {
|
||||
@@ -470,8 +470,8 @@ TEST(MultiCommandWhiteboxTest, GivenTwoValidCommandLinesAndVerboseModeWhenRunnin
|
||||
EXPECT_EQ(2, mockMultiCommand.singleBuildCalledCount);
|
||||
|
||||
ASSERT_EQ(2u, mockMultiCommand.retValues.size());
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, mockMultiCommand.retValues[0]);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, mockMultiCommand.retValues[1]);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, mockMultiCommand.retValues[0]);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, mockMultiCommand.retValues[1]);
|
||||
|
||||
const auto expectedOutput{"Command number 1: \n"
|
||||
"Command number 2: \n"};
|
||||
@@ -497,7 +497,7 @@ TEST(MultiCommandWhiteboxTest, GivenArgsWithQuietModeAndEmptyMulticommandFileWhe
|
||||
const auto result = mockMultiCommand.initialize(args);
|
||||
const auto output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, result);
|
||||
|
||||
const auto expectedOutput = "Command file was empty.\n";
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
@@ -519,7 +519,7 @@ TEST(MultiCommandWhiteboxTest, GivenInvalidArgsWhenInitializingThenErrorIsReturn
|
||||
const auto result = mockMultiCommand.initialize(args);
|
||||
const auto output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
const auto expectedError = "Invalid option (arg 3): -invalid_option\n";
|
||||
const auto errorPosition = output.find(expectedError);
|
||||
@@ -675,7 +675,7 @@ TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithRevisionWhenInitHwIn
|
||||
for (const auto &acronym : deprecatedAcronyms) {
|
||||
mockOfflineCompiler.deviceName = acronym.str();
|
||||
mockOfflineCompiler.revisionId = 0x3;
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(OCLOC_SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
|
||||
auto defaultIpVersion = mockOfflineCompiler.compilerProductHelper->getDefaultHwIpVersion();
|
||||
auto productConfig = mockOfflineCompiler.compilerProductHelper->matchRevisionIdWithProductConfig(defaultIpVersion, mockOfflineCompiler.revisionId);
|
||||
@@ -712,7 +712,7 @@ TEST_F(MockOfflineCompilerTests, givenValidAcronymAndRevisionIdWhenInitHardwareI
|
||||
}
|
||||
|
||||
mockOfflineCompiler.revisionId = 0x3;
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_DEVICE, mockOfflineCompiler.initHardwareInfoForProductConfig(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(OCLOC_INVALID_DEVICE, mockOfflineCompiler.initHardwareInfoForProductConfig(mockOfflineCompiler.deviceName));
|
||||
}
|
||||
|
||||
TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForProductConfigThenCorrectValuesAreSet) {
|
||||
@@ -725,7 +725,7 @@ TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForProductConfigT
|
||||
for (const auto &acronym : enabledProductAcronyms) {
|
||||
mockOfflineCompiler.deviceName = acronym.str();
|
||||
mockOfflineCompiler.hwInfoConfig = 0x100020003;
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OCLOC_SUCCESS);
|
||||
|
||||
uint32_t sliceCount = static_cast<uint16_t>(mockOfflineCompiler.hwInfoConfig >> 32);
|
||||
uint32_t subSlicePerSliceCount = static_cast<uint16_t>(mockOfflineCompiler.hwInfoConfig >> 16);
|
||||
@@ -751,7 +751,7 @@ TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForDeprecatedAcro
|
||||
mockOfflineCompiler.deviceName = acronym.str();
|
||||
mockOfflineCompiler.hwInfoConfig = 0x100020003;
|
||||
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OCLOC_SUCCESS);
|
||||
|
||||
uint32_t sliceCount = static_cast<uint16_t>(mockOfflineCompiler.hwInfoConfig >> 32);
|
||||
uint32_t subSlicePerSliceCount = static_cast<uint16_t>(mockOfflineCompiler.hwInfoConfig >> 16);
|
||||
@@ -789,7 +789,7 @@ TEST_F(MockOfflineCompilerTests, givenAcronymWithUppercaseWhenInitHwInfoThenSucc
|
||||
}
|
||||
|
||||
std::transform(mockOfflineCompiler.deviceName.begin(), mockOfflineCompiler.deviceName.end(), mockOfflineCompiler.deviceName.begin(), ::toupper);
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OCLOC_SUCCESS);
|
||||
}
|
||||
|
||||
TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithUppercaseWhenInitHwInfoThenSuccessIsReturned) {
|
||||
@@ -802,7 +802,7 @@ TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithUppercaseWhenInitHwI
|
||||
for (const auto &acronym : deprecatedAcronyms) {
|
||||
mockOfflineCompiler.deviceName = acronym.str();
|
||||
std::transform(mockOfflineCompiler.deviceName.begin(), mockOfflineCompiler.deviceName.end(), mockOfflineCompiler.deviceName.begin(), ::toupper);
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OCLOC_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ TEST_F(MockOfflineCompilerTests, givenDeviceIpVersionWhenInitHwInfoThenCorrectRe
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(OCLOC_SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
}
|
||||
|
||||
TEST_F(MockOfflineCompilerTests, givenTheSameProductConfigWhenDifferentDeviceFormParameterIsPassedThenSameResultsAreReturned) {
|
||||
@@ -860,12 +860,12 @@ TEST_F(MockOfflineCompilerTests, givenTheSameProductConfigWhenDifferentDeviceFor
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(OCLOC_SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_NE(AOT::UNKNOWN_ISA, mockOfflineCompiler.deviceConfig);
|
||||
auto expectedConfig = mockOfflineCompiler.deviceConfig;
|
||||
|
||||
mockOfflineCompiler.deviceName = ipVersion.str();
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(OCLOC_SUCCESS, mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName));
|
||||
EXPECT_EQ(expectedConfig, mockOfflineCompiler.deviceConfig);
|
||||
}
|
||||
|
||||
@@ -880,7 +880,7 @@ TEST_F(OfflineCompilerTests, GivenHelpOptionOnQueryThenSuccessIsReturned) {
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_STREQ(OfflineCompiler::queryHelp.data(), output.c_str());
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(OfflineCompilerTests, GivenHelpOptionOnIdsThenSuccessIsReturned) {
|
||||
@@ -904,7 +904,7 @@ All supported acronyms: )===";
|
||||
expectedOutput << getSupportedDevices(oclocArgHelperWithoutInput.get()) << ".\n";
|
||||
|
||||
EXPECT_STREQ(output.c_str(), expectedOutput.str().c_str());
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,7 +938,7 @@ TEST_F(OfflineCompilerTests, givenFamilyAcronymWhenIdsCommandIsInvokeThenSuccess
|
||||
expectedOutput << prefix << "\n";
|
||||
}
|
||||
EXPECT_STREQ(expectedOutput.str().c_str(), output.c_str());
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ TEST_F(OfflineCompilerTests, givenReleaseAcronymWhenIdsCommandIsInvokeThenSucces
|
||||
expectedOutput << prefix << "\n";
|
||||
}
|
||||
EXPECT_STREQ(expectedOutput.str().c_str(), output.c_str());
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1006,7 +1006,7 @@ TEST_F(OfflineCompilerTests, givenProductAcronymWhenIdsCommandIsInvokeThenSucces
|
||||
expectedOutput << prefix << "\n";
|
||||
}
|
||||
EXPECT_STREQ(expectedOutput.str().c_str(), output.c_str());
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1026,7 +1026,7 @@ TEST_F(OfflineCompilerTests, GivenFlagsWhichRequireMoreArgsWithoutThemWhenParsin
|
||||
const auto result = mockOfflineCompiler.parseCommandLine(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
const std::string expectedErrorMessage{"Invalid option (arg 2): " + flag + "\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -1050,7 +1050,7 @@ TEST_F(OfflineCompilerTests, Given32BitModeFlagWhenParsingThenInternalOptionsCon
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto result = mockOfflineCompiler.parseCommandLine(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, result);
|
||||
|
||||
const auto is32BitModeSet{mockOfflineCompiler.internalOptions.find(CompilerOptions::arch32bit.data()) != std::string::npos};
|
||||
EXPECT_TRUE(is32BitModeSet);
|
||||
@@ -1074,7 +1074,7 @@ TEST_F(OfflineCompilerTests, givenConfigFlagWhenParsingCommandLineThenCorrectVal
|
||||
parseHwInfoConfigString(configStr, config);
|
||||
|
||||
const auto result = mockOfflineCompiler.parseCommandLine(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(mockOfflineCompiler.hwInfoConfig, config);
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ TEST_F(OfflineCompilerTests, givenIncorrectConfigFlagWhenParsingCommandLineThenE
|
||||
const auto result = mockOfflineCompiler.parseCommandLine(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(mockOfflineCompiler.hwInfoConfig, 0u);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Invalid config.\n"};
|
||||
@@ -1120,7 +1120,7 @@ TEST_F(OfflineCompilerTests, Given64BitModeFlagWhenParsingThenInternalOptionsCon
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto result = mockOfflineCompiler.parseCommandLine(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, result);
|
||||
|
||||
const auto is64BitModeSet{mockOfflineCompiler.internalOptions.find(CompilerOptions::arch64bit.data()) != std::string::npos};
|
||||
EXPECT_TRUE(is64BitModeSet);
|
||||
@@ -1144,10 +1144,10 @@ TEST_F(OfflineCompilerTests, Given32BitModeFlagAnd64BitModeFlagWhenParsingThenEr
|
||||
const auto result = mockOfflineCompiler.parseCommandLine(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_NE(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_NE(OCLOC_SUCCESS, result);
|
||||
|
||||
const auto maskedResult = result | OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, maskedResult);
|
||||
const auto maskedResult = result | OCLOC_INVALID_COMMAND_LINE;
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, maskedResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Cannot compile for 32-bit and 64-bit, please choose one.\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -1174,7 +1174,7 @@ TEST_F(OfflineCompilerTests, GivenFlagStringWhenParsingThenInternalBooleanIsSetA
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto result = mockOfflineCompiler.parseCommandLine(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, result);
|
||||
|
||||
EXPECT_TRUE(mockOfflineCompiler.*memberBoolean);
|
||||
}
|
||||
@@ -1188,7 +1188,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenQueryIsCalledThenSuccessIsReturned) {
|
||||
|
||||
int retVal = OfflineCompiler::query(argv.size(), argv, oclocArgHelperWithoutInput.get());
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(OfflineCompilerTests, GivenArgsWhenOfflineCompilerIsCreatedThenSuccessIsReturned) {
|
||||
@@ -1478,7 +1478,7 @@ TEST_F(OfflineCompilerTests, givenDebugOptionAndNonSpirvInputWhenFilenameIsSepar
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
const auto result = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, result);
|
||||
const auto &options = mockOfflineCompiler->options;
|
||||
std::string appendedOption{"-s \"filename with spaces.cl\""};
|
||||
EXPECT_TRUE(hasSubstr(options, appendedOption));
|
||||
@@ -1610,7 +1610,7 @@ TEST_F(OfflineCompilerTests, givenValidArgumentsAndFclInitFailureWhenInitIsPerfo
|
||||
expectedErrorMessage << "Error! Loading of FCL library has failed! Filename: " << Os::frontEndDllName << "\n"
|
||||
<< "Error! FCL initialization failure. Error code = -6\n";
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, initResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, initResult);
|
||||
EXPECT_EQ(expectedErrorMessage.str(), output);
|
||||
}
|
||||
|
||||
@@ -1633,7 +1633,7 @@ TEST_F(OfflineCompilerTests, givenValidArgumentsAndIgcInitFailureWhenInitIsPerfo
|
||||
expectedErrorMessage << "Error! Loading of IGC library has failed! Filename: " << Os::igcDllName << "\n"
|
||||
<< "Error! IGC initialization failure. Error code = -6\n";
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, initResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, initResult);
|
||||
EXPECT_EQ(expectedErrorMessage.str(), output);
|
||||
}
|
||||
|
||||
@@ -1733,7 +1733,7 @@ TEST_F(OfflineCompilerTests, givenLackOfExcludeIrArgumentWhenCompilingKernelThen
|
||||
mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
|
||||
const auto buildResult{mockOfflineCompiler.build()};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, buildResult);
|
||||
|
||||
std::string errorReason{};
|
||||
std::string warning{};
|
||||
@@ -1756,7 +1756,7 @@ TEST_F(OfflineCompilerTests, givenZeroSizeInputFileWhenInitializationIsPerformed
|
||||
mockOfflineCompiler.uniqueHelper->shouldLoadDataFromFileReturnZeroSize = true;
|
||||
|
||||
const auto initResult = mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, initResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, initResult);
|
||||
}
|
||||
|
||||
TEST_F(OfflineCompilerTests, givenInvalidIgcOutputWhenCompilingKernelThenOutOfHostMemoryIsReturned) {
|
||||
@@ -1774,10 +1774,10 @@ TEST_F(OfflineCompilerTests, givenInvalidIgcOutputWhenCompilingKernelThenOutOfHo
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto initResult = mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, initResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, initResult);
|
||||
|
||||
const auto buildResult{mockOfflineCompiler.build()};
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, buildResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, buildResult);
|
||||
|
||||
NEO::setIgcDebugVars(gEnvironment->igcDebugVars);
|
||||
}
|
||||
@@ -1797,10 +1797,10 @@ TEST_F(OfflineCompilerTests, givenIgcBuildFailureWhenCompilingKernelThenBuildPro
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto initResult = mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, initResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, initResult);
|
||||
|
||||
const auto buildResult{mockOfflineCompiler.build()};
|
||||
EXPECT_EQ(OclocErrorCode::BUILD_PROGRAM_FAILURE, buildResult);
|
||||
EXPECT_EQ(OCLOC_BUILD_PROGRAM_FAILURE, buildResult);
|
||||
|
||||
NEO::setIgcDebugVars(gEnvironment->igcDebugVars);
|
||||
}
|
||||
@@ -1820,10 +1820,10 @@ TEST_F(OfflineCompilerTests, givenInvalidFclOutputWhenCompilingKernelThenOutOfHo
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto initResult = mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, initResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, initResult);
|
||||
|
||||
const auto buildResult{mockOfflineCompiler.build()};
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, buildResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, buildResult);
|
||||
|
||||
NEO::setFclDebugVars(gEnvironment->fclDebugVars);
|
||||
}
|
||||
@@ -1843,10 +1843,10 @@ TEST_F(OfflineCompilerTests, givenFclTranslationContextCreationFailureWhenCompil
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto initResult = mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, initResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, initResult);
|
||||
|
||||
const auto buildResult{mockOfflineCompiler.build()};
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, buildResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, buildResult);
|
||||
|
||||
NEO::setFclDebugVars(gEnvironment->fclDebugVars);
|
||||
}
|
||||
@@ -1867,10 +1867,10 @@ TEST_F(OfflineCompilerTests, givenFclTranslationContextCreationFailureAndErrorMe
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
|
||||
const auto initResult = mockOfflineCompiler.initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, initResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, initResult);
|
||||
|
||||
const auto buildResult{mockOfflineCompiler.build()};
|
||||
EXPECT_EQ(OclocErrorCode::BUILD_PROGRAM_FAILURE, buildResult);
|
||||
EXPECT_EQ(OCLOC_BUILD_PROGRAM_FAILURE, buildResult);
|
||||
|
||||
EXPECT_EQ("Error: Could not create context!", mockOfflineCompiler.getBuildLog());
|
||||
|
||||
@@ -2270,7 +2270,7 @@ TEST_F(OfflineCompilerTests, GivenHelpOptionThenBuildDoesNotOccur) {
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE("", output.c_str());
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
|
||||
delete pOfflineCompiler;
|
||||
}
|
||||
@@ -2288,7 +2288,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidFileWhenBuildingThenInvalidFileErrorIsR
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, retVal);
|
||||
DebugManager.flags.PrintDebugMessages.set(false);
|
||||
delete pOfflineCompiler;
|
||||
}
|
||||
@@ -2306,7 +2306,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidFlagWhenBuildingThenInvalidCommandLineE
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
|
||||
delete pOfflineCompiler;
|
||||
}
|
||||
@@ -2323,7 +2323,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidOptionsWhenBuildingThenInvalidCommandLi
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
|
||||
delete pOfflineCompiler;
|
||||
|
||||
@@ -2337,7 +2337,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidOptionsWhenBuildingThenInvalidCommandLi
|
||||
output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
|
||||
delete pOfflineCompiler;
|
||||
}
|
||||
@@ -2586,7 +2586,7 @@ TEST(OfflineCompilerTest, GivenUnknownIsaConfigValueWhenInitHardwareInfoThenInva
|
||||
std::stringstream resString;
|
||||
|
||||
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
||||
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_DEVICE);
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
|
||||
@@ -2596,7 +2596,7 @@ TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenIn
|
||||
std::stringstream resString;
|
||||
|
||||
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
||||
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_DEVICE);
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, GivenUnsupportedDeviceWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
|
||||
@@ -2607,7 +2607,7 @@ TEST(OfflineCompilerTest, GivenUnsupportedDeviceWhenInitHardwareInfoThenInvalidD
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto retVal = mockOfflineCompiler->initHardwareInfo(deviceName);
|
||||
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
|
||||
EXPECT_EQ(retVal, OCLOC_INVALID_DEVICE);
|
||||
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
resString << "Could not determine device target: " << deviceName << ".\n";
|
||||
@@ -3357,7 +3357,7 @@ TEST(OfflineCompilerTest, givenDeviceOptionsWithDeprecatedDeviceAcronymWhenCmdLi
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(0u, output.size());
|
||||
EXPECT_NE(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_NE(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
std::stringstream expectedErrorMessage;
|
||||
expectedErrorMessage << "Error: Invalid device acronym passed to -device_options: " << deviceName;
|
||||
@@ -3391,7 +3391,7 @@ TEST(OfflineCompilerTest, givenUnknownDeviceAcronymInDeviceOptionsWhenParsingCom
|
||||
const auto result = mockOfflineCompiler->parseCommandLine(argv.size(), argv);
|
||||
const std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
const std::string expectedErrorMessage1{"Error: Invalid device acronym passed to -device_options: unknownDeviceName1\n"};
|
||||
const std::string expectedErrorMessage2{"Error: Invalid device acronym passed to -device_options: unknownDeviceName2\n"};
|
||||
@@ -3600,7 +3600,7 @@ TEST(OfflineCompilerTest, givenDeviceOptionsForMultipleDevicesSeparatedByCommasW
|
||||
const auto result = mockOfflineCompiler->parseCommandLine(argv.size(), argv);
|
||||
const std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
EXPECT_NE(0u, output.size());
|
||||
|
||||
std::stringstream expectedErrorMessage;
|
||||
@@ -3627,7 +3627,7 @@ TEST(OfflineCompilerTest, givenDashOOptionWhenCmdLineParsedThenBinaryOutputNameI
|
||||
auto retVal = mockOfflineCompiler->parseCommandLine(argv.size(), argv);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_EQ(0u, output.size());
|
||||
|
||||
EXPECT_EQ("nameOfFile.bin", mockOfflineCompiler->binaryOutputFile);
|
||||
@@ -3658,7 +3658,7 @@ TEST(OfflineCompilerTest, givenDashOAndOtherInvalidOptionsWhenCmdLineParsedThenE
|
||||
auto retVal = mockOfflineCompiler->parseCommandLine(argv.size(), argv);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_NE(0u, output.size());
|
||||
|
||||
EXPECT_TRUE(hasSubstr(output, std::string("Error: options: -gen_file/-cpp_file/-output_no_suffix/-output cannot be used with -o\n")));
|
||||
@@ -3682,7 +3682,7 @@ TEST(OfflineCompilerTest, givenDashOAndOtherInvalidOptionsWhenCmdLineParsedThenE
|
||||
auto retVal = mockOfflineCompiler->parseCommandLine(argv2.size(), argv2);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_NE(0u, output.size());
|
||||
|
||||
EXPECT_TRUE(hasSubstr(output, std::string("Error: options: -gen_file/-cpp_file/-output_no_suffix/-output cannot be used with -o\n")));
|
||||
@@ -3928,7 +3928,7 @@ TEST(OfflineCompilerTest, givenCompilerWhenBuildSourceCodeFailsThenGenerateElfBi
|
||||
MockOfflineCompiler compiler;
|
||||
compiler.overrideBuildSourceCodeStatus = true;
|
||||
|
||||
auto expectedError = OclocErrorCode::BUILD_PROGRAM_FAILURE;
|
||||
auto expectedError = OCLOC_BUILD_PROGRAM_FAILURE;
|
||||
compiler.buildSourceCodeStatus = expectedError;
|
||||
|
||||
EXPECT_EQ(0u, compiler.generateElfBinaryCalled);
|
||||
@@ -3959,7 +3959,7 @@ TEST(OfflineCompilerTest, givenDeviceSpecificKernelFileWhenCompilerIsInitialized
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
int retVal = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_STREQ("-cl-opt-disable", mockOfflineCompiler->options.c_str());
|
||||
}
|
||||
|
||||
@@ -3978,7 +3978,7 @@ TEST(OfflineCompilerTest, givenHexadecimalRevisionIdWhenCompilerIsInitializedThe
|
||||
"0x11"};
|
||||
|
||||
int retVal = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_EQ(mockOfflineCompiler->hwInfo.platform.usRevId, 17);
|
||||
}
|
||||
|
||||
@@ -4000,7 +4000,7 @@ TEST(OfflineCompilerTest, givenDebugVariableSetWhenInitializingThenOverrideRevis
|
||||
"0x11"};
|
||||
|
||||
int retVal = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_EQ(mockOfflineCompiler->hwInfo.platform.usRevId, 123);
|
||||
}
|
||||
|
||||
@@ -4019,7 +4019,7 @@ TEST(OfflineCompilerTest, givenDecimalRevisionIdWhenCompilerIsInitializedThenPas
|
||||
"17"};
|
||||
|
||||
int retVal = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_EQ(mockOfflineCompiler->hwInfo.platform.usRevId, 17);
|
||||
}
|
||||
|
||||
@@ -4038,7 +4038,7 @@ TEST(OfflineCompilerTest, givenNoRevisionIdWhenCompilerIsInitializedThenHwInfoHa
|
||||
mockOfflineCompiler->initHardwareInfo(gEnvironment->devicePrefix.c_str());
|
||||
auto revId = mockOfflineCompiler->hwInfo.platform.usRevId;
|
||||
int retVal = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
EXPECT_EQ(mockOfflineCompiler->hwInfo.platform.usRevId, revId);
|
||||
}
|
||||
|
||||
@@ -4048,7 +4048,7 @@ TEST(OfflineCompilerTest, givenEmptyDeviceNameWhenInitializingHardwareInfoThenIn
|
||||
const std::string emptyDeviceName{};
|
||||
const auto result = mockOfflineCompiler.initHardwareInfo(emptyDeviceName);
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_DEVICE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_DEVICE, result);
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, whenDeviceIsSpecifiedThenDefaultConfigFromTheDeviceIsUsed) {
|
||||
@@ -4064,7 +4064,7 @@ TEST(OfflineCompilerTest, whenDeviceIsSpecifiedThenDefaultConfigFromTheDeviceIsU
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
int retVal = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, retVal);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, retVal);
|
||||
|
||||
HardwareInfo hwInfo = mockOfflineCompiler->hwInfo;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/offline_compiler/source/multi_command.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/offline_compiler.h"
|
||||
|
||||
#include "opencl/test/unit_test/offline_compiler/mock/mock_argument_helper.h"
|
||||
@@ -23,7 +23,7 @@ namespace NEO {
|
||||
class OfflineCompilerTests : public ::testing::Test {
|
||||
public:
|
||||
OfflineCompiler *pOfflineCompiler = nullptr;
|
||||
int retVal = OclocErrorCode::SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
std::map<std::string, std::string> filesMap;
|
||||
std::unique_ptr<MockOclocArgHelper> oclocArgHelperWithoutInput = std::make_unique<MockOclocArgHelper>(filesMap);
|
||||
|
||||
@@ -41,7 +41,7 @@ class MultiCommandTests : public ::testing::Test {
|
||||
MultiCommand *pMultiCommand = nullptr;
|
||||
std::string nameOfFileWithArgs;
|
||||
std::string outFileList;
|
||||
int retVal = OclocErrorCode::SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
std::map<std::string, std::string> filesMap;
|
||||
std::unique_ptr<MockOclocArgHelper> oclocArgHelperWithoutInput = std::make_unique<MockOclocArgHelper>(filesMap);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "offline_linker_tests.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_decoder.h"
|
||||
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
@@ -78,7 +78,7 @@ TEST_F(OfflineLinkerTest, GivenLessThanTwoArgumentsWhenParsingThenInvalidCommand
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
}
|
||||
|
||||
TEST_F(OfflineLinkerTest, GivenInputFilesArgumentsWhenParsingThenListOfFilenamesIsPopulated) {
|
||||
@@ -96,7 +96,7 @@ TEST_F(OfflineLinkerTest, GivenInputFilesArgumentsWhenParsingThenListOfFilenames
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, result);
|
||||
ASSERT_EQ(2u, mockOfflineLinker.inputFilenames.size());
|
||||
|
||||
EXPECT_EQ(firstFile, mockOfflineLinker.inputFilenames[0]);
|
||||
@@ -115,7 +115,7 @@ TEST_F(OfflineLinkerTest, GivenOutputFilenameArgumentWhenParsingThenOutputFilena
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(outputFilename, mockOfflineLinker.outputFilename);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ TEST_F(OfflineLinkerTest, GivenValidOutputFileFormatWhenParsingThenOutputFormatI
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(IGC::CodeType::llvmBc, mockOfflineLinker.outputFormat);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ TEST_F(OfflineLinkerTest, GivenUnknownOutputFileFormatWhenParsingThenInvalidForm
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(IGC::CodeType::invalid, mockOfflineLinker.outputFormat);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ TEST_F(OfflineLinkerTest, GivenOptionsArgumentWhenParsingThenOptionsAreSet) {
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(options, mockOfflineLinker.options);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ TEST_F(OfflineLinkerTest, GivenInternalOptionsArgumentWhenParsingThenInternalOpt
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(internalOptions, mockOfflineLinker.internalOptions);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ TEST_F(OfflineLinkerTest, GivenHelpArgumentWhenParsingThenShowHelpOperationIsSet
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, result);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, result);
|
||||
EXPECT_EQ(OperationMode::SHOW_HELP, mockOfflineLinker.operationMode);
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ TEST_F(OfflineLinkerTest, GivenUnknownArgumentWhenParsingThenErrorIsReported) {
|
||||
const auto result = mockOfflineLinker.initialize(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
const std::string expectedErrorMessage{"Invalid option (arg 2): -some_new_unknown_command\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -226,7 +226,7 @@ TEST_F(OfflineLinkerTest, GivenFlagsWhichRequireMoreArgsWithoutThemWhenParsingTh
|
||||
const auto result = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, result);
|
||||
|
||||
const std::string expectedErrorMessage{"Invalid option (arg 2): " + flag + "\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -241,7 +241,7 @@ TEST_F(OfflineLinkerTest, GivenCommandWithoutInputFilesWhenVerificationIsPerform
|
||||
const auto verificationResult = mockOfflineLinker.verifyLinkerCommand();
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, verificationResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, verificationResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Input name is missing! At least one input file is required!\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -260,7 +260,7 @@ TEST_F(OfflineLinkerTest, GivenCommandWithEmptyFilenameWhenVerificationIsPerform
|
||||
const auto verificationResult = mockOfflineLinker.initialize(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, verificationResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, verificationResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Empty filename cannot be used!\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -277,13 +277,13 @@ TEST_F(OfflineLinkerTest, GivenCommandWithNonexistentInputFileWhenVerificationIs
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto parsingResult = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, parsingResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, parsingResult);
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto verificationResult = mockOfflineLinker.verifyLinkerCommand();
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_FILE, verificationResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_FILE, verificationResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Input file some_file1.spv missing.\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -302,13 +302,13 @@ TEST_F(OfflineLinkerTest, GivenCommandWithInvalidOutputFormatWhenVerificationIsP
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto parsingResult = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, parsingResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, parsingResult);
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto verificationResult = mockOfflineLinker.verifyLinkerCommand();
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, verificationResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, verificationResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Invalid output type!\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -328,13 +328,13 @@ TEST_F(OfflineLinkerTest, GivenValidCommandWhenVerificationIsPerformedThenSucces
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
const auto parsingResult = mockOfflineLinker.parseCommand(argv.size(), argv);
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, parsingResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, parsingResult);
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto verificationResult = mockOfflineLinker.verifyLinkerCommand();
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, verificationResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, verificationResult);
|
||||
EXPECT_TRUE(output.empty());
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ TEST_F(OfflineLinkerTest, GivenEmptyFileWhenLoadingInputFilesThenErrorIsReturned
|
||||
const auto initializationResult = mockOfflineLinker.initialize(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::INVALID_FILE, initializationResult);
|
||||
ASSERT_EQ(OCLOC_INVALID_FILE, initializationResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Cannot read input file: some_file.spv\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -374,7 +374,7 @@ TEST_F(OfflineLinkerTest, GivenValidFileWithUnknownFormatWhenLoadingInputFilesTh
|
||||
const auto readingResult = mockOfflineLinker.loadInputFilesContent();
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::INVALID_PROGRAM, readingResult);
|
||||
ASSERT_EQ(OCLOC_INVALID_PROGRAM, readingResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Unsupported format of input file: some_file.unknown\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -395,7 +395,7 @@ TEST_F(OfflineLinkerTest, GivenValidFilesWithValidFormatsWhenLoadingInputFilesTh
|
||||
const auto readingResult = mockOfflineLinker.loadInputFilesContent();
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, readingResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, readingResult);
|
||||
EXPECT_TRUE(output.empty());
|
||||
|
||||
const auto &firstExpectedContent = mockArgHelperFilesMap[firstFilename];
|
||||
@@ -434,7 +434,7 @@ TEST_F(OfflineLinkerTest, GivenValidFilesWhenInitializationIsSuccessfulThenLinkM
|
||||
const auto initializationResult = mockOfflineLinker.initialize(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::SUCCESS, initializationResult);
|
||||
EXPECT_EQ(OCLOC_SUCCESS, initializationResult);
|
||||
EXPECT_TRUE(output.empty());
|
||||
|
||||
EXPECT_EQ(OperationMode::LINK_FILES, mockOfflineLinker.operationMode);
|
||||
@@ -453,7 +453,7 @@ TEST_F(OfflineLinkerTest, GivenSPIRVandLLVMBCFilesWhenElfOutputIsRequestedThenEl
|
||||
mockOfflineLinker.operationMode = OperationMode::LINK_FILES;
|
||||
|
||||
const auto linkingResult{mockOfflineLinker.execute()};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, linkingResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, linkingResult);
|
||||
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count("linker_output"));
|
||||
const auto &rawOutput{mockArgHelper.interceptedFiles.at("linker_output")};
|
||||
@@ -495,7 +495,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsWhenLlvmBcOutputIsRequested
|
||||
|
||||
HardwareInfo hwInfo{};
|
||||
const auto igcInitializationResult{mockOclocIgcFacade->initialize(hwInfo)};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, igcInitializationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, igcInitializationResult);
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
mockOfflineLinker.inputFilesContent.emplace_back(std::move(spirvFileContent.bytes), spirvFileContent.size, spirvFileContent.codeType);
|
||||
@@ -504,7 +504,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsWhenLlvmBcOutputIsRequested
|
||||
mockOfflineLinker.operationMode = OperationMode::LINK_FILES;
|
||||
|
||||
const auto linkingResult{mockOfflineLinker.execute()};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, linkingResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, linkingResult);
|
||||
|
||||
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count("linker_output"));
|
||||
const auto &actualOutput{mockArgHelper.interceptedFiles.at("linker_output")};
|
||||
@@ -528,7 +528,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsAndFailingIGCWhenLlvmBcOutp
|
||||
|
||||
HardwareInfo hwInfo{};
|
||||
const auto igcInitializationResult{mockOclocIgcFacade->initialize(hwInfo)};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, igcInitializationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, igcInitializationResult);
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
mockOfflineLinker.inputFilesContent.emplace_back(std::move(spirvFileContent.bytes), spirvFileContent.size, spirvFileContent.codeType);
|
||||
@@ -540,7 +540,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsAndFailingIGCWhenLlvmBcOutp
|
||||
const auto linkingResult{mockOfflineLinker.execute()};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::BUILD_PROGRAM_FAILURE, linkingResult);
|
||||
ASSERT_EQ(OCLOC_BUILD_PROGRAM_FAILURE, linkingResult);
|
||||
EXPECT_EQ(0u, mockArgHelper.interceptedFiles.count("linker_output"));
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Translation has failed! IGC returned empty output.\n"};
|
||||
@@ -559,7 +559,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsAndIGCSignalingSuccessButRe
|
||||
|
||||
HardwareInfo hwInfo{};
|
||||
const auto igcInitializationResult{mockOclocIgcFacade->initialize(hwInfo)};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, igcInitializationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, igcInitializationResult);
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
mockOfflineLinker.inputFilesContent.emplace_back(std::move(spirvFileContent.bytes), spirvFileContent.size, spirvFileContent.codeType);
|
||||
@@ -571,7 +571,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsAndIGCSignalingSuccessButRe
|
||||
const auto linkingResult{mockOfflineLinker.execute()};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::BUILD_PROGRAM_FAILURE, linkingResult);
|
||||
ASSERT_EQ(OCLOC_BUILD_PROGRAM_FAILURE, linkingResult);
|
||||
EXPECT_EQ(0u, mockArgHelper.interceptedFiles.count("linker_output"));
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Translation has failed! IGC returned empty output.\n"};
|
||||
@@ -590,7 +590,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsAndInvalidTranslationOutput
|
||||
|
||||
HardwareInfo hwInfo{};
|
||||
const auto igcInitializationResult{mockOclocIgcFacade->initialize(hwInfo)};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, igcInitializationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, igcInitializationResult);
|
||||
|
||||
MockOfflineLinker mockOfflineLinker{&mockArgHelper, std::move(mockOclocIgcFacade)};
|
||||
mockOfflineLinker.inputFilesContent.emplace_back(std::move(spirvFileContent.bytes), spirvFileContent.size, spirvFileContent.codeType);
|
||||
@@ -602,7 +602,7 @@ TEST_F(OfflineLinkerTest, GivenValidInputFileContentsAndInvalidTranslationOutput
|
||||
const auto linkingResult{mockOfflineLinker.execute()};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, linkingResult);
|
||||
ASSERT_EQ(OCLOC_OUT_OF_HOST_MEMORY, linkingResult);
|
||||
EXPECT_EQ(0u, mockArgHelper.interceptedFiles.count("linker_output"));
|
||||
|
||||
const std::string expectedErrorMessage{"Error: Translation has failed! IGC output is nullptr!\n"};
|
||||
@@ -616,7 +616,7 @@ TEST_F(OfflineLinkerTest, GivenUninitializedLinkerWhenExecuteIsInvokedThenErrorI
|
||||
const auto executionResult{mockOfflineLinker.execute()};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, executionResult);
|
||||
ASSERT_EQ(OCLOC_INVALID_COMMAND_LINE, executionResult);
|
||||
ASSERT_FALSE(output.empty());
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ TEST_F(OfflineLinkerTest, GivenHelpRequestWhenExecuteIsInvokedThenHelpIsPrinted)
|
||||
const auto executionResult{mockOfflineLinker.execute()};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, executionResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, executionResult);
|
||||
ASSERT_FALSE(output.empty());
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ TEST_F(OfflineLinkerTest, GivenInvalidOperationModeWhenExecuteIsInvokedThenError
|
||||
const auto executionResult{mockOfflineLinker.execute()};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, executionResult);
|
||||
ASSERT_EQ(OCLOC_INVALID_COMMAND_LINE, executionResult);
|
||||
ASSERT_FALSE(output.empty());
|
||||
}
|
||||
|
||||
@@ -649,7 +649,7 @@ TEST_F(OfflineLinkerTest, GivenUninitializedHwInfoWhenInitIsCalledThenHwInfoIsIn
|
||||
ASSERT_EQ(IGFX_UNKNOWN, mockOfflineLinker.hwInfo.platform.eProductFamily);
|
||||
|
||||
const auto hwInfoInitializationResult{mockOfflineLinker.initHardwareInfo()};
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, hwInfoInitializationResult);
|
||||
ASSERT_EQ(OCLOC_SUCCESS, hwInfoInitializationResult);
|
||||
EXPECT_NE(IGFX_UNKNOWN, mockOfflineLinker.hwInfo.platform.eProductFamily);
|
||||
}
|
||||
|
||||
@@ -675,7 +675,7 @@ TEST_F(OfflineLinkerTest, GivenEmptyHwInfoTableWhenInitializationIsPerformedThen
|
||||
const auto initializationResult = mockOfflineLinker.initialize(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::INVALID_DEVICE, initializationResult);
|
||||
EXPECT_EQ(OCLOC_INVALID_DEVICE, initializationResult);
|
||||
|
||||
const std::string expectedErrorMessage{"Error! Cannot retrieve any valid hardware information!\n"};
|
||||
EXPECT_EQ(expectedErrorMessage, output);
|
||||
@@ -703,7 +703,7 @@ TEST_F(OfflineLinkerTest, GivenMissingIgcLibraryWhenInitializationIsPerformedThe
|
||||
const auto initializationResult = mockOfflineLinker.initialize(argv.size(), argv);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(OclocErrorCode::OUT_OF_HOST_MEMORY, initializationResult);
|
||||
EXPECT_EQ(OCLOC_OUT_OF_HOST_MEMORY, initializationResult);
|
||||
|
||||
std::stringstream expectedErrorMessage;
|
||||
expectedErrorMessage << "Error! Loading of IGC library has failed! Filename: " << Os::igcDllName << "\n";
|
||||
|
||||
@@ -98,7 +98,6 @@ set(CLOC_LIB_SRCS_LIB
|
||||
${OCLOC_DIRECTORY}/source/ocloc_concat.h
|
||||
${OCLOC_DIRECTORY}/source/ocloc_dll_options.cpp
|
||||
${OCLOC_DIRECTORY}/source/ocloc_dll_options.h
|
||||
${OCLOC_DIRECTORY}/source/ocloc_error_code.h
|
||||
${OCLOC_DIRECTORY}/source/ocloc_fatbinary.cpp
|
||||
${OCLOC_DIRECTORY}/source/ocloc_fatbinary.h
|
||||
${OCLOC_DIRECTORY}/source/ocloc_fcl_facade.cpp
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "zebin_manipulator.h"
|
||||
|
||||
#include "shared/offline_compiler/source/decoder/iga_wrapper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/source/device_binary_format/device_binary_formats.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_decoder.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
@@ -51,21 +51,21 @@ ErrorCode parseIntelGTNotesSectionForDevice(const std::vector<Zebin::Elf::IntelG
|
||||
}
|
||||
if (IGFX_UNKNOWN != hwInfo.platform.eProductFamily) {
|
||||
iga->setProductFamily(hwInfo.platform.eProductFamily);
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
} else if (productFamilyNoteId != std::numeric_limits<size_t>::max()) {
|
||||
UNRECOVERABLE_IF(sizeof(PRODUCT_FAMILY) != intelGTNotes[productFamilyNoteId].data.size());
|
||||
auto productFamily = *reinterpret_cast<const PRODUCT_FAMILY *>(intelGTNotes[productFamilyNoteId].data.begin());
|
||||
iga->setProductFamily(productFamily);
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
} else if (gfxCoreNoteId != std::numeric_limits<size_t>::max()) {
|
||||
UNRECOVERABLE_IF(sizeof(GFXCORE_FAMILY) != intelGTNotes[gfxCoreNoteId].data.size());
|
||||
auto gfxCore = *reinterpret_cast<const GFXCORE_FAMILY *>(intelGTNotes[gfxCoreNoteId].data.begin());
|
||||
iga->setGfxCore(gfxCore);
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
return OclocErrorCode::INVALID_DEVICE;
|
||||
return OCLOC_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
ErrorCode validateInput(const std::vector<std::string> &args, IgaWrapper *iga, OclocArgHelper *argHelper, Arguments &outArguments) {
|
||||
@@ -81,7 +81,7 @@ ErrorCode validateInput(const std::vector<std::string> &args, IgaWrapper *iga, O
|
||||
addSlash(outArguments.pathToDump);
|
||||
} else if ("--help" == currArg) {
|
||||
outArguments.showHelp = true;
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
} else if ("-q" == currArg) {
|
||||
argHelper->getPrinterRef().setSuppressMessages(true);
|
||||
iga->setMessagePrinter(argHelper->getPrinterRef());
|
||||
@@ -89,13 +89,13 @@ ErrorCode validateInput(const std::vector<std::string> &args, IgaWrapper *iga, O
|
||||
outArguments.skipIGAdisassembly = true;
|
||||
} else {
|
||||
argHelper->printf("Unknown argument %s\n", currArg.c_str());
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
if (outArguments.binaryFile.empty()) {
|
||||
argHelper->printf("Error: Missing -file argument\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
if (outArguments.pathToDump.empty()) {
|
||||
@@ -103,7 +103,7 @@ ErrorCode validateInput(const std::vector<std::string> &args, IgaWrapper *iga, O
|
||||
outArguments.pathToDump = "dump/";
|
||||
}
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
bool is64BitZebin(OclocArgHelper *argHelper, const std::string §ionsInfoFilepath) {
|
||||
@@ -170,7 +170,7 @@ ErrorCode ZebinDecoder<numBits>::decode() {
|
||||
|
||||
ElfT elf;
|
||||
ErrorCode retVal = decodeZebin(ArrayRef<const uint8_t>::fromAny(zebinBinary.data(), zebinBinary.size()), elf);
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error while decoding zebin.\n");
|
||||
return retVal;
|
||||
}
|
||||
@@ -179,11 +179,11 @@ ErrorCode ZebinDecoder<numBits>::decode() {
|
||||
auto intelGTNotes = getIntelGTNotes(elf);
|
||||
if (intelGTNotes.empty()) {
|
||||
argHelper->printf("Error missing or invalid Intel GT Notes section.\n");
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
retVal = parseIntelGTNotesSectionForDevice(intelGTNotes, iga.get(), argHelper);
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error while parsing Intel GT Notes section for device.\n");
|
||||
return retVal;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ ErrorCode ZebinDecoder<numBits>::decode() {
|
||||
auto sectionsInfo = dumpElfSections(elf);
|
||||
dumpSectionInfo(sectionsInfo);
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template ErrorCode ZebinDecoder<Elf::EI_CLASS_32>::validateInput(const std::vector<std::string> &args);
|
||||
@@ -321,10 +321,10 @@ ErrorCode ZebinDecoder<numBits>::decodeZebin(ArrayRef<const uint8_t> zebin, ElfT
|
||||
|
||||
if (false == errors.empty()) {
|
||||
argHelper->printf("decodeElf error: %s\n", errors.c_str());
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
@@ -385,17 +385,17 @@ template ErrorCode ZebinEncoder<Elf::EI_CLASS_32>::encode();
|
||||
template ErrorCode ZebinEncoder<Elf::EI_CLASS_64>::encode();
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
ErrorCode ZebinEncoder<numBits>::encode() {
|
||||
ErrorCode retVal = OclocErrorCode::SUCCESS;
|
||||
ErrorCode retVal = OCLOC_SUCCESS;
|
||||
|
||||
std::vector<SectionInfo> sectionInfos;
|
||||
retVal = loadSectionsInfo(sectionInfos);
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error while loading sections file.\n");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
retVal = checkIfAllFilesExist(sectionInfos);
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error: Missing one or more section files.\n");
|
||||
return retVal;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ ErrorCode ZebinEncoder<numBits>::encode() {
|
||||
auto intelGTNotesSectionData = getIntelGTNotesSection(sectionInfos);
|
||||
auto intelGTNotes = getIntelGTNotes(intelGTNotesSectionData);
|
||||
retVal = parseIntelGTNotesSectionForDevice(intelGTNotes, iga.get(), argHelper);
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error while parsing Intel GT Notes section for device.\n");
|
||||
return retVal;
|
||||
}
|
||||
@@ -413,7 +413,7 @@ ErrorCode ZebinEncoder<numBits>::encode() {
|
||||
elfEncoder.getElfFileHeader().type = Zebin::Elf::ELF_TYPE_ZEBIN::ET_ZEBIN_EXE;
|
||||
|
||||
retVal = appendSections(elfEncoder, sectionInfos);
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error while appending elf sections.\n");
|
||||
return retVal;
|
||||
}
|
||||
@@ -421,7 +421,7 @@ ErrorCode ZebinEncoder<numBits>::encode() {
|
||||
auto zebin = elfEncoder.encode();
|
||||
argHelper->saveOutput(getFilePath(arguments.binaryFile), zebin.data(), zebin.size());
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template ErrorCode ZebinEncoder<Elf::EI_CLASS_32>::validateInput(const std::vector<std::string> &args);
|
||||
@@ -487,7 +487,7 @@ ErrorCode ZebinEncoder<numBits>::loadSectionsInfo(std::vector<SectionInfo> §
|
||||
std::vector<std::string> sectionsInfoLines;
|
||||
argHelper->readFileToVectorOfStrings(getFilePath(sectionsInfoFilename.data()), sectionsInfoLines);
|
||||
if (sectionsInfoLines.size() <= 2) {
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
sectionInfos.resize(sectionsInfoLines.size() - 2);
|
||||
@@ -498,7 +498,7 @@ ErrorCode ZebinEncoder<numBits>::loadSectionsInfo(std::vector<SectionInfo> §
|
||||
sectionInfo.name = elements[0];
|
||||
sectionInfo.type = static_cast<uint32_t>(std::stoull(elements[1]));
|
||||
}
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
@@ -511,10 +511,10 @@ ErrorCode ZebinEncoder<numBits>::checkIfAllFilesExist(const std::vector<SectionI
|
||||
|
||||
if (false == fileExists) {
|
||||
argHelper->printf("Error: Could not find the file \"%s\"\n", sectionInfo.name.c_str());
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
}
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
@@ -528,7 +528,7 @@ ErrorCode ZebinEncoder<numBits>::appendSections(ElfEncoderT &encoder, const std:
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCode retVal = OclocErrorCode::SUCCESS;
|
||||
ErrorCode retVal = OCLOC_SUCCESS;
|
||||
for (const auto §ion : sectionInfos) {
|
||||
if (section.type == Elf::SHT_SYMTAB) {
|
||||
retVal |= appendSymtab(encoder, section, sectionInfos.size() + 1, secNameToId);
|
||||
@@ -551,13 +551,13 @@ ErrorCode ZebinEncoder<numBits>::appendRel(ElfEncoderT &encoder, const SectionIn
|
||||
argHelper->readFileToVectorOfStrings(getFilePath(section.name), relocationLines);
|
||||
if (relocationLines.empty()) {
|
||||
argHelper->printf("Error: Empty relocations file: %s\n", section.name.c_str());
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
auto relocs = parseRel(relocationLines);
|
||||
auto &sec = encoder.appendSection(Elf::SHT_REL, section.name, ArrayRef<const uint8_t>::fromAny(relocs.data(), relocs.size()));
|
||||
sec.info = static_cast<uint32_t>(targetSecId);
|
||||
sec.link = static_cast<uint32_t>(symtabSecId);
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
@@ -566,13 +566,13 @@ ErrorCode ZebinEncoder<numBits>::appendRela(ElfEncoderT &encoder, const SectionI
|
||||
argHelper->readFileToVectorOfStrings(getFilePath(section.name), relocationLines);
|
||||
if (relocationLines.empty()) {
|
||||
argHelper->printf("Error: Empty relocations file: %s\n", section.name.c_str());
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
auto relocs = parseRela(relocationLines);
|
||||
auto &sec = encoder.appendSection(Elf::SHT_RELA, section.name, ArrayRef<const uint8_t>::fromAny(relocs.data(), relocs.size()));
|
||||
sec.info = static_cast<uint32_t>(targetSecId);
|
||||
sec.link = static_cast<uint32_t>(symtabSecId);
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
@@ -601,7 +601,7 @@ ErrorCode ZebinEncoder<numBits>::appendKernel(ElfEncoderT &encoder, const Sectio
|
||||
auto data = argHelper->readBinaryFile(getFilePath(section.name));
|
||||
encoder.appendSection(Elf::SHT_PROGBITS, section.name, ArrayRef<const uint8_t>::fromAny(data.data(), data.size()));
|
||||
}
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
@@ -610,7 +610,7 @@ ErrorCode ZebinEncoder<numBits>::appendSymtab(ElfEncoderT &encoder, const Sectio
|
||||
argHelper->readFileToVectorOfStrings(getFilePath(section.name), symTabLines);
|
||||
if (symTabLines.empty()) {
|
||||
argHelper->printf("Error: Empty symtab file: %s\n", section.name.c_str());
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
size_t numLocalSymbols = 0;
|
||||
@@ -619,14 +619,14 @@ ErrorCode ZebinEncoder<numBits>::appendSymtab(ElfEncoderT &encoder, const Sectio
|
||||
auto &symtabSection = encoder.appendSection(section.type, section.name, ArrayRef<const uint8_t>::fromAny(symbols.data(), symbols.size()));
|
||||
symtabSection.info = static_cast<uint32_t>(numLocalSymbols);
|
||||
symtabSection.link = static_cast<uint32_t>(strtabSecId);
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
ErrorCode ZebinEncoder<numBits>::appendOther(ElfEncoderT &encoder, const SectionInfo §ion) {
|
||||
auto sectionData = argHelper->readBinaryFile(getFilePath(section.name));
|
||||
encoder.appendSection(section.type, section.name, ArrayRef<const uint8_t>::fromAny(sectionData.data(), sectionData.size()));
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
template <Elf::ELF_IDENTIFIER_CLASS numBits>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "shared/offline_compiler/source/multi_command.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_fatbinary.h"
|
||||
#include "shared/offline_compiler/source/offline_compiler.h"
|
||||
#include "shared/offline_compiler/source/utilities/get_current_dir.h"
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
namespace NEO {
|
||||
int MultiCommand::singleBuild(const std::vector<std::string> &args) {
|
||||
int retVal = OclocErrorCode::SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
|
||||
if (requestedFatBinary(args, argHelper)) {
|
||||
retVal = buildFatBinary(args, argHelper);
|
||||
} else {
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(args.size(), args, true, retVal, argHelper)};
|
||||
if (retVal == OclocErrorCode::SUCCESS) {
|
||||
if (retVal == OCLOC_SUCCESS) {
|
||||
retVal = buildWithSafetyGuard(pCompiler.get());
|
||||
|
||||
std::string &buildLog = pCompiler->getBuildLog();
|
||||
@@ -35,14 +35,14 @@ int MultiCommand::singleBuild(const std::vector<std::string> &args) {
|
||||
}
|
||||
outFileName += ".bin";
|
||||
}
|
||||
if (retVal == OclocErrorCode::SUCCESS) {
|
||||
if (retVal == OCLOC_SUCCESS) {
|
||||
if (!quiet)
|
||||
argHelper->printf("Build succeeded.\n");
|
||||
} else {
|
||||
argHelper->printf("Build failed with error code: %d\n", retVal);
|
||||
}
|
||||
|
||||
if (retVal == OclocErrorCode::SUCCESS) {
|
||||
if (retVal == OCLOC_SUCCESS) {
|
||||
outputFile << getCurrentDirectoryOwn(outDirForBuilds) + outFileName;
|
||||
} else {
|
||||
outputFile << "Unsuccesful build";
|
||||
@@ -53,7 +53,7 @@ int MultiCommand::singleBuild(const std::vector<std::string> &args) {
|
||||
}
|
||||
|
||||
MultiCommand *MultiCommand::create(const std::vector<std::string> &args, int &retVal, OclocArgHelper *helper) {
|
||||
retVal = OclocErrorCode::SUCCESS;
|
||||
retVal = OCLOC_SUCCESS;
|
||||
auto pMultiCommand = new MultiCommand();
|
||||
|
||||
if (pMultiCommand) {
|
||||
@@ -61,7 +61,7 @@ MultiCommand *MultiCommand::create(const std::vector<std::string> &args, int &re
|
||||
retVal = pMultiCommand->initialize(args);
|
||||
}
|
||||
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
delete pMultiCommand;
|
||||
pMultiCommand = nullptr;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ int MultiCommand::initialize(const std::vector<std::string> &args) {
|
||||
} else {
|
||||
argHelper->printf("Invalid option (arg %zu): %s\n", argIndex, currArg.c_str());
|
||||
printHelp();
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ int MultiCommand::initialize(const std::vector<std::string> &args) {
|
||||
argHelper->readFileToVectorOfStrings(pathToCommandFile, lines);
|
||||
if (lines.empty()) {
|
||||
argHelper->printf("Command file was empty.\n");
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
} else {
|
||||
argHelper->printf("Could not find/open file with builds argument.s\n");
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
runBuilds(args[0]);
|
||||
@@ -141,7 +141,7 @@ void MultiCommand::runBuilds(const std::string &argZero) {
|
||||
std::vector<std::string> args = {argZero};
|
||||
|
||||
int retVal = splitLineInSeparateArgs(args, lines[i], i);
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
retValues.push_back(retVal);
|
||||
continue;
|
||||
}
|
||||
@@ -193,22 +193,22 @@ int MultiCommand::splitLineInSeparateArgs(std::vector<std::string> &qargs, const
|
||||
}
|
||||
if (end == std::string::npos) {
|
||||
argHelper->printf("One of the quotes is open in build number %zu\n", numberOfBuild + 1);
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
argLen = end - start;
|
||||
i = end;
|
||||
qargs.push_back(commandsLine.substr(start, argLen));
|
||||
}
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
int MultiCommand::showResults() {
|
||||
int retValue = OclocErrorCode::SUCCESS;
|
||||
int retValue = OCLOC_SUCCESS;
|
||||
int indexRetVal = 0;
|
||||
for (int retVal : retValues) {
|
||||
retValue |= retVal;
|
||||
if (!quiet) {
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Build command %d: failed. Error code: %d\n", indexRetVal, retVal);
|
||||
} else {
|
||||
argHelper->printf("Build command %d: successful\n", indexRetVal);
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "ocloc_api.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_interface.h"
|
||||
|
||||
#include <iostream>
|
||||
@@ -29,7 +29,7 @@ int oclocInvoke(unsigned int numArgs, const char *argv[],
|
||||
try {
|
||||
if (numArgs <= 1 || NEO::ConstStringRef("-h") == args[1] || NEO::ConstStringRef("--help") == args[1]) {
|
||||
printHelp(*helper);
|
||||
return NEO::OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
auto &command = args[1];
|
||||
if (command == CommandNames::disassemble) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,6 +24,17 @@ typedef enum _ocloc_version_t {
|
||||
OCLOC_VERSION_FORCE_UINT32 = 0x7fffffff
|
||||
} ocloc_version_t;
|
||||
|
||||
typedef enum _ocloc_error_t {
|
||||
OCLOC_SUCCESS = 0,
|
||||
OCLOC_OUT_OF_HOST_MEMORY = -6,
|
||||
OCLOC_BUILD_PROGRAM_FAILURE = -11,
|
||||
OCLOC_INVALID_DEVICE = -33,
|
||||
OCLOC_INVALID_PROGRAM = -44,
|
||||
OCLOC_INVALID_COMMAND_LINE = -5150,
|
||||
OCLOC_INVALID_FILE = -5151,
|
||||
OCLOC_COMPILATION_CRASH = -5152,
|
||||
} ocloc_error_t;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SIGNATURE __declspec(dllexport) int __cdecl
|
||||
#else
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_concat.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/source/device_binary_format/ar/ar_decoder.h"
|
||||
#include "shared/source/device_binary_format/ar/ar_encoder.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_decoder.h"
|
||||
@@ -34,7 +34,7 @@ OclocConcat::ErrorCode OclocConcat::parseArguments(const std::vector<std::string
|
||||
if (NEO::ConstStringRef("-out") == args[i]) {
|
||||
if (i + 1 >= args.size()) {
|
||||
argHelper->printf("Missing out file name after \"-out\" argument\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
fatBinaryName = args[++i];
|
||||
} else {
|
||||
@@ -44,10 +44,10 @@ OclocConcat::ErrorCode OclocConcat::parseArguments(const std::vector<std::string
|
||||
|
||||
if (fileNamesToConcat.empty()) {
|
||||
argHelper->printf("No files to concatenate were provided.\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
OclocConcat::ErrorCode OclocConcat::checkIfFatBinariesExist() {
|
||||
@@ -59,7 +59,7 @@ OclocConcat::ErrorCode OclocConcat::checkIfFatBinariesExist() {
|
||||
argHelper->printf(errorMsg.c_str());
|
||||
}
|
||||
}
|
||||
return filesExist ? OclocErrorCode::SUCCESS : OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return filesExist ? OCLOC_SUCCESS : OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
void OclocConcat::printMsg(ConstStringRef fileName, const std::string &message) {
|
||||
@@ -113,7 +113,7 @@ OclocConcat::ErrorCode OclocConcat::concatenate() {
|
||||
|
||||
if (false == errors.empty()) {
|
||||
printMsg(fileName, errors);
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
printMsg(fileName, warnings);
|
||||
|
||||
@@ -128,7 +128,7 @@ OclocConcat::ErrorCode OclocConcat::concatenate() {
|
||||
auto productConfig = getAOTProductConfigFromBinary(fileRef, errors);
|
||||
if (false == errors.empty()) {
|
||||
printMsg(fileName, errors);
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
auto entryName = ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
arEncoder.appendFileEntry(entryName, fileRef);
|
||||
@@ -137,7 +137,7 @@ OclocConcat::ErrorCode OclocConcat::concatenate() {
|
||||
|
||||
auto arFile = arEncoder.encode();
|
||||
argHelper->saveOutput(fatBinaryName, arFile.data(), arFile.size());
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
void OclocConcat::printHelp() {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace NEO::OclocErrorCode {
|
||||
|
||||
enum {
|
||||
SUCCESS = 0,
|
||||
OUT_OF_HOST_MEMORY = -6,
|
||||
BUILD_PROGRAM_FAILURE = -11,
|
||||
INVALID_DEVICE = -33,
|
||||
INVALID_PROGRAM = -44,
|
||||
INVALID_COMMAND_LINE = -5150,
|
||||
INVALID_FILE = -5151,
|
||||
COMPILATION_CRASH = -5152,
|
||||
};
|
||||
|
||||
} // namespace NEO::OclocErrorCode
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_fatbinary.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/offline_compiler.h"
|
||||
#include "shared/offline_compiler/source/utilities/safety_caller.h"
|
||||
#include "shared/source/compiler_interface/compiler_options.h"
|
||||
@@ -343,7 +343,7 @@ int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelp
|
||||
|
||||
if (deviceArgIndex == static_cast<size_t>(-1)) {
|
||||
argHelper->printf("Error! Command does not contain device argument!\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
Ar::ArEncoder fatbinary(true);
|
||||
@@ -365,7 +365,7 @@ int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelp
|
||||
argsCopy[deviceArgIndex] = product.str();
|
||||
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(argsCopy.size(), argsCopy, false, retVal, argHelper)};
|
||||
if (OclocErrorCode::SUCCESS != retVal) {
|
||||
if (OCLOC_SUCCESS != retVal) {
|
||||
argHelper->printf("Error! Couldn't create OfflineCompiler. Exiting.\n");
|
||||
return retVal;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelp
|
||||
|
||||
if (shouldPreserveGenericIr) {
|
||||
const auto errorCode = appendGenericIr(fatbinary, inputFileName, argHelper, optionsForIr);
|
||||
if (errorCode != OclocErrorCode::SUCCESS) {
|
||||
if (errorCode != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error! Couldn't append generic IR file!\n");
|
||||
return errorCode;
|
||||
}
|
||||
@@ -405,7 +405,7 @@ int appendGenericIr(Ar::ArEncoder &fatbinary, const std::string &inputFile, Oclo
|
||||
std::unique_ptr<char[]> fileContents = argHelper->loadDataFromFile(inputFile, fileSize);
|
||||
if (fileSize == 0) {
|
||||
argHelper->printf("Error! Couldn't read input file!\n");
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
const auto ir = ArrayRef<const uint8_t>::fromAny(fileContents.get(), fileSize);
|
||||
@@ -413,14 +413,14 @@ int appendGenericIr(Ar::ArEncoder &fatbinary, const std::string &inputFile, Oclo
|
||||
if (!isSpirVBitcode(ir)) {
|
||||
argHelper->printf("Error! Input file is not in supported generic IR format! "
|
||||
"Currently supported format is SPIR-V.\n");
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
const auto encodedElf = createEncodedElfWithSpirv(ir, opt);
|
||||
ArrayRef<const uint8_t> genericIrFile{encodedElf.data(), encodedElf.size()};
|
||||
|
||||
fatbinary.appendFileEntry("generic_ir", genericIrFile);
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> createEncodedElfWithSpirv(const ArrayRef<const uint8_t> &spirv, const ArrayRef<const uint8_t> &options) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_fcl_facade.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/source/compiler_interface/igc_platform_helper.h"
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
@@ -32,19 +32,19 @@ int OclocFclFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
fclLib = loadFclLibrary();
|
||||
if (!fclLib) {
|
||||
argHelper->printf("Error! Loading of FCL library has failed! Filename: %s\n", Os::frontEndDllName);
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
const auto fclCreateMainFunction = loadCreateFclMainFunction();
|
||||
if (!fclCreateMainFunction) {
|
||||
argHelper->printf("Error! Cannot load required functions from FCL library.\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
fclMain = createFclMain(fclCreateMainFunction);
|
||||
if (!fclMain) {
|
||||
argHelper->printf("Error! Cannot create FCL main component!\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
if (!isFclInterfaceCompatible()) {
|
||||
@@ -52,13 +52,13 @@ int OclocFclFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
argHelper->printf("Error! Incompatible interface in FCL: %s\n", incompatibleInterface.c_str());
|
||||
|
||||
DEBUG_BREAK_IF(true);
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
fclDeviceCtx = createFclDeviceContext();
|
||||
if (!fclDeviceCtx) {
|
||||
argHelper->printf("Error! Cannot create FCL device context!\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
fclDeviceCtx->SetOclApiVersion(hwInfo.capabilityTable.clVersionSupport * 10);
|
||||
@@ -67,14 +67,14 @@ int OclocFclFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
const auto platform = getPlatformHandle();
|
||||
if (!platform) {
|
||||
argHelper->printf("Error! FCL device context has not been properly created!\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
populateFclInterface(*platform, hwInfo);
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
std::unique_ptr<OsLibrary> OclocFclFacade::loadFclLibrary() const {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_igc_facade.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/source/compiler_interface/igc_platform_helper.h"
|
||||
#include "shared/source/compiler_interface/os_compiler_cache_helper.h"
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
@@ -36,7 +36,7 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
igcLib = loadIgcLibrary();
|
||||
if (!igcLib) {
|
||||
argHelper->printf("Error! Loading of IGC library has failed! Filename: %s\n", Os::igcDllName);
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
std::string igcPath = igcLib->getFullPath();
|
||||
@@ -46,13 +46,13 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
const auto igcCreateMainFunction = loadCreateIgcMainFunction();
|
||||
if (!igcCreateMainFunction) {
|
||||
argHelper->printf("Error! Cannot load required functions from IGC library.\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
igcMain = createIgcMain(igcCreateMainFunction);
|
||||
if (!igcMain) {
|
||||
argHelper->printf("Error! Cannot create IGC main component!\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
const std::vector<CIF::InterfaceId_t> interfacesToIgnore = {IGC::OclGenBinaryBase::GetInterfaceId()};
|
||||
@@ -61,12 +61,12 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
argHelper->printf("Error! Incompatible interface in IGC: %s\n", incompatibleInterface.c_str());
|
||||
|
||||
DEBUG_BREAK_IF(true);
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
if (!isPatchtokenInterfaceSupported()) {
|
||||
argHelper->printf("Error! Patchtoken interface is missing.\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -83,7 +83,7 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
igcDeviceCtx = createIgcDeviceContext();
|
||||
if (!igcDeviceCtx) {
|
||||
argHelper->printf("Error! Cannot create IGC device context!\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
igcDeviceCtx->SetProfilingTimerResolution(static_cast<float>(hwInfo.capabilityTable.defaultProfilingTimerResolution));
|
||||
@@ -94,7 +94,7 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
|
||||
if (!igcPlatform || !igcGtSystemInfo || !igcFtrWa) {
|
||||
argHelper->printf("Error! IGC device context has not been properly created!\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily);
|
||||
|
||||
@@ -109,7 +109,7 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
populateWithFeatures(igcFtrWa.get(), copyHwInfo, compilerProductHelper.get());
|
||||
|
||||
initialized = true;
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
std::unique_ptr<OsLibrary> OclocIgcFacade::loadIgcLibrary() const {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "shared/offline_compiler/source/decoder/binary_encoder.h"
|
||||
#include "shared/offline_compiler/source/decoder/zebin_manipulator.h"
|
||||
#include "shared/offline_compiler/source/multi_command.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_concat.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_fatbinary.h"
|
||||
#include "shared/offline_compiler/source/ocloc_validator.h"
|
||||
#include "shared/offline_compiler/source/offline_compiler.h"
|
||||
@@ -123,10 +123,10 @@ int compile(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
return NEO::buildFatBinary(args, argHelper);
|
||||
}
|
||||
|
||||
int retVal = OclocErrorCode::SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(args.size(), args, true, retVal, argHelper)};
|
||||
if (retVal == OclocErrorCode::SUCCESS) {
|
||||
if (retVal == OCLOC_SUCCESS) {
|
||||
if (pCompiler->showHelpOnly()) {
|
||||
return retVal;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ int compile(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
argHelper->printf("%s\n", buildLog.c_str());
|
||||
}
|
||||
|
||||
if (retVal == OclocErrorCode::SUCCESS) {
|
||||
if (retVal == OCLOC_SUCCESS) {
|
||||
if (!pCompiler->isQuiet())
|
||||
argHelper->printf("Build succeeded.\n");
|
||||
} else {
|
||||
@@ -145,7 +145,7 @@ int compile(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal != OclocErrorCode::SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
printOclocOptionsReadFromFile(*argHelper, pCompiler.get());
|
||||
printOclocCmdLine(*argHelper, args);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ int compile(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
};
|
||||
|
||||
int link(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
int createResult{OclocErrorCode::SUCCESS};
|
||||
int createResult{OCLOC_SUCCESS};
|
||||
const auto linker{OfflineLinker::create(args.size(), args, createResult, argHelper)};
|
||||
const auto linkingResult{linkWithSafetyGuard(linker.get())};
|
||||
|
||||
@@ -162,7 +162,7 @@ int link(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
argHelper->printf("%s\n", buildLog.c_str());
|
||||
}
|
||||
|
||||
if (createResult == OclocErrorCode::SUCCESS && linkingResult == OclocErrorCode::SUCCESS) {
|
||||
if (createResult == OCLOC_SUCCESS && linkingResult == OCLOC_SUCCESS) {
|
||||
argHelper->printf("Linker execution has succeeded!\n");
|
||||
}
|
||||
|
||||
@@ -175,9 +175,9 @@ int disassemble(OclocArgHelper *argHelper, const std::vector<std::string> &args)
|
||||
int retVal = decoder.validateInput(args);
|
||||
if (decoder.showHelp) {
|
||||
decoder.printHelp();
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
return (retVal == OclocErrorCode::SUCCESS) ? decoder.decode() : retVal;
|
||||
return (retVal == OCLOC_SUCCESS) ? decoder.decode() : retVal;
|
||||
};
|
||||
|
||||
if (binaryFormat == Zebin::Manipulator::BinaryFormats::PatchTokens) {
|
||||
@@ -199,9 +199,9 @@ int assemble(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
int retVal = encoder.validateInput(args);
|
||||
if (encoder.showHelp) {
|
||||
encoder.printHelp();
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
return (retVal == OclocErrorCode::SUCCESS) ? encoder.encode() : retVal;
|
||||
return (retVal == OCLOC_SUCCESS) ? encoder.encode() : retVal;
|
||||
};
|
||||
if (binaryFormat == Zebin::Manipulator::BinaryFormats::PatchTokens) {
|
||||
BinaryEncoder assembler(argHelper);
|
||||
@@ -216,7 +216,7 @@ int assemble(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
}
|
||||
|
||||
int multi(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
int retValue = OclocErrorCode::SUCCESS;
|
||||
int retValue = OCLOC_SUCCESS;
|
||||
std::unique_ptr<MultiCommand> pMulti{(MultiCommand::create(args, retValue, argHelper))};
|
||||
return retValue;
|
||||
}
|
||||
@@ -236,7 +236,7 @@ int ids(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
int concat(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
auto arConcat = NEO::OclocConcat(argHelper);
|
||||
auto error = arConcat.initialize(args);
|
||||
if (OclocErrorCode::SUCCESS != error) {
|
||||
if (OCLOC_SUCCESS != error) {
|
||||
arConcat.printHelp();
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "offline_compiler.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_fcl_facade.h"
|
||||
#include "shared/offline_compiler/source/ocloc_igc_facade.h"
|
||||
#include "shared/offline_compiler/source/queries.h"
|
||||
@@ -45,8 +45,6 @@
|
||||
#define GetCurrentWorkingDirectory getcwd
|
||||
#endif
|
||||
|
||||
using namespace NEO::OclocErrorCode;
|
||||
|
||||
namespace NEO {
|
||||
|
||||
std::string convertToPascalCase(const std::string &inString) {
|
||||
@@ -89,7 +87,7 @@ OfflineCompiler::~OfflineCompiler() {
|
||||
}
|
||||
|
||||
OfflineCompiler *OfflineCompiler::create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal, OclocArgHelper *helper) {
|
||||
retVal = SUCCESS;
|
||||
retVal = OCLOC_SUCCESS;
|
||||
auto pOffCompiler = new OfflineCompiler();
|
||||
|
||||
if (pOffCompiler) {
|
||||
@@ -99,7 +97,7 @@ OfflineCompiler *OfflineCompiler::create(size_t numArgs, const std::vector<std::
|
||||
retVal = pOffCompiler->initialize(numArgs, allArgs, dumpFiles);
|
||||
}
|
||||
|
||||
if (retVal != SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
delete pOffCompiler;
|
||||
pOffCompiler = nullptr;
|
||||
}
|
||||
@@ -114,10 +112,10 @@ void printQueryHelp(OclocArgHelper *helper) {
|
||||
int OfflineCompiler::query(size_t numArgs, const std::vector<std::string> &allArgs, OclocArgHelper *helper) {
|
||||
if (allArgs.size() != 3) {
|
||||
helper->printf("Error: Invalid command line. Expected ocloc query <argument>");
|
||||
return INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
auto retVal = SUCCESS;
|
||||
auto retVal = OCLOC_SUCCESS;
|
||||
auto &arg = allArgs[2];
|
||||
|
||||
if (Queries::queryNeoRevision == arg) {
|
||||
@@ -130,7 +128,7 @@ int OfflineCompiler::query(size_t numArgs, const std::vector<std::string> &allAr
|
||||
printQueryHelp(helper);
|
||||
} else {
|
||||
helper->printf("Error: Invalid command line. Unknown argument %s.", arg.c_str());
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
@@ -142,11 +140,11 @@ void printAcronymIdsHelp(OclocArgHelper *helper) {
|
||||
|
||||
int OfflineCompiler::queryAcronymIds(size_t numArgs, const std::vector<std::string> &allArgs, OclocArgHelper *helper) {
|
||||
const size_t numArgRequested = 3u;
|
||||
auto retVal = SUCCESS;
|
||||
auto retVal = OCLOC_SUCCESS;
|
||||
|
||||
if (numArgs != numArgRequested) {
|
||||
helper->printf("Error: Invalid command line. Expected ocloc ids <acronym>.\n");
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
return retVal;
|
||||
} else if ((ConstStringRef("-h") == allArgs[2] || ConstStringRef("--help") == allArgs[2])) {
|
||||
printAcronymIdsHelp(helper);
|
||||
@@ -183,7 +181,7 @@ int OfflineCompiler::queryAcronymIds(size_t numArgs, const std::vector<std::stri
|
||||
}
|
||||
} else {
|
||||
helper->printf("Error: Invalid command line. Unknown acronym %s.\n", allArgs[2].c_str());
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -206,7 +204,7 @@ struct OfflineCompiler::buildInfo {
|
||||
};
|
||||
|
||||
int OfflineCompiler::buildIrBinary() {
|
||||
int retVal = SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
|
||||
if (allowCaching) {
|
||||
const std::string igcRevision = igcFacade->getIgcRevision();
|
||||
@@ -258,13 +256,13 @@ int OfflineCompiler::buildIrBinary() {
|
||||
|
||||
if (true == NEO::areNotNullptr(err->GetMemory<char>())) {
|
||||
updateBuildLog(err->GetMemory<char>(), err->GetSizeRaw());
|
||||
retVal = BUILD_PROGRAM_FAILURE;
|
||||
retVal = OCLOC_BUILD_PROGRAM_FAILURE;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (false == NEO::areNotNullptr(fclSrc.get(), pBuildInfo->fclOptions.get(), pBuildInfo->fclInternalOptions.get(),
|
||||
fclTranslationCtx.get())) {
|
||||
retVal = OUT_OF_HOST_MEMORY;
|
||||
retVal = OCLOC_OUT_OF_HOST_MEMORY;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -272,7 +270,7 @@ int OfflineCompiler::buildIrBinary() {
|
||||
pBuildInfo->fclInternalOptions.get(), nullptr, 0);
|
||||
|
||||
if (pBuildInfo->fclOutput == nullptr) {
|
||||
retVal = OUT_OF_HOST_MEMORY;
|
||||
retVal = OCLOC_OUT_OF_HOST_MEMORY;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -281,7 +279,7 @@ int OfflineCompiler::buildIrBinary() {
|
||||
|
||||
if (pBuildInfo->fclOutput->Successful() == false) {
|
||||
updateBuildLog(pBuildInfo->fclOutput->GetBuildLog()->GetMemory<char>(), pBuildInfo->fclOutput->GetBuildLog()->GetSizeRaw());
|
||||
retVal = BUILD_PROGRAM_FAILURE;
|
||||
retVal = OCLOC_BUILD_PROGRAM_FAILURE;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -325,10 +323,10 @@ std::string OfflineCompiler::validateInputType(const std::string &input, bool is
|
||||
}
|
||||
|
||||
int OfflineCompiler::buildSourceCode() {
|
||||
int retVal = SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
|
||||
if (sourceCode.empty()) {
|
||||
return INVALID_PROGRAM;
|
||||
return OCLOC_INVALID_PROGRAM;
|
||||
}
|
||||
|
||||
const std::string igcRevision = igcFacade->getIgcRevision();
|
||||
@@ -378,7 +376,7 @@ int OfflineCompiler::buildSourceCode() {
|
||||
bool inputIsIntermediateRepresentation = inputFileLlvm || inputFileSpirV;
|
||||
if (false == inputIsIntermediateRepresentation) {
|
||||
retVal = buildIrBinary();
|
||||
if (retVal != SUCCESS)
|
||||
if (retVal != OCLOC_SUCCESS)
|
||||
return retVal;
|
||||
|
||||
auto igcTranslationCtx = igcFacade->createTranslationContext(pBuildInfo->intermediateRepresentation, IGC::CodeType::oclGenBin);
|
||||
@@ -396,7 +394,7 @@ int OfflineCompiler::buildSourceCode() {
|
||||
igcOutput = igcTranslationCtx->Translate(igcSrc.get(), igcOptions.get(), igcInternalOptions.get(), nullptr, 0);
|
||||
}
|
||||
if (igcOutput == nullptr) {
|
||||
return OUT_OF_HOST_MEMORY;
|
||||
return OCLOC_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
UNRECOVERABLE_IF(igcOutput->GetBuildLog() == nullptr);
|
||||
UNRECOVERABLE_IF(igcOutput->GetOutput() == nullptr);
|
||||
@@ -415,13 +413,13 @@ int OfflineCompiler::buildSourceCode() {
|
||||
cache->cacheBinary(dbgHash, debugDataBinary, static_cast<uint32_t>(debugDataBinarySize));
|
||||
}
|
||||
|
||||
retVal = igcOutput->Successful() ? SUCCESS : BUILD_PROGRAM_FAILURE;
|
||||
retVal = igcOutput->Successful() ? OCLOC_SUCCESS : OCLOC_BUILD_PROGRAM_FAILURE;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int OfflineCompiler::build() {
|
||||
int retVal = SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
if (isOnlySpirV()) {
|
||||
retVal = buildIrBinary();
|
||||
} else {
|
||||
@@ -477,10 +475,10 @@ int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceNam
|
||||
productFamilyName = hardwarePrefix[hwInfo.platform.eProductFamily];
|
||||
releaseHelper = NEO::ReleaseHelper::create(hwInfo.ipVersion);
|
||||
|
||||
return SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
}
|
||||
return INVALID_DEVICE;
|
||||
return OCLOC_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
bool OfflineCompiler::isArgumentDeviceId(const std::string &argument) const {
|
||||
@@ -496,37 +494,37 @@ int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) {
|
||||
auto deviceID = static_cast<unsigned short>(std::stoi(deviceName, 0, 16));
|
||||
productConfig = argHelper->getProductConfigAndSetHwInfoBasedOnDeviceAndRevId(hwInfo, deviceID, revisionId, compilerProductHelper, releaseHelper);
|
||||
if (productConfig == AOT::UNKNOWN_ISA) {
|
||||
return INVALID_DEVICE;
|
||||
return OCLOC_INVALID_DEVICE;
|
||||
}
|
||||
auto product = argHelper->productConfigHelper->getAcronymForProductConfig(productConfig);
|
||||
argHelper->printf("Auto-detected target based on %s device id: %s\n", deviceName.c_str(), product.c_str());
|
||||
} else if (revisionId == -1) {
|
||||
productConfig = argHelper->productConfigHelper->getProductConfigFromDeviceName(deviceName);
|
||||
if (!argHelper->setHwInfoForProductConfig(productConfig, hwInfo, compilerProductHelper, releaseHelper)) {
|
||||
return INVALID_DEVICE;
|
||||
return OCLOC_INVALID_DEVICE;
|
||||
}
|
||||
} else {
|
||||
return INVALID_DEVICE;
|
||||
return OCLOC_INVALID_DEVICE;
|
||||
}
|
||||
argHelper->setHwInfoForHwInfoConfig(hwInfo, hwInfoConfig, compilerProductHelper, releaseHelper);
|
||||
deviceConfig = hwInfo.ipVersion.value;
|
||||
productFamilyName = hardwarePrefix[hwInfo.platform.eProductFamily];
|
||||
return SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
||||
int retVal = INVALID_DEVICE;
|
||||
int retVal = OCLOC_INVALID_DEVICE;
|
||||
if (deviceName.empty()) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
retVal = initHardwareInfoForProductConfig(deviceName);
|
||||
if (retVal == SUCCESS) {
|
||||
if (retVal == OCLOC_SUCCESS) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
retVal = initHardwareInfoForDeprecatedAcronyms(deviceName, compilerProductHelper, releaseHelper);
|
||||
if (retVal != SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Could not determine device target: %s.\n", deviceName.c_str());
|
||||
}
|
||||
return retVal;
|
||||
@@ -550,7 +548,7 @@ std::string OfflineCompiler::getStringWithinDelimiters(const std::string &src) {
|
||||
|
||||
int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles) {
|
||||
this->dumpFiles = dumpFiles;
|
||||
int retVal = SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
const char *source = nullptr;
|
||||
std::unique_ptr<char[]> sourceFromFile;
|
||||
size_t sourceFromFileSize = 0;
|
||||
@@ -561,7 +559,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
if (showHelp) {
|
||||
printUsage();
|
||||
return retVal;
|
||||
} else if (retVal != SUCCESS) {
|
||||
} else if (retVal != OCLOC_SUCCESS) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -583,7 +581,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>{}};
|
||||
|
||||
retVal = parseCommandLine(tokens.size(), tokens);
|
||||
if (retVal != SUCCESS) {
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Failed with ocloc options from file:\n%s\n", oclocOptionsFromFile.c_str());
|
||||
return retVal;
|
||||
}
|
||||
@@ -615,8 +613,8 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
}
|
||||
}
|
||||
|
||||
retVal = deviceName.empty() ? SUCCESS : initHardwareInfo(deviceName.c_str());
|
||||
if (retVal != SUCCESS) {
|
||||
retVal = deviceName.empty() ? OCLOC_SUCCESS : initHardwareInfo(deviceName.c_str());
|
||||
if (retVal != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error: Cannot get HW Info for device %s.\n", deviceName.c_str());
|
||||
return retVal;
|
||||
}
|
||||
@@ -649,7 +647,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
// set up the device inside the program
|
||||
sourceFromFile = argHelper->loadDataFromFile(inputFile, sourceFromFileSize);
|
||||
if (sourceFromFileSize == 0) {
|
||||
retVal = INVALID_FILE;
|
||||
retVal = OCLOC_INVALID_FILE;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -664,7 +662,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
|
||||
if ((inputFileSpirV == false) && (inputFileLlvm == false)) {
|
||||
const auto fclInitializationResult = fclFacade->initialize(hwInfo);
|
||||
if (fclInitializationResult != SUCCESS) {
|
||||
if (fclInitializationResult != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error! FCL initialization failure. Error code = %d\n", fclInitializationResult);
|
||||
return fclInitializationResult;
|
||||
}
|
||||
@@ -678,7 +676,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
}
|
||||
|
||||
const auto igcInitializationResult = igcFacade->initialize(hwInfo);
|
||||
if (igcInitializationResult != SUCCESS) {
|
||||
if (igcInitializationResult != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error! IGC initialization failure. Error code = %d\n", igcInitializationResult);
|
||||
return igcInitializationResult;
|
||||
}
|
||||
@@ -692,7 +690,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
}
|
||||
|
||||
int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::string> &argv) {
|
||||
int retVal = SUCCESS;
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
bool compile32 = false;
|
||||
bool compile64 = false;
|
||||
std::set<std::string> deviceAcronymsFromDeviceOptions;
|
||||
@@ -770,7 +768,7 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
||||
outputNoSuffix = true;
|
||||
} else if ("--help" == currArg) {
|
||||
showHelp = true;
|
||||
return SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
} else if (("-revision_id" == currArg) && hasMoreArgs) {
|
||||
revisionId = std::stoi(argv[argIndex + 1], nullptr, 0);
|
||||
argIndex++;
|
||||
@@ -783,7 +781,7 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
||||
parseHwInfoConfigString(argv[argIndex + 1], hwInfoConfig);
|
||||
if (!hwInfoConfig) {
|
||||
argHelper->printf("Error: Invalid config.\n");
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
break;
|
||||
}
|
||||
argIndex++;
|
||||
@@ -791,7 +789,7 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
||||
allowCaching = true;
|
||||
} else {
|
||||
argHelper->printf("Invalid option (arg %d): %s\n", argIndex, argv[argIndex].c_str());
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -802,7 +800,7 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
||||
|
||||
if (!binaryOutputFile.empty() && (useGenFile || useCppFile || outputNoSuffix || !outputFile.empty())) {
|
||||
argHelper->printf("Error: options: -gen_file/-cpp_file/-output_no_suffix/-output cannot be used with -o\n");
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
return retVal;
|
||||
}
|
||||
unifyExcludeIrFlags();
|
||||
@@ -811,15 +809,15 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
||||
revisionId = static_cast<unsigned short>(DebugManager.flags.OverrideRevision.get());
|
||||
}
|
||||
|
||||
if (retVal == SUCCESS) {
|
||||
if (retVal == OCLOC_SUCCESS) {
|
||||
if (compile32 && compile64) {
|
||||
argHelper->printf("Error: Cannot compile for 32-bit and 64-bit, please choose one.\n");
|
||||
retVal |= INVALID_COMMAND_LINE;
|
||||
retVal |= OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
if (deviceName.empty() && (false == onlySpirV)) {
|
||||
argHelper->printf("Error: Device name missing.\n");
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
for (const auto &device : deviceAcronymsFromDeviceOptions) {
|
||||
@@ -837,17 +835,17 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
||||
}
|
||||
if (!isDeprecatedName) {
|
||||
argHelper->printf("Error: Invalid device acronym passed to -device_options: %s\n", device.c_str());
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inputFile.empty()) {
|
||||
argHelper->printf("Error: Input file name missing.\n");
|
||||
retVal = INVALID_COMMAND_LINE;
|
||||
retVal = OCLOC_INVALID_COMMAND_LINE;
|
||||
} else if (!argHelper->fileExists(inputFile)) {
|
||||
argHelper->printf("Error: Input file %s missing.\n", inputFile.c_str());
|
||||
retVal = INVALID_FILE;
|
||||
retVal = OCLOC_INVALID_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "offline_linker.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_igc_facade.h"
|
||||
#include "shared/source/compiler_interface/intermediate_representations.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
@@ -42,43 +42,43 @@ OfflineLinker::~OfflineLinker() = default;
|
||||
|
||||
int OfflineLinker::initialize(size_t argsCount, const std::vector<std::string> &args) {
|
||||
const auto parsingResult{parseCommand(argsCount, args)};
|
||||
if (parsingResult != OclocErrorCode::SUCCESS) {
|
||||
if (parsingResult != OCLOC_SUCCESS) {
|
||||
return parsingResult;
|
||||
}
|
||||
|
||||
// If a user requested help, then stop here.
|
||||
if (operationMode == OperationMode::SHOW_HELP) {
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
const auto verificationResult{verifyLinkerCommand()};
|
||||
if (verificationResult != OclocErrorCode::SUCCESS) {
|
||||
if (verificationResult != OCLOC_SUCCESS) {
|
||||
return verificationResult;
|
||||
}
|
||||
|
||||
const auto loadingResult{loadInputFilesContent()};
|
||||
if (loadingResult != OclocErrorCode::SUCCESS) {
|
||||
if (loadingResult != OCLOC_SUCCESS) {
|
||||
return loadingResult;
|
||||
}
|
||||
|
||||
const auto hwInfoInitializationResult{initHardwareInfo()};
|
||||
if (hwInfoInitializationResult != OclocErrorCode::SUCCESS) {
|
||||
if (hwInfoInitializationResult != OCLOC_SUCCESS) {
|
||||
return hwInfoInitializationResult;
|
||||
}
|
||||
|
||||
const auto igcPreparationResult{igcFacade->initialize(hwInfo)};
|
||||
if (igcPreparationResult != OclocErrorCode::SUCCESS) {
|
||||
if (igcPreparationResult != OCLOC_SUCCESS) {
|
||||
return igcPreparationResult;
|
||||
}
|
||||
|
||||
operationMode = OperationMode::LINK_FILES;
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
int OfflineLinker::parseCommand(size_t argsCount, const std::vector<std::string> &args) {
|
||||
if (argsCount < 2u) {
|
||||
operationMode = OperationMode::SHOW_HELP;
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
for (size_t argIndex = 1u; argIndex < argsCount; ++argIndex) {
|
||||
@@ -104,14 +104,14 @@ int OfflineLinker::parseCommand(size_t argsCount, const std::vector<std::string>
|
||||
++argIndex;
|
||||
} else if (currentArg == "--help") {
|
||||
operationMode = OperationMode::SHOW_HELP;
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
} else {
|
||||
argHelper->printf("Invalid option (arg %zd): %s\n", argIndex, currentArg.c_str());
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
IGC::CodeType::CodeType_t OfflineLinker::parseOutputFormat(const std::string &outputFormatName) {
|
||||
@@ -131,27 +131,27 @@ IGC::CodeType::CodeType_t OfflineLinker::parseOutputFormat(const std::string &ou
|
||||
int OfflineLinker::verifyLinkerCommand() {
|
||||
if (inputFilenames.empty()) {
|
||||
argHelper->printf("Error: Input name is missing! At least one input file is required!\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
for (const auto &filename : inputFilenames) {
|
||||
if (filename.empty()) {
|
||||
argHelper->printf("Error: Empty filename cannot be used!\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
if (!argHelper->fileExists(filename)) {
|
||||
argHelper->printf("Error: Input file %s missing.\n", filename.c_str());
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
if (outputFormat == IGC::CodeType::invalid) {
|
||||
argHelper->printf("Error: Invalid output type!\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
int OfflineLinker::loadInputFilesContent() {
|
||||
@@ -166,19 +166,19 @@ int OfflineLinker::loadInputFilesContent() {
|
||||
bytes = argHelper->loadDataFromFile(filename, size);
|
||||
if (size == 0) {
|
||||
argHelper->printf("Error: Cannot read input file: %s\n", filename.c_str());
|
||||
return OclocErrorCode::INVALID_FILE;
|
||||
return OCLOC_INVALID_FILE;
|
||||
}
|
||||
|
||||
codeType = detectCodeType(bytes.get(), size);
|
||||
if (codeType == IGC::CodeType::invalid) {
|
||||
argHelper->printf("Error: Unsupported format of input file: %s\n", filename.c_str());
|
||||
return OclocErrorCode::INVALID_PROGRAM;
|
||||
return OCLOC_INVALID_PROGRAM;
|
||||
}
|
||||
|
||||
inputFilesContent.emplace_back(std::move(bytes), size, codeType);
|
||||
}
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
IGC::CodeType::CodeType_t OfflineLinker::detectCodeType(char *bytes, size_t size) const {
|
||||
@@ -208,12 +208,12 @@ int OfflineLinker::initHardwareInfo() {
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, hwInfo);
|
||||
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, hwInfoConfig, *compilerProductHelper);
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
argHelper->printf("Error! Cannot retrieve any valid hardware information!\n");
|
||||
return OclocErrorCode::INVALID_DEVICE;
|
||||
return OCLOC_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
ArrayRef<const HardwareInfo *> OfflineLinker::getHardwareInfoTable() const {
|
||||
@@ -230,7 +230,7 @@ int OfflineLinker::execute() {
|
||||
[[fallthrough]];
|
||||
default:
|
||||
argHelper->printf("Error: Linker cannot be executed due to unsuccessful initialization!\n");
|
||||
return OclocErrorCode::INVALID_COMMAND_LINE;
|
||||
return OCLOC_INVALID_COMMAND_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,18 +271,18 @@ Examples:
|
||||
|
||||
argHelper->printf(help);
|
||||
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
int OfflineLinker::link() {
|
||||
const auto encodedElfFile{createSingleInputFile()};
|
||||
if (outputFormat == IGC::CodeType::elf) {
|
||||
argHelper->saveOutput(outputFilename, encodedElfFile.data(), encodedElfFile.size());
|
||||
return OclocErrorCode::SUCCESS;
|
||||
return OCLOC_SUCCESS;
|
||||
}
|
||||
|
||||
const auto [translationResult, translatedBitcode] = translateToOutputFormat(encodedElfFile);
|
||||
if (translationResult == OclocErrorCode::SUCCESS) {
|
||||
if (translationResult == OCLOC_SUCCESS) {
|
||||
argHelper->saveOutput(outputFilename, translatedBitcode.data(), translatedBitcode.size());
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ std::pair<int, std::vector<uint8_t>> OfflineLinker::translateToOutputFormat(cons
|
||||
std::vector<uint8_t> outputFileContent{};
|
||||
if (!igcOutput) {
|
||||
argHelper->printf("Error: Translation has failed! IGC output is nullptr!\n");
|
||||
return {OclocErrorCode::OUT_OF_HOST_MEMORY, std::move(outputFileContent)};
|
||||
return {OCLOC_OUT_OF_HOST_MEMORY, std::move(outputFileContent)};
|
||||
}
|
||||
|
||||
if (igcOutput->GetOutput()->GetSizeRaw() != 0) {
|
||||
@@ -328,8 +328,8 @@ std::pair<int, std::vector<uint8_t>> OfflineLinker::translateToOutputFormat(cons
|
||||
|
||||
tryToStoreBuildLog(igcOutput->GetBuildLog()->GetMemory<char>(), igcOutput->GetBuildLog()->GetSizeRaw());
|
||||
|
||||
const auto errorCode{igcOutput->Successful() && !outputFileContent.empty() ? OclocErrorCode::SUCCESS : OclocErrorCode::BUILD_PROGRAM_FAILURE};
|
||||
if (errorCode != OclocErrorCode::SUCCESS) {
|
||||
const auto errorCode{igcOutput->Successful() && !outputFileContent.empty() ? OCLOC_SUCCESS : OCLOC_BUILD_PROGRAM_FAILURE};
|
||||
if (errorCode != OCLOC_SUCCESS) {
|
||||
argHelper->printf("Error: Translation has failed! IGC returned empty output.\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/offline_compiler.h"
|
||||
#include "shared/offline_compiler/source/offline_linker.h"
|
||||
#include "shared/offline_compiler/source/utilities/linux/safety_guard_linux.h"
|
||||
@@ -15,14 +15,14 @@ using namespace NEO;
|
||||
|
||||
int buildWithSafetyGuard(OfflineCompiler *compiler) {
|
||||
SafetyGuardLinux safetyGuard;
|
||||
int retVal = NEO::OclocErrorCode::COMPILATION_CRASH;
|
||||
int retVal = OCLOC_COMPILATION_CRASH;
|
||||
|
||||
return safetyGuard.call<int, OfflineCompiler, decltype(&OfflineCompiler::build)>(compiler, &OfflineCompiler::build, retVal);
|
||||
}
|
||||
|
||||
int linkWithSafetyGuard(OfflineLinker *linker) {
|
||||
SafetyGuardLinux safetyGuard{};
|
||||
int returnValueOnCrash{NEO::OclocErrorCode::COMPILATION_CRASH};
|
||||
int returnValueOnCrash{OCLOC_COMPILATION_CRASH};
|
||||
|
||||
return safetyGuard.call(linker, &OfflineLinker::execute, returnValueOnCrash);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_error_code.h"
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/offline_compiler.h"
|
||||
#include "shared/offline_compiler/source/offline_linker.h"
|
||||
#include "shared/offline_compiler/source/utilities/windows/safety_guard_windows.h"
|
||||
@@ -14,13 +14,13 @@ using namespace NEO;
|
||||
|
||||
int buildWithSafetyGuard(OfflineCompiler *compiler) {
|
||||
SafetyGuardWindows safetyGuard;
|
||||
int retVal = NEO::OclocErrorCode::COMPILATION_CRASH;
|
||||
int retVal = OCLOC_COMPILATION_CRASH;
|
||||
return safetyGuard.call<int, OfflineCompiler, decltype(&OfflineCompiler::build)>(compiler, &OfflineCompiler::build, retVal);
|
||||
}
|
||||
|
||||
int linkWithSafetyGuard(OfflineLinker *linker) {
|
||||
SafetyGuardWindows safetyGuard{};
|
||||
int returnValueOnCrash{NEO::OclocErrorCode::COMPILATION_CRASH};
|
||||
int returnValueOnCrash{OCLOC_COMPILATION_CRASH};
|
||||
|
||||
return safetyGuard.call(linker, &OfflineLinker::execute, returnValueOnCrash);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user