mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
Check Windows OsContext is properly initialized
Related-To: NEO-3639 Change-Id: I9442402a109174bbf9345d8451dba8e7ddb8c1d9 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
8585170f05
commit
6f7d83f7ab
60
unit_tests/os_interface/windows/os_context_win_tests.cpp
Normal file
60
unit_tests/os_interface/windows/os_context_win_tests.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct OsContextWinTest : public WddmTestWithMockGdiDll {
|
||||
void SetUp() override {
|
||||
WddmTestWithMockGdiDll::SetUp();
|
||||
preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
engineType = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0];
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
PreemptionMode preemptionMode;
|
||||
aub_stream::EngineType engineType;
|
||||
};
|
||||
|
||||
TEST_F(OsContextWinTest, givenWddm20WhenCreatingOsContextThenOsContextIsInitialized) {
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false);
|
||||
EXPECT_TRUE(osContext->isInitialized());
|
||||
}
|
||||
|
||||
TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmContextFailThenOsContextIsNotInitialized) {
|
||||
wddm->device = INVALID_HANDLE;
|
||||
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false);
|
||||
EXPECT_FALSE(osContext->isInitialized());
|
||||
}
|
||||
|
||||
TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmMonitorFenceFailThenOsContextIsNotInitialized) {
|
||||
*getCreateSynchronizationObject2FailCallFcn() = true;
|
||||
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false);
|
||||
EXPECT_FALSE(osContext->isInitialized());
|
||||
}
|
||||
|
||||
TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackFailThenOsContextIsNotInitialized) {
|
||||
*getRegisterTrimNotificationFailCallFcn() = true;
|
||||
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false);
|
||||
EXPECT_FALSE(osContext->isInitialized());
|
||||
}
|
||||
|
||||
TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackIsDisabledThenOsContextIsInitialized) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.DoNotRegisterTrimCallback.set(true);
|
||||
*getRegisterTrimNotificationFailCallFcn() = true;
|
||||
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false);
|
||||
EXPECT_TRUE(osContext->isInitialized());
|
||||
}
|
||||
Reference in New Issue
Block a user