From: Charles Giessen Date: Tue, 15 Feb 2022 22:03:25 +0000 (-0700) Subject: Guard building of live_verification tests X-Git-Tag: upstream/v1.3.207~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38b9a27fbc0308439941d6d2b4315dad73b6e224;p=platform%2Fupstream%2FVulkan-Loader.git Guard building of live_verification tests Don't build live verification tests by default. These are meant as manual tests for developers to run to diagnose issues or verify correctness on a real system. --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e64b7d1b..12d108bc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,6 +20,7 @@ # Use these options to force a specific sanitizer on all test executables option(TEST_USE_ADDRESS_SANITIZER "Linux only: Advanced memory checking" OFF) option(TEST_USE_THREAD_SANITIZER "Linux only: Advanced thread checking" OFF) +option(ENABLE_LIVE_VERIFICATION_TESTS "Enable tests which expect to run on live drivers. Meant for manual verification only" OFF) include(GoogleTest) add_subdirectory(framework) @@ -45,6 +46,11 @@ add_executable( loader_threading_tests.cpp) target_link_libraries(test_threading PRIVATE testing_dependencies) +# executables that are meant for testing against real drivers rather than the mocks +if (ENABLE_LIVE_VERIFICATION_TESTS) + add_subdirectory(live_verification) +endif() + if(WIN32) # Copy loader and googletest (gtest) libs to test dir so the test executable can find them. add_custom_command(TARGET test_regression POST_BUILD @@ -54,10 +60,13 @@ if(WIN32) add_custom_command(TARGET test_regression POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ $) endif() + + # Copy the gtest shared lib (if built) to the live verification tests directory so the tests finds it. + if(ENABLE_LIVE_VERIFICATION_TESTS) + add_custom_command(TARGET test_regression POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $) + endif() endif() # must happen after the dll's get copied over -gtest_discover_tests(test_regression) - -# executables that are meant for testing against real drivers rather than the mocks -add_subdirectory(live_verification) \ No newline at end of file +gtest_discover_tests(test_regression) \ No newline at end of file diff --git a/tests/framework/test_environment.cpp b/tests/framework/test_environment.cpp index 53655993..5d5f2ad3 100644 --- a/tests/framework/test_environment.cpp +++ b/tests/framework/test_environment.cpp @@ -89,7 +89,7 @@ std::vector EnumerateDeviceExtensions(InstWrapper const& EXPECT_EQ(VK_SUCCESS, res); std::vector extensions; extensions.resize(ext_count); - res = inst.functions->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &ext_count, nullptr); + res = inst.functions->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &ext_count, extensions.data()); EXPECT_EQ(VK_SUCCESS, res); extensions.resize(ext_count); return extensions; diff --git a/tests/live_verification/dynamic_rendering_get_proc_addr.cpp b/tests/live_verification/dynamic_rendering_get_proc_addr.cpp index 301f63da..f4a521fb 100644 --- a/tests/live_verification/dynamic_rendering_get_proc_addr.cpp +++ b/tests/live_verification/dynamic_rendering_get_proc_addr.cpp @@ -65,15 +65,15 @@ int main() { alloc_info.commandPool = command_pool; funcs.vkAllocateCommandBuffers(dev, &alloc_info, &command_buffer); PFN_vkBeginCommandBuffer vkBeginCommandBuffer = - reinterpret_cast(vk_funcs.vkGetInstanceProcAddr(inst, "vkBeginCommandBuffer")); + reinterpret_cast(vk_funcs.vkGetInstanceProcAddr(inst.inst, "vkBeginCommandBuffer")); VkCommandBufferBeginInfo begin_info{}; begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; VkResult res = vkBeginCommandBuffer(command_buffer, &begin_info); assert(res == VK_SUCCESS); - // call the dynamic rendering function + // call the dynamic rendering function -- should not go into the physical device function trampoline. PFN_vkCmdBeginRenderingKHR vkCmdBeginRenderingKHR = - reinterpret_cast(vk_funcs.vkGetDeviceProcAddr(dev.dev, "vkCmdBeginRenderingKHR")); + reinterpret_cast(vk_funcs.vkGetInstanceProcAddr(inst.inst, "vkCmdBeginRenderingKHR")); VkRenderingInfoKHR rendering_info{}; rendering_info.sType = VK_STRUCTURE_TYPE_RENDERING_INFO_KHR; vkCmdBeginRenderingKHR(command_buffer, &rendering_info);