class TestProcessArgs
Defined at line 29 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
This is a "builder"-style object that collects information to be packed into
the processargs message(s).
Public Methods
TestProcessArgs & AddHandle (uint32_t info, zx::handle handle)
Defined at line 33 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddDuplicateHandle (uint32_t info, zx::unowned_handle ref)
This duplicates the handle.
Defined at line 39 of file ../../sdk/lib/ld/testing/test-processargs.cc
template <typename T>
TestProcessArgs & AddHandle (uint32_t info, T && handle)
These work with any zx::foo type.
Defined at line 41 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddFd (int fd, zx::handle handle)
This is just a shorthand for using PA_HND(PA_FD, fd).
Defined at line 45 of file ../../sdk/lib/ld/testing/test-processargs.cc
template <typename T>
TestProcessArgs & AddDuplicateHandle (uint32_t info, zx::unowned<T> ref)
Defined at line 46 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddFd (int test_fd, fbl::unique_fd local_fd)
Defined at line 49 of file ../../sdk/lib/ld/testing/test-processargs.cc
template <typename T>
TestProcessArgs & AddFd (int fd, T && handle)
Defined at line 51 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddClonedFd (int test_fd, int local_fd)
This doesn't consume the fd, but immediately clones it. It's about
equivalent to `AddFd(test_fd, fbl::unique_fd{dup(local_fd)})`.
Defined at line 55 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddName (std::string_view name, uint32_t info, zx::channel handle)
This adds a name table entry along with a handle of the given PA_NS_* type
using the new entry's index.
Defined at line 61 of file ../../sdk/lib/ld/testing/test-processargs.cc
size_t next_name ()
This returns the index of the entry the next AddName call will append.
Defined at line 62 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddName (std::string_view name)
Append one name to the name table.
Defined at line 65 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddInProcessTestHandles ()
This calls AddProcess and AddThread.
Defined at line 67 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddProcess (zx::unowned_process process)
These add the handles for the process and initial thread.
Defined at line 71 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddThread (zx::unowned_thread thread)
Defined at line 75 of file ../../sdk/lib/ld/testing/test-processargs.cc
template <auto names>
TestProcessArgs & SetNames (std::ranges::input_range auto names)
This replaces the entire name table.
Defined at line 75 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddLdsvc (zx::channel ldsvc)
Add a fuchsia.ldsvc.Loader channel handle. If this is called with a null
handle, it will clone the calling process's own loader service.
Defined at line 79 of file ../../sdk/lib/ld/testing/test-processargs.cc
template <auto args>
TestProcessArgs & SetArgs (std::ranges::input_range auto args)
Defined at line 83 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
template <auto args>
auto InterpArgs (std::ranges::input_range auto args)
If the argument would be given to SetArgs for the main (libc) message, then
this yields an argument to SetArgs for the dynamic linker's message.
Defined at line 93 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddAllocationVmar (zx::vmar vmar)
Add the VMAR to use for allocation and loading.
Defined at line 94 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddAllocationVmar (zx::unowned_vmar vmar)
Defined at line 98 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddSelfVmar (zx::vmar vmar)
Add the VMAR for the dynamic linker's load image.
Defined at line 86 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddSelfVmar (zx::unowned_vmar vmar)
Defined at line 90 of file ../../sdk/lib/ld/testing/test-processargs.cc
template <auto env>
TestProcessArgs & SetEnv (std::ranges::input_range auto env)
Defined at line 101 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
TestProcessArgs & AddExecutableVmo (zx::vmo vmo)
Add the VMO for the executable.
Defined at line 102 of file ../../sdk/lib/ld/testing/test-processargs.cc
TestProcessArgs & AddStackVmo (zx::vmo vmo)
Add the VMO for the initial stack.
Defined at line 106 of file ../../sdk/lib/ld/testing/test-processargs.cc
void PackBootstrap (zx::unowned_channel bootstrap_sender)
This packs up a message and sends it on the given channel. When this
returns without raising a gtest fatal failure, the state of the object is
cleared out so it it could be used for another call.
Defined at line 110 of file ../../sdk/lib/ld/testing/test-processargs.cc
template <auto env>
auto InterpEnv (std::ranges::input_range auto env)
If the argument would be given to SetEnv for the main (libc) message, then
this yields an argument to SetEnv for the dynamic linker's message.
Defined at line 111 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
zx::channel & bootstrap_sender ()
Access the sender channel if one was created by MakeBootstrap() or
PackBootstrap(). Once no more PackBootstrap() calls will be made, this
can be moved-from or reset to close or take ownership of the channel end.
Defined at line 164 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/test-processargs.h
zx::channel PackBootstrap ()
This creates a new channel and returns the receiver end to be passed to
the new process. Before returning, it sends a bootstrap message on the
sender side of the channel and clears the builder state. The sender side
of the channel is retained in this object. If this is called again when a
channel already exists, it sends a second message on that same channel; in
that case it always returns a null handle. If anything went wrong, this
raises a gtest fatal failure.
Defined at line 214 of file ../../sdk/lib/ld/testing/test-processargs.cc
std::optional<size_t> GetStackSize ()
This returns the stack size to use for the initial thread,
if the bootstrap protocol wants to control that.
Defined at line 114 of file ../../sdk/lib/ld/testing/test-processargs.cc
zx::channel MakeBootstrap ()
This just creates a new channel and installs the other end as
bootstrap_sender(), without packing anything into it.
Defined at line 204 of file ../../sdk/lib/ld/testing/test-processargs.cc
bool empty ()
This returns true if the object has no pending data or handles added since
construction or the last PackBootstrap() call.
Defined at line 230 of file ../../sdk/lib/ld/testing/test-processargs.cc