mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Ensure that submissions are flushed prior to csr destruction.
Change-Id: Ie04de561d3d295f40f55a19f01274d873d259abd
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user