Skip to content

Simplify libc-based tests with shared helpers #4725

@RalfJung

Description

@RalfJung

Many of our libc-based tests are enormously verbose: they directly interact with the libc APIs, which is cumbersome from Rust. (They also often let-bind way more than is necessary or useful.)

The goal of this issue is to make the tests more concise and therefore more readable and easier to maintain. #4724 and #4721 and good examples for the kinds of things we can do:

  • use C string literals instead of manually mucking about with CString or manually null-terminating byte slice literals
  • use errno_result or errno_check instead of manually checking the result of functions that report their error via errno
  • use read_all_into_array instead of read/read_all, and write_all_from_slice instead of write/write_all (this won't always work!)
  • use the epoll helpers in the epoll tests (I only ported a few of them)

Metadata

Metadata

Assignees

Labels

A-testsArea: affects our test suite or CIC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementE-good-first-issueA good way to start contributing, mentoring is available

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions