Add debug flag to print called ioctls

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2021-04-22 13:37:02 +00:00
committed by Compute-Runtime-Automation
parent 8deb4bcdba
commit 3521d89106
4 changed files with 29 additions and 0 deletions

View File

@ -157,6 +157,23 @@ TEST(DrmTest, GivenSelectedExistingDeviceWhenOpenDirFailsThenRetryOpeningRenderD
EXPECT_STREQ("00:03.0", hwDeviceIds[1]->getPciPath());
}
TEST(DrmTest, givenPrintIoctlEntriesWhenCallIoctlThenIoctlIsPrinted) {
::testing::internal::CaptureStdout();
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
auto drm = DrmWrap::createDrm(*executionEnvironment->rootDeviceEnvironments[0]);
DebugManagerStateRestore restorer;
DebugManager.flags.PrintIoctlEntries.set(true);
uint32_t contextId = 1u;
drm->destroyDrmContext(contextId);
std::string output = ::testing::internal::GetCapturedStdout();
EXPECT_STREQ(output.c_str(), "IOCTL 1074291822 called\nIOCTL 1074291822 returns 0, errno 9\n");
}
TEST(DrmTest, givenPrintIoctlTimesWhenCallIoctlThenStatisticsAreGathered) {
struct DrmMock : public Drm {
using Drm::ioctlStatistics;