Module test_utils

Source
Available on crate feature _test only.
Expand description

Utilities used in the integration tests of this crate.

The Vulkan layer essentially provides a bunch of function pointers to the loader. To mock multiple layers in the same process, it is required to use different types so different function pointers will be generated. To avoid extremely long compile time, we shouldn’t create a new layer type for every test case. Instead we run test cases in different processes, and share the same layer type as possible. If a test case needs multiple layers at the same time, multiple layer types should be used.

Follow the following steps to write a unit test:

  1. Use TestGlobal::builder to construct the static resources needed to mock one layer. Mocks to static methods can be set with different builder functions.
  2. Call TestGlobal::create_context to set up the scope for expectations.
  3. Use TestLayer as a layer implementation.

Modules§

__mock_MockDrop
__mock_MockDrop_Drop
__mock_MockTestLayer
__mock_MockTestLayer_TestLayerMock

Structs§

ArcDel
A thread-safe reference-counting pointer, but with a custom deleter.
Del
A wrapper for T but with a user defined deleter. ‘Del’ stands for ‘deleter’.
MockDeviceInfo
A mock struct that implements the DeviceInfo trait.
MockDrop
MockGlobalHooksInfo
A mock struct that implements the GlobalHooksInfo trait.
MockInstanceInfo
A mock struct that implements the InstanceInfo trait.
MockTestLayer
Tag
Test layer tags to distinguish different TestLayer. Different I will result in different types.
TestGlobal
The container of the static resources related to TestLayer<T>.
TestGlobalBuilder
The builder for TestGlobal.
TestLayer
The mock for the Layer trait.
VkLayerDeviceCreateInfo
Sub type of structure for instance and device loader ext of CreateInfo. Bindings for the C VkLayerDeviceCreateInfo type defined in the vk_layer.h file.
VkLayerFunctionWindows
Bindings for the C VkLayerFunction type defined in the vk_layer.h file.
VkLayerInstanceCreateInfo
Sub type of structure for instance and device loader ext of CreateInfo.

Traits§

LayerManifestExt
A trait to provide an extra meaningful constructor for LayerManifest.
TestLayerMock
A set of interfaces that the integration tests are interested to mock.
TestLayerTag
A trait used to include all possible Tag<I>.

Type Aliases§

VkLayerDeviceLink
A list node that contains the next entity’s vkGetInstanceProcAddr and vkGetDeviceProcAddr used by a layer. One possible payload of VkLayerDeviceCreateInfo