Files
compute-runtime/unit_tests/os_interface/windows/wddm_residency_handler_tests.cpp
Maciej Plewka 7827501b91 Add returned status to MemoryOperationsHandler
Change-Id: Ic8685e3711cec03d8f83d371fa7152ee095a47a0
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
2019-09-02 08:42:50 +02:00

38 lines
1.5 KiB
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
#include "test.h"
#include "unit_tests/mocks/mock_allocation_properties.h"
#include "unit_tests/mocks/mock_wddm.h"
#include "unit_tests/os_interface/windows/mock_wddm_allocation.h"
#include "unit_tests/os_interface/windows/wddm_fixture.h"
using namespace NEO;
struct WddmMemoryOperationsHandlerTest : public WddmTest {
void SetUp() override {
WddmTest::SetUp();
wddmMemoryOperationsHandler = std::make_unique<WddmMemoryOperationsHandler>(wddm);
wddmAllocation.handle = 0x2;
}
std::unique_ptr<WddmMemoryOperationsHandler> wddmMemoryOperationsHandler;
MockWddmAllocation wddmAllocation;
};
TEST_F(WddmMemoryOperationsHandlerTest, whenMakingResidentAllocaionExpectMakeResidentCalled) {
EXPECT_EQ(wddmMemoryOperationsHandler->makeResident(wddmAllocation), MemoryOperationsStatus::SUCCESS);
EXPECT_EQ(wddmMemoryOperationsHandler->isResident(wddmAllocation), MemoryOperationsStatus::SUCCESS);
}
TEST_F(WddmMemoryOperationsHandlerTest, whenEvictingResidentAllocationExpectEvictCalled) {
EXPECT_EQ(wddmMemoryOperationsHandler->makeResident(wddmAllocation), MemoryOperationsStatus::SUCCESS);
EXPECT_EQ(wddmMemoryOperationsHandler->evict(wddmAllocation), MemoryOperationsStatus::SUCCESS);
EXPECT_EQ(wddmMemoryOperationsHandler->isResident(wddmAllocation), MemoryOperationsStatus::MEMORY_NOT_FOUND);
}