Merge pull request #2172 from jhscheer/stat_test_selinux

stat: fix test to ignore selinux related output
This commit is contained in:
Sylvestre Ledru 2021-05-05 22:35:32 +02:00 committed by GitHub
commit 86a8195166
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"