Retrun valid status on createAllocation64k fail

Change-Id: Iaaed107c995a79125236196b6a956696dfe20875
This commit is contained in:
Dunajski, Bartosz
2018-08-28 12:56:05 +02:00
committed by sys_ocldev
parent 0c01653daf
commit 02611dc953
2 changed files with 24 additions and 13 deletions

View File

@@ -789,6 +789,22 @@ TEST_F(Wddm20Tests, givenOpenSharedHandleWhenZeroAllocationsThenReturnNull) {
EXPECT_EQ(false, ret);
}
TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
struct FailingCreateAllocation {
static NTSTATUS APIENTRY mockCreateAllocation(D3DKMT_CREATEALLOCATION *param) {
return STATUS_GRAPHICS_NO_VIDEO_MEMORY;
};
};
gdi->createAllocation = FailingCreateAllocation::mockCreateAllocation;
void *fakePtr = reinterpret_cast<void *>(0x123);
auto gmm = std::make_unique<Gmm>(fakePtr, 100, false);
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull);
allocation.gmm = gmm.get();
EXPECT_FALSE(wddm->createAllocation64k(&allocation));
}
TEST_F(Wddm20Tests, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMemoryThenCorrectStatusIsReturned) {
class MockCreateAllocation {
public: