From 1feba3b3fcb03da1576702ef396a42eb94f97eda Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Jul 2024 15:48:32 -0700 Subject: [PATCH] Look for api dump test output in current directory The tests are failing on windows due to a mismatch in the working directory that the executable is being run and the directory that is assumed to be where Api Dump will output. By querying where the current directory is, the tests can always find the output of Api Dump. --- layersvt/test/CMakeLists.txt | 1 - layersvt/test/test_api_dump.cpp | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/layersvt/test/CMakeLists.txt b/layersvt/test/CMakeLists.txt index b2e4cb3779..9bd7f8fe02 100644 --- a/layersvt/test/CMakeLists.txt +++ b/layersvt/test/CMakeLists.txt @@ -34,7 +34,6 @@ function(LayerTest NAME) add_dependencies(${TEST_NAME} VkLayer_${NAME}) target_link_libraries(${TEST_NAME} Vulkan::Headers Vulkan::Loader GTest::gtest GTest::gtest_main Vulkan::LayerSettings) target_compile_definitions(${TEST_NAME} PUBLIC LAYER_BINARY_PATH="$") - target_compile_definitions(${TEST_NAME} PUBLIC TEST_EXECUTABLE_PATH="$") add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) set_tests_properties(${TEST_NAME} PROPERTIES ENVIRONMENT diff --git a/layersvt/test/test_api_dump.cpp b/layersvt/test/test_api_dump.cpp index 72a73bfd2d..7576eac071 100644 --- a/layersvt/test/test_api_dump.cpp +++ b/layersvt/test/test_api_dump.cpp @@ -23,6 +23,8 @@ #include #include +#include + static const char* kLayerName = "VK_LAYER_LUNARG_api_dump"; class ApiDumpTests : public VkTestFramework { @@ -50,8 +52,8 @@ TEST_F(ApiDumpTests, init_layer) { EXPECT_EQ(err, VK_SUCCESS); // check the output file is generated - const std::string path = std::string(TEST_EXECUTABLE_PATH) + "/" + filename_string; - FILE* file = fopen(path.c_str(), "r"); + const std::filesystem::path path = std::filesystem::current_path() / std::filesystem::path(filename_string); + FILE* file = fopen(path.string().c_str(), "r"); ASSERT_TRUE(file != NULL); const char* file_start_content_expected = "";