Ensure that submissions are flushed prior to csr destruction.

Change-Id: Ie04de561d3d295f40f55a19f01274d873d259abd
This commit is contained in:
Mrozek, Michal
2018-03-09 14:48:42 +01:00
parent 3d139c204e
commit 8254d6a081
10 changed files with 78 additions and 18 deletions

View File

@@ -27,6 +27,7 @@
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_csr.h"
#include "unit_tests/libult/create_command_stream.h"
#include "test.h"
#include <memory>
@@ -144,3 +145,14 @@ TEST(DeviceCreation, givenDeviceWithUsedTagAllocationWhenItIsDestroyedThenThereA
auto tagAllocation = device->peekTagAllocation();
tagAllocation->taskCount = 1;
}
TEST(DeviceCleanup, givenDeviceWhenItIsDestroyedThenFlushBatchedSubmissionsIsCalled) {
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
MockCommandStreamReceiver *csr = new MockCommandStreamReceiver;
mockDevice->resetCommandStreamReceiver(csr);
int flushedBatchedSubmissionsCalledCount = 0;
csr->flushBatchedSubmissionsCallCounter = &flushedBatchedSubmissionsCalledCount;
mockDevice.reset(nullptr);
EXPECT_EQ(1, flushedBatchedSubmissionsCalledCount);
}