Test framework now shims registry functions

Previously the way the test framework worked was to fake the registry using a
special windows API call. However this led to brittle tests and was incompatible
with googletest's death test capabilities.

These death tests highlighted that the current set of them didn't use the built in
matcher to verify a correct crash/abort. This commit also amends all uses of
ASSERT_DEATH to provide the relevant death message.

If a driver reports an interface version greater than 0 but doesn't export
vk_icdGetInstanceProcAddr, the loader will now skip the driver.
This commit is contained in:
Charles Giessen 2022-03-14 21:57:55 -06:00 committed by Charles Giessen
parent 2ded39d6f8
commit 38e9dc8faf
10 changed files with 347 additions and 383 deletions

View File

@ -1393,7 +1393,14 @@ static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struc
fp_get_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetInstanceProcAddr");
if (NULL == fp_get_proc_addr) {
assert(interface_vers == 0);
if (interface_vers != 0) {
loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0,
"loader_scanned_icd_add: ICD %s reports an interface version of %d but doesn't export "
"vk_icdGetInstanceProcAddr, skip "
"this ICD.",
filename, interface_vers);
goto out;
}
// Use deprecated interface from version 0
fp_get_proc_addr = loader_platform_get_proc_address(handle, "vkGetInstanceProcAddr");
if (NULL == fp_get_proc_addr) {

View File

@ -651,7 +651,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupp
if (NULL == icd_term->dispatch.GetPhysicalDeviceWin32PresentationSupportKHR) {
loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0,
"ICD for selected physical device does not exportvkGetPhysicalDeviceWin32PresentationSupportKHR!\n");
"ICD for selected physical device does not export vkGetPhysicalDeviceWin32PresentationSupportKHR!\n");
abort();
}

View File

@ -47,23 +47,23 @@ enum class ManifestCategory { implicit_layer, explicit_layer, icd };
enum class GpuType { unspecified, integrated, discrete, external };
#if defined(WIN32)
struct RegistryEntry {
RegistryEntry() = default;
RegistryEntry(std::string const& name) noexcept : name(name) {}
RegistryEntry(std::string const& name, DWORD value) noexcept : name(name), value(value) {}
std::string name;
DWORD value{};
};
struct KeyWrapper {
explicit KeyWrapper(HKEY key) noexcept;
explicit KeyWrapper(HKEY key_root, const char* key_path) noexcept;
~KeyWrapper() noexcept;
explicit KeyWrapper(KeyWrapper const&) = delete;
KeyWrapper& operator=(KeyWrapper const&) = delete;
explicit KeyWrapper(KeyWrapper&& other) noexcept;
KeyWrapper& operator=(KeyWrapper&& other) noexcept;
struct HKeyHandle {
explicit HKeyHandle(const size_t value, const std::string& key_path) noexcept : key(HKEY{}), path(key_path) {
key = reinterpret_cast<HKEY>(value);
}
HKEY get() const noexcept { return key; }
operator HKEY() { return key; }
operator HKEY() const { return key; }
operator HKEY&() { return key; }
operator HKEY const &() const { return key; }
HKEY key{};
std::string path;
};
static const char* pnp_registry_path = "SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}";
@ -110,16 +110,11 @@ struct D3DKMT_Adapter {
fs::path path;
};
uint32_t setup_override(DebugMode debug_mode);
void clear_override(DebugMode debug_mode, uint32_t random_base_path);
#endif
// Necessary to have inline definitions as shim is a dll and thus functions
// defined in the .cpp wont be found by the rest of the application
struct PlatformShim {
// Test Framework interface
void setup_override(DebugMode debug_mode = DebugMode::none);
void clear_override(DebugMode debug_mode = DebugMode::none);
void reset(DebugMode debug_mode = DebugMode::none);
void redirect_all_paths(fs::path const& path);
@ -140,7 +135,6 @@ struct PlatformShim {
void add_dxgi_adapter(fs::path const& manifest_path, GpuType gpu_preference, uint32_t known_driver_index,
DXGI_ADAPTER_DESC1 desc1);
void add_d3dkmt_adapter(SHIM_D3DKMT_ADAPTERINFO adapter, fs::path const& path);
void add_CM_Device_ID(std::wstring const& id, fs::path const& icd_path, fs::path const& layer_path);
uint32_t next_adapter_handle = 1; // increment everytime add_dxgi_adapter is called
std::vector<DXGIAdapter> dxgi_adapters;
@ -148,13 +142,25 @@ struct PlatformShim {
// next two are a pair
std::vector<D3DKMT_Adapter> d3dkmt_adapters;
// TODO:
void add_CM_Device_ID(std::wstring const& id, fs::path const& icd_path, fs::path const& layer_path);
std::wstring CM_device_ID_list = {L'\0'};
std::vector<KeyWrapper> CM_device_ID_registry_keys;
std::vector<RegistryEntry> CM_device_ID_registry_keys;
uint32_t random_base_path = 0;
std::vector<fs::path> icd_paths;
std::vector<RegistryEntry> hkey_current_user_explicit_layers;
std::vector<RegistryEntry> hkey_current_user_implicit_layers;
std::vector<RegistryEntry> hkey_local_machine_explicit_layers;
std::vector<RegistryEntry> hkey_local_machine_implicit_layers;
std::vector<RegistryEntry> hkey_local_machine_drivers;
// When a key is created, return the index of the
size_t created_key_count = 0;
std::vector<HKeyHandle> created_keys;
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
bool is_fake_path(fs::path const& path);
fs::path const& get_fake_path(fs::path const& path);

View File

@ -70,165 +70,22 @@ std::string category_path_name(ManifestCategory category) {
return "Drivers";
}
std::string override_base_path(uint32_t random_base_path) {
return std::string("SOFTWARE\\LoaderRegressionTests_") + std::to_string(random_base_path);
}
std::string get_override_path(HKEY root_key, uint32_t random_base_path) {
std::string override_path = override_base_path(random_base_path);
if (root_key == HKEY_CURRENT_USER) {
override_path += "\\HKCU";
} else if (root_key == HKEY_LOCAL_MACHINE) {
override_path += "\\HKLM";
}
return override_path;
}
HKEY create_key(HKEY key_root, const char* key_path) {
DWORD dDisposition{};
HKEY key{};
LSTATUS out =
RegCreateKeyExA(key_root, key_path, NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &dDisposition);
if (out != ERROR_SUCCESS) std::cerr << win_api_error_str(out) << " failed to create key " << key << " at " << key_path << "\n";
return key;
}
void close_key(HKEY key) {
LSTATUS out = RegCloseKey(key);
if (out != ERROR_SUCCESS) std::cerr << win_api_error_str(out) << " failed to close key " << key << "\n";
}
void delete_key(HKEY key, const char* key_path, bool report_failure = true) {
LSTATUS out = RegDeleteKeyA(key, key_path);
if (out != ERROR_SUCCESS)
if (report_failure)
std::cerr << win_api_error_str(out) << " failed to close key " << key << " with path " << key_path << "\n";
}
void setup_override_key(HKEY root_key, uint32_t random_base_path) {
DWORD dDisposition{};
LSTATUS out;
auto override_path = get_override_path(root_key, random_base_path);
HKEY override_key;
out = RegCreateKeyExA(HKEY_CURRENT_USER, override_path.c_str(), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
&override_key, &dDisposition);
if (out != ERROR_SUCCESS)
std::cerr << win_api_error_str(out) << " failed to create key " << override_key << " with path " << override_path << "\n";
out = RegOverridePredefKey(root_key, override_key);
if (out != ERROR_SUCCESS) std::cerr << win_api_error_str(out) << " failed to override key " << override_key << "\n";
close_key(override_key);
}
void revert_override(HKEY root_key, uint32_t random_base_path) {
LSTATUS out = RegOverridePredefKey(root_key, NULL);
if (out != ERROR_SUCCESS) std::cerr << win_api_error_str(out) << " failed to revert override key " << root_key << "\n";
auto override_path = get_override_path(root_key, random_base_path);
out = RegDeleteTreeA(HKEY_CURRENT_USER, override_path.c_str());
if (out != ERROR_SUCCESS) print_error_message(out, "RegDeleteTreeA", std::string("Key") + override_path);
}
KeyWrapper::KeyWrapper(HKEY key) noexcept : key(key) {}
KeyWrapper::KeyWrapper(HKEY key_root, const char* key_path) noexcept { key = create_key(key_root, key_path); }
KeyWrapper::~KeyWrapper() noexcept {
if (key != NULL) close_key(key);
}
KeyWrapper::KeyWrapper(KeyWrapper&& other) noexcept : key(other.key) { other.key = NULL; };
KeyWrapper& KeyWrapper::operator=(KeyWrapper&& other) noexcept {
if (this != &other) {
if (key != NULL) close_key(key);
key = other.key;
other.key = NULL;
}
return *this;
};
void add_key_value(HKEY const& key, fs::path const& manifest_path, bool enabled = true) {
DWORD value = enabled ? 0 : 1;
LSTATUS out = RegSetValueEx(key, manifest_path.c_str(), 0, REG_DWORD, reinterpret_cast<const BYTE*>(&value), sizeof(value));
if (out != ERROR_SUCCESS) std::cerr << win_api_error_str(out) << " failed to set key value for " << manifest_path.str() << "\n";
}
void add_key_value_string(HKEY const& key, const char* name, const char* str) {
LSTATUS out = RegSetValueExA(key, name, 0, REG_SZ, reinterpret_cast<const BYTE*>(str), static_cast<DWORD>(strlen(str)));
if (out != ERROR_SUCCESS)
std::cerr << win_api_error_str(out) << " failed to set string value for " << name << ":" << str << "\n";
}
void remove_key_value(HKEY const& key, fs::path const& manifest_path) {
LSTATUS out = RegDeleteValueA(key, manifest_path.c_str());
if (out != ERROR_SUCCESS)
std::cerr << win_api_error_str(out) << " failed to delete key value for " << manifest_path.str() << "\n";
}
uint32_t setup_override(DebugMode debug_mode) {
uint32_t random_base_path = 0;
std::random_device rd;
std::ranlux48 gen(rd());
std::uniform_int_distribution<uint32_t> dist(0, 2000000);
while (random_base_path == 0) {
uint32_t random_num = dist(gen);
auto override_path = get_override_path(HKEY_CURRENT_USER, random_num);
HKEY temp_key = NULL;
auto result = RegOpenKeyEx(HKEY_CURRENT_USER, override_path.c_str(), 0, KEY_READ, &temp_key);
if (result != ERROR_SUCCESS) {
// Didn't find it, use the random number
random_base_path = random_num;
} else {
// try a different random number that isn't being used
std::cout << "INFO: Encountered existing registry key, is the registry full of old LoaderRegressionTest keys?\n";
}
}
auto reg_base = override_base_path(random_base_path);
HKEY timestamp_key = create_key(HKEY_CURRENT_USER, reg_base.c_str());
std::time_t cur_time = std::time(nullptr);
char mbstr[100];
tm time_buf{};
localtime_s(&time_buf, &cur_time);
if (std::strftime(mbstr, sizeof(mbstr), "%A %c", &time_buf)) {
add_key_value_string(timestamp_key, "Timestamp", mbstr);
}
setup_override_key(HKEY_LOCAL_MACHINE, random_base_path);
setup_override_key(HKEY_CURRENT_USER, random_base_path);
return random_base_path;
}
void clear_override(DebugMode debug_mode, uint32_t random_base_path) {
if (debug_mode != DebugMode::no_delete) {
revert_override(HKEY_CURRENT_USER, random_base_path);
revert_override(HKEY_LOCAL_MACHINE, random_base_path);
LSTATUS out = RegDeleteKeyA(HKEY_CURRENT_USER, override_base_path(random_base_path).c_str());
if (out != ERROR_SUCCESS)
print_error_message(out, "RegDeleteKeyA", std::string("Key") + override_base_path(random_base_path).c_str());
}
}
void PlatformShim::reset(DebugMode debug_mode) {
delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers", false);
delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers", false);
delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers", false);
delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers", false);
delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\Drivers", false);
delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Khronos\\Vulkan\\Drivers", false);
delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Khronos\\Vulkan\\ExplicitLayers", false);
delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Khronos\\Vulkan\\ImplicitLayers", false);
hkey_current_user_explicit_layers.clear();
hkey_current_user_implicit_layers.clear();
hkey_local_machine_explicit_layers.clear();
hkey_local_machine_implicit_layers.clear();
hkey_local_machine_drivers.clear();
}
void PlatformShim::set_path(ManifestCategory category, fs::path const& path) {}
void PlatformShim::add_manifest(ManifestCategory category, fs::path const& path) {
std::string reg_path = std::string("SOFTWARE\\Khronos\\Vulkan\\") + category_path_name(category);
KeyWrapper key{HKEY_LOCAL_MACHINE, reg_path.c_str()};
add_key_value(key, path);
if (category == ManifestCategory::icd) {
icd_paths.push_back(path);
}
if (category == ManifestCategory::implicit_layer) hkey_local_machine_implicit_layers.emplace_back(path.str());
if (category == ManifestCategory::explicit_layer)
hkey_local_machine_explicit_layers.emplace_back(path.str());
else
hkey_local_machine_drivers.emplace_back(path.str());
}
void PlatformShim::add_dxgi_adapter(fs::path const& manifest_path, GpuType gpu_preference, uint32_t known_driver_index,
DXGI_ADAPTER_DESC1 desc1) {
@ -239,44 +96,27 @@ void PlatformShim::add_d3dkmt_adapter(SHIM_D3DKMT_ADAPTERINFO adapter, fs::path
d3dkmt_adapters.push_back({adapter, path});
}
// TODO:
void PlatformShim::add_CM_Device_ID(std::wstring const& id, fs::path const& icd_path, fs::path const& layer_path) {
// append a null byte as separator if there is already id's in the list
if (CM_device_ID_list.size() != 0) {
CM_device_ID_list += L'\0'; // I'm sure this wont cause issues with std::string down the line... /s
}
CM_device_ID_list += id;
std::string id_str(id.length(), '\0');
size_t size_written{};
wcstombs_s(&size_written, &id_str[0], id_str.length(), id.c_str(), id.length());
// // append a null byte as separator if there is already id's in the list
// if (CM_device_ID_list.size() != 0) {
// CM_device_ID_list += L'\0'; // I'm sure this wont cause issues with std::string down the line... /s
// }
// CM_device_ID_list += id;
// std::string id_str(id.length(), '\0');
// size_t size_written{};
// wcstombs_s(&size_written, &id_str[0], id_str.length(), id.c_str(), id.length());
std::string device_path = std::string(pnp_registry_path) + "\\" + id_str;
CM_device_ID_registry_keys.emplace_back(HKEY_LOCAL_MACHINE, device_path.c_str());
HKEY id_key = CM_device_ID_registry_keys.back().key;
add_key_value_string(id_key, "VulkanDriverName", icd_path.c_str());
add_key_value_string(id_key, "VulkanLayerName", layer_path.c_str());
// TODO: decide how to handle 32 bit
// add_key_value_string(id_key, "VulkanDriverNameWoW", icd_path.c_str());
// add_key_value_string(id_key, "VulkanLayerName", layer_path.c_str());
// std::string device_path = std::string(pnp_registry_path) + "\\" + id_str;
// CM_device_ID_registry_keys.push_back(device_path.c_str());
// add_key_value_string(id_key, "VulkanDriverName", icd_path.c_str());
// add_key_value_string(id_key, "VulkanLayerName", layer_path.c_str());
// // TODO: decide how to handle 32 bit
// // add_key_value_string(id_key, "VulkanDriverNameWoW", icd_path.c_str());
// // add_key_value_string(id_key, "VulkanLayerName", layer_path.c_str());
}
void PlatformShim::redirect_category(fs::path const& new_path, ManifestCategory search_category) {
switch (search_category) {
case (ManifestCategory::implicit_layer):
create_key(HKEY_CURRENT_USER, "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers");
create_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers");
create_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Khronos\\Vulkan\\ImplicitLayers");
break;
case (ManifestCategory::explicit_layer):
create_key(HKEY_CURRENT_USER, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers");
create_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers");
create_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Khronos\\Vulkan\\ExplicitLayers");
break;
case (ManifestCategory::icd):
create_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\Drivers");
create_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Khronos\\Vulkan\\Drivers");
break;
}
}
void PlatformShim::redirect_category(fs::path const& new_path, ManifestCategory search_category) {}
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
@ -291,8 +131,6 @@ std::string category_path_name(ManifestCategory category) {
return "icd.d";
}
void PlatformShim::setup_override(DebugMode debug_mode) {}
void PlatformShim::clear_override(DebugMode debug_mode) {}
void PlatformShim::reset(DebugMode debug_mode) { redirection_map.clear(); }
void PlatformShim::redirect_path(fs::path const& path, fs::path const& new_path) { redirection_map[path.str()] = new_path; }

View File

@ -275,6 +275,86 @@ HRESULT __stdcall ShimCreateDXGIFactory1(REFIID riid, void **ppFactory) {
return S_FALSE;
}
// Windows Registry shims
using PFN_RegOpenKeyExA = LSTATUS(__stdcall *)(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
static PFN_RegOpenKeyExA fpRegOpenKeyExA = RegOpenKeyExA;
using PFN_RegQueryValueExA = LSTATUS(__stdcall *)(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData,
LPDWORD lpcbData);
static PFN_RegQueryValueExA fpRegQueryValueExA = RegQueryValueExA;
using PFN_RegEnumValueA = LSTATUS(__stdcall *)(HKEY hKey, DWORD dwIndex, LPSTR lpValueName, LPDWORD lpcchValueName,
LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
static PFN_RegEnumValueA fpRegEnumValueA = RegEnumValueA;
using PFN_RegCloseKey = LSTATUS(__stdcall *)(HKEY hKey);
static PFN_RegCloseKey fpRegCloseKey = RegCloseKey;
LSTATUS __stdcall ShimRegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult) {
if (HKEY_LOCAL_MACHINE != hKey && HKEY_CURRENT_USER != hKey) return ERROR_BADKEY;
std::string hive = "";
if (HKEY_LOCAL_MACHINE == hKey)
hive = "HKEY_LOCAL_MACHINE";
else if (HKEY_CURRENT_USER == hKey)
hive = "HKEY_CURRENT_USER";
platform_shim.created_keys.emplace_back(platform_shim.created_key_count++, hive + "\\" + lpSubKey);
*phkResult = platform_shim.created_keys.back().get();
return 0;
}
const std::string *get_path_of_created_key(HKEY hKey) {
for (const auto &key : platform_shim.created_keys) {
if (key.key == hKey) {
return &key.path;
}
}
return nullptr;
}
std::vector<RegistryEntry> *get_registry_vector(std::string const &path) {
if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\Drivers") return &platform_shim.hkey_local_machine_drivers;
if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers")
return &platform_shim.hkey_local_machine_explicit_layers;
if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers")
return &platform_shim.hkey_local_machine_implicit_layers;
if (path == "HKEY_CURRENT_USER\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers")
return &platform_shim.hkey_current_user_explicit_layers;
if (path == "HKEY_CURRENT_USER\\SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers")
return &platform_shim.hkey_current_user_implicit_layers;
return nullptr;
}
LSTATUS __stdcall ShimRegQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData,
LPDWORD lpcbData) {
// TODO:
return ERROR_SUCCESS;
}
LSTATUS __stdcall ShimRegEnumValueA(HKEY hKey, DWORD dwIndex, LPSTR lpValueName, LPDWORD lpcchValueName, LPDWORD lpReserved,
LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData) {
const std::string *path = get_path_of_created_key(hKey);
if (path == nullptr) return ERROR_NO_MORE_ITEMS;
const auto *location_ptr = get_registry_vector(*path);
if (location_ptr == nullptr) return ERROR_NO_MORE_ITEMS;
const auto &location = *location_ptr;
if (dwIndex >= location.size()) return ERROR_NO_MORE_ITEMS;
if (*lpcchValueName < location[dwIndex].name.size()) return ERROR_NO_MORE_ITEMS;
for (size_t i = 0; i < location[dwIndex].name.size(); i++) {
lpValueName[i] = location[dwIndex].name[i];
}
lpValueName[location[dwIndex].name.size()] = '\0';
*lpcchValueName = static_cast<DWORD>(location[dwIndex].name.size() + 1);
if (*lpcbData < sizeof(DWORD)) return ERROR_NO_MORE_ITEMS;
DWORD *lpcbData_dword = reinterpret_cast<DWORD *>(lpData);
*lpcbData_dword = location[dwIndex].value;
*lpcbData = sizeof(DWORD);
return ERROR_SUCCESS;
}
LSTATUS __stdcall ShimRegCloseKey(HKEY hKey) {
for (size_t i = 0; i < platform_shim.created_keys.size(); i++) {
if (platform_shim.created_keys[i].get() == hKey) {
platform_shim.created_keys.erase(platform_shim.created_keys.begin() + i);
return ERROR_SUCCESS;
}
}
return ERROR_SUCCESS;
}
// Initialization
void WINAPI DetourFunctions() {
if (!gdi32_dll) {
@ -318,6 +398,10 @@ void WINAPI DetourFunctions() {
DetourAttach(&(PVOID &)REAL_CM_Get_DevNode_Registry_PropertyW, SHIM_CM_Get_DevNode_Registry_PropertyW);
DetourAttach(&(PVOID &)REAL_CM_Get_Sibling, SHIM_CM_Get_Sibling);
DetourAttach(&(PVOID &)RealCreateDXGIFactory1, ShimCreateDXGIFactory1);
DetourAttach(&(PVOID &)fpRegOpenKeyExA, ShimRegOpenKeyExA);
DetourAttach(&(PVOID &)fpRegQueryValueExA, ShimRegQueryValueExA);
DetourAttach(&(PVOID &)fpRegEnumValueA, ShimRegEnumValueA);
DetourAttach(&(PVOID &)fpRegCloseKey, ShimRegCloseKey);
LONG error = DetourTransactionCommit();
if (error != NO_ERROR) {
@ -341,6 +425,10 @@ void DetachFunctions() {
DetourDetach(&(PVOID &)REAL_CM_Get_DevNode_Registry_PropertyW, SHIM_CM_Get_DevNode_Registry_PropertyW);
DetourDetach(&(PVOID &)REAL_CM_Get_Sibling, SHIM_CM_Get_Sibling);
DetourDetach(&(PVOID &)RealCreateDXGIFactory1, ShimCreateDXGIFactory1);
DetourDetach(&(PVOID &)fpRegOpenKeyExA, ShimRegOpenKeyExA);
DetourDetach(&(PVOID &)fpRegQueryValueExA, ShimRegQueryValueExA);
DetourDetach(&(PVOID &)fpRegEnumValueA, ShimRegEnumValueA);
DetourDetach(&(PVOID &)fpRegCloseKey, ShimRegCloseKey);
DetourTransactionCommit();
}

View File

@ -70,22 +70,12 @@ TEST(EnvVarICDOverrideSetup, version_1_icd_gipa) {
}
// support vk_icdNegotiateLoaderICDInterfaceVersion but not vk_icdGetInstanceProcAddr
// should assert that `interface_vers == 0` due to version mismatch, only checkable in Debug Mode
TEST(EnvVarICDOverrideSetup, version_negotiate_interface_version_death_test) {
FrameworkEnvironment env{};
env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NEGOTIATE_INTERFACE_VERSION).set_use_env_var_icd_filenames(true));
InstWrapper inst{env.vulkan_functions};
#if !defined(NDEBUG)
#if defined(WIN32)
ASSERT_DEATH(inst.CheckCreate(), "");
#else
ASSERT_DEATH(inst.CheckCreate(), "interface_vers == 0");
#endif
#else
inst.CheckCreate();
#endif
inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER);
}
// export vk_icdNegotiateLoaderICDInterfaceVersion and vk_icdGetInstanceProcAddr

View File

@ -53,8 +53,8 @@ TEST_F(LoaderHandleValidTests, BadInstEnumPhysDevices) {
VkInstance bad_instance = (VkInstance)(&my_bad_data);
uint32_t returned_physical_count = 0;
ASSERT_DEATH(env->vulkan_functions.vkEnumeratePhysicalDevices(bad_instance, &returned_physical_count, nullptr), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkEnumeratePhysicalDevices(bad_instance, &returned_physical_count, nullptr),
"vkEnumeratePhysicalDevices: Invalid instance \\[VUID-vkEnumeratePhysicalDevices-instance-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadInstGetInstProcAddr) {
@ -69,8 +69,8 @@ TEST_F(LoaderHandleValidTests, BadInstGetInstProcAddr) {
} my_bad_data;
VkInstance bad_instance = (VkInstance)(&my_bad_data);
ASSERT_DEATH(env->vulkan_functions.vkGetInstanceProcAddr(bad_instance, "vkGetBufferDeviceAddress"), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetInstanceProcAddr(bad_instance, "vkGetBufferDeviceAddress"),
"vkGetInstanceProcAddr: Invalid instance \\[VUID-vkGetInstanceProcAddr-instance-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadInstDestroyInstance) {
@ -85,8 +85,8 @@ TEST_F(LoaderHandleValidTests, BadInstDestroyInstance) {
} my_bad_data;
VkInstance bad_instance = (VkInstance)(&my_bad_data);
ASSERT_DEATH(env->vulkan_functions.vkDestroyInstance(bad_instance, nullptr), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkDestroyInstance(bad_instance, nullptr),
"vkDestroyInstance: Invalid instance \\[VUID-vkDestroyInstance-instance-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadInstDestroySurface) {
@ -105,8 +105,8 @@ TEST_F(LoaderHandleValidTests, BadInstDestroySurface) {
} my_bad_data;
VkInstance bad_instance = (VkInstance)(&my_bad_data);
ASSERT_DEATH(env->vulkan_functions.vkDestroySurfaceKHR(bad_instance, VK_NULL_HANDLE, nullptr), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkDestroySurfaceKHR(bad_instance, VK_NULL_HANDLE, nullptr),
"vkDestroySurfaceKHR: Invalid instance \\[VUID-vkDestroySurfaceKHR-instance-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadInstCreateHeadlessSurf) {
@ -130,8 +130,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateHeadlessSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateHeadlessSurfaceEXT(bad_instance, &surf_create_info, nullptr, &created_surface), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkCreateHeadlessSurfaceEXT(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateHeadlessSurfaceEXT: Invalid instance \\[VUID-vkCreateHeadlessSurfaceEXT-instance-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadInstCreateDisplayPlaneSurf) {
@ -156,8 +156,7 @@ TEST_F(LoaderHandleValidTests, BadInstCreateDisplayPlaneSurf) {
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateDisplayPlaneSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface),
"");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
"vkCreateDisplayPlaneSurfaceKHR: Invalid instance \\[VUID-vkCreateDisplayPlaneSurfaceKHR-instance-parameter\\]");
}
#ifdef VK_USE_PLATFORM_ANDROID_KHR
@ -182,8 +181,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateAndroidSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateAndroidSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkCreateAndroidSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateAndroidSurfaceKHR: Invalid instance \\[VUID-vkCreateAndroidSurfaceKHR-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_ANDROID_KHR
@ -209,8 +208,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateDirectFBSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_DIRECTFB_SURFACE_CREATE_INFO_EXT;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateDirectFBSurfaceEXT(bad_instance, &surf_create_info, nullptr, &created_surface), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkCreateDirectFBSurfaceEXT(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateDirectFBSurfaceEXT: Invalid instance \\[VUID-vkCreateDirectFBSurfaceEXT-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_DIRECTFB_EXT
@ -237,8 +236,7 @@ TEST_F(LoaderHandleValidTests, BadInstCreateFuchsiaSurf) {
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateImagePipeSurfaceFUCHSIA(bad_instance, &surf_create_info, nullptr, &created_surface),
"");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
"vkCreateImagePipeSurfaceFUCHSIA: Invalid instance \\[VUID-vkCreateImagePipeSurfaceFUCHSIA-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_FUCHSIA
@ -265,8 +263,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateGGPSurf) {
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(
env->vulkan_functions.vkCreateStreamDescriptorSurfaceGGP(bad_instance, &surf_create_info, nullptr, &created_surface), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
env->vulkan_functions.vkCreateStreamDescriptorSurfaceGGP(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateStreamDescriptorSurfaceGGP: Invalid instance \\[VUID-vkCreateStreamDescriptorSurfaceGGP-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_GGP
@ -292,8 +290,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateIOSSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateIOSSurfaceMVK(bad_instance, &surf_create_info, nullptr, &created_surface), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkCreateIOSSurfaceMVK(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateIOSSurfaceMVK: Invalid instance \\[VUID-vkCreateIOSSurfaceMVK-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_IOS_MVK
@ -319,8 +317,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateMacOSSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateMacOSSurfaceMVK(bad_instance, &surf_create_info, nullptr, &created_surface), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkCreateMacOSSurfaceMVK(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateMacOSSurfaceMVK: Invalid instance \\[VUID-vkCreateMacOSSurfaceMVK-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_MACOS_MVK
@ -346,8 +344,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateMetalSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateMetalSurfaceEXT(bad_instance, &surf_create_info, nullptr, &created_surface), "");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkCreateMetalSurfaceEXT(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateMetalSurfaceEXT: Invalid instance \\[VUID-vkCreateMetalSurfaceEXT-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_METAL_EXT
@ -373,7 +371,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateQNXSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateScreenSurfaceQNX(bad_instance, &surf_create_info, nullptr, &created_surface), "");
ASSERT_DEATH(env->vulkan_functions.vkCreateScreenSurfaceQNX(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateScreenSurfaceQNX: Invalid instance \\[VUID-vkCreateScreenSurfaceQNX-instance-parameter\\]");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
}
#endif // VK_USE_PLATFORM_SCREEN_QNX
@ -400,7 +399,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateViNNSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.CreateViSurfaceNN(bad_instance, &surf_create_info, nullptr, &created_surface), "");
ASSERT_DEATH(env->vulkan_functions.vkCreateViSurfaceNN(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateViSurfaceNN: Invalid instance \\[VUID-vkCreateViSurfaceNN-instance-parameter\\]");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
}
#endif // VK_USE_PLATFORM_VI_NN
@ -427,7 +427,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateWaylandSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateWaylandSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface), "");
ASSERT_DEATH(env->vulkan_functions.vkCreateWaylandSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateWaylandSurfaceKHR: Invalid instance \\[VUID-vkCreateWaylandSurfaceKHR-instance-parameter\\]");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
@ -454,7 +455,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateWin32Surf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateWin32SurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface), "");
ASSERT_DEATH(env->vulkan_functions.vkCreateWin32SurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateWin32SurfaceKHR: Invalid instance \\[VUID-vkCreateWin32SurfaceKHR-instance-parameter\\]");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
}
#endif // VK_USE_PLATFORM_WIN32_KHR
@ -481,7 +483,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateXCBSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateXcbSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface), "");
ASSERT_DEATH(env->vulkan_functions.vkCreateXcbSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateXcbSurfaceKHR: Invalid instance \\[VUID-vkCreateXcbSurfaceKHR-instance-parameter\\]");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
}
#endif // VK_USE_PLATFORM_XCB_KHR
@ -508,7 +511,8 @@ TEST_F(LoaderHandleValidTests, BadInstCreateXlibSurf) {
surf_create_info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
surf_create_info.pNext = nullptr;
VkSurfaceKHR created_surface = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateXlibSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface), "");
ASSERT_DEATH(env->vulkan_functions.vkCreateXlibSurfaceKHR(bad_instance, &surf_create_info, nullptr, &created_surface),
"vkCreateXlibSurfaceKHR: Invalid instance \\[VUID-vkCreateXlibSurfaceKHR-instance-parameter\\]");
// TODO: Look for "invalid instance" in stderr log to make sure correct error is thrown
}
#endif // VK_USE_PLATFORM_XLIB_KHR
@ -529,8 +533,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
VkPhysicalDeviceFeatures features = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceFeatures(bad_physical_dev, &features), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(
env->vulkan_functions.vkGetPhysicalDeviceFeatures(bad_physical_dev, &features),
"vkGetPhysicalDeviceFeatures: Invalid physicalDevice \\[VUID-vkGetPhysicalDeviceFeatures-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps) {
@ -548,8 +553,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps) {
VkFormatProperties format_info = {};
ASSERT_DEATH(
env->vulkan_functions.vkGetPhysicalDeviceFormatProperties(bad_physical_dev, VK_FORMAT_R8G8B8A8_UNORM, &format_info), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
env->vulkan_functions.vkGetPhysicalDeviceFormatProperties(bad_physical_dev, VK_FORMAT_R8G8B8A8_UNORM, &format_info),
"vkGetPhysicalDeviceFormatProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceFormatProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps) {
@ -569,8 +575,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps) {
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceImageFormatProperties(bad_physical_dev, VK_FORMAT_R8G8B8A8_UNORM,
VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_LINEAR,
VK_IMAGE_USAGE_STORAGE_BIT, 0, &format_info),
"");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
"vkGetPhysicalDeviceImageFormatProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceImageFormatProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevProps) {
@ -587,8 +593,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevProps) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
VkPhysicalDeviceProperties properties = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceProperties(bad_physical_dev, &properties), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(
env->vulkan_functions.vkGetPhysicalDeviceProperties(bad_physical_dev, &properties),
"vkGetPhysicalDeviceProperties: Invalid physicalDevice \\[VUID-vkGetPhysicalDeviceProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps) {
@ -604,8 +611,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceQueueFamilyProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceQueueFamilyProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps) {
@ -622,8 +630,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
VkPhysicalDeviceMemoryProperties properties = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceMemoryProperties(bad_physical_dev, &properties), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceMemoryProperties(bad_physical_dev, &properties),
"vkGetPhysicalDeviceMemoryProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceMemoryProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevCreateDevice) {
@ -659,8 +668,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevCreateDevice) {
dev_create_info.ppEnabledExtensionNames = nullptr;
dev_create_info.pEnabledFeatures = nullptr;
VkDevice created_dev = VK_NULL_HANDLE;
ASSERT_DEATH(env->vulkan_functions.vkCreateDevice(bad_physical_dev, &dev_create_info, nullptr, &created_dev), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkCreateDevice(bad_physical_dev, &dev_create_info, nullptr, &created_dev),
"vkCreateDevice: Invalid physicalDevice \\[VUID-vkCreateDevice-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevEnumDevExtProps) {
@ -676,8 +685,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevEnumDevExtProps) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkEnumerateDeviceExtensionProperties(bad_physical_dev, nullptr, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkEnumerateDeviceExtensionProperties(bad_physical_dev, nullptr, &count, nullptr),
"vkEnumerateDeviceExtensionProperties: Invalid physicalDevice "
"\\[VUID-vkEnumerateDeviceExtensionProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevEnumDevLayerProps) {
@ -693,8 +703,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevEnumDevLayerProps) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkEnumerateDeviceLayerProperties(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkEnumerateDeviceLayerProperties(bad_physical_dev, &count, nullptr),
"vkEnumerateDeviceLayerProperties: Invalid physicalDevice "
"\\[VUID-vkEnumerateDeviceLayerProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps) {
@ -714,8 +725,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps) {
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSparseImageFormatProperties(
bad_physical_dev, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_TYPE_2D, VK_SAMPLE_COUNT_1_BIT,
VK_IMAGE_USAGE_STORAGE_BIT, VK_IMAGE_TILING_LINEAR, &count, nullptr),
"");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
"vkGetPhysicalDeviceSparseImageFormatProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSparseImageFormatProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature2) {
@ -734,8 +745,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature2) {
VkPhysicalDeviceFeatures2 features = {};
features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
features.pNext = nullptr;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceFeatures2(bad_physical_dev, &features), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(
env->vulkan_functions.vkGetPhysicalDeviceFeatures2(bad_physical_dev, &features),
"vkGetPhysicalDeviceFeatures2: Invalid physicalDevice \\[VUID-vkGetPhysicalDeviceFeatures2-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps2) {
@ -755,8 +767,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps2) {
properties.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2;
properties.pNext = nullptr;
ASSERT_DEATH(
env->vulkan_functions.vkGetPhysicalDeviceFormatProperties2(bad_physical_dev, VK_FORMAT_R8G8B8A8_UNORM, &properties), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
env->vulkan_functions.vkGetPhysicalDeviceFormatProperties2(bad_physical_dev, VK_FORMAT_R8G8B8A8_UNORM, &properties),
"vkGetPhysicalDeviceFormatProperties2: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceFormatProperties2-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps2) {
@ -778,8 +791,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps2) {
VkImageFormatProperties2 properties = {};
properties.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2;
properties.pNext = nullptr;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceImageFormatProperties2(bad_physical_dev, &format_info, &properties), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceImageFormatProperties2(bad_physical_dev, &format_info, &properties),
"vkGetPhysicalDeviceImageFormatProperties2: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceImageFormatProperties2-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevProps2) {
@ -798,8 +812,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevProps2) {
VkPhysicalDeviceProperties2 properties = {};
properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
properties.pNext = nullptr;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceProperties2(bad_physical_dev, &properties), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceProperties2(bad_physical_dev, &properties),
"vkGetPhysicalDeviceProperties2: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceProperties2-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps2) {
@ -815,8 +830,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps2) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties2(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties2(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceQueueFamilyProperties2: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceQueueFamilyProperties2-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps2) {
@ -835,8 +851,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps2) {
VkPhysicalDeviceMemoryProperties2 properties = {};
properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
properties.pNext = nullptr;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceMemoryProperties2(bad_physical_dev, &properties), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceMemoryProperties2(bad_physical_dev, &properties),
"vkGetPhysicalDeviceMemoryProperties2: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceMemoryProperties2-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps2) {
@ -857,8 +874,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps2) {
info.pNext = nullptr;
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSparseImageFormatProperties2(bad_physical_dev, &info, &count, nullptr),
"");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
"vkGetPhysicalDeviceSparseImageFormatProperties2: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSparseImageFormatProperties2-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevExternFenceProps) {
@ -878,8 +895,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevExternFenceProps) {
info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO;
info.pNext = nullptr;
VkExternalFenceProperties props = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceExternalFenceProperties(bad_physical_dev, &info, &props), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceExternalFenceProperties(bad_physical_dev, &info, &props),
"vkGetPhysicalDeviceExternalFenceProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceExternalFenceProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevExternBufferProps) {
@ -899,8 +917,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevExternBufferProps) {
info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO;
info.pNext = nullptr;
VkExternalBufferProperties props = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceExternalBufferProperties(bad_physical_dev, &info, &props), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceExternalBufferProperties(bad_physical_dev, &info, &props),
"vkGetPhysicalDeviceExternalBufferProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceExternalBufferProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevExternSemaphoreProps) {
@ -920,8 +939,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevExternSemaphoreProps) {
info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO;
info.pNext = nullptr;
VkExternalSemaphoreProperties props = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceExternalSemaphoreProperties(bad_physical_dev, &info, &props), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceExternalSemaphoreProperties(bad_physical_dev, &info, &props),
"vkGetPhysicalDeviceExternalSemaphoreProperties: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceExternalSemaphoreProperties-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceSupportKHR) {
@ -941,8 +961,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceSupportKHR) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
VkBool32 supported = VK_FALSE;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfaceSupportKHR(bad_physical_dev, 0, VK_NULL_HANDLE, &supported), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfaceSupportKHR(bad_physical_dev, 0, VK_NULL_HANDLE, &supported),
"vkGetPhysicalDeviceSurfaceSupportKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSurfaceSupportKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCapsKHR) {
@ -961,8 +982,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCapsKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
VkSurfaceCapabilitiesKHR caps = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfaceCapabilitiesKHR(bad_physical_dev, VK_NULL_HANDLE, &caps), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfaceCapabilitiesKHR(bad_physical_dev, VK_NULL_HANDLE, &caps),
"vkGetPhysicalDeviceSurfaceCapabilitiesKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSurfaceCapabilitiesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormatsKHR) {
@ -981,8 +1003,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormatsKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfaceFormatsKHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfaceFormatsKHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr),
"vkGetPhysicalDeviceSurfaceFormatsKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSurfaceFormatsKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModesKHR) {
@ -1002,8 +1025,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModesKHR) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfacePresentModesKHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr),
"");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
"vkGetPhysicalDeviceSurfacePresentModesKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSurfacePresentModesKHR-physicalDevice-parameter\\]");
}
#ifdef VK_USE_PLATFORM_DIRECTFB_EXT
@ -1024,8 +1047,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetDirectFBPresentSupportKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
IDirectFB directfb;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDirectFBPresentationSupportEXT(bad_physical_dev, 0, &directfb), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDirectFBPresentationSupportEXT(bad_physical_dev, 0, &directfb),
"vkGetPhysicalDeviceDirectFBPresentationSupportEXT: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceDirectFBPresentationSupportEXT-physicalDevice-parameter\\]");
}
#endif // VK_USE_PLATFORM_DIRECTFB_EXT
@ -1046,8 +1070,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetQNXPresentSupportKHR) {
uint64_t bad_array[3] = {0x123456789AB, 0x23456789AB1, 0x9876543210AB};
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
ASSERT_DEATH(env->vulkan_functions.PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX(bad_physical_dev, 0, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX(bad_physical_dev, 0, nullptr),
"vkGetPhysicalDeviceScreenPresentationSupportQNX: Invalid instance "
"\\[VUID-vkGetPhysicalDeviceScreenPresentationSupportQNX-instance-parameter\\]");
}
#endif // VK_USE_PLATFORM_SCREEN_QNX
@ -1068,8 +1093,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevWaylandPresentSupportKHR) {
uint64_t bad_array[3] = {0x123456789AB, 0x23456789AB1, 0x9876543210AB};
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWaylandPresentationSupportKHR(bad_physical_dev, 0, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWaylandPresentationSupportKHR(bad_physical_dev, 0, nullptr),
"vkGetPhysicalDeviceWaylandPresentationSupportKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceWaylandPresentationSupportKHR-physicalDevice-parameter\\]");
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
@ -1090,8 +1116,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevWin32PresentSupportKHR) {
uint64_t bad_array[3] = {0x123456789AB, 0x23456789AB1, 0x9876543210AB};
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWin32PresentationSupportKHR(bad_physical_dev, 0), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWin32PresentationSupportKHR(bad_physical_dev, 0),
"vkGetPhysicalDeviceWin32PresentationSupportKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceWin32PresentationSupportKHR-physicalDevice-parameter\\]");
}
#endif // VK_USE_PLATFORM_WIN32_KHR
@ -1114,8 +1141,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetXCBPresentSupportKHR) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
xcb_visualid_t visual = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXcbPresentationSupportKHR(bad_physical_dev, 0, nullptr, visual), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXcbPresentationSupportKHR(bad_physical_dev, 0, nullptr, visual),
"vkGetPhysicalDeviceXcbPresentationSupportKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceXcbPresentationSupportKHR-physicalDevice-parameter\\]");
}
#endif // VK_USE_PLATFORM_XCB_KHR
@ -1138,8 +1166,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetXlibPresentSupportKHR) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
VisualID visual = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXlibPresentationSupportKHR(bad_physical_dev, 0, nullptr, visual), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXlibPresentationSupportKHR(bad_physical_dev, 0, nullptr, visual),
"vkGetPhysicalDeviceXlibPresentationSupportKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceXlibPresentationSupportKHR-physicalDevice-parameter\\]");
}
#endif // VK_USE_PLATFORM_XLIB_KHR
@ -1160,8 +1189,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPropsKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayPropertiesKHR(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayPropertiesKHR(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceDisplayPropertiesKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceDisplayPropertiesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlanePropsKHR) {
@ -1181,8 +1211,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlanePropsKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayPlanePropertiesKHR(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayPlanePropertiesKHR(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceDisplayPlanePropertiesKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceDisplayPlanePropertiesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneSupportedDisplaysKHR) {
@ -1202,8 +1233,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneSupportedDisplaysKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayPlaneSupportedDisplaysKHR(bad_physical_dev, 0, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayPlaneSupportedDisplaysKHR(bad_physical_dev, 0, &count, nullptr),
"vkGetDisplayPlaneSupportedDisplaysKHR: Invalid physicalDevice "
"\\[VUID-vkGetDisplayPlaneSupportedDisplaysKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayModePropsKHR) {
@ -1223,8 +1255,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayModePropsKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayModePropertiesKHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(
env->vulkan_functions.vkGetDisplayModePropertiesKHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr),
"vkGetDisplayModePropertiesKHR: Invalid physicalDevice \\[VUID-vkGetDisplayModePropertiesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevCreateDisplayModeKHR) {
@ -1248,8 +1281,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevCreateDisplayModeKHR) {
create_info.pNext = nullptr;
VkDisplayModeKHR display_mode;
ASSERT_DEATH(
env->vulkan_functions.vkCreateDisplayModeKHR(bad_physical_dev, VK_NULL_HANDLE, &create_info, nullptr, &display_mode), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
env->vulkan_functions.vkCreateDisplayModeKHR(bad_physical_dev, VK_NULL_HANDLE, &create_info, nullptr, &display_mode),
"vkCreateDisplayModeKHR: Invalid physicalDevice \\[VUID-vkCreateDisplayModeKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCapsKHR) {
@ -1269,8 +1302,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCapsKHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
VkDisplayPlaneCapabilitiesKHR caps = {};
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayPlaneCapabilitiesKHR(bad_physical_dev, VK_NULL_HANDLE, 0, &caps), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayPlaneCapabilitiesKHR(bad_physical_dev, VK_NULL_HANDLE, 0, &caps),
"vkGetDisplayPlaneCapabilitiesKHR: Invalid physicalDevice "
"\\[VUID-vkGetDisplayPlaneCapabilitiesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevPresentRectsKHR) {
@ -1291,8 +1325,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevPresentRectsKHR) {
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDevicePresentRectanglesKHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr),
"");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
"vkGetPhysicalDevicePresentRectanglesKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDevicePresentRectanglesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayProps2KHR) {
@ -1312,8 +1346,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayProps2KHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayProperties2KHR(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayProperties2KHR(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceDisplayProperties2KHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceDisplayProperties2KHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlaneProps2KHR) {
@ -1333,8 +1368,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlaneProps2KHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayPlaneProperties2KHR(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceDisplayPlaneProperties2KHR(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceDisplayPlaneProperties2KHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceDisplayPlaneProperties2KHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayModeProps2KHR) {
@ -1354,8 +1390,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayModeProps2KHR) {
} my_bad_data;
VkPhysicalDevice bad_physical_dev = (VkPhysicalDevice)(&my_bad_data);
uint32_t count = 0;
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayModeProperties2KHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayModeProperties2KHR(bad_physical_dev, VK_NULL_HANDLE, &count, nullptr),
"vkGetDisplayModeProperties2KHR: Invalid physicalDevice "
"\\[VUID-vkGetDisplayModeProperties2KHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCaps2KHR) {
@ -1378,8 +1415,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCaps2KHR) {
disp_plane_info.sType = VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR;
disp_plane_info.pNext = nullptr;
VkDisplayPlaneCapabilities2KHR caps = {};
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayPlaneCapabilities2KHR(bad_physical_dev, &disp_plane_info, &caps), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(env->vulkan_functions.vkGetDisplayPlaneCapabilities2KHR(bad_physical_dev, &disp_plane_info, &caps),
"vkGetDisplayPlaneCapabilities2KHR: Invalid physicalDevice "
"\\[VUID-vkGetDisplayPlaneCapabilities2KHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCaps2KHR) {
@ -1403,8 +1441,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCaps2KHR) {
phys_dev_surf_info.pNext = nullptr;
VkSurfaceCapabilities2KHR caps = {};
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceSurfaceCapabilities2KHR(bad_physical_dev, &phys_dev_surf_info, &caps),
"");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
"vkGetPhysicalDeviceSurfaceCapabilities2KHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSurfaceCapabilities2KHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormats2KHR) {
@ -1427,8 +1465,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormats2KHR) {
phys_dev_surf_info.pNext = nullptr;
uint32_t count = 0;
ASSERT_DEATH(
env->vulkan_functions.vkGetPhysicalDeviceSurfaceFormats2KHR(bad_physical_dev, &phys_dev_surf_info, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
env->vulkan_functions.vkGetPhysicalDeviceSurfaceFormats2KHR(bad_physical_dev, &phys_dev_surf_info, &count, nullptr),
"vkGetPhysicalDeviceSurfaceFormats2KHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSurfaceFormats2KHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevEnumPhysDevQueueFamilyPerfQueryCountersKHR) {
@ -1448,8 +1487,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevEnumPhysDevQueueFamilyPerfQueryCounters
env->vulkan_functions.vkGetInstanceProcAddr(instance,
"vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, 0, &count, nullptr, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, 0, &count, nullptr, nullptr),
"vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR: Invalid physicalDevice "
"\\[VUID-vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamilyPerfQueryPassesKHR) {
@ -1471,8 +1511,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamilyPerfQueryPassesKHR
reinterpret_cast<PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR>(
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, &create_info, &count), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, &create_info, &count),
"vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFragmentShadingRatesKHR) {
@ -1490,8 +1531,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevFragmentShadingRatesKHR) {
PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR pfn = reinterpret_cast<PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR>(
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFragmentShadingRatesKHR"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceFragmentShadingRatesKHR: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceFragmentShadingRatesKHR-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevMSPropsEXT) {
@ -1509,8 +1551,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevMSPropsEXT) {
PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT pfn = reinterpret_cast<PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT>(
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMultisamplePropertiesEXT"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, VK_SAMPLE_COUNT_1_BIT, &props), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, VK_SAMPLE_COUNT_1_BIT, &props),
"vkGetPhysicalDeviceMultisamplePropertiesEXT: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceMultisamplePropertiesEXT-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevAcquireDrmDisplayEXT) {
@ -1531,8 +1574,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevAcquireDrmDisplayEXT) {
PFN_vkAcquireDrmDisplayEXT pfn = reinterpret_cast<PFN_vkAcquireDrmDisplayEXT>(
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkAcquireDrmDisplayEXT"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, 0, VK_NULL_HANDLE), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, 0, VK_NULL_HANDLE),
"vkAcquireDrmDisplayEXT: Invalid physicalDevice \\[VUID-vkAcquireDrmDisplayEXT-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetDrmDisplayEXT) {
@ -1553,8 +1596,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetDrmDisplayEXT) {
PFN_vkGetDrmDisplayEXT pfn =
reinterpret_cast<PFN_vkGetDrmDisplayEXT>(env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkGetDrmDisplayEXT"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, 0, 0, VK_NULL_HANDLE), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, 0, 0, VK_NULL_HANDLE),
"vkGetDrmDisplayEXT: Invalid physicalDevice "
"\\[VUID-vkGetDrmDisplayEXT-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevReleaseDisplayEXT) {
@ -1575,8 +1619,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevReleaseDisplayEXT) {
PFN_vkReleaseDisplayEXT pfn =
reinterpret_cast<PFN_vkReleaseDisplayEXT>(env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkReleaseDisplayEXT"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, VK_NULL_HANDLE), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, VK_NULL_HANDLE),
"vkReleaseDisplayEXT: Invalid physicalDevice \\[VUID-vkReleaseDisplayEXT-physicalDevice-parameter\\]");
}
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
@ -1598,8 +1642,8 @@ TEST_F(LoaderHandleValidTests, BadPhysDevAcquireXlibDisplayEXT) {
PFN_vkAcquireXlibDisplayEXT pfn = reinterpret_cast<PFN_vkAcquireXlibDisplayEXT>(
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkAcquireXlibDisplayEXT"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, nullptr, VK_NULL_HANDLE), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, nullptr, VK_NULL_HANDLE),
"vkAcquireXlibDisplayEXT: Invalid physicalDevice \\[VUID-vkAcquireXlibDisplayEXT-physicalDevice-parameter\\]");
}
TEST_F(LoaderHandleValidTests, BadPhysDevGetRandROutputDisplayEXT) {
@ -1622,8 +1666,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetRandROutputDisplayEXT) {
PFN_vkGetRandROutputDisplayEXT pfn = reinterpret_cast<PFN_vkGetRandROutputDisplayEXT>(
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkGetRandROutputDisplayEXT"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, nullptr, rrout, &disp), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(
pfn(bad_physical_dev, nullptr, rrout, &disp),
"vkGetRandROutputDisplayEXT: Invalid physicalDevice \\[VUID-vkGetRandROutputDisplayEXT-physicalDevice-parameter\\]");
}
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
@ -1646,8 +1691,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModes2EXT) {
PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT pfn = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT>(
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfacePresentModes2EXT"));
ASSERT_NE(pfn, nullptr);
ASSERT_DEATH(pfn(bad_physical_dev, &phys_dev_surf_info, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, &phys_dev_surf_info, &count, nullptr),
"vkGetPhysicalDeviceSurfacePresentModes2EXT: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceSurfacePresentModes2EXT-physicalDevice-parameter\\]");
}
#endif // VK_USE_PLATFORM_WIN32_KHR
@ -1666,8 +1712,9 @@ TEST_F(LoaderHandleValidTests, BadPhysDevGetPhysDevToolPropertiesEXT) {
env->vulkan_functions.vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceToolPropertiesEXT"));
ASSERT_NE(pfn, nullptr);
uint32_t count = 0;
ASSERT_DEATH(pfn(bad_physical_dev, &count, nullptr), "");
// TODO: Look for "invalid physicalDevice" in stderr log to make sure correct error is thrown
ASSERT_DEATH(pfn(bad_physical_dev, &count, nullptr),
"vkGetPhysicalDeviceToolPropertiesEXT: Invalid physicalDevice "
"\\[VUID-vkGetPhysicalDeviceToolPropertiesEXT-physicalDevice-parameter\\]");
}
#ifdef VK_USE_PLATFORM_ANDROID_KHR

View File

@ -68,24 +68,8 @@ int main(int argc, char** argv) {
set_env_var("HOME", "/home/fake_home");
#endif
#if defined(_WIN32)
// Death tests call main twice, this causes the override to be set up multiple times.
// Use an env-var to signal whether the override has been set up.
uint32_t random_base_path = 0;
std::string env_var{"size_large_enough"};
DWORD has_not_setup_tests = GetEnvironmentVariable("VK_LOADER_TEST_REGISTRY_IS_SETUP", (LPSTR)env_var.c_str(), 256);
if (has_not_setup_tests == 0) {
random_base_path = setup_override(DebugMode::none);
set_env_var("VK_LOADER_TEST_REGISTRY_IS_SETUP", "SETUP");
}
#endif
::testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
#if defined(_WIN32)
if (has_not_setup_tests == 0) {
clear_override(DebugMode::none, random_base_path);
}
#endif
return result;
}

View File

@ -209,7 +209,7 @@ TEST(UnknownFunctionDeathTests, PhysicalDeviceFunctionErrorPath) {
decltype(custom_physical_device_functions::func_zero)* returned_func_i =
env.vulkan_functions.load(inst.inst, fake_function_names.at(0).c_str());
ASSERT_NE(returned_func_i, nullptr);
ASSERT_DEATH(returned_func_i(phys_dev_to_use, 0), "");
ASSERT_DEATH(returned_func_i(phys_dev_to_use, 0), "Extension vkNotIntRealFuncTEST_0 not supported for this physical device");
}
TEST_F(UnknownFunction, PhysicalDeviceFunctionWithImplicitLayer) {

View File

@ -151,7 +151,8 @@ TEST_F(WsiTests, GetPhysicalDeviceWin32PresentNoICDSupport) {
ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDevices(inst, &driver_count, &physical_device));
ASSERT_EQ(driver_count, 1);
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWin32PresentationSupportKHR(physical_device, 0), "");
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWin32PresentationSupportKHR(physical_device, 0),
"ICD for selected physical device does not export vkGetPhysicalDeviceWin32PresentationSupportKHR!");
}
TEST_F(WsiTests, GetPhysicalDeviceWin32PresentICDSupport) {
@ -285,7 +286,8 @@ TEST_F(WsiTests, GetPhysicalDeviceXcbPresentNoICDSupport) {
ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDevices(inst, &driver_count, &physical_device));
ASSERT_EQ(driver_count, 1);
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXcbPresentationSupportKHR(physical_device, 0, nullptr, 0), "");
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXcbPresentationSupportKHR(physical_device, 0, nullptr, 0),
"ICD for selected physical device does not exportvkGetPhysicalDeviceXcbPresentationSupportKHR!");
}
TEST_F(WsiTests, GetPhysicalDeviceXcbPresentICDSupport) {
@ -419,7 +421,8 @@ TEST_F(WsiTests, GetPhysicalDeviceXlibPresentNoICDSupport) {
ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDevices(inst, &driver_count, &physical_device));
ASSERT_EQ(driver_count, 1);
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXlibPresentationSupportKHR(physical_device, 0, nullptr, 0), "");
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceXlibPresentationSupportKHR(physical_device, 0, nullptr, 0),
"ICD for selected physical device does not exportvkGetPhysicalDeviceXlibPresentationSupportKHR!");
}
TEST_F(WsiTests, GetPhysicalDeviceXlibPresentICDSupport) {
@ -553,7 +556,8 @@ TEST_F(WsiTests, GetPhysicalDeviceWaylandPresentNoICDSupport) {
ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDevices(inst, &driver_count, &physical_device));
ASSERT_EQ(driver_count, 1);
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWaylandPresentationSupportKHR(physical_device, 0, nullptr), "");
ASSERT_DEATH(env->vulkan_functions.vkGetPhysicalDeviceWaylandPresentationSupportKHR(physical_device, 0, nullptr),
"ICD for selected physical device does not exportvkGetPhysicalDeviceWaylandPresentationSupportKHR!");
}
TEST_F(WsiTests, GetPhysicalDeviceWaylandPresentICDSupport) {