Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 10 additions & 5 deletions src/uucore/src/lib/features/proc_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,16 @@ mod tests {
.flat_map(Teletype::try_from)
.collect::<HashSet<_>>();

assert_eq!(result.len(), 1);
assert_eq!(
pid_entry.tty(),
Vec::from_iter(result.into_iter()).first().unwrap().clone()
);
// In CI environments or when running without a terminal, there may be no TTY
if result.is_empty() {
assert_eq!(pid_entry.tty(), Teletype::Unknown);
} else {
assert_eq!(result.len(), 1);
assert_eq!(
pid_entry.tty(),
Vec::from_iter(result.into_iter()).first().unwrap().clone()
);
}
}

#[test]
Expand Down
12 changes: 5 additions & 7 deletions src/uucore/src/lib/features/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ pub fn getpid() -> pid_t {
/// so some system such as redox doesn't supported.
#[cfg(not(target_os = "redox"))]
pub fn getsid(pid: i32) -> Result<pid_t, Errno> {
unsafe {
let result = libc::getsid(pid);
if Errno::last() == Errno::UnknownErrno {
Ok(result)
} else {
Err(Errno::last())
}
let result = unsafe { libc::getsid(pid) };
if result == -1 {
Err(Errno::last())
} else {
Ok(result)
}
}

Expand Down
4 changes: 4 additions & 0 deletions tests/by-util/test_dd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,8 @@ fn test_reading_partial_blocks_from_fifo() {
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.env("LC_ALL", "C")
.env("LANG", "C")
.env("LANGUAGE", "C")
.spawn()
.unwrap();

Expand Down Expand Up @@ -1700,6 +1702,8 @@ fn test_reading_partial_blocks_from_fifo_unbuffered() {
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.env("LC_ALL", "C")
.env("LANG", "C")
.env("LANGUAGE", "C")
.spawn()
.unwrap();

Expand Down
9 changes: 8 additions & 1 deletion util/build-run-test-coverage-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
set -e
# Treat unset variables as errors
set -u
# Ensure pipeline failures are caught (not just the last command's exit code)
set -o pipefail
# Print expanded commands to stdout before running them
set -x

Expand All @@ -39,7 +41,12 @@ REPO_main_dir="$(dirname -- "${ME_dir}")"
FEATURES_OPTION=${FEATURES_OPTION:-"--features=feat_os_unix"}
COVERAGE_DIR=${COVERAGE_DIR:-"${REPO_main_dir}/coverage"}

LLVM_PROFDATA="$(find "$(rustc --print sysroot)" -name llvm-profdata)"
# Find llvm-profdata in the nightly toolchain (which is used for coverage builds)
LLVM_PROFDATA="$(find "$(RUSTUP_TOOLCHAIN=nightly-gnu rustc --print sysroot)" -name llvm-profdata)"
if [ -z "${LLVM_PROFDATA}" ]; then
echo "Error: llvm-profdata not found. Install it with: rustup +nightly-gnu component add llvm-tools"
exit 1
fi

PROFRAW_DIR="${COVERAGE_DIR}/traces"
PROFDATA_DIR="${COVERAGE_DIR}/data"
Expand Down
Loading