mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Fix ocloc decoder ULTs for IGA
This PR fixes the decoder tests in ocloc to improve single SKUs. In tests, checking the existence of the platform in IGA has been added. Signed-off-by: Daria Hinz <daria.hinz@intel.com> Related-To: NEO-7509
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
ebab9b8926
commit
9e6d3d93e7
@ -304,9 +304,6 @@ TEST(DecoderTests, givenDeprecatedDeviceNamesWhenValidateInputThenCorrectWarning
|
||||
MockDecoder decoder{suppressMessages};
|
||||
|
||||
auto deprecatedAcronyms = decoder.mockArgHelper->productConfigHelper->getDeprecatedAcronyms();
|
||||
if (deprecatedAcronyms.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
for (const auto &acronym : deprecatedAcronyms) {
|
||||
const std::vector<std::string> args = {
|
||||
@ -326,29 +323,34 @@ TEST(DecoderTests, givenDeprecatedDeviceNamesWhenValidateInputThenCorrectWarning
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DecoderTests, givenDeviceNamesWhenValidateInputThenSuccessIsReturned) {
|
||||
TEST(DecoderTests, givenProductNamesThatExistsForIgaWhenValidateInputThenSuccessIsReturned) {
|
||||
constexpr auto suppressMessages{false};
|
||||
MockDecoder decoder{suppressMessages};
|
||||
decoder.mockArgHelper->hasOutput = true;
|
||||
|
||||
auto supportedAcronyms = decoder.mockArgHelper->productConfigHelper->getAllProductAcronyms();
|
||||
if (supportedAcronyms.empty()) {
|
||||
if (!decoder.getMockIga()->isValidPlatform()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
for (const auto &acronym : supportedAcronyms) {
|
||||
const std::vector<std::string> args = {
|
||||
"ocloc",
|
||||
"disasm",
|
||||
"-device",
|
||||
acronym.str()};
|
||||
decoder.mockArgHelper->hasOutput = true;
|
||||
auto aotInfos = decoder.mockArgHelper->productConfigHelper->getDeviceAotInfo();
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto result = decoder.validateInput(args);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
for (const auto &device : aotInfos) {
|
||||
if (productFamily != device.hwInfo->platform.eProductFamily)
|
||||
continue;
|
||||
|
||||
EXPECT_EQ(result, 0);
|
||||
EXPECT_TRUE(output.empty());
|
||||
for (const auto &acronym : device.acronyms) {
|
||||
const std::vector<std::string> args = {
|
||||
"ocloc",
|
||||
"disasm",
|
||||
"-device",
|
||||
acronym.str()};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto result = decoder.validateInput(args);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
EXPECT_EQ(result, 0);
|
||||
EXPECT_TRUE(output.empty());
|
||||
}
|
||||
}
|
||||
|
||||
decoder.mockArgHelper->hasOutput = false;
|
||||
@ -391,9 +393,13 @@ TEST(DecoderTests, GivenQuietModeFlagWhenParsingValidListOfParametersThenReturnV
|
||||
}
|
||||
|
||||
TEST(DecoderTests, GivenMissingDumpFlagWhenParsingValidListOfParametersThenReturnValueIsZeroAndWarningAboutCreationOfDefaultDirectoryIsPrinted) {
|
||||
if (gEnvironment->productConfig.empty()) {
|
||||
constexpr auto suppressMessages{false};
|
||||
MockDecoder decoder{suppressMessages};
|
||||
|
||||
if (gEnvironment->productConfig.empty() || !decoder.getMockIga()->isValidPlatform()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
const std::vector<std::string> args = {
|
||||
"ocloc",
|
||||
"disasm",
|
||||
@ -404,9 +410,6 @@ TEST(DecoderTests, GivenMissingDumpFlagWhenParsingValidListOfParametersThenRetur
|
||||
"-patch",
|
||||
"test_files/patch"};
|
||||
|
||||
constexpr auto suppressMessages{false};
|
||||
MockDecoder decoder{suppressMessages};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto result = decoder.validateInput(args);
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
@ -418,7 +421,10 @@ TEST(DecoderTests, GivenMissingDumpFlagWhenParsingValidListOfParametersThenRetur
|
||||
}
|
||||
|
||||
TEST(DecoderTests, GivenMissingDumpFlagAndArgHelperOutputEnabledWhenParsingValidListOfParametersThenReturnValueIsZeroAndDefaultDirectoryWarningIsNotEmitted) {
|
||||
if (gEnvironment->productConfig.empty()) {
|
||||
constexpr auto suppressMessages{false};
|
||||
MockDecoder decoder{suppressMessages};
|
||||
|
||||
if (gEnvironment->productConfig.empty() || !decoder.getMockIga()->isValidPlatform()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
const std::vector<std::string> args = {
|
||||
@ -430,8 +436,7 @@ TEST(DecoderTests, GivenMissingDumpFlagAndArgHelperOutputEnabledWhenParsingValid
|
||||
gEnvironment->productConfig.c_str(),
|
||||
"-patch",
|
||||
"test_files/patch"};
|
||||
constexpr auto suppressMessages{false};
|
||||
MockDecoder decoder{suppressMessages};
|
||||
|
||||
decoder.mockArgHelper->hasOutput = true;
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
|
@ -94,7 +94,10 @@ TEST(EncoderTests, GivenQuietModeFlagWhenParsingValidListOfParametersThenReturnV
|
||||
}
|
||||
|
||||
TEST(EncoderTests, GivenMissingDumpFlagAndArgHelperOutputEnabledWhenParsingValidListOfParametersThenReturnValueIsZeroAndDefaultDirectoryIsNotUsedAsDumpPath) {
|
||||
if (gEnvironment->productConfig.empty()) {
|
||||
constexpr auto suppressMessages{false};
|
||||
MockEncoder encoder{suppressMessages};
|
||||
|
||||
if (gEnvironment->productConfig.empty() || !encoder.getMockIga()->isValidPlatform()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
const std::vector<std::string> args = {
|
||||
@ -106,8 +109,6 @@ TEST(EncoderTests, GivenMissingDumpFlagAndArgHelperOutputEnabledWhenParsingValid
|
||||
gEnvironment->productConfig.c_str(),
|
||||
};
|
||||
|
||||
constexpr auto suppressMessages{false};
|
||||
MockEncoder encoder{suppressMessages};
|
||||
encoder.mockArgHelper->hasOutput = true;
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
extern PRODUCT_FAMILY productFamily;
|
||||
|
||||
struct MockIgaWrapper : public IgaWrapper {
|
||||
bool tryDisassembleGenISA(const void *kernelPtr, uint32_t kernelSize, std::string &out) override {
|
||||
out = asmToReturn;
|
||||
@ -39,6 +41,11 @@ struct MockIgaWrapper : public IgaWrapper {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isValidPlatform() {
|
||||
setProductFamily(productFamily);
|
||||
return isKnownPlatform();
|
||||
}
|
||||
|
||||
std::string asmToReturn;
|
||||
std::string binaryToReturn;
|
||||
std::string receivedAsm;
|
||||
|
Reference in New Issue
Block a user