-
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 <lisanna.dettwyler@intel.com> Co-authored-by: Jemale Lockett <jemale.lockett@intel.com>
- Loading branch information
1 parent
c1f6e28
commit 785c6fe
Showing
11 changed files
with
117 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,27 @@ | ||
# 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) | ||
if(MSVC) | ||
get_target_property(binary_dir ${TARGET_LOADER_NAME} RUNTIME_OUTPUT_DIRECTORY) | ||
else() | ||
get_target_property(binary_dir ${TARGET_LOADER_NAME} LIBRARY_OUTPUT_DIRECTORY) | ||
endif() | ||
set_property(TEST tests PROPERTY ENVIRONMENT "ZEL_LIBRARY_PATH=${binary_dir};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.