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