Selectively specifying elevated privilege requirement for test

Open
#11,482 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust
Domain
testing

Research direction

Start by reviewing the linked Cargo issue #5999 and the existing cargo test behavior; the report names no files or tests to inspect. Clarify how a test declares an elevated-privilege requirement and how cargo test should handle marked tests when privilege is absent, using the proposed behavior as the completion criteria.

Written by the indexing model from the issue text.

Description

C-feature-request Command-test S-needs-info
Problem

I am developing an embedded SW with rust which definitely requires root privilege to access HW.
The issue https://github.com/rust-lang/cargo/issues/5999#issue-358372249 has been closed but with "globally" running cargo with "sudo" as a solution.

Of course, one can write a shell script to run certain tests with "sudo" by passing the test names as arguments. However, it is not ergonomic and possibly requires writing a separate shell script for non-privilege requiring tests.

Proposed Solution
  • It would be much safe and ergonomic if one could mark a certain test need to be executed under elevated privilege.
  • In case the "cargo test" has run without the privilege, those marked tests would not get executed.
Notes

No response

Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/cargo

All issues in rust-lang/cargo

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.