-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Add CTS for Sysman memory diagnostics #137
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,16 @@ void validate_tests(std::vector<zes_diag_test_t> tests) { | |
} | ||
|
||
#ifdef USE_ZESINIT | ||
class DiagnosticsZesTest : public lzt::ZesSysmanCtsClass {}; | ||
class DiagnosticsZesTest : public lzt::ZesSysmanCtsClass { | ||
public: | ||
bool diag_handles_available = false; | ||
}; | ||
#define DIAGNOSTICS_TEST DiagnosticsZesTest | ||
#else // USE_ZESINIT | ||
class DiagnosticsTest : public lzt::SysmanCtsClass {}; | ||
class DiagnosticsTest : public lzt::SysmanCtsClass { | ||
public: | ||
bool diag_handles_available = false; | ||
}; | ||
#define DIAGNOSTICS_TEST DiagnosticsTest | ||
#endif // USE_ZESINIT | ||
|
||
|
@@ -238,4 +244,50 @@ TEST_F( | |
} | ||
} | ||
} | ||
|
||
TEST_F( | ||
DIAGNOSTICS_TEST, | ||
GivenValidDeviceWhenMemoryDiagnosticsIsRunAndMemoryGetStateIsCalledThenExpectSuccessIsReturned) { | ||
for (auto device : devices) { | ||
uint32_t count = 0; | ||
auto diag_handles = lzt::get_diag_handles(device, count); | ||
|
||
if (count > 0) { | ||
diag_handles_available = true; | ||
bool mem_diag_available = false; | ||
for (auto diag_handle : diag_handles) { | ||
ASSERT_NE(nullptr, diag_handle); | ||
auto properties = lzt::get_diag_properties(diag_handle); | ||
|
||
if (strcmp(properties.name, "MEMORY_PPR") == 0) { | ||
bool mem_diag_available = true; | ||
auto result = lzt::run_diag_tests( | ||
diag_handle, ZES_DIAG_FIRST_TEST_INDEX, ZES_DIAG_LAST_TEST_INDEX); | ||
EXPECT_EQ(result, ZES_DIAG_RESULT_NO_ERRORS); | ||
|
||
// get memory state after memory diagnostics | ||
uint32_t mem_handles_count = 0; | ||
std::vector<zes_mem_handle_t> mem_handles = | ||
lzt::get_mem_handles(device, mem_handles_count); | ||
EXPECT_GT(mem_handles_count, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have verification to check mem_handles_count is same as before diagnostics ? |
||
|
||
for (auto mem_handle : mem_handles) { | ||
ASSERT_NE(nullptr, mem_handle); | ||
lzt::get_mem_state(mem_handle); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error check ? |
||
} | ||
} | ||
} | ||
|
||
if (!mem_diag_available) { | ||
FAIL() << "Memory Diagnostics is not available for this device!"; | ||
} | ||
} else { | ||
LOG_WARNING << "No handles found on this device!"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please specify what handles are not found |
||
} | ||
} | ||
|
||
if (!diag_handles_available) { | ||
FAIL() << "No handles found in any of the devices!"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No "Diagnostic" |
||
} | ||
} | ||
} // namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be using the declaration at Ln 257 ?