1/* 2 * Copyright (c) 2021-2023 The Khronos Group Inc. 3 * Copyright (c) 2021-2023 Valve Corporation 4 * Copyright (c) 2021-2023 LunarG, Inc. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and/or associated documentation files (the "Materials"), to 8 * deal in the Materials without restriction, including without limitation the 9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 * sell copies of the Materials, and to permit persons to whom the Materials are 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice(s) and this permission notice shall be included in 14 * all copies or substantial portions of the Materials. 15 * 16 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 * 20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 23 * USE OR OTHER DEALINGS IN THE MATERIALS. 24 * 25 * Author: Charles Giessen <charles@lunarg.com> 26 * Author: Mark Young <markylunarg.com> 27 */ 28 29#include "test_environment.h" 30 31// Don't support vk_icdNegotiateLoaderICDInterfaceVersion 32// Loader calls vk_icdGetInstanceProcAddr second 33// does not support vk_icdGetInstanceProcAddr 34// must export vkGetInstanceProcAddr, vkCreateInstance, vkEnumerateInstanceExtensionProperties 35TEST(EnvVarICDOverrideSetup, version_0_none) { 36 FrameworkEnvironment env{}; 37 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)); 38 39 InstWrapper inst{env.vulkan_functions}; 40 inst.CheckCreate(); 41 42 ASSERT_EQ(env.get_test_icd(0).called_vk_icd_gipa, CalledICDGIPA::vk_gipa); 43} 44 45// Don't support vk_icdNegotiateLoaderICDInterfaceVersion 46// the loader calls vk_icdGetInstanceProcAddr first 47TEST(EnvVarICDOverrideSetup, version_1_icd_gipa) { 48 FrameworkEnvironment env{}; 49 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_ICD_GIPA).set_discovery_type(ManifestDiscoveryType::env_var)); 50 51 InstWrapper inst{env.vulkan_functions}; 52 inst.CheckCreate(); 53 54 ASSERT_EQ(env.get_test_icd(0).called_vk_icd_gipa, CalledICDGIPA::vk_icd_gipa); 55} 56 57// support vk_icdNegotiateLoaderICDInterfaceVersion but not vk_icdGetInstanceProcAddr 58TEST(EnvVarICDOverrideSetup, version_negotiate_interface_version_death_test) { 59 FrameworkEnvironment env{}; 60 env.add_icd( 61 TestICDDetails(TEST_ICD_PATH_EXPORT_NEGOTIATE_INTERFACE_VERSION).set_discovery_type(ManifestDiscoveryType::env_var)); 62 63 InstWrapper inst{env.vulkan_functions}; 64 inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); 65} 66 67// export vk_icdNegotiateLoaderICDInterfaceVersion and vk_icdGetInstanceProcAddr 68TEST(EnvVarICDOverrideSetup, version_2_negotiate_interface_version_and_icd_gipa) { 69 FrameworkEnvironment env{}; 70 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2).set_discovery_type(ManifestDiscoveryType::env_var)); 71 72 InstWrapper inst{env.vulkan_functions}; 73 inst.CheckCreate(); 74 75 ASSERT_EQ(env.get_test_icd(0).called_vk_icd_gipa, CalledICDGIPA::vk_icd_gipa); 76} 77 78// export vk_icdNegotiateLoaderICDInterfaceVersion and vk_icdGetInstanceProcAddr 79TEST(EnvVarICDOverrideSetup, version_2_negotiate_interface_version_and_icd_gipa_unicode) { 80 FrameworkEnvironment env{}; 81 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_UNICODE) 82 .set_discovery_type(ManifestDiscoveryType::env_var) 83 .set_json_name(TEST_JSON_NAME_VERSION_2_UNICODE)); 84 85 InstWrapper inst{env.vulkan_functions}; 86 inst.CheckCreate(); 87 88 ASSERT_EQ(env.get_test_icd(0).called_vk_icd_gipa, CalledICDGIPA::vk_icd_gipa); 89} 90 91// Test VK_DRIVER_FILES environment variable 92TEST(EnvVarICDOverrideSetup, TestOnlyDriverEnvVar) { 93 FrameworkEnvironment env{}; 94 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)); 95 env.get_test_icd(0).add_physical_device("pd0"); 96 97 InstWrapper inst1{env.vulkan_functions}; 98 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 99 inst1.CheckCreate(); 100 EXPECT_FALSE( 101 env.debug_log.find("Ignoring override VK_ICD_FILENAMES, VK_DRIVER_FILES, and VK_ADD_DRIVER_FILES due to high-integrity")); 102 103 std::array<VkPhysicalDevice, 5> phys_devs_array; 104 uint32_t phys_dev_count = 1; 105 ASSERT_EQ(inst1->vkEnumeratePhysicalDevices(inst1.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); 106 ASSERT_EQ(phys_dev_count, 1U); 107 108 for (uint32_t add = 0; add < 2; ++add) { 109 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)) 110 .add_physical_device("pd" + std::to_string(add) + "0") 111 .add_physical_device("pd" + std::to_string(add) + "1"); 112 } 113 114 env.debug_log.clear(); 115 116 InstWrapper inst2{env.vulkan_functions}; 117 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 118 inst2.CheckCreate(); 119 120 phys_dev_count = 5; 121 ASSERT_EQ(inst2->vkEnumeratePhysicalDevices(inst2.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); 122 ASSERT_EQ(phys_dev_count, 5U); 123 124 env.debug_log.clear(); 125 126 env.platform_shim->set_elevated_privilege(true); 127 128 InstWrapper inst3{env.vulkan_functions}; 129 FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); 130 inst3.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); 131 132 EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!")); 133 134 env.platform_shim->set_elevated_privilege(false); 135} 136 137// Test VK_DRIVER_FILES environment variable containing a path to a folder 138TEST(EnvVarICDOverrideSetup, TestOnlyDriverEnvVarInFolder) { 139 FrameworkEnvironment env{}; 140 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var).set_is_dir(false)); 141 env.get_test_icd(0).add_physical_device("pd0"); 142 143 InstWrapper inst1{env.vulkan_functions}; 144 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 145 inst1.CheckCreate(); 146 EXPECT_FALSE( 147 env.debug_log.find("Ignoring override VK_ICD_FILENAMES, VK_DRIVER_FILES, and VK_ADD_DRIVER_FILES due to high-integrity")); 148 149 std::array<VkPhysicalDevice, 5> phys_devs_array; 150 uint32_t phys_dev_count = 1; 151 ASSERT_EQ(inst1->vkEnumeratePhysicalDevices(inst1.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); 152 ASSERT_EQ(phys_dev_count, 1U); 153 154 for (uint32_t add = 0; add < 2; ++add) { 155 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)) 156 .add_physical_device("pd" + std::to_string(add) + "0") 157 .add_physical_device("pd" + std::to_string(add) + "1"); 158 } 159 160 env.debug_log.clear(); 161 162 InstWrapper inst2{env.vulkan_functions}; 163 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 164 inst2.CheckCreate(); 165 166 phys_dev_count = 5; 167 ASSERT_EQ(inst2->vkEnumeratePhysicalDevices(inst2.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); 168 ASSERT_EQ(phys_dev_count, 5U); 169 170 env.debug_log.clear(); 171 172 env.platform_shim->set_elevated_privilege(true); 173 174 InstWrapper inst3{env.vulkan_functions}; 175 FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); 176 inst3.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); 177 178 EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!")); 179 180 env.platform_shim->set_elevated_privilege(false); 181} 182 183#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) 184// Make sure the loader reports the correct message based on if LOADER_USE_UNSAFE_FILE_SEARCH is set or not 185TEST(EnvVarICDOverrideSetup, NonSecureEnvVarLookup) { 186 FrameworkEnvironment env{}; 187 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); 188 189 DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; 190 InstWrapper inst{env.vulkan_functions}; 191 FillDebugUtilsCreateDetails(inst.create_info, log); 192 inst.CheckCreate(); 193 194#if !defined(LOADER_USE_UNSAFE_FILE_SEARCH) 195 ASSERT_FALSE(log.find("Loader is using non-secure environment variable lookup for")); 196#else 197 ASSERT_TRUE(log.find("Loader is using non-secure environment variable lookup for")); 198#endif 199} 200 201// Check for proper handling of paths specified via environment variables. 202TEST(EnvVarICDOverrideSetup, XDG) { 203 // Set up a layer path that includes default and user-specified locations, 204 // so that the test app can find them. Include some badly specified elements as well. 205 // Need to redirect the 'home' directory 206 fs::path HOME = "/home/fake_home"; 207 EnvVarWrapper home_env_var{"HOME", HOME.str()}; 208 EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", ":/tmp/goober:::::/tmp/goober/::::"}; 209 EnvVarWrapper xdg_config_home_env_var{"XDG_CONFIG_HOME", ":/tmp/goober:::::/tmp/goober2/::::"}; 210 EnvVarWrapper xdg_data_dirs_env_var{"XDG_DATA_DIRS", "::::/tmp/goober3:/tmp/goober4/with spaces:::"}; 211 EnvVarWrapper xdg_data_home_env_var{"XDG_DATA_HOME", "::::/tmp/goober3:/tmp/goober4/with spaces:::"}; 212 213 FrameworkEnvironment env{}; 214 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); 215 216 InstWrapper inst{env.vulkan_functions}; 217 FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); 218 inst.CheckCreate(); 219 220 auto check_paths = [](DebugUtilsLogger const& debug_log, ManifestCategory category) { 221 EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober/vulkan") / category_path_name(category)).str())); 222 EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober2/vulkan") / category_path_name(category)).str())); 223 EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober3/vulkan") / category_path_name(category)).str())); 224 EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober4/with spaces/vulkan") / category_path_name(category)).str())); 225 }; 226 check_paths(env.debug_log, ManifestCategory::icd); 227 check_paths(env.debug_log, ManifestCategory::implicit_layer); 228 check_paths(env.debug_log, ManifestCategory::explicit_layer); 229} 230// Check that a json file in the paths don't cause the loader to crash 231TEST(EnvVarICDOverrideSetup, XDGContainsJsonFile) { 232 // Set up a layer path that includes default and user-specified locations, 233 // so that the test app can find them. Include some badly specified elements as well. 234 // Need to redirect the 'home' directory 235 EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", "bad_file.json"}; 236 237 FrameworkEnvironment env{}; 238 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); 239 240 InstWrapper inst{env.vulkan_functions}; 241 FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); 242 inst.CheckCreate(VK_SUCCESS); 243} 244#endif 245 246// Test VK_ADD_DRIVER_FILES environment variable 247TEST(EnvVarICDOverrideSetup, TestOnlyAddDriverEnvVar) { 248 FrameworkEnvironment env{}; 249 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::add_env_var)); 250 env.get_test_icd(0).physical_devices.emplace_back("pd0"); 251 252 InstWrapper inst1{env.vulkan_functions}; 253 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 254 inst1.CheckCreate(); 255 256 std::array<VkPhysicalDevice, 1> phys_devs_array; 257 uint32_t phys_dev_count = 1; 258 ASSERT_EQ(inst1->vkEnumeratePhysicalDevices(inst1.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); 259 ASSERT_EQ(phys_dev_count, 1U); 260 261 env.platform_shim->set_elevated_privilege(true); 262 263 InstWrapper inst2{env.vulkan_functions}; 264 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 265 inst2.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); 266 267 EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!")); 268 269 env.platform_shim->set_elevated_privilege(false); 270} 271 272// Test Both VK_DRIVER_FILES and VK_ADD_DRIVER_FILES environment variable 273TEST(EnvVarICDOverrideSetup, TestBothDriverEnvVars) { 274 FrameworkEnvironment env{}; 275 276 // Add a driver that isn't enabled with the environment variable 277 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)); 278 env.get_test_icd(0).add_physical_device("pd0").add_physical_device("pd1"); 279 280 env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::add_env_var)); 281 env.get_test_icd(0).add_physical_device("pd2"); 282 283 InstWrapper inst{env.vulkan_functions}; 284 inst.CheckCreate(); 285 286 // The enumerate should now detect both drivers because we used the add 287 std::array<VkPhysicalDevice, 3> phys_devs_array; 288 uint32_t phys_dev_count = 3; 289 ASSERT_EQ(inst->vkEnumeratePhysicalDevices(inst.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); 290 ASSERT_EQ(phys_dev_count, 3U); 291} 292 293#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) 294// Test VK_LAYER_PATH environment variable 295TEST(EnvVarICDOverrideSetup, TestOnlyLayerEnvVar) { 296 FrameworkEnvironment env{}; 297 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); 298 env.platform_shim->redirect_path("/tmp/carol", env.get_folder(ManifestLocation::explicit_layer_env_var).location()); 299 300 const char* layer_name = "TestLayer"; 301 env.add_explicit_layer( 302 TestLayerDetails(ManifestLayer{}.add_layer( 303 ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), 304 "test_layer.json") 305 .set_discovery_type(ManifestDiscoveryType::env_var)); 306 307 // Now set up a layer path that includes default and user-specified locations, 308 // so that the test app can find them. Include some badly specified elements as well. 309 // Need to redirect the 'home' directory 310 fs::path HOME = "/home/fake_home"; 311 EnvVarWrapper home_env_var{"HOME", HOME.str()}; 312 std::string vk_layer_path = ":/tmp/carol::::/:"; 313 vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str(); 314 EnvVarWrapper layer_path_env_var{"VK_LAYER_PATH", vk_layer_path}; 315 InstWrapper inst1{env.vulkan_functions}; 316 inst1.create_info.add_layer(layer_name); 317 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 318 inst1.CheckCreate(); 319 320 // look for VK_LAYER_PATHS 321 EXPECT_TRUE(env.debug_log.find("/tmp/carol")); 322 EXPECT_TRUE(env.debug_log.find("/tandy")); 323 EXPECT_TRUE(env.debug_log.find((HOME / "/ with spaces/").str())); 324 325 env.debug_log.clear(); 326 327 env.platform_shim->set_elevated_privilege(true); 328 329 InstWrapper inst2{env.vulkan_functions}; 330 inst2.create_info.add_layer(layer_name); 331 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 332 inst2.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); 333 334 EXPECT_FALSE(env.debug_log.find("/tmp/carol")); 335 336 env.platform_shim->set_elevated_privilege(false); 337} 338 339// Test VK_ADD_LAYER_PATH environment variable 340TEST(EnvVarICDOverrideSetup, TestOnlyAddLayerEnvVar) { 341 FrameworkEnvironment env{}; 342 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); 343 env.platform_shim->redirect_path("/tmp/carol", env.get_folder(ManifestLocation::explicit_layer_add_env_var).location()); 344 345 const char* layer_name = "TestLayer"; 346 env.add_explicit_layer( 347 TestLayerDetails(ManifestLayer{}.add_layer( 348 ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), 349 "test_layer.json") 350 .set_discovery_type(ManifestDiscoveryType::add_env_var)); 351 352 // Set up a layer path that includes default and user-specified locations, 353 // so that the test app can find them. Include some badly specified elements as well. 354 // Need to redirect the 'home' directory 355 fs::path HOME = "/home/fake_home"; 356 EnvVarWrapper home_env_var{"HOME", HOME.str()}; 357 std::string vk_layer_path = ":/tmp/carol::::/:"; 358 vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str(); 359 EnvVarWrapper add_layer_path_env_var{"VK_ADD_LAYER_PATH", vk_layer_path}; 360 361 InstWrapper inst1{env.vulkan_functions}; 362 inst1.create_info.add_layer(layer_name); 363 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 364 inst1.CheckCreate(); 365 366 // look for VK_ADD_LAYER_PATHS 367 EXPECT_TRUE(env.debug_log.find("/tmp/carol")); 368 EXPECT_TRUE(env.debug_log.find("/tandy")); 369 EXPECT_TRUE(env.debug_log.find((HOME / "/ with spaces/").str())); 370 371 env.debug_log.clear(); 372 373 env.platform_shim->set_elevated_privilege(true); 374 375 InstWrapper inst2{env.vulkan_functions}; 376 inst2.create_info.add_layer(layer_name); 377 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 378 inst2.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); 379 380 EXPECT_FALSE(env.debug_log.find("/tmp/carol")); 381 382 env.platform_shim->set_elevated_privilege(false); 383} 384 385#endif 386 387// Test that the driver filter select will only enable driver manifest files that match the filter 388TEST(EnvVarICDOverrideSetup, FilterSelectDriver) { 389 FrameworkEnvironment env{}; 390 EnvVarWrapper filter_select_env_var{"VK_LOADER_DRIVERS_SELECT"}; 391 392 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD")); 393 env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD")); 394 env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_disable_icd_inc(true).set_json_name("CDE_ICD")); 395 396 InstWrapper inst1{env.vulkan_functions}; 397 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 398 inst1.CheckCreate(); 399 400 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 401 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 402 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 403 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 404 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 405 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 406 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 407 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 408 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 409 410 // Match full-name 411 env.debug_log.clear(); 412 filter_select_env_var.set_new_value("ABC_ICD.json"); 413 414 InstWrapper inst2{env.vulkan_functions}; 415 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 416 inst2.CheckCreate(); 417 418 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 419 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 420 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 421 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 422 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 423 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 424 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 425 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 426 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 427 428 // Match prefix 429 env.debug_log.clear(); 430 filter_select_env_var.set_new_value("ABC*"); 431 432 InstWrapper inst3{env.vulkan_functions}; 433 FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); 434 inst3.CheckCreate(); 435 436 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 437 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 438 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 439 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 440 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 441 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 442 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 443 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 444 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 445 446 // Match suffix 447 env.debug_log.clear(); 448 filter_select_env_var.set_new_value("*C_ICD.json"); 449 450 InstWrapper inst4{env.vulkan_functions}; 451 FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); 452 inst4.CheckCreate(); 453 454 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 455 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 456 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 457 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 458 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 459 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 460 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 461 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 462 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 463 464 // Match sub-string 465 env.debug_log.clear(); 466 filter_select_env_var.set_new_value("*BC*"); 467 468 InstWrapper inst5{env.vulkan_functions}; 469 FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); 470 inst5.CheckCreate(); 471 472 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 473 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 474 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 475 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 476 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 477 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 478 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 479 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 480 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 481 482 // Match all with star '*' 483 env.debug_log.clear(); 484 filter_select_env_var.set_new_value("*"); 485 486 InstWrapper inst6{env.vulkan_functions}; 487 FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); 488 inst6.CheckCreate(); 489 490 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 491 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 492 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 493 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 494 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 495 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 496 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 497 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 498 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 499 500 // Match all with special name 501 env.debug_log.clear(); 502 filter_select_env_var.set_new_value("~all~"); 503 504 InstWrapper inst7{env.vulkan_functions}; 505 FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); 506 inst7.CheckCreate(); 507 508 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 509 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 510 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 511 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 512 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 513 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 514 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 515 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 516 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 517 518 // The full-name string is not a valid match if it doesn't also include the file extension 519 env.debug_log.clear(); 520 filter_select_env_var.set_new_value("ABC_ICD"); 521 522 InstWrapper inst8{env.vulkan_functions}; 523 FillDebugUtilsCreateDetails(inst8.create_info, env.debug_log); 524 inst8.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); 525 526 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 527 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 528 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 529 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 530 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 531 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 532 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 533 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 534 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 535} 536 537// Test that the driver filter disable disables driver manifest files that match the filter 538TEST(EnvVarICDOverrideSetup, FilterDisableDriver) { 539 FrameworkEnvironment env{}; 540 EnvVarWrapper filter_disable_env_var{"VK_LOADER_DRIVERS_DISABLE"}; 541 542 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD")); 543 env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD")); 544 env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_disable_icd_inc(true).set_json_name("CDE_ICD")); 545 546 InstWrapper inst1{env.vulkan_functions}; 547 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 548 inst1.CheckCreate(); 549 550 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 551 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 552 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 553 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 554 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 555 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 556 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 557 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 558 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 559 560 // Match full-name 561 env.debug_log.clear(); 562 filter_disable_env_var.set_new_value("ABC_ICD.json"); 563 564 InstWrapper inst2{env.vulkan_functions}; 565 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 566 inst2.CheckCreate(); 567 568 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 569 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 570 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 571 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 572 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 573 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 574 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 575 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 576 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 577 578 // Match prefix 579 env.debug_log.clear(); 580 filter_disable_env_var.set_new_value("ABC_*"); 581 582 InstWrapper inst3{env.vulkan_functions}; 583 FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); 584 inst3.CheckCreate(); 585 586 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 587 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 588 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 589 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 590 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 591 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 592 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 593 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 594 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 595 596 // Match suffix 597 env.debug_log.clear(); 598 filter_disable_env_var.set_new_value("*C_ICD.json"); 599 600 InstWrapper inst4{env.vulkan_functions}; 601 FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); 602 inst4.CheckCreate(); 603 604 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 605 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 606 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 607 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 608 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 609 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 610 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 611 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 612 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 613 614 // Match substring 615 env.debug_log.clear(); 616 filter_disable_env_var.set_new_value("*BC*"); 617 618 InstWrapper inst5{env.vulkan_functions}; 619 FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); 620 inst5.CheckCreate(); 621 622 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 623 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 624 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 625 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 626 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 627 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 628 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 629 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 630 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 631 632 // Match all with star '*' 633 env.debug_log.clear(); 634 filter_disable_env_var.set_new_value("*"); 635 636 InstWrapper inst6{env.vulkan_functions}; 637 FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); 638 inst6.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); 639 640 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 641 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 642 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 643 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 644 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 645 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 646 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 647 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 648 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 649 650 // Match all with special name 651 env.debug_log.clear(); 652 filter_disable_env_var.set_new_value("~all~"); 653 654 InstWrapper inst7{env.vulkan_functions}; 655 FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); 656 inst7.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); 657 658 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 659 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 660 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 661 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 662 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 663 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 664 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 665 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 666 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 667} 668 669// Test that the when both driver filter select and disable environment variables are present, that the 670// appropriate drivers are enabled and disabled 671TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) { 672 FrameworkEnvironment env{}; 673 EnvVarWrapper filter_disable_env_var{"VK_LOADER_DRIVERS_DISABLE"}; 674 EnvVarWrapper filter_select_env_var{"VK_LOADER_DRIVERS_SELECT"}; 675 676 env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD")); 677 env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD")); 678 env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_disable_icd_inc(true).set_json_name("CDE_ICD")); 679 680 InstWrapper inst1{env.vulkan_functions}; 681 FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); 682 inst1.CheckCreate(); 683 684 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 685 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 686 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 687 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 688 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 689 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 690 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 691 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 692 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 693 694 // Disable two, but enable one 695 env.debug_log.clear(); 696 filter_disable_env_var.set_new_value("*BC*"); 697 filter_select_env_var.set_new_value("BCD*"); 698 699 InstWrapper inst2{env.vulkan_functions}; 700 FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); 701 inst2.CheckCreate(); 702 703 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 704 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 705 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 706 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 707 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 708 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 709 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 710 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 711 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 712 713 // Disable all, but enable two 714 env.debug_log.clear(); 715 filter_disable_env_var.set_new_value("*"); 716 filter_select_env_var.set_new_value("*BC*"); 717 718 InstWrapper inst3{env.vulkan_functions}; 719 FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); 720 inst3.CheckCreate(); 721 722 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 723 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 724 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 725 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 726 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 727 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 728 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 729 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 730 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 731 732 // Disable all, but enable all 733 env.debug_log.clear(); 734 filter_disable_env_var.set_new_value("*"); 735 filter_select_env_var.set_new_value("*"); 736 737 InstWrapper inst4{env.vulkan_functions}; 738 FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); 739 inst4.CheckCreate(); 740 741 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); 742 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); 743 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); 744 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); 745 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); 746 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); 747 ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); 748 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); 749 ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); 750} 751