Name Date Size

..25-Oct-20244 KiB

CMakeLists.txtH A D25-Oct-20246.6 KiB

corpus/H25-Oct-20244 KiB

framework/H25-Oct-20244 KiB

integration/H25-Oct-20244 KiB

live_verification/H25-Oct-20244 KiB

loader_alloc_callback_tests.cppH A D25-Oct-202451.7 KiB

loader_debug_ext_tests.cppH A D25-Oct-202461.8 KiB

loader_envvar_tests.cppH A D25-Oct-202442 KiB

loader_get_proc_addr_tests.cppH A D25-Oct-202423.7 KiB

loader_handle_validation_tests.cppH A D25-Oct-202479.4 KiB

loader_layer_tests.cppH A D25-Oct-2024312.2 KiB

loader_phys_dev_inst_ext_tests.cppH A D25-Oct-2024308.2 KiB

loader_regression_tests.cppH A D25-Oct-2024223.2 KiB

loader_settings_tests.cppH A D25-Oct-202488.6 KiB

loader_testing_main.cppH A D25-Oct-20244.9 KiB

loader_threading_tests.cppH A D25-Oct-20246.7 KiB

loader_unknown_ext_tests.cppH A D25-Oct-202470.2 KiB

loader_version_tests.cppH A D25-Oct-202473 KiB

loader_wsi_tests.cppH A D25-Oct-202437.4 KiB

README.mdH A D25-Oct-20242.8 KiB

README.md

1
2# Loader Tests
3
4This directory contains a test suite for the Vulkan loader.
5These tests are not exhaustive — they are expected to be supplemented with other tests, such as CTS.
6
7
8## Test specific CMake Configuration
9
10| Option                         | Platform | Default | Description                                              |
11| ------------------------------ | -------- | ------- | -------------------------------------------------------- |
12| BUILD_TESTS                    | All      | `OFF`   | Controls whether or not the loader tests are built.      |
13| ENABLE_LIVE_VERIFICATION_TESTS | All      | `OFF`   | Enables building of tests meant to run with live drivers |
14
15## Running Tests
16
17For most purposes `ctest` is the desired method of running tests.
18This is because when a test fails, `ctest` will automatically printout the failing test case.
19
20Tests are organized into various executables:
21 * `test_regression` - Contains most tests.
22 * `test_threading` - Tests which need multiple threads to execute.
23   * This allows targeted testing which uses tools like ThreadSanitizer
24
25The loader test framework is designed to be easy to use, as simple as just running a single executable. To achieve that requires extensive build script
26automation is required. More details are in the tests/framework/README.md.
27The consequence of this automation: Do not relocate the build folder of the project without cleaning the CMakeCache. Most components are found by absolute
28path and thus require the contents of the folder to not be relocated.
29
30## Writing Tests
31
32The `test_environment.h/cpp` are the primary tool used when creating new tests. Either use the existing child classes of FrameworkEnvironment or create a new one
33to suite the tests need. Refer to the `tests/framework/README.md` for more details.
34
35IMPORTANT NOTES:
36 * NEVER FORGET TO DESTROY A VKINSTANCE THAT WAS SUCCESSFULLY CREATED.
37   * The loader loads dynamic libraries in `vkCreateInstance` and unloads them in `vkDestroyInstance`. If these dynamic libraries aren't unloaded, they leak state
38   into the next test that runs, causing spurious failures or even crashes.
39   * Use InstWrapper helper as well as DeviceWrapper to automate this concern away.
40
41## Using a specific loader with the tests
42
43The environment variable `VK_LOADER_TEST_LOADER_PATH` can be used to specify which vulkan-loader binary should be used.
44This is useful when writing tests to exercise a bug fix.
45Simply build the loader without the fix, stash it in a known location.
46Write the fix and the test that should exercise the bug and it passes.
47Then run the test again but with this env-var set to the older loader without the fix and show that the test now fails.
48
49Basic usage example:
50```c
51VK_LOADER_TEST_LOADER_PATH="/path/to/older/loader/build" ctest --output-on-failure
52```
53