Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/Vulkan-Loader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2022-11-04 01:18:20 +0300
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2022-11-04 23:08:39 +0300
commit256a5e3b6d6fc31e711f912291498becd6a41330 (patch)
tree58b0c6bbafb1af75edb5c22488962c84d920523c
parent78ffb447a3324e8a4f75ab57a67f1f184ebd0648 (diff)
Fix tests for env-var filtering due to previous commit
The previous commit altered vkCreateInstance erroring out if the application tries to enable an env-var disabled layer, so the tests need to be revised for it. This commit also makes lot of modifications to the tests in addition to that. Also adds tests for when the override layer is present and when implicit layer's enable-environment variables are present.
-rw-r--r--tests/framework/test_environment.cpp12
-rw-r--r--tests/framework/test_environment.h19
-rw-r--r--tests/loader_alloc_callback_tests.cpp3
-rw-r--r--tests/loader_envvar_tests.cpp348
-rw-r--r--tests/loader_layer_tests.cpp1698
-rw-r--r--tests/loader_regression_tests.cpp6
-rw-r--r--tests/loader_testing_main.cpp1
7 files changed, 1105 insertions, 982 deletions
diff --git a/tests/framework/test_environment.cpp b/tests/framework/test_environment.cpp
index 4fc316dd2..13ef8b832 100644
--- a/tests/framework/test_environment.cpp
+++ b/tests/framework/test_environment.cpp
@@ -138,13 +138,13 @@ void FillDebugUtilsCreateDetails(InstanceCreateInfo& create_info, DebugUtilsWrap
// Look through the event log. If you find a line containing the prefix we're interested in, look for the end of
// line character, and then see if the postfix occurs in it as well.
-bool FindPrefixPostfixStringOnLine(DebugUtilsLogger& env_log, const char* prefix, const char* postfix) {
+bool DebugUtilsLogger::find_prefix_then_postfix(const char* prefix, const char* postfix) const {
size_t new_start = 0;
size_t postfix_index = 0;
size_t next_eol = 0;
- while ((new_start = env_log.returned_output.find(prefix, new_start)) != std::string::npos) {
- next_eol = env_log.returned_output.find("\n", new_start);
- if ((postfix_index = env_log.returned_output.find(postfix, new_start)) != std::string::npos) {
+ while ((new_start = returned_output.find(prefix, new_start)) != std::string::npos) {
+ next_eol = returned_output.find("\n", new_start);
+ if ((postfix_index = returned_output.find(postfix, new_start)) != std::string::npos) {
if (postfix_index < next_eol) {
return true;
}
@@ -154,6 +154,10 @@ bool FindPrefixPostfixStringOnLine(DebugUtilsLogger& env_log, const char* prefix
return false;
}
+bool FindPrefixPostfixStringOnLine(DebugUtilsLogger const& env_log, const char* prefix, const char* postfix) {
+ return env_log.find_prefix_then_postfix(prefix, postfix);
+}
+
PlatformShimWrapper::PlatformShimWrapper(std::vector<fs::FolderManager>* folders, bool enable_log) noexcept {
#if defined(WIN32) || defined(__APPLE__)
shim_library = LibraryWrapper(SHIM_LIBRARY_NAME);
diff --git a/tests/framework/test_environment.h b/tests/framework/test_environment.h
index e8edc47a9..95af7d4ea 100644
--- a/tests/framework/test_environment.h
+++ b/tests/framework/test_environment.h
@@ -211,6 +211,11 @@ struct DebugUtilsLogger {
DebugUtilsLogger& operator=(DebugUtilsLogger&&) = delete;
// Find a string in the log output
bool find(std::string const& search_text) const { return returned_output.find(search_text) != std::string::npos; }
+
+ // Look through the event log. If you find a line containing the prefix we're interested in, look for the end of
+ // line character, and then see if the postfix occurs in it as well.
+ bool find_prefix_then_postfix(const char* prefix, const char* postfix) const;
+
// Clear the log
void clear() { returned_output.clear(); }
VkDebugUtilsMessengerCreateInfoEXT* get() noexcept { return &create_info; }
@@ -259,10 +264,6 @@ VkResult CreateDebugUtilsMessenger(DebugUtilsWrapper& debug_utils);
void FillDebugUtilsCreateDetails(InstanceCreateInfo& create_info, DebugUtilsLogger& logger);
void FillDebugUtilsCreateDetails(InstanceCreateInfo& create_info, DebugUtilsWrapper& wrapper);
-// Look through the event log. If you find a line containing the prefix we're interested in, look for the end of
-// line character, and then see if the postfix occurs in it as well.
-bool FindPrefixPostfixStringOnLine(DebugUtilsLogger& env_log, const char* prefix, const char* postfix);
-
struct FrameworkEnvironment; // forward declaration
struct PlatformShimWrapper {
@@ -405,3 +406,13 @@ void setup_WSI_in_create_instance(InstWrapper& inst, const char* api_selection =
// api_selection: optionally provide a VK_USE_PLATFORM_XXX string to select which API to create a surface with.
// defaults to Metal on macOS and XCB on linux if not provided
void create_surface(InstWrapper& inst, VkSurfaceKHR& out_surface, const char* api_selection = nullptr);
+
+struct EnvVarCleaner {
+ std::string env_var;
+ EnvVarCleaner(std::string env_var) noexcept : env_var(env_var) {}
+ ~EnvVarCleaner() noexcept { remove_env_var(env_var); }
+
+ // delete copy operators
+ EnvVarCleaner(const EnvVarCleaner&) = delete;
+ EnvVarCleaner& operator=(const EnvVarCleaner&) = delete;
+};
diff --git a/tests/loader_alloc_callback_tests.cpp b/tests/loader_alloc_callback_tests.cpp
index 4f3ea16e1..bd85d0552 100644
--- a/tests/loader_alloc_callback_tests.cpp
+++ b/tests/loader_alloc_callback_tests.cpp
@@ -453,7 +453,7 @@ TEST(Allocation, DriverEnvVarIntentionalAllocFail) {
driver_files += OS_ENV_VAR_LIST_SEPARATOR;
driver_files += (fs::path("totally_made_up") / "path_to_fake" / "jason_file.json").str();
set_env_var("VK_DRIVER_FILES", driver_files);
-
+ EnvVarCleaner cleaner("VK_DRIVER_FILES");
size_t fail_index = 66; // 0
VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY;
while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) {
@@ -468,7 +468,6 @@ TEST(Allocation, DriverEnvVarIntentionalAllocFail) {
ASSERT_TRUE(tracker.empty());
fail_index++;
}
- remove_env_var("VK_DRIVER_FILES");
}
// Test failure during vkCreateDevice to make sure we don't leak memory if
diff --git a/tests/loader_envvar_tests.cpp b/tests/loader_envvar_tests.cpp
index 47c1deb6f..4fa18220c 100644
--- a/tests/loader_envvar_tests.cpp
+++ b/tests/loader_envvar_tests.cpp
@@ -147,8 +147,6 @@ TEST(EnvVarICDOverrideSetup, TestOnlyDriverEnvVar) {
EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!"));
env.platform_shim->set_elevated_privilege(false);
-
- remove_env_var("VK_DRIVER_FILES");
}
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
@@ -226,8 +224,6 @@ TEST(EnvVarICDOverrideSetup, TestOnlyAddDriverEnvVar) {
EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!"));
env.platform_shim->set_elevated_privilege(false);
-
- remove_env_var("VK_ADD_DRIVER_FILES");
}
// Test Both VK_DRIVER_FILES and VK_ADD_DRIVER_FILES environment variable
@@ -250,9 +246,6 @@ TEST(EnvVarICDOverrideSetup, TestBothDriverEnvVars) {
uint32_t phys_dev_count = 3;
ASSERT_EQ(inst->vkEnumeratePhysicalDevices(inst.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS);
ASSERT_EQ(phys_dev_count, 3U);
-
- remove_env_var("VK_DRIVER_FILES");
- remove_env_var("VK_ADD_DRIVER_FILES");
}
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
@@ -278,7 +271,7 @@ TEST(EnvVarICDOverrideSetup, TestOnlyLayerEnvVar) {
std::string vk_layer_path = ":/tmp/carol::::/:";
vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str();
set_env_var("VK_LAYER_PATH", vk_layer_path);
-
+ EnvVarCleaner layer_path_cleaner("VK_LAYER_PATH");
InstWrapper inst1{env.vulkan_functions};
inst1.create_info.add_layer(layer_name);
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
@@ -301,8 +294,6 @@ TEST(EnvVarICDOverrideSetup, TestOnlyLayerEnvVar) {
EXPECT_FALSE(env.debug_log.find("/tmp/carol"));
env.platform_shim->set_elevated_privilege(false);
-
- remove_env_var("VK_LAYER_PATH");
}
// Test VK_ADD_LAYER_PATH environment variable
@@ -327,6 +318,7 @@ TEST(EnvVarICDOverrideSetup, TestOnlyAddLayerEnvVar) {
std::string vk_layer_path = ":/tmp/carol::::/:";
vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str();
set_env_var("VK_ADD_LAYER_PATH", vk_layer_path);
+ EnvVarCleaner add_layer_path_cleaner("VK_ADD_LAYER_PATH");
InstWrapper inst1{env.vulkan_functions};
inst1.create_info.add_layer(layer_name);
@@ -350,8 +342,6 @@ TEST(EnvVarICDOverrideSetup, TestOnlyAddLayerEnvVar) {
EXPECT_FALSE(env.debug_log.find("/tmp/carol"));
env.platform_shim->set_elevated_privilege(false);
-
- remove_env_var("VK_ADD_LAYER_PATH");
}
#endif
@@ -369,15 +359,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
inst1.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match full-name
env.debug_log.clear();
@@ -387,15 +377,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
inst2.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match prefix
env.debug_log.clear();
@@ -405,15 +395,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
inst3.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match suffix
env.debug_log.clear();
@@ -423,15 +413,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
inst4.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match sub-string
env.debug_log.clear();
@@ -441,15 +431,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
inst5.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match all with star '*'
env.debug_log.clear();
@@ -459,15 +449,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
inst6.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match all with special name
env.debug_log.clear();
@@ -477,23 +467,22 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log);
inst7.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
-
- remove_env_var(filter_select_env_var);
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
}
// Test that the driver filter disable disables driver manifest files that match the filter
TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FrameworkEnvironment env{};
const char* filter_disable_env_var = "VK_LOADER_DRIVERS_DISABLE";
+ EnvVarCleaner filter_disable_cleaner(filter_disable_env_var);
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD"));
env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD"));
@@ -503,15 +492,15 @@ TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
inst1.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match full-name
env.debug_log.clear();
@@ -521,15 +510,15 @@ TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
inst2.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match prefix
env.debug_log.clear();
@@ -539,15 +528,15 @@ TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
inst3.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match suffix
env.debug_log.clear();
@@ -557,15 +546,15 @@ TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
inst4.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match substring
env.debug_log.clear();
@@ -575,15 +564,15 @@ TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
inst5.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match all with star '*'
env.debug_log.clear();
@@ -593,15 +582,15 @@ TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
inst6.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER);
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Match all with special name
env.debug_log.clear();
@@ -611,17 +600,15 @@ TEST(EnvVarICDOverrideSetup, FilterDisableDriver) {
FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log);
inst7.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER);
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
-
- remove_env_var(filter_disable_env_var);
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
}
// Test that the when both driver filter select and disable environment variables are present, that the
@@ -630,6 +617,8 @@ TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) {
FrameworkEnvironment env{};
const char* filter_select_env_var = "VK_LOADER_DRIVERS_SELECT";
const char* filter_disable_env_var = "VK_LOADER_DRIVERS_DISABLE";
+ EnvVarCleaner filter_select_cleaner(filter_select_env_var);
+ EnvVarCleaner filter_disable_cleaner(filter_disable_env_var);
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD"));
env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD"));
@@ -639,15 +628,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) {
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
inst1.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Disable two, but enable one
env.debug_log.clear();
@@ -658,15 +647,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) {
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
inst2.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Disable all, but enable two
env.debug_log.clear();
@@ -677,15 +666,15 @@ TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) {
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
inst3.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
// Disable all, but enable all
env.debug_log.clear();
@@ -696,16 +685,13 @@ TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) {
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
inst4.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "ABC_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "ABC_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "BCD_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "BCD_ICD.json", "ignored because it was disabled by env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found ICD manifest file", "CDE_ICD.json"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because not selected by env var"));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "CDE_ICD.json", "ignored because it was disabled by env var"));
-
- remove_env_var(filter_select_env_var);
- remove_env_var(filter_disable_env_var);
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
}
diff --git a/tests/loader_layer_tests.cpp b/tests/loader_layer_tests.cpp
index 54e0b2043..32a0850bb 100644
--- a/tests/loader_layer_tests.cpp
+++ b/tests/loader_layer_tests.cpp
@@ -50,6 +50,9 @@ TEST(ImplicitLayers, WithEnableAndDisableEnvVar) {
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
+ EnvVarCleaner disable_cleaner(disable_env_var);
+
env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(implicit_layer_name)
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
@@ -68,10 +71,11 @@ TEST(ImplicitLayers, WithEnableAndDisableEnvVar) {
set_env_var(enable_env_var, "0");
CheckLogForLayerString(env, implicit_layer_name, false);
- // // set enable env-var, layer should load
+ // set enable env-var, layer should load
set_env_var(enable_env_var, "1");
CheckLogForLayerString(env, implicit_layer_name, true);
+ // remove enable env var, so we can check what happens when only disable is present
remove_env_var(enable_env_var);
// set disable env-var to 0, layer should not load
@@ -86,9 +90,6 @@ TEST(ImplicitLayers, WithEnableAndDisableEnvVar) {
set_env_var(enable_env_var, "1");
set_env_var(disable_env_var, "1");
CheckLogForLayerString(env, implicit_layer_name, false);
-
- remove_env_var(enable_env_var);
- remove_env_var(disable_env_var);
}
TEST(ImplicitLayers, OnlyDisableEnvVar) {
@@ -96,7 +97,7 @@ TEST(ImplicitLayers, OnlyDisableEnvVar) {
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA));
const char* implicit_layer_name = "ImplicitTestLayer";
const char* disable_env_var = "DISABLE_ME";
-
+ EnvVarCleaner disable_cleaner(disable_env_var);
env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(implicit_layer_name)
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
@@ -125,7 +126,6 @@ TEST(ImplicitLayers, OnlyDisableEnvVar) {
inst.CheckCreate(VK_SUCCESS);
ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + implicit_layer_name));
}
- remove_env_var(disable_env_var);
}
TEST(ImplicitLayers, PreInstanceEnumInstLayerProps) {
@@ -133,6 +133,7 @@ TEST(ImplicitLayers, PreInstanceEnumInstLayerProps) {
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA));
const char* implicit_layer_name = "ImplicitTestLayer";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner disable_cleaner(disable_env_var);
env.add_implicit_layer(
ManifestLayer{}
@@ -161,8 +162,6 @@ TEST(ImplicitLayers, PreInstanceEnumInstLayerProps) {
ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr));
ASSERT_NE(count, 0U);
ASSERT_NE(count, layer_props);
-
- remove_env_var(disable_env_var);
}
TEST(ImplicitLayers, PreInstanceEnumInstExtProps) {
@@ -170,6 +169,7 @@ TEST(ImplicitLayers, PreInstanceEnumInstExtProps) {
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA));
const char* implicit_layer_name = "ImplicitTestLayer";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner disable_cleaner(disable_env_var);
env.add_implicit_layer(ManifestLayer{}
.set_file_format_version(ManifestVersion(1, 1, 2))
@@ -198,8 +198,6 @@ TEST(ImplicitLayers, PreInstanceEnumInstExtProps) {
ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr));
ASSERT_NE(count, 0U);
ASSERT_NE(count, ext_props);
-
- remove_env_var(disable_env_var);
}
TEST(ImplicitLayers, PreInstanceVersion) {
@@ -210,6 +208,7 @@ TEST(ImplicitLayers, PreInstanceVersion) {
const char* implicit_layer_name = "ImplicitTestLayer";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner disable_cleaner(disable_env_var);
env.add_implicit_layer(
ManifestLayer{}
@@ -239,8 +238,6 @@ TEST(ImplicitLayers, PreInstanceVersion) {
ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version));
ASSERT_NE(version, 0U);
ASSERT_NE(version, layer_version);
-
- remove_env_var(disable_env_var);
}
// Run with a pre-Negotiate function version of the layer so that it has to query vkCreateInstance using the
@@ -254,6 +251,7 @@ TEST(ImplicitLayers, OverrideGetInstanceProcAddr) {
const char* implicit_layer_name = "ImplicitTestLayer";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner disable_cleaner(disable_env_var);
env.add_implicit_layer(ManifestLayer{}
.set_file_format_version(ManifestVersion(1, 0, 0))
@@ -277,8 +275,6 @@ TEST(ImplicitLayers, OverrideGetInstanceProcAddr) {
InstWrapper inst2{env.vulkan_functions};
inst2.CheckCreate();
}
-
- remove_env_var(disable_env_var);
}
// Force enable with filter env var
@@ -323,26 +319,26 @@ TEST(ImplicitLayers, EnableWithFilter) {
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
implicit_json_name_3);
+ EnvVarCleaner layers_enable_cleaner("VK_LOADER_LAYERS_ENABLE");
+ EnvVarCleaner layer_1_enable_cleaner(enable_layer_name_1);
+
// First, test an instance/device without the layer forced on.
InstWrapper inst1{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
inst1.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Now force on one layer with its full name
// ------------------------------------------
@@ -353,21 +349,18 @@ TEST(ImplicitLayers, EnableWithFilter) {
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
inst2.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match prefix
// ------------------------------------------
@@ -378,21 +371,18 @@ TEST(ImplicitLayers, EnableWithFilter) {
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
inst3.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match suffix
// ------------------------------------------
@@ -403,21 +393,18 @@ TEST(ImplicitLayers, EnableWithFilter) {
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
inst4.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match substring
// ------------------------------------------
@@ -428,21 +415,18 @@ TEST(ImplicitLayers, EnableWithFilter) {
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
inst5.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with star '*'
// ------------------------------------------
@@ -453,21 +437,18 @@ TEST(ImplicitLayers, EnableWithFilter) {
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
inst6.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with special name
// ------------------------------------------
@@ -478,21 +459,18 @@ TEST(ImplicitLayers, EnableWithFilter) {
FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log);
inst7.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match substring, but enable the other layer manually
// ------------------------------------------
@@ -504,24 +482,18 @@ TEST(ImplicitLayers, EnableWithFilter) {
FillDebugUtilsCreateDetails(inst8.create_info, env.debug_log);
inst8.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
-
- remove_env_var("VK_LOADER_LAYERS_ENABLE");
- remove_env_var(enable_layer_name_1);
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
}
// Force disabled with new filter env var
@@ -560,26 +532,25 @@ TEST(ImplicitLayers, DisableWithFilter) {
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
implicit_json_name_3);
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
+
// First, test an instance/device
InstWrapper inst1{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
inst1.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Now force off one layer with its full name
// ------------------------------------------
@@ -590,21 +561,18 @@ TEST(ImplicitLayers, DisableWithFilter) {
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
inst2.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match prefix
// ------------------------------------------
@@ -615,21 +583,18 @@ TEST(ImplicitLayers, DisableWithFilter) {
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
inst3.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match suffix
// ------------------------------------------
@@ -640,21 +605,18 @@ TEST(ImplicitLayers, DisableWithFilter) {
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
inst4.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match substring
// ------------------------------------------
@@ -665,21 +627,18 @@ TEST(ImplicitLayers, DisableWithFilter) {
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
inst5.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with star '*'
// ------------------------------------------
@@ -690,21 +649,18 @@ TEST(ImplicitLayers, DisableWithFilter) {
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
inst6.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with special name
// ------------------------------------------
@@ -715,23 +671,122 @@ TEST(ImplicitLayers, DisableWithFilter) {
FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log);
inst7.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
+}
+
+// Force disabled with new filter env var
+TEST(ImplicitLayers, DisableWithFilterWhenLayersEnableEnvVarIsActive) {
+ FrameworkEnvironment env;
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0)));
+ env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0);
+
+ const char* implicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer";
+ const char* implicit_json_name_1 = "First_layer.json";
+ const char* disable_layer_name_1 = "DISABLE_FIRST";
+ const char* enable_layer_name_1 = "ENABLE_FIRST";
+ env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
+ .set_name(implicit_layer_name_1)
+ .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
+ .set_disable_environment(disable_layer_name_1)
+ .set_enable_environment(enable_layer_name_1)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
+ implicit_json_name_1);
+
+ const char* implicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer";
+ const char* implicit_json_name_2 = "Second_layer.json";
+ const char* disable_layer_name_2 = "DISABLE_SECOND";
+ const char* enable_layer_name_2 = "ENABLE_SECOND";
+ env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
+ .set_name(implicit_layer_name_2)
+ .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
+ .set_disable_environment(disable_layer_name_2)
+ .set_enable_environment(enable_layer_name_2)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
+ implicit_json_name_2);
+
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
+ EnvVarCleaner layer_1_enable_cleaner(enable_layer_name_1);
+ EnvVarCleaner layer_2_enable_cleaner(enable_layer_name_2);
- remove_env_var("VK_LOADER_LAYERS_DISABLE");
+ // First, test an instance/device
+ InstWrapper inst1{env.vulkan_functions};
+ FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
+ inst1.CheckCreate();
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+
+ // Set the layers enable env-var
+ // ------------------------------------------
+ env.debug_log.clear();
+ set_env_var(enable_layer_name_1, "1");
+ set_env_var(enable_layer_name_2, "1");
+
+ InstWrapper inst2{env.vulkan_functions};
+ FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
+ inst2.CheckCreate();
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+
+ // Now force off one layer with its full name
+ // ------------------------------------------
+ env.debug_log.clear();
+ set_env_var("VK_LOADER_LAYERS_DISABLE", implicit_layer_name_1);
+
+ InstWrapper inst3{env.vulkan_functions};
+ FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
+ inst3.CheckCreate();
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+
+ // Now force off both layers
+ // ------------------------------------------
+ env.debug_log.clear();
+ set_env_var("VK_LOADER_LAYERS_DISABLE", "~implicit~");
+
+ InstWrapper inst4{env.vulkan_functions};
+ FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
+ inst4.CheckCreate();
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
}
// Test interaction between both the enable and disable filter environment variables. The enable should always
@@ -771,6 +826,9 @@ TEST(ImplicitLayers, EnableAndDisableWithFilter) {
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
implicit_json_name_3);
+ EnvVarCleaner layers_enable_cleaner("VK_LOADER_LAYERS_ENABLE");
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
+
// Disable 2 but enable 1
// ------------------------------------------
env.debug_log.clear();
@@ -781,21 +839,18 @@ TEST(ImplicitLayers, EnableAndDisableWithFilter) {
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
inst1.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable all but enable 2
// ------------------------------------------
@@ -807,21 +862,18 @@ TEST(ImplicitLayers, EnableAndDisableWithFilter) {
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
inst2.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable all but enable 2
// ------------------------------------------
@@ -833,21 +885,18 @@ TEST(ImplicitLayers, EnableAndDisableWithFilter) {
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
inst3.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable implicit but enable 2
// ------------------------------------------
@@ -859,21 +908,18 @@ TEST(ImplicitLayers, EnableAndDisableWithFilter) {
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
inst4.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable explicit but enable 2 (should still be everything)
// ------------------------------------------
@@ -885,21 +931,18 @@ TEST(ImplicitLayers, EnableAndDisableWithFilter) {
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
inst5.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable implicit but enable all
// ------------------------------------------
@@ -911,24 +954,18 @@ TEST(ImplicitLayers, EnableAndDisableWithFilter) {
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
inst6.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", implicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", implicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, implicit_layer_name_3, "disabled because name matches filter of env var"));
-
- remove_env_var("VK_LOADER_LAYERS_ENABLE");
- remove_env_var("VK_LOADER_LAYERS_DISABLE");
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var"));
}
// Meta layer which contains component layers that do not exist.
@@ -2065,6 +2102,7 @@ TEST(LayerExtensions, ImplicitNoAdditionalInstanceExtension) {
const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects";
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(implicit_layer_name)
@@ -2100,8 +2138,6 @@ TEST(LayerExtensions, ImplicitNoAdditionalInstanceExtension) {
// Make sure all the function pointers are NULL as well
handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT"));
handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"));
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ImplicitDirDispModeInstanceExtension) {
@@ -2116,6 +2152,7 @@ TEST(LayerExtensions, ImplicitDirDispModeInstanceExtension) {
const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects";
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
env.add_implicit_layer(
ManifestLayer{}.add_layer(
@@ -2155,8 +2192,6 @@ TEST(LayerExtensions, ImplicitDirDispModeInstanceExtension) {
// Make sure only the appropriate function pointers are NULL as well
handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT"));
handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"));
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ImplicitDispSurfCountInstanceExtension) {
@@ -2171,6 +2206,7 @@ TEST(LayerExtensions, ImplicitDispSurfCountInstanceExtension) {
const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects";
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(implicit_layer_name)
@@ -2210,8 +2246,6 @@ TEST(LayerExtensions, ImplicitDispSurfCountInstanceExtension) {
// Make sure only the appropriate function pointers are NULL as well
handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT"));
handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"));
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ImplicitBothInstanceExtensions) {
@@ -2226,6 +2260,7 @@ TEST(LayerExtensions, ImplicitBothInstanceExtensions) {
const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects";
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
env.add_implicit_layer(
ManifestLayer{}.add_layer(
@@ -2268,8 +2303,6 @@ TEST(LayerExtensions, ImplicitBothInstanceExtensions) {
// Make sure only the appropriate function pointers are NULL as well
handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT"));
handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"));
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ExplicitNoAdditionalInstanceExtension) {
@@ -2589,6 +2622,7 @@ TEST(LayerExtensions, ImplicitNoAdditionalDeviceExtension) {
// // set enable env-var, layer should load
set_env_var(enable_env_var, "1");
+ EnvVarCleaner enable_cleaner(enable_env_var);
CheckLogForLayerString(env, implicit_layer_name, true);
InstWrapper inst{env.vulkan_functions};
@@ -2646,8 +2680,6 @@ TEST(LayerExtensions, ImplicitNoAdditionalDeviceExtension) {
ASSERT_DEATH(pfn_vkTrimCommandPool(dev.dev, VK_NULL_HANDLE, 0), "");
ASSERT_DEATH(pfn_vkGetSwapchainStatus(dev.dev, VK_NULL_HANDLE), "");
ASSERT_DEATH(pfn_vkSetDeviceMemoryPriority(dev.dev, VK_NULL_HANDLE, 0.f), "");
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ImplicitMaintenanceDeviceExtension) {
@@ -2662,6 +2694,7 @@ TEST(LayerExtensions, ImplicitMaintenanceDeviceExtension) {
const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects";
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(implicit_layer_name)
@@ -2707,8 +2740,6 @@ TEST(LayerExtensions, ImplicitMaintenanceDeviceExtension) {
// Make sure only the appropriate function pointers are NULL as well
handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR"));
handle_assert_null(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR"));
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ImplicitPresentImageDeviceExtension) {
@@ -2723,6 +2754,7 @@ TEST(LayerExtensions, ImplicitPresentImageDeviceExtension) {
const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects";
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(implicit_layer_name)
@@ -2769,8 +2801,6 @@ TEST(LayerExtensions, ImplicitPresentImageDeviceExtension) {
// Make sure only the appropriate function pointers are NULL as well
handle_assert_null(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR"));
handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR"));
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ImplicitBothDeviceExtensions) {
@@ -2785,6 +2815,7 @@ TEST(LayerExtensions, ImplicitBothDeviceExtensions) {
const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects";
const char* enable_env_var = "ENABLE_ME";
const char* disable_env_var = "DISABLE_ME";
+ EnvVarCleaner enable_cleaner(enable_env_var);
env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(implicit_layer_name)
@@ -2836,8 +2867,6 @@ TEST(LayerExtensions, ImplicitBothDeviceExtensions) {
// Make sure only the appropriate function pointers are NULL as well
handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR"));
handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR"));
-
- remove_env_var(enable_env_var);
}
TEST(LayerExtensions, ExplicitNoAdditionalDeviceExtension) {
@@ -3395,6 +3424,7 @@ TEST(TestLayers, InstEnvironEnableExplicitLayer) {
// Now setup the instance layer
set_env_var("VK_INSTANCE_LAYERS", explicit_layer_name);
+ EnvVarCleaner instance_layers_cleaner("VK_INSTANCE_LAYERS");
// Now, test an instance/device with the layer forced on. The extensions should be present and
// the function pointers should be valid.
@@ -3431,8 +3461,6 @@ TEST(TestLayers, InstEnvironEnableExplicitLayer) {
handle_assert_has_value(pfn_GetSwapchainStatusAfter);
ASSERT_EQ(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, pfn_GetSwapchainStatusAfter(dev2.dev, VK_NULL_HANDLE));
-
- remove_env_var("VK_INSTANCE_LAYERS");
}
// Verify that VK_LOADER_LAYERS_ENABLE work. To test this, make sure that an explicit layer does not affect an instance until
@@ -3458,34 +3486,33 @@ TEST(TestLayers, EnvironLayerEnableExplicitLayer) {
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
explicit_json_name_2);
- const char* explicit_layer_name_3 = "VK_LAYER_LUNARG_Second_test_layer";
- const char* explicit_json_name_3 = "Second_test_layer.json";
+ const char* explicit_layer_name_3 = "VK_LAYER_LUNARG_second_test_layer";
+ const char* explicit_json_name_3 = "second_test_layer.json";
env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(explicit_layer_name_3)
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
explicit_json_name_3);
+ EnvVarCleaner layers_enable_cleaner("VK_LOADER_LAYERS_ENABLE");
+
// First, test an instance/device without the layer forced on.
InstWrapper inst1{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
inst1.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Now force on one layer with its full name
// ------------------------------------------
@@ -3496,21 +3523,18 @@ TEST(TestLayers, EnvironLayerEnableExplicitLayer) {
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
inst2.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match prefix
// ------------------------------------------
@@ -3521,21 +3545,18 @@ TEST(TestLayers, EnvironLayerEnableExplicitLayer) {
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
inst3.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match suffix
// ------------------------------------------
@@ -3546,21 +3567,18 @@ TEST(TestLayers, EnvironLayerEnableExplicitLayer) {
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
inst4.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match substring
// ------------------------------------------
@@ -3571,21 +3589,18 @@ TEST(TestLayers, EnvironLayerEnableExplicitLayer) {
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
inst5.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with star '*'
// ------------------------------------------
@@ -3596,21 +3611,18 @@ TEST(TestLayers, EnvironLayerEnableExplicitLayer) {
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
inst6.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with special name
// ------------------------------------------
@@ -3621,23 +3633,18 @@ TEST(TestLayers, EnvironLayerEnableExplicitLayer) {
FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log);
inst7.CheckCreate();
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
-
- remove_env_var("VK_LOADER_LAYERS_ENABLE");
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
}
// Verify that VK_LOADER_LAYERS_DISABLE work. To test this, make sure that an explicit layer does not affect an instance until
@@ -3670,28 +3677,26 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
explicit_json_name_3);
+ EnvVarCleaner layers_enable_cleaner("VK_LOADER_LAYERS_ENABLE");
// First, test an instance/device without the layer forced on.
InstWrapper inst1{env.vulkan_functions};
inst1.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
- inst1.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst1.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Now force on one layer with its full name
// ------------------------------------------
@@ -3701,23 +3706,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst2{env.vulkan_functions};
inst2.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
- inst2.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst2.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match prefix
// ------------------------------------------
@@ -3727,23 +3729,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst3{env.vulkan_functions};
inst3.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
- inst3.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match suffix
// ------------------------------------------
@@ -3753,23 +3752,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst4{env.vulkan_functions};
inst4.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
- inst4.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst4.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match substring
// ------------------------------------------
@@ -3779,23 +3775,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst5{env.vulkan_functions};
inst5.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
- inst5.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst5.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with star '*'
// ------------------------------------------
@@ -3805,23 +3798,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst6{env.vulkan_functions};
inst6.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
- inst6.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst6.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match all with special name
// ------------------------------------------
@@ -3831,23 +3821,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst7{env.vulkan_functions};
inst7.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log);
- inst7.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst7.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Match explicit special name
// ------------------------------------------
@@ -3857,23 +3844,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst8{env.vulkan_functions};
inst8.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst8.create_info, env.debug_log);
- inst8.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst8.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// No match implicit special name
// ------------------------------------------
@@ -3883,25 +3867,20 @@ TEST(TestLayers, EnvironLayerDisableExplicitLayer) {
InstWrapper inst9{env.vulkan_functions};
inst9.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst9.create_info, env.debug_log);
- inst9.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
-
- remove_env_var("VK_LOADER_LAYERS_DISABLE");
+ ASSERT_NO_FATAL_FAILURE(inst9.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
}
// Verify that VK_LOADER_LAYERS_ENABLE + VK_LOADER_LAYERS_DISABLE work.(results in the layer still being
@@ -3935,27 +3914,27 @@ TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) {
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
explicit_json_name_3);
+ EnvVarCleaner layers_enable_cleaner("VK_LOADER_LAYERS_ENABLE");
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
+
// First, test an instance/device without the layer forced on.
InstWrapper inst1{env.vulkan_functions};
inst1.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
- inst1.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst1.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable 2 but enable 1
// ------------------------------------------
@@ -3964,25 +3943,21 @@ TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) {
set_env_var("VK_LOADER_LAYERS_ENABLE", "*test_layer");
InstWrapper inst2{env.vulkan_functions};
- inst2.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
- inst2.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst2.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable all but enable 2
// ------------------------------------------
@@ -3991,25 +3966,21 @@ TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) {
set_env_var("VK_LOADER_LAYERS_ENABLE", "*Second*");
InstWrapper inst3{env.vulkan_functions};
- inst3.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
- inst3.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable all but enable 2
// ------------------------------------------
@@ -4018,25 +3989,21 @@ TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) {
set_env_var("VK_LOADER_LAYERS_ENABLE", "*Second*");
InstWrapper inst4{env.vulkan_functions};
- inst4.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log);
- inst4.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst4.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable explicit but enable 2
// ------------------------------------------
@@ -4045,25 +4012,21 @@ TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) {
set_env_var("VK_LOADER_LAYERS_ENABLE", "*Second*");
InstWrapper inst5{env.vulkan_functions};
- inst5.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log);
- inst5.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst5.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable implicit but enable 2 (should still be everything)
// ------------------------------------------
@@ -4074,23 +4037,20 @@ TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) {
InstWrapper inst6{env.vulkan_functions};
inst6.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log);
- inst6.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
+ ASSERT_NO_FATAL_FAILURE(inst6.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
// Disable explicit but enable all
// ------------------------------------------
@@ -4101,31 +4061,25 @@ TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) {
InstWrapper inst7{env.vulkan_functions};
inst7.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3);
FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log);
- inst7.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_3));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_3, "disabled because name matches filter of env var"));
-
- remove_env_var("VK_LOADER_LAYERS_ENABLE");
- remove_env_var("VK_LOADER_LAYERS_DISABLE");
+ ASSERT_NO_FATAL_FAILURE(inst7.CheckCreate());
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var"));
}
// Verify that VK_INSTANCE_LAYERS + VK_LOADER_LAYERS_DISABLE work.(results in the layer still being
// enabled)
-TEST(TestLayers, EnvironVkInstancdAndDisableFilters) {
+TEST(TestLayers, EnvironVkInstanceLayersAndDisableFilters) {
FrameworkEnvironment env;
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0)));
env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0);
@@ -4146,22 +4100,23 @@ TEST(TestLayers, EnvironVkInstancdAndDisableFilters) {
.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))),
explicit_json_name_2);
+ EnvVarCleaner instance_layers_cleaner("VK_INSTANCE_LAYERS");
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
+
// First, test an instance/device without the layer forced on.
InstWrapper inst1{env.vulkan_functions};
inst1.create_info.add_layer(explicit_layer_name_1);
FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log);
- inst1.CheckCreate();
+ ASSERT_NO_FATAL_FAILURE(inst1.CheckCreate());
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
// Enable the non-default enabled layer with VK_INSTANCE_LAYERS
// ------------------------------------------
@@ -4171,18 +4126,16 @@ TEST(TestLayers, EnvironVkInstancdAndDisableFilters) {
InstWrapper inst2{env.vulkan_functions};
inst2.create_info.add_layer(explicit_layer_name_1);
FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log);
- inst2.CheckCreate();
+ ASSERT_NO_FATAL_FAILURE(inst2.CheckCreate());
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
// Try to disable all
// ------------------------------------------
@@ -4192,21 +4145,16 @@ TEST(TestLayers, EnvironVkInstancdAndDisableFilters) {
InstWrapper inst3{env.vulkan_functions};
inst3.create_info.add_layer(explicit_layer_name_1);
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
- inst3.CheckCreate();
-
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_1));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "forced enabled due to env var"));
- ASSERT_TRUE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_1, "disabled because name matches filter of env var"));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Found manifest file", explicit_json_name_2));
- ASSERT_TRUE(FindPrefixPostfixStringOnLine(env.debug_log, "Insert instance layer", explicit_layer_name_2));
- ASSERT_FALSE(FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "forced enabled due to env var"));
- ASSERT_FALSE(
- FindPrefixPostfixStringOnLine(env.debug_log, explicit_layer_name_2, "disabled because name matches filter of env var"));
-
- remove_env_var("VK_INSTANCE_LAYERS");
- remove_env_var("VK_LOADER_LAYERS_DISABLE");
+ ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var"));
}
TEST(TestLayers, AppEnabledExplicitLayerFails) {
@@ -4224,22 +4172,200 @@ TEST(TestLayers, AppEnabledExplicitLayerFails) {
env.debug_log.clear();
set_env_var("VK_LOADER_LAYERS_DISABLE", explicit_layer_name_1);
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
uint32_t count = 0;
env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr);
- EXPECT_EQ(count, 0);
+ EXPECT_EQ(count, 0U);
std::vector<VkLayerProperties> layers;
layers.resize(1);
env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, layers.data());
- EXPECT_EQ(count, 0);
+ EXPECT_EQ(count, 0U);
InstWrapper inst3{env.vulkan_functions};
inst3.create_info.add_layer(explicit_layer_name_1);
FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log);
- inst3.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT);
+ ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT));
+
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+}
+
+TEST(TestLayers, OverrideEnabledExplicitLayerWithDisableFilter) {
+ FrameworkEnvironment env;
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0)));
+ env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0);
+
+ const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer";
+ const char* explicit_json_name_1 = "First_layer.json";
+ env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
+ .set_name(explicit_layer_name_1)
+ .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))),
+ explicit_json_name_1);
+ env.add_implicit_layer(ManifestLayer{}
+ .set_file_format_version(ManifestVersion(1, 2, 0))
+ .add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(explicit_layer_name_1)
+ .set_disable_environment("DisableMeIfYouCan")),
+ "meta_test_layer.json");
+
+ env.debug_log.clear();
+ set_env_var("VK_LOADER_LAYERS_DISABLE", explicit_layer_name_1);
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
- remove_env_var("VK_LOADER_LAYERS_DISABLE");
+ uint32_t count = 0;
+ env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr);
+ EXPECT_EQ(count, 1U);
+ std::vector<VkLayerProperties> layers;
+ layers.resize(1);
+ env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, layers.data());
+ EXPECT_EQ(count, 1U);
+ EXPECT_TRUE(string_eq(lunarg_meta_layer_name, &layers[0].layerName[0]));
+
+ { // both override layer and Disable env var
+ InstWrapper inst{env.vulkan_functions};
+ FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
+ inst.CheckCreate();
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(
+ env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ }
+ env.debug_log.clear();
+ { // Now try to enable the explicit layer as well
+ InstWrapper inst{env.vulkan_functions};
+ inst.create_info.add_layer(explicit_layer_name_1);
+ FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
+ inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT);
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(
+ env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ }
}
+
+TEST(TestLayers, OverrideEnabledExplicitLayerWithDisableFilterForOverrideLayer) {
+ FrameworkEnvironment env;
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0)));
+ env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0);
+
+ const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer";
+ const char* explicit_json_name_1 = "First_layer.json";
+ env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
+ .set_name(explicit_layer_name_1)
+ .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))),
+ explicit_json_name_1);
+ env.add_implicit_layer(ManifestLayer{}
+ .set_file_format_version(ManifestVersion(1, 2, 0))
+ .add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(explicit_layer_name_1)
+ .set_disable_environment("DisableMeIfYouCan")),
+ "meta_test_layer.json");
+
+ env.debug_log.clear();
+ set_env_var("VK_LOADER_LAYERS_DISABLE", lunarg_meta_layer_name);
+ EnvVarCleaner layers_disable_cleaner("VK_LOADER_LAYERS_DISABLE");
+
+ uint32_t count = 0;
+ env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr);
+ EXPECT_EQ(count, 1U);
+ std::vector<VkLayerProperties> layers;
+ layers.resize(1);
+ env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, layers.data());
+ EXPECT_EQ(count, 1U);
+ EXPECT_TRUE(string_eq(explicit_layer_name_1, &layers[0].layerName[0]));
+
+ { // both override layer and Disable env var
+ InstWrapper inst{env.vulkan_functions};
+ FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
+ inst.CheckCreate();
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(
+ env.debug_log.find_prefix_then_postfix(lunarg_meta_layer_name, "disabled because name matches filter of env var"));
+ }
+ env.debug_log.clear();
+ { // Now try to enable the explicit layer as well
+ InstWrapper inst{env.vulkan_functions};
+ inst.create_info.add_layer(explicit_layer_name_1);
+ FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
+ inst.CheckCreate();
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1));
+ ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_TRUE(
+ env.debug_log.find_prefix_then_postfix(lunarg_meta_layer_name, "disabled because name matches filter of env var"));
+ }
+}
+
+TEST(TestLayers, OverrideBlacklistedLayerWithEnableFilter) {
+ FrameworkEnvironment env;
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0)));
+ env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0);
+
+ const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer";
+ const char* explicit_json_name_1 = "First_layer.json";
+ env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
+ .set_name(explicit_layer_name_1)
+ .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))),
+ explicit_json_name_1);
+ env.add_implicit_layer(ManifestLayer{}
+ .set_file_format_version(ManifestVersion(1, 2, 0))
+ .add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_blacklisted_layer(explicit_layer_name_1)
+ .set_disable_environment("DisableMeIfYouCan")),
+ "meta_test_layer.json");
+
+ env.debug_log.clear();
+ set_env_var("VK_LOADER_LAYERS_ENABLE", explicit_layer_name_1);
+ EnvVarCleaner layers_enable_cleaner("VK_LOADER_LAYERS_ENABLE");
+
+ uint32_t count = 0;
+ env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr);
+ EXPECT_EQ(count, 1U);
+ std::vector<VkLayerProperties> layers;
+ layers.resize(1);
+ env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, layers.data());
+ EXPECT_EQ(count, 1U);
+ EXPECT_TRUE(string_eq(explicit_layer_name_1, &layers[0].layerName[0]));
+ {
+ InstWrapper inst{env.vulkan_functions};
+ FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
+ ASSERT_NO_FATAL_FAILURE(inst.CheckCreate());
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(
+ env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ }
+ env.debug_log.clear();
+ { // Try to enable a blacklisted layer
+ InstWrapper inst{env.vulkan_functions};
+ inst.create_info.add_layer(explicit_layer_name_1);
+ FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
+ ASSERT_NO_FATAL_FAILURE(inst.CheckCreate());
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1));
+ ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var"));
+ ASSERT_FALSE(
+ env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var"));
+ }
+}
+
// Add a device layer, should not work
TEST(TestLayers, DoNotUseDeviceLayer) {
FrameworkEnvironment env;
diff --git a/tests/loader_regression_tests.cpp b/tests/loader_regression_tests.cpp
index fa8b0e4c0..78c7cee43 100644
--- a/tests/loader_regression_tests.cpp
+++ b/tests/loader_regression_tests.cpp
@@ -2815,6 +2815,7 @@ TEST(SortedPhysicalDevices, DevicesSortedDisabled) {
FrameworkEnvironment env{};
set_env_var("VK_LOADER_DISABLE_SELECT", "1");
+ EnvVarCleaner disable_select_cleaner("VK_LOADER_DISABLE_SELECT");
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0));
env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME});
@@ -2917,8 +2918,6 @@ TEST(SortedPhysicalDevices, DevicesSortedDisabled) {
for (uint32_t dev = 0; dev < device_count; ++dev) {
ASSERT_EQ(physical_devices[dev], physical_devices_again[dev]);
}
-
- remove_env_var("VK_LOADER_DISABLE_SELECT");
}
TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) {
@@ -3109,6 +3108,7 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) {
FrameworkEnvironment env{};
set_env_var("VK_LOADER_DISABLE_SELECT", "1");
+ EnvVarCleaner disable_select_cleaner("VK_LOADER_DISABLE_SELECT");
// ICD 0: Vulkan 1.1
// PhysDev 0: pd0, Discrete, Vulkan 1.1, Bus 7
@@ -3277,8 +3277,6 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) {
ASSERT_EQ(physical_device_groups[group].physicalDevices[dev], physical_device_groups_again[group].physicalDevices[dev]);
}
}
-
- remove_env_var("VK_LOADER_DISABLE_SELECT");
}
#endif // __linux__ || __FreeBSD__ || __OpenBSD__
diff --git a/tests/loader_testing_main.cpp b/tests/loader_testing_main.cpp
index d1a3a09c9..6fe3f4540 100644
--- a/tests/loader_testing_main.cpp
+++ b/tests/loader_testing_main.cpp
@@ -71,7 +71,6 @@ int main(int argc, char** argv) {
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
set_env_var("HOME", "/home/fake_home");
#endif
-
::testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();