Commit Graph

154 Commits

Author SHA1 Message Date
Charles Giessen
b1b5de42ca test: Add test framekwork layer utility
At the present moment, this change is to define simple layer
utilities that tests in the future may use.

Change-Id: I9ab5e1950da64061997891a0527d0f70a49e41e7
2021-05-27 16:59:28 -06:00
Charles Giessen
25470c9111 test: Add framework platform abstraction shim
The loader queries various platform systems for info such as the
location of ICDs and layers. To isolate the loader during testing
from the system it is running on, the platform shim intercepts the
necessary functions so that the contents of the systems queried by
the loader can be configured by tests.

On windows this involves 2 aspects:
Detouring Win32 API functions and redirecting the registry.
The `Detours` library is used to easily capture Win32 API calls.
And the registry uses `RegOverridePredefKey` to redirect the registry
entries the loader accesses.

On linux this only involves intercepting 3 functions; `opendir`,
`access`, and `fopen`. This allows the framework to tell the loader
what to actuall open/access/fopen. These interceptions call the
underlying function but with altered arguments, specifically to
paths the tests set up.

Change-Id: I3531a1cb190c489ffd9f1f0549d0ebcacb3818c5
2021-05-27 16:59:28 -06:00
Charles Giessen
b7d170b7ad tests: Add TestICD for mocking ICD's
The TestICD is a configurable ICD which can recreate much of the
behavior the loader expects of an ICD. Combined with a direct line
of communication between the tests and TestICD, tests can setup
specific conditions that have a known response from the loader,
thus allowing proper regression testing.

Change-Id: I84303f0ddb6011fc1b76dad25fd249abb2da29c9
2021-05-27 16:59:28 -06:00
Charles Giessen
2703d19221 test: Add framework cmake and utilities
Create the CMake infrastructure for a testing framework.
`test_util.h/.cpp` contains the core macros, wrappers, and utilities.
framework_config.h.in is the header that other components include
to get the full path to binaries on a system.

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