• Home
Name Date Size #Lines LOC

..--

framework/12-May-2024-8,0206,355

live_verification/12-May-2024-538297

CMakeLists.txtD12-May-20243.5 KiB8474

README.mdD12-May-20243 KiB5439

loader_alloc_callback_tests.cppD12-May-202441 KiB859687

loader_debug_ext_tests.cppD12-May-202441.1 KiB852565

loader_envvar_tests.cppD12-May-202414.9 KiB358227

loader_get_proc_addr_tests.cppD12-May-20249.9 KiB187120

loader_handle_validation_tests.cppD12-May-202494.3 KiB2,0631,696

loader_layer_tests.cppD12-May-2024174.9 KiB3,4582,829

loader_phys_dev_inst_ext_tests.cppD12-May-2024276.4 KiB5,4033,993

loader_regression_tests.cppD12-May-2024177.3 KiB3,5312,848

loader_testing_main.cppD12-May-20243.2 KiB7639

loader_threading_tests.cppD12-May-20247.9 KiB150108

loader_unknown_ext_tests.cppD12-May-202472.1 KiB1,3821,138

loader_version_tests.cppD12-May-202451.1 KiB922721

loader_wsi_tests.cppD12-May-202435.1 KiB787601

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```