Get real path to layer & driver binaries & Refactor test framework#1746
Conversation
Queries the real path of loaded layers and drivers so that logging messages
contain the exact path used, instead of the path the loader gave to dlopen/
LoadLibrary. This ensures that logs are as accurate as can be, as the dynamic
linker may not respect the passed in library (due to environment variables
or other mechanisms which change which binary is loaded).
This requires normalizing paths before comparison, as the path given to
dlopen/LoadLibrary may represent the same location as the queried path, but
might not be identical strings. Normalization is done using the realpath()
function on platforms that support it, and a fallback implementation is
used elsewhere. The implementation only removes extra directory separators
("//"), extra current directory specifiers ("/./"), and removes relative
to parent directory specifiers ("/foo/../").
Makes many changes to test infrastructure: * Split test_util into separate files for maintainability * Move new files into tests/framework/util * Move FolderManager into separate file from test_environment * Rename COMMON_UNIX_PLATFORMS to TESTING_COMMON_UNIX_PLATFORMS * Rewrote unix path redirection logic, relies on FileSystemManager * Relative paths are actually relative now * Split unsecured folder location into unsecured driver/implicit layer/explicit layer/settings * Fix bugs in tests that are attributable to old path redirection logic. * Use normalized paths in test framework - ie normalize paths so they can be compared easily * Make running with elevated privileges a framework level setting * Split tests that change elevated privileges into separate tests * Framework can set home & xdg env-vars at startup * Platform specific folders are only defined on those platforms * PlatformShim::add_manifest is now windows only, reflecting that only windows implemented it
The searching for the loader_settings.json file relied on faulty assumptions about which paths would be used, notably ignoring XDG env-vars, as well as SYSCONFDIR, EXTRASYSCONFDIR, and the fallback xdg paths.
|
CI Vulkan-Loader build queued with queue ID 497523. |
|
CI Vulkan-Loader build queued with queue ID 497540. |
|
CI Vulkan-Loader build # 3125 running. |
|
CI Vulkan-Loader build # 3125 passed. |
|
While this PR does make changes to the loader source, it should not affect behavior of applications for the following reason: All of the logic to get the 'real' path to a binary is done after loading the binary, meaning that paths are not modified at all before calling dlopen/LoadLibrary. This ensures that existing behavior remains correct. The main change is to the paths that are printed in the log, meaning that the user will have a much better indication of what actually was loaded, instead of just printing the path that was attempted to be loaded. For this reason, I am going to go ahead and merge it in. |
Queries the real path of loaded layers and drivers so that logging messages
contain the exact path used, instead of the path the loader gave to dlopen/
LoadLibrary. This ensures that logs are as accurate as can be, as the dynamic
linker may not respect the passed in library (due to environment variables
or other mechanisms which change which binary is loaded).
This requires normalizing paths before comparison, as the path given to
dlopen/LoadLibrary may represent the same location as the queried path, but
might not be identical strings. Normalization is done using the realpath()
function on platforms that support it, and a fallback implementation is
used elsewhere. The implementation only removes extra directory separators
("//"), extra current directory specifiers ("/./"), and removes relative
to parent directory specifiers ("/foo/../").
Makes many changes to test infrastructure: