class LdLoadZirconLdsvcTestsBase
Defined at line 31 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
This is the common base class for test fixtures that use a
fuchsia.ldsvc.Loader service and set expectations for the dependencies
loaded by it. This class proxies calls to the MockLoaderServiceForTest and
passes the function it should use to retrieve test VMO files.
It takes calls giving ordered expectations for Loader service requests from
the process under test. These must be used after Load() and before Run()
in test cases.
Public Methods
std::string FindInterp (zx::unowned_vmo vmo)
Defined at line 34 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
void LdsvcExpectConfig (std::optional<std::string_view> config)
Optionally expect the dynamic linker to send a Config(config) message.
Defined at line 34 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
void LdsvcExpectDependency (std::string_view name)
Prime the MockLoaderService with the VMO for a dependency by name,
and expect the MockLoader to load that dependency for the test.
Defined at line 42 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
zx::channel TakeLdsvc ()
Defined at line 44 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
zx::vmo GetLibVmo (std::string_view name)
Defined at line 46 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
void VerifyAndClearNeeded ()
Defined at line 50 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
void LdsvcPathPrefix (std::string_view executable, std::optional<std::string_view> libprefix)
Defined at line 105 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
std::optional<std::string> ConfigFromInterp (const std::filesystem::path & interp, std::optional<std::string_view> expected_config)
Use the PT_INTERP string to update LdsvcPathPrefix() and then return the
config found, which can be passed to LdsvcExpectConfig(). The optional
argument makes it a failure if the extract Config() string doesn't match,
and doesn't change LdsvcPathPrefix().
Defined at line 38 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
zx::vmo GetExecutableVmoWithInterpConfig (std::string_view executable, std::optional<std::string_view> expected_config)
This just combines GetExecutableVmo, FindInterp, ConfigFromInterp, and
LdsvcExpectConfig.
Defined at line 50 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
std::optional<std::string> ConfigFromInterp (zx::unowned_vmo executable_vmo, std::optional<std::string_view> expected_config)
The same, but extract the PT_INTERP string from the executable file VMO.
Defined at line 64 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
void NeededViaLoadSet (elfldltl::Soname<> set_name, std::initializer_list<std::string_view> names)
Uses to TestElfLoadSet::Get(test_name) to do Needed() within the test's
package namespace based on the libprefix found in the TestElfObject data
rather than a PT_INTERP in the file.
Defined at line 89 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
Protected Methods
void Init (std::initializer_list<std::string_view> args, std::initializer_list<std::string_view> env)
Defined at line 18 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
TestProcessArgs & LdStartupProcArgs (TestProcessArgs & bootstrap, fbl::unique_fd log_fd, zx::unowned_vmar allocation_vmar)
Defined at line 24 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
zx::vmo GetInterp (std::string_view executable_name, std::optional<std::string_view> expected_config)
Defined at line 59 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.cc
const std::vector<std::string> & argv ()
Defined at line 84 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
const std::vector<std::string> & envp ()
Defined at line 85 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
void LdsvcExpectNeeded ()
Defined at line 93 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h
MockLoaderServiceForTest & mock ()
Defined at line 103 of file ../../sdk/lib/ld/test/ld-load-zircon-ldsvc-tests-base.h