refactor: don't call OsLibrary::load directly, use function pointer

this allows mocking this call in ULT

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-08-19 12:50:05 +00:00
committed by Compute-Runtime-Automation
parent 006285105d
commit 579af57161
51 changed files with 124 additions and 137 deletions

View File

@@ -26,11 +26,12 @@ struct ConvertibleProcAddr {
class OsLibrary {
protected:
OsLibrary() = default;
static OsLibrary *load(const std::string &name) { return loadAndCaptureError(name, nullptr); }
public:
virtual ~OsLibrary() = default;
static OsLibrary *load(const std::string &name) { return loadAndCaptureError(name, nullptr); }
static decltype(&OsLibrary::load) loadFunc;
static OsLibrary *loadAndCaptureError(const std::string &name, std::string *errorValue);
static const std::string createFullSystemPath(const std::string &name);