1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
From 5dfe64a676969aeebae857f5ab8f1301c4f339f8 Mon Sep 17 00:00:00 2001
From: Shijie Luo <luoshijie1@huawei.com>
Date: Sun, 15 Mar 2020 14:15:42 -0400
Subject: [PATCH] bypass wrong output when enabled selinux
When enforced selinux, excuting command getfattr may output something
about selinux. Bypass these messages to make testcases go success.
Signed-off-by: Shijie Luo <luoshijie1@huawei.com>
---
test/run | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/test/run b/test/run
index 4b1f8d0..5c017cc 100755
--- a/test/run
+++ b/test/run
@@ -160,21 +160,27 @@ sub process_test($$$$) {
map { s/\s/\\$&/g; $_ } @$p), " -- ";
my $result = exec_test($prog, $in);
my @good = ();
- my $nmax = (@$out > @$result) ? @$out : @$result;
- for (my $n=0; $n < $nmax; $n++) {
+ my $nmax = @$out;
+ my $mmax = @$result;
+ for (my $n=0, my $m=0; $n < $nmax; $n++, $m++) {
my $use_re;
+
if (defined $out->[$n] && $out->[$n] =~ /^~ /) {
$use_re = 1;
$out->[$n] =~ s/^~ //g;
}
- if (!defined($out->[$n]) || !defined($result->[$n]) ||
- (!$use_re && $result->[$n] ne $out->[$n]) ||
- ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
- push @good, ($use_re ? '!~' : '!=');
+ while ($m < $mmax &&
+ (!$use_re && $result->[$m] ne $out->[$n]) ||
+ ( $use_re && $result->[$m] !~ /^$out->[$n]/)) {
+ $m++;
+ }
+
+ if (!defined($result->[$m])) {
+ push @good, ($use_re ? '!~' : '!=');
}
else {
- push @good, ($use_re ? '=~' : '==');
+ push @good, ($use_re ? '=~' : '==');
}
}
my $good = !(grep /!/, @good);
--
2.23.0
|