Commit Graph

22 Commits

Author SHA1 Message Date
Charles Giessen c8713e1fbe Refactor FrameworkEnvironment API a bit
Redo some of API's for adding layers and ICD's to the test framework.
2022-04-12 13:00:32 -06:00
Charles Giessen e23d3208d3 Use correct TestICD in tests
Many tests were using the V6 TestICD, which means that it exports the
EnumerateAdapterPhysicalDevices. The loader then only looks for devices
using that functionality and if the test didn't set it up, the driver
won't have its devices found.

Also:
* Cleaned up handle_validation_tests
* Added WSI setup helpers, which put all the setup code for WSI in one place
* Created a to/from_nondispatch_handle function for TestICD, probably should
be in a more general location
2022-04-04 16:38:17 -06:00
Charles Giessen 8f95a59c5b Add test for different ICD interface versions
Fix Test Framework not skipping Drivers which have a different LUID.
2022-04-04 16:38:17 -06:00
Charles Giessen b8bc04cebd Dont emit warnings on unknown manifest file versions
Since the loader is meant to be forward compatible, it makes little sense to emit
a warning when an ICD or Layer manifest is found with a version that it doesn't
understand. Thus they now are INFO level.
2022-03-31 11:54:03 -06:00
Charles Giessen d27e4c0069 Replace TEST_F with TEST in most tests
Test fixturing (TEST_F) is useful when there is a lot of common code that needs
to be run for a suite of tests. However, the FrameworkEnvironment encapsulates
almost all of the setup work all tests needs, and so doesn't need to be in a
fixture. Making the add_icd call inside the tests makes it clear which binary
is being used.

This commit also uses the corrent signed/unsigned constants in tests, as was
warned by compilers when enhanced warnings were enabled (/W4 in msvc).
2022-03-29 16:10:30 -06:00
Charles Giessen 9ef85c237b Fixup windows test infrastructure
Cleaned up several bugs in the testing framework in the windows shim.
Rewrote the tests that exercise DXGI/D3DKMT functionality.
2022-03-24 19:00:28 -06:00
Mark Young 759d5b4c94 Add "additive" environment variables
Add "additive" environment variables for adding additional layer
paths or driver JSON files instead of replacing default ones.

Also, rename VK_ICD_FILENAMES to VK_DRIVER_FILES since we're trying
to remove references to ICDs because software driver implementations
of Vulkan aren't ICDs (but continue to support the old name as well).

Added documentation around these changes to reflect the new name and
the new variables.
2022-03-04 15:38:46 -07:00
Mark Young 2cac2efc06 Fix Windows build and add proper phys dev group sorting 2022-02-16 08:29:42 -07:00
Mark Young d4701211de Loader single EnumPhysDev call through layers
The loader trampoline previously would query all devices every time
vkEnumeratePhysicalDevices was called.
To do this, it would make two calls every time:
  - First, it would ignore the passed in user values
  - Second, it would query the total number of available devices.
  - Third, it would query the values for every available device

This resulted in layers reporting 2 vkEnumeratePhysicalDevices call for
every 1 the application made which could get very polluted in output.
It didn't break any functionality, just made things messy.

This change removes that behavior and adds a bunch of test cases to verify
nothing broke in the move.
2022-02-16 08:29:42 -07:00
Mark Young 54b2adc262 Add explicit layer invalid variant number test 2022-02-15 14:56:05 -07:00
Charles Giessen 5cc1385ecb Add wrong Variant tests 2022-01-28 16:24:27 -07:00
Charles Giessen ae2505132f Warn when the apiVersion's variant isn't 0
The 1.2.175 header release saw the addition of API Variants. For the purposes
of the loader, this should always be set to 0. If this value isn't zero, the
loader should warn about it.
2022-01-28 16:24:27 -07:00
Charles Giessen e9df7183e3 loader: Add basic 1.3 tests
Not complete and mainly just makes sure an app can load the function pointer and call it
without crashing.
2022-01-25 10:54:13 -08:00
Mark Young 03656b26a4 Fix debug utils wrapping in tests
Also fix another compiler warning.
2022-01-07 16:56:38 -07:00
Charles Giessen 9661a8c019 Refactor tests FrameworkEnvironment class
Move all the behavior found in child classes of FrameworkEnvironment to the
FrameworkEnvironment itself, allowing easier composibility of behavior. The
original idea was to allow special case behavior for specific test cases but
this resulted in a lot of code duplication and difficulty combining different
framework behavior, such as adding a fake ICD and setting VK_ICD_FILENAMES at
the same time.
2021-12-10 17:08:23 -07:00
Charles Giessen be8d1315b6 test: Fix compiler warnings in MSVC
Warnings/fixes include:
* strcpy/strncpy/wstrcpy
* Dropping static on inline functions
* Use localtime_s
* Name shadowing
* Use wcstombs_s
* 32<->64 bit int conversion
* Silence spurious C4996 generated in vs2015
2021-11-04 12:19:14 -06:00
Charles Giessen d76cef07ce test: Improved Test Wrapper interface
Made InstanceWrapper and DeviceWrapper simpler to use by moving them to test_environment
then making the Create() member functions and doing the gtest assertions in the function
itself.

Additionally:
Removed the `detail` namespace in the test_environment.
Renamed get_new_test_icd/layer to just `reset_icd/layer`. This is clearer about what it
is doing and makes the interface more expressive with code such as
`env->reset_icd().SetMinInterfaceVersion(5);`
2021-09-06 18:19:14 -06:00
Charles Giessen 57c6c8e8c7 test: Drop fp_ from function pointer names
Change-Id: Ibd047e99f442d4a9755ac186e16b3620d3544e37
2021-07-06 10:03:29 -06:00
Charles Giessen db6662c3f8 test: Refactor tests that use VK_ICD_FILENAMES
Change-Id: I34117fd500f7110669ae19d32ff1e1be920238a9
2021-06-07 14:07:38 -07:00
Charles Giessen f6fab4352d test: Control process elevation on Windows
Since the loader only uses environment variables if the process is
not running with elevated priviledges, the test harness needs to be
able to control that aspect to ensure consistency as CI systems may
run the tests in an 'elevated' context.

Change-Id: I8b15a1ecd4ab4960049ba198af8199943e872bba
2021-06-07 14:07:38 -07:00
Charles Giessen b9f4dd01e2 test: Delete files properly on windows
Move windows specific error reporting to test_util.h
This allows for its use anywhere its required.

Change-Id: I14a0da85dc0d3f4e651b99aa005469b47d98d940
2021-06-07 14:07:38 -07:00
Charles Giessen 2c1e399d8c test: Add regression tests code
These files are the current 4 source code files used to create the
regression test suite

loader_regression_tests.cpp and loader_version_tests.cpp contain a
majority of the tests.

loader_wsi_test.cpp is all the tests pertaining to the WSI functions
in the loader.

loader_testing_main.cpp contains the `main()` which has windows CRT
specific calls to disable popups and debug aserts.

There are two executables created, test_regression and test_wsi.
test_regression is both regression_tests and version_tests. test_wsi
is the WSI tests. These tests are separate as they rely on linking
with platform specific windowing libraries which may not be present
on a CI system.

Change-Id: I1c02b0f82826d337599f4a9a7c02dde40ea5afa3
2021-05-27 16:59:28 -06:00