Skip to content

Commit c610262

Browse files
authored
Merge pull request #7546 from drinkcat/fix-android-ci
Fix Android CI
2 parents 105042f + b142b9e commit c610262

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

tests/by-util/test_cat.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ fn test_fifo_symlink() {
9898
}
9999

100100
#[test]
101-
#[cfg(any(target_os = "linux", target_os = "android"))]
101+
// TODO(#7542): Re-enable on Android once we figure out why setting limit is broken.
102+
// #[cfg(any(target_os = "linux", target_os = "android"))]
103+
#[cfg(target_os = "linux")]
102104
fn test_closes_file_descriptors() {
103105
// Each file creates a pipe, which has two file descriptors.
104106
// If they are not closed then five is certainly too many.

tests/by-util/test_env.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ fn test_env_version() {
8181
}
8282

8383
#[test]
84+
#[cfg(unix)]
8485
fn test_env_permissions() {
86+
// Try to execute `empty` in test fixture, that does not have exec permission.
8587
new_ucmd!()
86-
.arg(".")
88+
.arg("./empty")
8789
.fails_with_code(126)
88-
.stderr_is("env: '.': Permission denied\n");
90+
.stderr_is("env: './empty': Permission denied\n");
8991
}
9092

9193
#[test]

tests/by-util/test_sort.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,9 @@ fn test_merge_batch_size() {
10901090
}
10911091

10921092
#[test]
1093-
#[cfg(any(target_os = "linux", target_os = "android"))]
1093+
// TODO(#7542): Re-enable on Android once we figure out why setting limit is broken.
1094+
// #[cfg(any(target_os = "linux", target_os = "android"))]
1095+
#[cfg(target_os = "linux")]
10941096
fn test_merge_batch_size_with_limit() {
10951097
use rlimit::Resource;
10961098
// Currently need...

tests/by-util/test_split.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,9 @@ fn test_round_robin() {
16271627
}
16281628

16291629
#[test]
1630-
#[cfg(any(target_os = "linux", target_os = "android"))]
1630+
// TODO(#7542): Re-enable on Android once we figure out why rlimit is broken.
1631+
// #[cfg(any(target_os = "linux", target_os = "android"))]
1632+
#[cfg(target_os = "linux")]
16311633
fn test_round_robin_limited_file_descriptors() {
16321634
new_ucmd!()
16331635
.args(&["-n", "r/40", "onehundredlines.txt"])

tests/common/util.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,17 @@ impl TestScenario {
12151215
command
12161216
}
12171217

1218+
/// Returns builder for invoking a command in shell (e.g. sh -c 'cmd').
1219+
/// Paths given are treated relative to the environment's unique temporary
1220+
/// test directory.
1221+
pub fn cmd_shell<S: AsRef<OsStr>>(&self, cmd: S) -> UCommand {
1222+
let mut command = UCommand::new();
1223+
// Intentionally leave bin_path unset.
1224+
command.arg(cmd);
1225+
command.temp_dir(self.tmpd.clone());
1226+
command
1227+
}
1228+
12181229
/// Returns builder for invoking any uutils command. Paths given are treated
12191230
/// relative to the environment's unique temporary test directory.
12201231
pub fn ccmd<S: AsRef<str>>(&self, util_name: S) -> UCommand {
@@ -4052,8 +4063,7 @@ mod tests {
40524063
};
40534064

40544065
let ts = TestScenario::new("util");
4055-
ts.cmd("sh")
4056-
.args(&["-c", "umask"])
4066+
ts.cmd_shell("umask")
40574067
.umask(c_umask)
40584068
.succeeds()
40594069
.stdout_is(expected);

tests/fixtures/env/empty

Whitespace-only changes.

0 commit comments

Comments
 (0)