mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Report failure given Compiler Library Load failed for L0
- Return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE given the Compiler cannot be loaded. - Print dlopen and LoadLibrary error strings given Debug Print Messages are enabled. Related-To: LOCI-1313 Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
95b9880385
commit
7a3095c273
@ -34,9 +34,18 @@ TEST(OsLibraryTest, GivenDisableDeepBindFlagWhenOpeningLibraryThenRtldDeepBindFl
|
||||
VariableBackup<bool> dlOpenCalledBackup{&NEO::SysCalls::dlOpenCalled, false};
|
||||
|
||||
DebugManager.flags.DisableDeepBind.set(1);
|
||||
auto lib = std::make_unique<Linux::OsLibrary>("abc");
|
||||
auto lib = std::make_unique<Linux::OsLibrary>("abc", nullptr);
|
||||
EXPECT_TRUE(NEO::SysCalls::dlOpenCalled);
|
||||
EXPECT_EQ(0, NEO::SysCalls::dlOpenFlags & RTLD_DEEPBIND);
|
||||
}
|
||||
|
||||
TEST(OsLibraryTest, GivenInvalidLibraryWhenOpeningLibraryThenDlopenErrorIsReturned) {
|
||||
VariableBackup<bool> dlOpenCalledBackup{&NEO::SysCalls::dlOpenCalled, false};
|
||||
|
||||
std::string errorValue;
|
||||
auto lib = std::make_unique<Linux::OsLibrary>("abc", &errorValue);
|
||||
EXPECT_FALSE(errorValue.empty());
|
||||
EXPECT_TRUE(NEO::SysCalls::dlOpenCalled);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -41,11 +41,25 @@ TEST(OSLibraryTest, GivenFakeLibNameWhenLoadingLibraryThenNullIsReturned) {
|
||||
EXPECT_EQ(nullptr, library);
|
||||
}
|
||||
|
||||
TEST(OSLibraryTest, GivenFakeLibNameWhenLoadingLibraryThenNullIsReturnedAndErrorString) {
|
||||
std::string errorValue;
|
||||
OsLibrary *library = OsLibrary::load(fakeLibName, &errorValue);
|
||||
EXPECT_FALSE(errorValue.empty());
|
||||
EXPECT_EQ(nullptr, library);
|
||||
}
|
||||
|
||||
TEST(OSLibraryTest, GivenValidLibNameWhenLoadingLibraryThenLibraryIsLoaded) {
|
||||
std::unique_ptr<OsLibrary> library(OsLibrary::load(Os::testDllName));
|
||||
EXPECT_NE(nullptr, library);
|
||||
}
|
||||
|
||||
TEST(OSLibraryTest, GivenValidLibNameWhenLoadingLibraryThenLibraryIsLoadedWithNoErrorString) {
|
||||
std::string errorValue;
|
||||
std::unique_ptr<OsLibrary> library(OsLibrary::load(Os::testDllName, &errorValue));
|
||||
EXPECT_TRUE(errorValue.empty());
|
||||
EXPECT_NE(nullptr, library);
|
||||
}
|
||||
|
||||
TEST(OSLibraryTest, whenSymbolNameIsValidThenGetProcAddressReturnsNonNullPointer) {
|
||||
std::unique_ptr<OsLibrary> library(OsLibrary::load(Os::testDllName));
|
||||
EXPECT_NE(nullptr, library);
|
||||
|
@ -101,4 +101,21 @@ TEST(OSLibraryWinTest, WhenCreatingFullSystemPathThenProperPathIsConstructed) {
|
||||
|
||||
auto fullPath = OsLibrary::createFullSystemPath("test");
|
||||
EXPECT_STREQ("C:\\System\\test", fullPath.c_str());
|
||||
}
|
||||
|
||||
TEST(OSLibraryWinTest, GivenInvalidLibraryWhenOpeningLibraryThenLoadLibraryErrorIsReturned) {
|
||||
std::string errorValue;
|
||||
auto lib = std::make_unique<Windows::OsLibrary>("abc", &errorValue);
|
||||
EXPECT_FALSE(errorValue.empty());
|
||||
}
|
||||
|
||||
TEST(OSLibraryWinTest, GivenNoLastErrorOnWindowsThenErrorStringisEmpty) {
|
||||
std::string errorValue;
|
||||
|
||||
auto lib = std::make_unique<Windows::OsLibrary>(Os::testDllName, &errorValue);
|
||||
EXPECT_NE(nullptr, lib);
|
||||
EXPECT_TRUE(errorValue.empty());
|
||||
lib.get()->getLastErrorString(&errorValue);
|
||||
EXPECT_TRUE(errorValue.empty());
|
||||
lib.get()->getLastErrorString(nullptr);
|
||||
}
|
Reference in New Issue
Block a user