Skip to content

Revisit test_mount's test runner #248

Open
@kamalmarhubi

Description

@kamalmarhubi

#231 enables mount. The test includes a hackish little macro-based test runner because the user and mount namespaces must be entered with unshare(2) before any threads spawn, and the built in test runner doesn't allow that.

Relevant bit of unshare(2) man page:

`CLONE_NEWUSER` requires that the calling process is not
threaded; specifying `CLONE_NEWUSER` automatically implies
`CLONE_THREAD`.

It would be better if we could use the default test runner, but this is not possible right now. We'd need either:

  1. the ability to specify RUST_TEST_THREADS=1 for this test from Cargo.toml, and then call unshare(2) from use sync::Once at the start of each test to ensure we've already entered the namespaces
  2. the ability to run setup code before the test harness spawns any threads

I think both are worthwhile options, but for this use case 2. would be nicer, as it would then allow the tests to run in concurrently which might be quicker.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kamalmarhubi

        Issue actions

          Revisit test_mount's test runner · Issue #248 · nix-rust/nix