|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| framework/ | | 12-May-2024 | - | 8,020 | 6,355 |
| live_verification/ | | 12-May-2024 | - | 538 | 297 |
| CMakeLists.txt | D | 12-May-2024 | 3.5 KiB | 84 | 74 |
| README.md | D | 12-May-2024 | 3 KiB | 54 | 39 |
| loader_alloc_callback_tests.cpp | D | 12-May-2024 | 41 KiB | 859 | 687 |
| loader_debug_ext_tests.cpp | D | 12-May-2024 | 41.1 KiB | 852 | 565 |
| loader_envvar_tests.cpp | D | 12-May-2024 | 14.9 KiB | 358 | 227 |
| loader_get_proc_addr_tests.cpp | D | 12-May-2024 | 9.9 KiB | 187 | 120 |
| loader_handle_validation_tests.cpp | D | 12-May-2024 | 94.3 KiB | 2,063 | 1,696 |
| loader_layer_tests.cpp | D | 12-May-2024 | 174.9 KiB | 3,458 | 2,829 |
| loader_phys_dev_inst_ext_tests.cpp | D | 12-May-2024 | 276.4 KiB | 5,403 | 3,993 |
| loader_regression_tests.cpp | D | 12-May-2024 | 177.3 KiB | 3,531 | 2,848 |
| loader_testing_main.cpp | D | 12-May-2024 | 3.2 KiB | 76 | 39 |
| loader_threading_tests.cpp | D | 12-May-2024 | 7.9 KiB | 150 | 108 |
| loader_unknown_ext_tests.cpp | D | 12-May-2024 | 72.1 KiB | 1,382 | 1,138 |
| loader_version_tests.cpp | D | 12-May-2024 | 51.1 KiB | 922 | 721 |
| loader_wsi_tests.cpp | D | 12-May-2024 | 35.1 KiB | 787 | 601 |
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| TEST_USE_ADDRESS_SANITIZER | Linux | `OFF` | Enables Address Sanitizer in the loader and tests |
15| TEST_USE_THREAD_SANITIZER | Linux | `OFF` | Enables Thread Sanitizer in the loader and tests |
16
17## Running Tests
18
19For most purposes `ctest` is the desired method of running tests.
20This is because when a test fails, `ctest` will automatically printout the failing test case.
21
22Tests are organized into various executables:
23 * `test_regression` - Contains most tests.
24 * `test_threading` - Tests which need multiple threads to execute.
25 * This allows targeted testing which uses tools like ThreadSanitizer
26
27The 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
28automation is required. More details are in the tests/framework/README.md.
29The consequence of this automation: Do not relocate the build folder of the project without cleaning the CMakeCache. Most components are found by absolute
30path and thus require the contents of the folder to not be relocated.
31
32## Writing Tests
33
34The `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
35to suite the tests need. Refer to the `tests/framework/README.md` for more details.
36
37IMPORTANT NOTES:
38 * NEVER FORGET TO DESTROY A VKINSTANCE THAT WAS SUCCESSFULLY CREATED.
39 * The loader loads dynamic libraries in `vkCreateInstance` and unloads them in `vkDestroyInstance`. If these dynamic libraries aren't unloaded, they leak state
40 into the next test that runs, causing spurious failures or even crashes.
41 * Use InstWrapper helper as well as DeviceWrapper to automate this concern away.
42
43## Using a specific loader with the tests
44
45The environment variable `VK_LOADER_TEST_LOADER_PATH` can be used to specify which vulkan-loader binary should be used.
46This is useful when writing tests to exercise a bug fix.
47Simply build the loader without the fix, stash it in a known location.
48Write the fix and the test that should exercise the bug and it passes.
49Then run the test again but with this env-var set to the older loader without the fix and show that the test now fails.
50
51Basic usage example:
52```c
53VK_LOADER_TEST_LOADER_PATH="/path/to/older/loader/build" ctest --output-on-failure
54```