Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for sudo-philic and sudo-phobic tests #1633

Open
LBensman opened this issue May 14, 2019 · 0 comments
Open

Support for sudo-philic and sudo-phobic tests #1633

LBensman opened this issue May 14, 2019 · 0 comments

Comments

@LBensman
Copy link

LBensman commented May 14, 2019

Description
It's possible to have tests that require to be executed in root/sudo context, as well as tests that explicitly require to be executed not as root/sudo. I have some of these tests, and managing them is a bit of a pain, with tagging not quite sufficient to handle the problem.

Example of test requiring sudo:
We use libusb to work with devices, and some of the libusb operations require root to be able to access devices. If tests are run without sudo, they fail. It would be good to be able to mark such tests as [!sudo] or [!root], and if test is run without sudo rights, fail softly (or have a way via CLI to control how such fail. I.e. similar to how [!mayfail] works, but more explicit with finer control.

Example of test explicitly requiring not sudo:
We have networking code that specifically checks how code handles where it cannot open listener on privileged port (as expected condition). Running as sudo will actually make the function succeed, and thereby fail the test. That test is expected to be run without sudo rights. It would be good to be able to mark such tests as [!nosudo] or [!noroot], and fail softly if run as root.

Additionally, to help handle test suites that contain tests that require sudo as well as tests that explicitly detest sudo, it would be good to be able to execute test suite with sudo rights, have it run tests that require sudo, then for it to drop its rights to non-sudo, and run remainder of tests that do not require sudo.

Such feature would allow for easier management and handling of full suite of tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant