Commit Graph

3654 Commits

Author SHA1 Message Date
Charles Giessen
9b11eca78c test: Fix extra } in layer manifest printer 2021-09-09 11:14:49 -06:00
Charles Giessen
d81a521e03 loader: Move layer cleanup to a single function
Previously the logic to free all the components of loader_layer_properties was spread
across a half dozen different places, resulting in leaks. This commit moves the logic
into a single location, centralizing the process and making it easier to add new
fields to the loader_layer_properties struct.
2021-09-09 11:14:49 -06:00
Mike Schuchardt
7d7cdaa17b build: Update to header 1.2.191
- Update known-good
- Generate source
2021-09-08 15:22:33 -07:00
Charles Giessen
3710001521 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
20cf221e72 loader: Make all loader functions use snake_case
Before it was a mix of camelCase, PascalCase, and snake_case.

"Vulkan" functions, like terminator_GetPhysicalDeviceProperties, remain in camelCase.
This way it looks visually similar with the actual vulkan functions they correspond to.
2021-09-03 11:11:25 -06:00
Mark Young
ee4d7bb1bf Fix loader not knowing about extensions enabled in layers
This change allows the loader to know extensions enabled in the layers
as well as extensions enabled but handled by layers.
This should fix several issues where the enabled extensions is not
known soon enough for layers to use.
2021-09-02 14:31:28 -06:00
Mark Young
4c8bf4cc69 Update XDG paths
Issue #245 was created because we were not properly using the XDG
paths.
This change updates the path search order to be more correct.
While an argument could be made that the loader really should only
be looking in the DATA folders, we already are looking in the
CONFIG folders.  Therefore, just correct the order and also make
sure the proper _HOME variable for CONFIG and DATA is searched
first (but only in non-superuser mode).
2021-09-02 07:51:43 -06:00
Charles Giessen
140738f852 test: Add handle_assert helper functions
Added functions which check handle values using GTEST. Includes:
checking for null, not null, equality of two handles, and variants that
operate on vectors and arrays.
2021-08-31 15:04:40 -06:00
Charles Giessen
9b66d3ef84 test: Move DeviceGroup tests to regression suite 2021-08-31 15:04:40 -06:00
Charles Giessen
b97855a86c test: Add TestICD DeviceGroup support
Add support for tests which use device groups by adding a new structure that
holds pointes to PhysicalDevice structs and implementing the necessary vulkan
API calls.

This commit also:
 - Formats test_icd.cpp
 - Makes vk_icdGetPhysicalDeviceProcAddr return stuff by refactoring the
   instance procaddr functions
2021-08-31 15:04:40 -06:00
Charles Giessen
d6a5a7ae31 scripts: Remove loader_icd_init_entries duplicate
Seems to be a copy-paste error that makes the function declaration appear twice.
2021-08-30 13:10:33 -06:00
Mike Schuchardt
4e55fdb4d2 build: Update to header 1.2.190
- Update known-good
- Generate source
2021-08-30 09:17:43 -07:00
Charles Giessen
39dd126e16 build: Silence MSVC warning of replacing /GR 2021-08-26 11:38:55 -06:00
Charles Giessen
d7c8139c37 test: Update 32/64 tests to check the log
Use the DebugUtilsLogger to verify that the loader is downgrading the error
level of dll/so's from ERROR to INFO
2021-08-26 10:51:15 -06:00
Charles Giessen
669c41d69f test: Add DebugUtilsWrapper
This wrapper allows easy reading of the log output through the debug utils
messenger infrastructure. Since getting the stdout/stderr is not well
supported by googletest, this allows tests to be written which check for
specific log messages to be emitted, allowing another way to verify the
loader is behaving as expected.
2021-08-26 10:51:15 -06:00
Charles Giessen
5661252091 loader: Downgrade wrong arch errors on windows
On linux, when the loader fails to load a .so if it was due to being on the
wrong architecture, the loader downgraded the error to INFO level. This
commit does the same thing for windows. Error code 193 is winapi's way to
signify that the dll failed to load cause of the architecture.
2021-08-26 10:51:15 -06:00
Mike Schuchardt
90fd66f60f build: Update to header 1.2.189
- Update known-good
- Generate source
2021-08-17 12:55:15 -07:00
Charles Giessen
8a3a1676ef test: Set VK_LAYER_PATH properly 2021-08-16 18:06:03 -06:00
Charles Giessen
b926e41607 test: Update Device Layers Match test
Move the old EnumerateDeviceLayers.LayersMatch to the new framework,
implementing the necessary components in the TestLayer code path.
2021-08-16 18:06:03 -06:00
Charles Giessen
413673b249 test: Use proper allocation count in tests
The test used to only keep track of the maximum number of allocations and fail
if it was exceeded, as calling free would decrease this number. Now tests use
the total number of times allocate was called, and realloc was added to this
metric. This should offer better OOM coverage due to failing at each and
every possible OOM place. The code does make sure not to increase the count
if realloc was called to 'downsize' the allocation, which shouldn't cause
OOM to occur ever.
2021-08-16 15:18:43 -06:00
Charles Giessen
55e607326f test: Add test for PR #639
This test tries to recreate an out of memory condition which causes
a binary of the wrong type to be confused with a valid binary, which
causes VK_ERROR_INCOMPATIBLE_DRIVER to be returned instead of VK_SUCCESS
(Or OOM if the case may be)
2021-08-16 15:18:43 -06:00
Charles Giessen
de37ef3a3a loader: Fix accidental error propagation
When a dll/so of the wrong architecture is found, the loader would
return ERROR_INCOMPATIBLE_DRIVER from `loader_scanned_icd_add`.
Previously it would return VK_SUCCESS, but that caused the logic to
not skip over the ICD. This commit fixes the issue where the error
code would be propagated out of the function, which shouldn't happen
since there may be other drivers which do successfully load.
2021-08-16 13:40:34 -06:00
WenqingLiAMD
024535bdfe Fix Vulkan CTS testcase bug: "create_instance_device_intentional_alloc_fail"
In function loader_scanned_icd_add, if open_library fails, VK_SUCCESS
is still returned, which would cause the bad number of good ICDs.
2021-08-16 11:42:09 -06:00
Charles Giessen
f1accaba1b test: Simplify wrong arch tests by adding a macro
Added the `CURRENT_PLATFORM_DUMMY_BINARY` macro which thanks to platform
defines contains the path of the binary which is 'wrong' for the current
architecture. EX: compiling with Win64, it points to the Win32 binary, and vice
versa when compiling for Win32. Same logic applies for linux 64/32 bit.
2021-08-16 11:38:17 -06:00
Charles Giessen
f06143bf8f test: Add windows 32/64 bit binary tests
Added both layer and ICD tests. Included lengthy description of why the test
successfully creates an instance even though it really shouldn't.
2021-08-16 11:38:17 -06:00
Charles Giessen
64665f7d21 test: Add linux x64 and x86 for wrong binaries
Test only looks for ICD binaries.
2021-08-16 11:38:17 -06:00
Charles Giessen
85765687d2 test: Add ELF test binaries for 32 and 64 bit
These binaries are necessary for testing whether the loader correctly
ignores binaries of the wrong architecture. Since they are data files
more than executables, they are being checked in.

Currently only Unix binaries are added but in the future windows along
with any other platform binaries will be added.
2021-08-16 11:38:17 -06:00
Charles Giessen
de99f8f6be loader: Make use of a generated header version
This changes the loader to always set the version to the one which was used when
generating the source files that are checked into the repo, instead of using the
version gotten from the Vulkan-Headers find cmake file.

Change-Id: Id0955ddfd10e35e0f358f5a77799d8baa4992b04
2021-08-11 15:17:20 -06:00
Charles Giessen
52859e7695 loader: Reformated loader source code
Previously, clang-format was required for all new commits but the codebase
itself wasn't conformant. This commit formats the source files in the loader
folder.
2021-08-11 15:16:56 -06:00
Charles Giessen
773f1d2076 test: Revamp which linux paths are redirected
Adds FALLBACK_DATA_DIRS, FALLBACK_CONFIG_DIRS, SYSCONFDIR, and EXTRASYSCONFDIR
to the list of redirected paths. They were previously 'covered' by manual entries.
This commit makes them responsive to changes in the build system.

This commit also makes sure that the path used for redirection is one searched by
the loader by using the SYSCONFIG variable. Previously it would use /usr/local/etc/
which was only correct on systems where CMAKE_INSTALL_PREFIX was set to /usr/local.
2021-08-11 15:16:33 -06:00
Mark Young
baf0ffd791 Fix environment test failure.
It was looking for a specific output for the manifest file search string.
Re-add that string for now.
2021-08-11 10:20:01 -06:00
Mike Schuchardt
fbb56aacce build: Update to header 1.2.188
- Update known-good
- Generate source (no change)
2021-08-10 12:40:45 -07:00
Mike Schuchardt
1d30345f2b scripts: Use altlen instead of parsing latexmath
KhronosGroup/Vulkan-ValidationLayers switched to this method a while ago
and this syncs the KhronosGroup/Vulkan-Loader version of
helper_file_generator.py to match.
2021-08-10 12:40:45 -07:00
Mark Young
b0841ad150 Allow "icd" as well as "implem" for VK_LOADER_DEBUG 2021-08-10 12:10:47 -06:00
Mark Young
1941128d41 Add layer and implementation-specific logging
Add logging that will allow end-users to specifically just look at
messages for layers and implementations/ICDs.
Setting VK_LOADER_DEBUG to include one of the following:
  - layer        : enables layer-specific logging
  - implem       : enables implementation/ICD-specific logging
2021-08-10 12:10:47 -06:00
Mark Young
9e43839765 Fix loader_log messages to use LOADER_ log levels
The loader_log messages were using the DEBUG_REPORT log levels
which just happened to coincide with the existing LOADER_ log levels.
Going forward, to add layer logging in its own level, this would not
have worked.
2021-08-10 12:10:47 -06:00
Charles Giessen
a2edd93673 test: Prevent macro collision 2021-08-06 16:00:06 -06:00
Charles Giessen
1f522f5570 test: Make MetaLayer test add extensions
Needed to fixup more of the manifest writer in the process
2021-08-06 16:00:06 -06:00
Charles Giessen
363f736a03 test: Make invalid meta layer test more comprehensive
This required fixing a few bugsin the Manifest file printing logic
2021-08-06 16:00:06 -06:00
Charles Giessen
6259c5754d test: Add simple invalid-meta layer test
Creates a meta layer whose component layers do not exist
2021-08-06 16:00:06 -06:00
Samiullah Khawaja
4c901a731a Deallocate the extension lists when deleting an item from layer list
Vulkan Loader loads the meta layer list and filters the ones that are
not valid. During filter it deallocates the attributes of the loaded
meta layer but does not deallocate the associated extension list.
2021-08-04 14:09:17 -06:00
Charles Giessen
f7aab801ef test: Clear TestICDs before each test
Calling `dlclose` doesn't necessarily mean that the static variables will
be reset nor the libraries destructor gets called. This caused cascading
errors in tests on linux with GCC. By always manually resetting the ICD
or Layer before each test, we prevent any funny business from occuring.
2021-08-04 09:57:16 -06:00
Charles Giessen
78c3e74427 test: Update tests/README.md
Include note to always destroy the instance at the end of a test.
2021-08-04 09:57:16 -06:00
Charles Giessen
ab97762603 test: Make all tests call vkDestroyInstance
This caused spurious failures in other tests due to the dynamic library
not being closed.
2021-08-04 09:57:16 -06:00
Charles Giessen
3d635aceda test: Add CreateInstance.LayerPresent test 2021-08-04 09:57:16 -06:00
Charles Giessen
63a9f8dc4c test: Update framework_config to include paths to layer binaries 2021-08-04 09:57:16 -06:00
Charles Giessen
9d4e0bdc9a test: Add noexcept in test_environment 2021-08-04 09:57:16 -06:00
Charles Giessen
1550eeb10a test: add CreateInstance.LayerNotPresent test
Remove the corresponding test in loader_validation_tests.cpp
2021-08-04 09:57:16 -06:00
Charles Giessen
56722cb3d6 test: Implemente layer create instance/device
Added the necessary bits to make calling create instance and device function,
though it may not work in all circumstances
2021-08-04 09:57:16 -06:00
Mike Schuchardt
fa67fe730d build: Update to header 1.2.187
- Update known-good
- Generate source (no change)
2021-08-03 15:16:04 -07:00