File tree Expand file tree Collapse file tree 4 files changed +27
-13
lines changed
src/uucore/src/lib/features Expand file tree Collapse file tree 4 files changed +27
-13
lines changed Original file line number Diff line number Diff line change @@ -465,11 +465,16 @@ mod tests {
465465 . flat_map ( Teletype :: try_from)
466466 . collect :: < HashSet < _ > > ( ) ;
467467
468- assert_eq ! ( result. len( ) , 1 ) ;
469- assert_eq ! (
470- pid_entry. tty( ) ,
471- Vec :: from_iter( result. into_iter( ) ) . first( ) . unwrap( ) . clone( )
472- ) ;
468+ // In CI environments or when running without a terminal, there may be no TTY
469+ if result. is_empty ( ) {
470+ assert_eq ! ( pid_entry. tty( ) , Teletype :: Unknown ) ;
471+ } else {
472+ assert_eq ! ( result. len( ) , 1 ) ;
473+ assert_eq ! (
474+ pid_entry. tty( ) ,
475+ Vec :: from_iter( result. into_iter( ) ) . first( ) . unwrap( ) . clone( )
476+ ) ;
477+ }
473478 }
474479
475480 #[ test]
Original file line number Diff line number Diff line change @@ -67,13 +67,11 @@ pub fn getpid() -> pid_t {
6767/// so some system such as redox doesn't supported.
6868#[ cfg( not( target_os = "redox" ) ) ]
6969pub fn getsid ( pid : i32 ) -> Result < pid_t , Errno > {
70- unsafe {
71- let result = libc:: getsid ( pid) ;
72- if Errno :: last ( ) == Errno :: UnknownErrno {
73- Ok ( result)
74- } else {
75- Err ( Errno :: last ( ) )
76- }
70+ let result = unsafe { libc:: getsid ( pid) } ;
71+ if result == -1 {
72+ Err ( Errno :: last ( ) )
73+ } else {
74+ Ok ( result)
7775 }
7876}
7977
Original file line number Diff line number Diff line change @@ -1655,6 +1655,8 @@ fn test_reading_partial_blocks_from_fifo() {
16551655 . stdout ( Stdio :: piped ( ) )
16561656 . stderr ( Stdio :: piped ( ) )
16571657 . env ( "LC_ALL" , "C" )
1658+ . env ( "LANG" , "C" )
1659+ . env ( "LANGUAGE" , "C" )
16581660 . spawn ( )
16591661 . unwrap ( ) ;
16601662
@@ -1700,6 +1702,8 @@ fn test_reading_partial_blocks_from_fifo_unbuffered() {
17001702 . stdout ( Stdio :: piped ( ) )
17011703 . stderr ( Stdio :: piped ( ) )
17021704 . env ( "LC_ALL" , "C" )
1705+ . env ( "LANG" , "C" )
1706+ . env ( "LANGUAGE" , "C" )
17031707 . spawn ( )
17041708 . unwrap ( ) ;
17051709
Original file line number Diff line number Diff line change 2828set -e
2929# Treat unset variables as errors
3030set -u
31+ # Ensure pipeline failures are caught (not just the last command's exit code)
32+ set -o pipefail
3133# Print expanded commands to stdout before running them
3234set -x
3335
@@ -39,7 +41,12 @@ REPO_main_dir="$(dirname -- "${ME_dir}")"
3941FEATURES_OPTION=${FEATURES_OPTION:- " --features=feat_os_unix" }
4042COVERAGE_DIR=${COVERAGE_DIR:- " ${REPO_main_dir} /coverage" }
4143
42- LLVM_PROFDATA=" $( find " $( rustc --print sysroot) " -name llvm-profdata) "
44+ # Find llvm-profdata in the nightly toolchain (which is used for coverage builds)
45+ LLVM_PROFDATA=" $( find " $( RUSTUP_TOOLCHAIN=nightly-gnu rustc --print sysroot) " -name llvm-profdata) "
46+ if [ -z " ${LLVM_PROFDATA} " ]; then
47+ echo " Error: llvm-profdata not found. Install it with: rustup +nightly-gnu component add llvm-tools"
48+ exit 1
49+ fi
4350
4451PROFRAW_DIR=" ${COVERAGE_DIR} /traces"
4552PROFDATA_DIR=" ${COVERAGE_DIR} /data"
You can’t perform that action at this time.
0 commit comments