Enumerations

enum AccessType
Name Value
Read 0
Write 1

Defined at line 538 of file ../../src/starnix/tests/syscalls/cpp/test_helper.h

Records

Functions

  • void DropAllCapabilities ()

    Drops all capabilities from the effective, permitted, and inheritable sets.

    Defined at line 18 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • bool HasCapability (int cap)

    Checks if a capability is in the effective set.

    Defined at line 27 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void UnsetCapability (int cap)

    Unsets a capability from the effective set.

    Defined at line 30 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • bool HasCapabilityEffective (int cap)

    Checks whether a capability is in the thread's effective set.

    Defined at line 33 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • bool HasCapabilityPermitted (int cap)

    Checks whether a capability is in the thread's permitted set.

    Defined at line 43 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • bool HasCapabilityInheritable (int cap)

    Checks whether a capability is in the thread's inheritable set.

    Defined at line 53 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • bool HasCapabilityAmbient (int cap)

    Checks whether a capability is in the thread's ambient set.

    Defined at line 62 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • bool HasCapabilityBounding (int cap)

    Checks whether a capability is in the thread's bounding set.

    Defined at line 66 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void UnsetCapabilityEffective (int cap)

    Removes a capability from the thread's effective set.

    Defined at line 69 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void UnsetCapabilityPermitted (int cap)

    Removes a capability from the thread's permitted set.

    Defined at line 80 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void UnsetCapabilityInheritable (int cap)

    Removes a capability from the thread's inheritable set.

    Defined at line 91 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void UnsetCapabilityAmbient (int cap)

    Removes a capability from the thread's ambient set.

    Defined at line 102 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void UnsetCapabilityBounding (int cap)

    Removes a capability from the thread's bounded set.

    Defined at line 107 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void DropAllAmbientCapabilities ()

    Drops all capabilities from the ambient set.

    Defined at line 147 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void SetCapabilityEffective (int cap)

    Sets a capability in the thread's effective set.

    Defined at line 110 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void SetCapabilityPermitted (int cap)

    Sets a capability in the thread's permitted set.

    Defined at line 121 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void SetCapabilityInheritable (int cap)

    Sets a capability in the thread's inheritable set.

    Defined at line 132 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void SetCapabilityAmbient (int cap)

    Sets a capability in the thread's ambient set.

    Defined at line 143 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc

  • void SetCapabilityBounding (int cap)

    Sets a capability in the thread's bounding set.

  • void waitForChildSucceeds (unsigned int waitFlag, int cloneFlags, int (*)(void *) childRunFunction, int (*)(void *) parentRunFunction)

    Defined at line 324 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • void waitForChildFails (unsigned int waitFlag, int cloneFlags, int (*)(void *) childRunFunction, int (*)(void *) parentRunFunction)

    Defined at line 340 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::string get_tmp_path ()

    Defined at line 354 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::string GetSystemDynamicLinkerPath ()

    Returns the path to the system dynamic linker requested by /proc/self/exe.

    Defined at line 364 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::string GetTestResourcePath (const std::string & resource)

    Returns the path to a test resource named `resource`, which should be in

    "data" relative to the current working directory.

    Defined at line 396 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::ostream & operator<< (std::ostream & os, const MemoryMappingExt & mapping)

    Defined at line 532 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::optional<size_t> parse_field_in_kb (std::string_view value)

    Defined at line 449 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • fit::result<int> SetCasefold (const std::string & path, bool enable)

    Defined at line 815 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::optional<MemoryMapping> find_memory_mapping (fit::function<bool (const MemoryMapping &)> match, std::string_view maps)

    Returns the first memory mapping that matches the given predicate.

    Defined at line 463 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::optional<MemoryMapping> find_memory_mapping (uintptr_t addr, std::string_view maps)

    Defined at line 480 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::optional<MemoryMappingExt> find_memory_mapping_ext (fit::function<bool (const MemoryMappingExt &)> match, std::string_view maps)

    Same as above, but with info from smaps

    Defined at line 486 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::optional<MemoryMappingExt> find_memory_mapping_ext (uintptr_t addr, std::string_view maps)

    Defined at line 524 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::string RandomHexString (size_t length)

    Returns a random hex string of the given length.

    Defined at line 548 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • bool HasSysAdmin ()

    Returns true if running with sysadmin capabilities.

    Defined at line 560 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • bool HasCapability (uint32_t cap)

    Returns true if running with the given capability.

  • bool IsStarnix ()

    Returns true if running on Starnix. This is likely only necessary when there are known bugs.

    Defined at line 562 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • bool IsKernelVersionAtLeast (int min_major, int min_minor)

    Returns true if reported kernel version is equal or greater than a given one.

    Defined at line 567 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • void RecursiveUnmountAndRemove (const std::string & path)

    Unmount anything mounted at or under `path` and remove it.

    Defined at line 579 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • bool TryRead (uintptr_t addr)

    Attempts to read a byte from the given memory address.

    Returns whether the read succeeded or not.

    Defined at line 650 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • bool TryWrite (uintptr_t addr)

    Attempts to write a zero byte to the given memory address.

    Returns whether the write succeeded or not.

    Defined at line 659 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • int MemFdCreate (const char * name, unsigned int flags)

    Wrapper for the memfd_create system call.

    Defined at line 640 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • int PidFdOpen (pid_t pid, unsigned int flags)

    Wrapper for the pidfd_open system call.

    Defined at line 644 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • testing::AssertionResult WaitUntilBlocked (pid_t target, bool ignore_tracer)

    Wait until the target process indicates a sleeping (S) or traced sleeping (t) state.

    Defined at line 666 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • testing::AssertionResult WaitUntilZombie (pid_t target)

    Wait until the target process indicates a zombie (Z) state.

    Defined at line 672 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • testing::AssertionResult WaitForTaskState (pid_t pid, pid_t tid, fit::function<bool (std::string_view)> predicate)

    Loop until the target task's process state in /proc/

    <pid

    >/task/

    <tid

    >/stat satisfies the given

    predicate function. The string passed to the predicate is the task state (R, S, T, Z, etc.).

    Defined at line 677 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • testing::AssertionResult TestThatAccessSegfaults (void * test_address, AccessType type)

    Checks whether the provided access segfaults.

    Defined at line 701 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • Rendezvous MakeRendezvous ()

    Constructs a new pipe-backed `Poker`-`Holder` pair for synchronization of two

    threads or processes.

    Defined at line 891 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • Rendezvous MakeRendezvous (ScopedPipe pipe)

    Constructs a `Poker`-`Holder` pair from an existing pipe.

    Defined at line 893 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • fit::result<int, std::vector<MountInfo>> ReadMountInfo ()

    Reads and parses "/proc/self/mountinfo".

    Defined at line 900 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::optional<MountInfo> ReadMountInfoLine (const std::string & path)

    Reads "/proc/self/mountinfo" and returns the info for the mount at `path`.

    If no such mount is found, or the file cannot be read, the result will be an empty optional.

    Defined at line 946 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • fit::result<int, std::set<std::string>> ListDirectory (const char * dir)

    Returns the set of file names in `dir`. `.` and `..` are not included.

    If `dir` does not exist or cannot be opened, returns an error (e.g. ENOENT).

    Defined at line 961 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc

  • std::vector<std::string> WaitForDevice (const std::set<std::string> & ls_before)

    Polls `/dev/input` for up to 5 seconds until new device entries appear that were

    not present in `ls_before`.

    Returns a vector of newly appeared device names. If the poll times out and no

    new devices appeared, the returned vector will be empty. Note that more than one

    device name may be returned if multiple devices appeared.

    Defined at line 979 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc