mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 06:23:01 +08:00
Revert "refactor: Unify GTPin initialization logic between APIs"
This reverts commit 68a5108e05.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
68a5108e05
commit
65df34bbc7
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/pin/pin.h"
|
||||
#include "shared/test/common/mocks/mock_os_library.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace ULT {
|
||||
|
||||
TEST(PinInitializationTest, GivenValidLibraryPinContextInitSucceeds) {
|
||||
uint32_t (*openPinHandler)(void *) = [](void *arg) -> uint32_t { return 0; };
|
||||
auto newPtr = new MockOsLibrary(reinterpret_cast<void *>(openPinHandler), false);
|
||||
MockOsLibrary::loadLibraryNewObject = newPtr;
|
||||
NEO::PinContext::osLibraryLoadFunction = MockOsLibrary::load;
|
||||
std::string mockGTPinFunctionName{"aaa"};
|
||||
EXPECT_TRUE(NEO::PinContext::init(mockGTPinFunctionName));
|
||||
|
||||
MockOsLibrary::loadLibraryNewObject = nullptr;
|
||||
delete newPtr;
|
||||
}
|
||||
|
||||
TEST(PinInitializationTest, GivenBadLibraryNamePinContextInitFAILS) {
|
||||
MockOsLibrary::loadLibraryNewObject = nullptr;
|
||||
NEO::PinContext::osLibraryLoadFunction = MockOsLibrary::load;
|
||||
std::string mockGTPinFunctionName{"aaa"};
|
||||
EXPECT_FALSE(NEO::PinContext::init(mockGTPinFunctionName));
|
||||
|
||||
MockOsLibrary::loadLibraryNewObject = nullptr;
|
||||
}
|
||||
|
||||
TEST(PinInitializationTest, GivenBadProcAddressPinContextInitFAILS) {
|
||||
auto newPtr = new MockOsLibrary(nullptr, false);
|
||||
MockOsLibrary::loadLibraryNewObject = newPtr;
|
||||
NEO::PinContext::osLibraryLoadFunction = MockOsLibrary::load;
|
||||
std::string mockGTPinFunctionName{"aaa"};
|
||||
EXPECT_FALSE(NEO::PinContext::init(mockGTPinFunctionName));
|
||||
|
||||
MockOsLibrary::loadLibraryNewObject = nullptr;
|
||||
delete newPtr;
|
||||
}
|
||||
|
||||
TEST(PinInitializationTest, GivenBadPinHandlerPinContextInitFAILS) {
|
||||
uint32_t (*openPinHandler)(void *) = [](void *arg) -> uint32_t { return 1; };
|
||||
auto newPtr = new MockOsLibrary(reinterpret_cast<void *>(openPinHandler), false);
|
||||
MockOsLibrary::loadLibraryNewObject = newPtr;
|
||||
NEO::PinContext::osLibraryLoadFunction = MockOsLibrary::load;
|
||||
std::string mockGTPinFunctionName{"aaa"};
|
||||
EXPECT_FALSE(NEO::PinContext::init(mockGTPinFunctionName));
|
||||
|
||||
MockOsLibrary::loadLibraryNewObject = nullptr;
|
||||
delete newPtr;
|
||||
}
|
||||
|
||||
} // namespace ULT
|
||||
Reference in New Issue
Block a user