-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a single loader API test using googletest. Adds the ZEL_LIBRARY_PATH environment variable, which allows using a local copy of the loader for the purposes of testing. Signed-off-by: Lisanna Dettwyler <[email protected]> Co-authored-by: Jemale Lockett <[email protected]>
- Loading branch information
1 parent
c1f6e28
commit 6fef76b
Showing
11 changed files
with
114 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: MIT | ||
add_subdirectory(layers) | ||
add_subdirectory(test_api) | ||
|
||
add_executable( | ||
tests | ||
loader_api.cpp | ||
) | ||
target_include_directories(tests PRIVATE ${CMAKE_SOURCE_DIR}/include) | ||
target_link_libraries( | ||
tests | ||
GTest::gtest_main | ||
${TARGET_LOADER_NAME} | ||
) | ||
|
||
# For some reason the MSVC runtime libraries used by googletest and test | ||
# binaries don't match, so force the test binary to use the dynamic runtime. | ||
if(MSVC) | ||
target_compile_options(tests PRIVATE "/MD$<$<CONFIG:Debug>:d>") | ||
endif() | ||
|
||
add_test(NAME tests COMMAND tests) | ||
set_property(TEST tests PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
test/layers/validation/handle_lifetime_tracking/CMakeLists.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "loader/ze_loader.h" | ||
#include "ze_api.h" | ||
|
||
namespace { | ||
|
||
TEST( | ||
LoaderAPI, | ||
GivenLevelZeroLoaderPresentWhenCallingzeGetLoaderVersionsAPIThenValidVersionIsReturned) { | ||
|
||
EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(0)); | ||
|
||
size_t size = 0; | ||
EXPECT_EQ(ZE_RESULT_SUCCESS, zelLoaderGetVersions(&size, nullptr)); | ||
EXPECT_GT(size, 0); | ||
|
||
std::vector<zel_component_version_t> versions(size); | ||
EXPECT_EQ(ZE_RESULT_SUCCESS, zelLoaderGetVersions(&size, versions.data())); | ||
|
||
std::cout << "Found " << versions.size() << " versions" << std::endl; | ||
std::cout << std::endl; | ||
const std::string loader_name = "loader"; | ||
for (auto &component : versions) { | ||
std::cout << "component.component_name: " << component.component_name << std::endl; | ||
std::cout << "component.component_lib_version.major: " << component.component_lib_version.major << std::endl; | ||
std::cout << "component.spec_version: " << component.spec_version << std::endl; | ||
std::cout << "component.component_lib_name: " << component.component_name << std::endl; | ||
std::cout << std::endl; | ||
|
||
if (loader_name == component.component_name) { | ||
EXPECT_GE(component.component_lib_version.major, 1); | ||
} | ||
} | ||
} | ||
|
||
} // namespace |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.