TBX with AUB dump to call open on aub manager

Call open on aub manager to open file stream.

Change-Id: Id48ac4b3bdb212db4adc5912bacd28ccb895c9cf
Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2019-03-27 20:41:06 +01:00
parent 4973204ae2
commit 9f95e9b704
2 changed files with 29 additions and 0 deletions

View File

@ -156,6 +156,12 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const std::
executionEnvironment.initAubCenter(localMemoryEnabled, fullName, CommandStreamReceiverType::CSR_TBX_WITH_AUB); executionEnvironment.initAubCenter(localMemoryEnabled, fullName, CommandStreamReceiverType::CSR_TBX_WITH_AUB);
csr = new CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<GfxFamily>>(baseName, executionEnvironment); csr = new CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<GfxFamily>>(baseName, executionEnvironment);
if (csr->aubManager) {
if (!csr->aubManager->isOpen()) {
csr->aubManager->open(fullName);
UNRECOVERABLE_IF(!csr->aubManager->isOpen());
}
}
} else { } else {
csr = new TbxCommandStreamReceiverHw<GfxFamily>(executionEnvironment); csr = new TbxCommandStreamReceiverHw<GfxFamily>(executionEnvironment);
} }

View File

@ -482,3 +482,26 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenFileNameIsE
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsr(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(TbxCommandStreamReceiver::create("aubfile", true, executionEnvironment))); std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsr(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(TbxCommandStreamReceiver::create("aubfile", true, executionEnvironment)));
EXPECT_STREQ(fullName.c_str(), executionEnvironment.aubFileNameReceived.c_str()); EXPECT_STREQ(fullName.c_str(), executionEnvironment.aubFileNameReceived.c_str());
} }
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenOpenIsCalledOnAubManagerToOpenFileStream) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.setHwInfo(*platformDevices);
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsrWithAubDump(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
TbxCommandStreamReceiver::create("aubfile", true, executionEnvironment)));
EXPECT_TRUE(tbxCsrWithAubDump->aubManager->isOpen());
}
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpSeveralTimesThenOpenIsCalledOnAubManagerOnceOnly) {
MockExecutionEnvironment executionEnvironment(*platformDevices, true);
executionEnvironment.setHwInfo(*platformDevices);
auto tbxCsrWithAubDump1 = std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>>(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
TbxCommandStreamReceiverHw<FamilyType>::create("aubfile", true, executionEnvironment)));
auto tbxCsrWithAubDump2 = std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>>(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
TbxCommandStreamReceiverHw<FamilyType>::create("aubfile", true, executionEnvironment)));
auto mockManager = reinterpret_cast<MockAubManager *>(executionEnvironment.aubCenter->getAubManager());
EXPECT_EQ(1u, mockManager->openCalledCnt);
}