mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
tests/common/util: Make sure test_altering_umask is run in correct shell
On Android CI, `sh` would point at a different flavor of shell shipped with termux (dash). The current umask test expects that `/system/bin/sh` is used though, so create a new function TestScenario:cmd_shell that runs a command in the default shell (that could be used in more tests). Fixes one part of #7542.
This commit is contained in:
parent
105042fb70
commit
152dada379
1 changed files with 12 additions and 2 deletions
|
@ -1215,6 +1215,17 @@ impl TestScenario {
|
|||
command
|
||||
}
|
||||
|
||||
/// Returns builder for invoking a command in shell (e.g. sh -c 'cmd').
|
||||
/// Paths given are treated relative to the environment's unique temporary
|
||||
/// test directory.
|
||||
pub fn cmd_shell<S: AsRef<OsStr>>(&self, cmd: S) -> UCommand {
|
||||
let mut command = UCommand::new();
|
||||
// Intentionally leave bin_path unset.
|
||||
command.arg(cmd);
|
||||
command.temp_dir(self.tmpd.clone());
|
||||
command
|
||||
}
|
||||
|
||||
/// Returns builder for invoking any uutils command. Paths given are treated
|
||||
/// relative to the environment's unique temporary test directory.
|
||||
pub fn ccmd<S: AsRef<str>>(&self, util_name: S) -> UCommand {
|
||||
|
@ -4052,8 +4063,7 @@ mod tests {
|
|||
};
|
||||
|
||||
let ts = TestScenario::new("util");
|
||||
ts.cmd("sh")
|
||||
.args(&["-c", "umask"])
|
||||
ts.cmd_shell("umask")
|
||||
.umask(c_umask)
|
||||
.succeeds()
|
||||
.stdout_is(expected);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue