mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
test: Rollback due to StreamCapture impacting test functionality.
The rollback is related to the StreamCapture class, which introduces errors during coverage testing for l0_tools. Signed-off-by: Marcel Skierkowski <marcel.skierkowski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
16032a8710
commit
9749f1a623
@@ -8,7 +8,6 @@
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||
#include "shared/test/common/helpers/stream_capture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
@@ -516,13 +515,12 @@ TEST(DebugSession, GivenLogsEnabledWhenPrintBitmaskCalledThenBitmaskIsPrinted) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::debugManager.flags.DebuggerLogBitmask.set(255);
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
uint64_t bitmask[2] = {0x404080808080, 0x1111ffff1111ffff};
|
||||
DebugSession::printBitmask(reinterpret_cast<uint8_t *>(bitmask), sizeof(bitmask));
|
||||
|
||||
auto output = capture.getCapturedStdout();
|
||||
auto output = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_TRUE(hasSubstr(output, std::string("\nINFO: Bitmask: ")));
|
||||
EXPECT_TRUE(hasSubstr(output, std::string("[0] = 0x0000404080808080")));
|
||||
@@ -533,13 +531,12 @@ TEST(DebugSession, GivenLogsDisabledWhenPrintBitmaskCalledThenBitmaskIsNotPrinte
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::debugManager.flags.DebuggerLogBitmask.set(0);
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
uint64_t bitmask[2] = {0x404080808080, 0x1111ffff1111ffff};
|
||||
DebugSession::printBitmask(reinterpret_cast<uint8_t *>(bitmask), sizeof(bitmask));
|
||||
|
||||
auto output = capture.getCapturedStdout();
|
||||
auto output = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(0u, output.size());
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/stream_capture.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/tools/source/debug/eu_thread.h"
|
||||
@@ -153,13 +152,12 @@ TEST(EuThread, GivenEnabledErrorLogsWhenThreadStateStoppedAndVerifyingStopWithEv
|
||||
euThread.verifyStopped(1);
|
||||
euThread.stopThread(1u);
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
EXPECT_FALSE(euThread.verifyStopped(2));
|
||||
EXPECT_TRUE(euThread.isRunning());
|
||||
|
||||
auto message = capture.getCapturedStderr();
|
||||
auto message = ::testing::internal::GetCapturedStderr();
|
||||
// Trim message and remove timestamp + first space
|
||||
size_t pos = message.find(']');
|
||||
message.erase(0, pos + 2);
|
||||
@@ -209,13 +207,12 @@ TEST(EuThread, GivenEnabledErrorLogsWhenThreadStateStoppedAndVerifyingStopWithOd
|
||||
|
||||
euThread.verifyStopped(1);
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
EXPECT_TRUE(euThread.verifyStopped(7));
|
||||
EXPECT_TRUE(euThread.isStopped());
|
||||
|
||||
auto message = capture.getCapturedStderr();
|
||||
auto message = ::testing::internal::GetCapturedStderr();
|
||||
// Trim message and remove timestamp + first space
|
||||
size_t pos = message.find(']');
|
||||
message.erase(0, pos + 2);
|
||||
@@ -233,13 +230,12 @@ TEST(EuThread, GivenEnabledErrorLogsWhenThreadStateRunningAndVerifyingStopWithOd
|
||||
euThread.verifyStopped(1);
|
||||
euThread.resumeThread();
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
EXPECT_TRUE(euThread.verifyStopped(1));
|
||||
EXPECT_TRUE(euThread.isStopped());
|
||||
|
||||
auto message = capture.getCapturedStderr();
|
||||
auto message = ::testing::internal::GetCapturedStderr();
|
||||
// Trim message and remove timestamp + first space
|
||||
size_t pos = message.find(']');
|
||||
message.erase(0, pos + 2);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||
#include "shared/test/common/helpers/stream_capture.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/libult/linux/drm_query_mock.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -317,12 +316,11 @@ TEST(DebugSessionLinuxi915Test, GivenLogsEnabledWhenPrintContextVmsCalledThenMap
|
||||
|
||||
EXPECT_EQ(2u, sessionMock->clientHandleToConnection[sessionMock->clientHandle]->contextsCreated.size());
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
sessionMock->printContextVms();
|
||||
|
||||
auto map = capture.getCapturedStdout();
|
||||
auto map = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_TRUE(hasSubstr(map, std::string("INFO: Context - VM map:")));
|
||||
EXPECT_TRUE(hasSubstr(map, std::string("Context = 0 : 1")));
|
||||
@@ -348,12 +346,11 @@ TEST(DebugSessionLinuxi915Test, GivenLogsDisabledWhenPrintContextVmsCalledThenMa
|
||||
|
||||
EXPECT_EQ(2u, sessionMock->clientHandleToConnection[sessionMock->clientHandle]->contextsCreated.size());
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
sessionMock->printContextVms();
|
||||
|
||||
auto map = capture.getCapturedStdout();
|
||||
auto map = ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_TRUE(map.empty());
|
||||
}
|
||||
@@ -999,15 +996,13 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerLogsWhenOpenDebuggerFailsThenCorrectMessa
|
||||
mockDrm->context.debuggerOpenRetval = -1;
|
||||
mockDrm->baseErrno = false;
|
||||
mockDrm->errnoRetVal = 22;
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
|
||||
::testing::internal::CaptureStderr();
|
||||
auto session = DebugSession::create(config, device, result, !device->getNEODevice()->isSubDevice());
|
||||
|
||||
EXPECT_EQ(nullptr, session);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, result);
|
||||
|
||||
auto errorMessage = capture.getCapturedStderr();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStderr();
|
||||
// Trim errorMessage and remove timestamp + first space
|
||||
size_t pos = errorMessage.find(']');
|
||||
errorMessage.erase(0, pos + 2);
|
||||
@@ -1058,15 +1053,14 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerLogsWhenOpenDebuggerSucceedsThenCorrectMe
|
||||
mockDrm->context.debuggerOpenRetval = 10;
|
||||
mockDrm->baseErrno = false;
|
||||
mockDrm->errnoRetVal = 0;
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
auto session = std::unique_ptr<DebugSession>(DebugSession::create(config, device, result, !device->getNEODevice()->isSubDevice()));
|
||||
|
||||
EXPECT_NE(nullptr, session);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto errorMessage = capture.getCapturedStdout();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_TRUE(hasSubstr(errorMessage, std::string("INFO: PRELIM_DRM_IOCTL_I915_DEBUGGER_OPEN: open.pid: 4660, open.events: 0, debugFd: 10\n")));
|
||||
}
|
||||
|
||||
@@ -1137,8 +1131,7 @@ TEST_F(DebugApiLinuxTest, GivenPrintDebugMessagesWhenDebugSessionClosesConnectio
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
auto session = std::make_unique<MockDebugSessionLinuxi915>(config, device, 10);
|
||||
|
||||
@@ -1156,7 +1149,7 @@ TEST_F(DebugApiLinuxTest, GivenPrintDebugMessagesWhenDebugSessionClosesConnectio
|
||||
NEO::SysCalls::closeFuncArgPassed = 0;
|
||||
NEO::SysCalls::closeFuncRetVal = 0;
|
||||
|
||||
auto errorMessage = capture.getCapturedStderr();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStderr();
|
||||
// Trim errorMessage and remove timestamp + first space
|
||||
size_t pos = errorMessage.find(']');
|
||||
errorMessage.erase(0, pos + 2);
|
||||
@@ -2327,8 +2320,7 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerLogsWhenReadEventFailsDuringInitializatio
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
auto session = std::make_unique<MockDebugSessionLinuxi915>(config, device, 10);
|
||||
ASSERT_NE(nullptr, session);
|
||||
@@ -2351,7 +2343,7 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerLogsWhenReadEventFailsDuringInitializatio
|
||||
EXPECT_EQ(ZE_RESULT_NOT_READY, result);
|
||||
EXPECT_EQ(2, session->getInternalEventCounter);
|
||||
|
||||
auto errorMessage = capture.getCapturedStderr();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStderr();
|
||||
auto pos = errorMessage.find("PRELIM_I915_DEBUG_IOCTL_READ_EVENT failed: retCode: -1 errno =");
|
||||
EXPECT_NE(std::string::npos, pos);
|
||||
}
|
||||
@@ -3203,12 +3195,11 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerLogsAndUnhandledEventTypeWhenHandlingEven
|
||||
|
||||
session->ioctlHandler.reset(handler);
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
session->handleEvent(&event);
|
||||
|
||||
auto errorMessage = capture.getCapturedStdout();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStdout();
|
||||
std::stringstream expectedMessage;
|
||||
expectedMessage << "PRELIM_I915_DEBUG_IOCTL_READ_EVENT type: UNHANDLED ";
|
||||
expectedMessage << PRELIM_DRM_I915_DEBUG_EVENT_MAX_EVENT + 1;
|
||||
@@ -5083,15 +5074,14 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerLogsAndFailingReadUuidEventIoctlWhenHandl
|
||||
auto handler = new MockIoctlHandlerI915;
|
||||
session->ioctlHandler.reset(handler);
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
errno = 0;
|
||||
session->handleEvent(reinterpret_cast<prelim_drm_i915_debug_event *>(&uuid));
|
||||
|
||||
EXPECT_EQ(1, handler->ioctlCalled);
|
||||
EXPECT_EQ(0u, session->getClassHandleToIndex().size());
|
||||
|
||||
auto errorMessage = capture.getCapturedStderr();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStderr();
|
||||
// Trim errorMessage and remove timestamp + first space
|
||||
size_t pos = errorMessage.find(']');
|
||||
errorMessage.erase(0, pos + 2);
|
||||
@@ -5218,8 +5208,7 @@ TEST_F(DebugApiLinuxTest, GivenContextParamEventWhenTypeIsParamEngineThenEventIs
|
||||
i915_engine_class_instance ci = {drm_i915_gem_engine_class::I915_ENGINE_CLASS_RENDER, 1};
|
||||
memcpy(classInstance, &ci, sizeof(i915_engine_class_instance));
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
session->handleEvent(&contextParamEvent->base);
|
||||
alignedFree(memory);
|
||||
@@ -5232,7 +5221,7 @@ TEST_F(DebugApiLinuxTest, GivenContextParamEventWhenTypeIsParamEngineThenEventIs
|
||||
session->clientHandleToConnection[MockDebugSessionLinuxi915::mockClientHandle]->vmToTile.find(vmId));
|
||||
EXPECT_EQ(0u, session->clientHandleToConnection[MockDebugSessionLinuxi915::mockClientHandle]->vmToTile[vmId]);
|
||||
|
||||
auto infoMessage = capture.getCapturedStdout();
|
||||
auto infoMessage = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_TRUE(hasSubstr(infoMessage, std::string("I915_CONTEXT_PARAM_ENGINES ctx_id = 20 param = 10 value = 0")));
|
||||
}
|
||||
|
||||
@@ -5330,14 +5319,13 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerErrorLogsWhenContextParamWithInvalidConte
|
||||
contextParamEvent.ctx_handle = 77;
|
||||
contextParamEvent.param = {.ctx_id = 3, .size = 8, .param = I915_CONTEXT_PARAM_VM, .value = vmId};
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
session->handleEvent(&contextParamEvent.base);
|
||||
|
||||
EXPECT_EQ(session->clientHandleToConnection[contextParamEvent.client_handle]->contextsCreated.end(),
|
||||
session->clientHandleToConnection[contextParamEvent.client_handle]->contextsCreated.find(77));
|
||||
|
||||
auto errorMessage = capture.getCapturedStderr();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStderr();
|
||||
// Trim errorMessage and remove timestamp + first space
|
||||
size_t pos = errorMessage.find(']');
|
||||
errorMessage.erase(0, pos + 2);
|
||||
@@ -5369,15 +5357,14 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerInfoLogsWhenHandlingContextParamEventWith
|
||||
contextParamEvent.ctx_handle = contextHandle;
|
||||
contextParamEvent.param = {.ctx_id = 3, .size = 8, .param = I915_CONTEXT_PARAM_BAN_PERIOD, .value = vmId};
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
session->handleEvent(&contextParamEvent.base);
|
||||
|
||||
EXPECT_EQ(session->clientHandleToConnection[contextParamEvent.client_handle]->contextsCreated.end(),
|
||||
session->clientHandleToConnection[contextParamEvent.client_handle]->contextsCreated.find(77));
|
||||
|
||||
auto errorMessage = capture.getCapturedStdout();
|
||||
auto errorMessage = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_TRUE(hasSubstr(errorMessage, std::string("client_handle = 1 ctx_handle = 20\n")));
|
||||
EXPECT_TRUE(hasSubstr(errorMessage, std::string("INFO: I915_CONTEXT_PARAM UNHANDLED = 1\n")));
|
||||
}
|
||||
@@ -5944,8 +5931,7 @@ TEST_F(DebugApiLinuxTest, givenEnginesEventHandledThenLrcToContextHandleMapIsFil
|
||||
engines2->engines[2].lrc_handle = 5;
|
||||
engines2->engines[3].lrc_handle = 0;
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
::testing::internal::CaptureStdout();
|
||||
|
||||
NEO::debugManager.flags.DebuggerLogBitmask.set(NEO::DebugVariables::DEBUGGER_LOG_BITMASK::LOG_INFO);
|
||||
|
||||
@@ -5968,7 +5954,7 @@ TEST_F(DebugApiLinuxTest, givenEnginesEventHandledThenLrcToContextHandleMapIsFil
|
||||
EXPECT_EQ(40u, session->clientHandleToConnection[clientHandle]->lrcToContextHandle[4]);
|
||||
EXPECT_EQ(40u, session->clientHandleToConnection[clientHandle]->lrcToContextHandle[5]);
|
||||
|
||||
auto infoMessage = capture.getCapturedStdout();
|
||||
auto infoMessage = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_TRUE(hasSubstr(infoMessage, std::string("ENGINES event: client_handle = 34, ctx_handle = 20, num_engines = 2 CREATE")));
|
||||
EXPECT_TRUE(hasSubstr(infoMessage, std::string("ENGINES event: client_handle = 34, ctx_handle = 40, num_engines = 4 CREATE")));
|
||||
EXPECT_TRUE(hasSubstr(infoMessage, std::string("ENGINES event: client_handle = 34, ctx_handle = 20, num_engines = 2 DESTROY")));
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||
#include "shared/test/common/helpers/stream_capture.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -2912,12 +2911,11 @@ TEST_F(DebugApiLinuxTestXe, GivenMultipleExecQueuePlacementEventForSameVmHandleW
|
||||
engineClassInstance[0].engineInstance = 1;
|
||||
engineClassInstance[0].gtId = 0;
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStderr();
|
||||
::testing::internal::CaptureStderr();
|
||||
session->handleEvent(&execQueuePlacements->base);
|
||||
alignedFree(memory);
|
||||
|
||||
auto infoMessage = capture.getCapturedStderr();
|
||||
auto infoMessage = ::testing::internal::GetCapturedStderr();
|
||||
EXPECT_EQ(1u, session->clientHandleToConnection[client1.clientHandle]->vmToTile[vmHandle]);
|
||||
EXPECT_TRUE(hasSubstr(infoMessage, std::string("tileIndex = 1 already present. Attempt to overwrite with tileIndex = 0")));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/stream_capture.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
@@ -599,12 +598,11 @@ TEST_F(DebugApiTest, givenZeAffinityMaskAndEnabledDebugMessagesWhenDebugAttachCa
|
||||
MockDeviceImp deviceImp(neoDevice);
|
||||
deviceImp.debugSession.reset(new DebugSessionMock(config, &deviceImp));
|
||||
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
testing::internal::CaptureStdout();
|
||||
zet_debug_session_handle_t debugSession = nullptr;
|
||||
zetDebugAttach(deviceImp.toHandle(), &config, &debugSession);
|
||||
|
||||
std::string output = capture.getCapturedStdout();
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(std::string("ZE_AFFINITY_MASK is not recommended while using program debug API\n"), output);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user