Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Copy link
Contributor

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 ?

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);
Copy link
Contributor

Choose a reason for hiding this comment

The 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);
Copy link
Contributor

Choose a reason for hiding this comment

The 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!";
Copy link
Contributor

Choose a reason for hiding this comment

The 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!";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No "Diagnostic"

}
}
} // namespace
Loading