Skip to content

Commit

Permalink
pgrep: make two tests linux-only
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Nov 12, 2024
1 parent 96b72ae commit 0d5ff87
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/uu/pgrep/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ pub fn walk_process() -> impl Iterator<Item = ProcessInformation> {
#[cfg(test)]
mod tests {
use super::*;
#[cfg(target_os = "linux")]
use std::{collections::HashSet, str::FromStr};

#[test]
Expand All @@ -398,6 +399,7 @@ mod tests {
assert!(RunState::try_from("Rg").is_err());
}

#[cfg(target_os = "linux")]
fn current_pid() -> usize {
// Direct read link of /proc/self.
// It's result must be current programs pid.
Expand All @@ -410,6 +412,7 @@ mod tests {
}

#[test]
#[cfg(target_os = "linux")]
fn test_walk_pid() {
let current_pid = current_pid();

Expand All @@ -419,6 +422,7 @@ mod tests {
}

#[test]
#[cfg(target_os = "linux")]
fn test_pid_entry() {
let current_pid = current_pid();

Expand Down

0 comments on commit 0d5ff87

Please sign in to comment.