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

Avoid spurious failures in the presence of non-zero default nice #4783

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/by-util/test_nice.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// spell-checker:ignore libc's
use crate::common::util::TestScenario;

#[test]
#[cfg(not(target_os = "android"))]
fn test_get_current_niceness() {
// NOTE: this assumes the test suite is being run with a default niceness
// of 0, which may not necessarily be true
new_ucmd!().run().stdout_is("0\n");
// Test that the nice command with no arguments returns the default nice
// value, which we determine by querying libc's `nice` in our own process.
new_ucmd!()
.run()
.stdout_is(format!("{}\n", unsafe { libc::nice(0) }));
}

#[test]
Expand Down