mirror of
https://github.com/uutils/coreutils
synced 2024-11-10 15:14:24 +00:00
Merge pull request #2172 from jhscheer/stat_test_selinux
stat: fix test to ignore selinux related output
This commit is contained in:
commit
86a8195166
1 changed files with 9 additions and 2 deletions
|
@ -198,9 +198,16 @@ fn test_terse_normal_format() {
|
|||
let expect = expected_result(&args);
|
||||
println!("actual: {:?}", actual);
|
||||
println!("expect: {:?}", expect);
|
||||
let v_actual: Vec<&str> = actual.split(' ').collect();
|
||||
let v_expect: Vec<&str> = expect.split(' ').collect();
|
||||
let v_actual: Vec<&str> = actual.trim().split(' ').collect();
|
||||
let mut v_expect: Vec<&str> = expect.trim().split(' ').collect();
|
||||
assert!(!v_expect.is_empty());
|
||||
|
||||
// uu_stat does not support selinux
|
||||
if v_actual.len() == v_expect.len() - 1 && v_expect[v_expect.len() - 1].contains(":") {
|
||||
// assume last element contains: `SELinux security context string`
|
||||
v_expect.pop();
|
||||
}
|
||||
|
||||
// * allow for inequality if `stat` (aka, expect) returns "0" (unknown value)
|
||||
assert!(
|
||||
expect == "0"
|
||||
|
|
Loading…
Reference in a new issue