+Support -KPASS.
[nethome.git] / bin / diffgdbfilt
1 #! /usr/bin/perl
2 use strict;
3 use warnings;
4
5 my $last;
6 my $lastfile;
7 while (<>) {
8   next if /^diff /;
9   my($thisname)=m{^.(?:Running (?:.*/)?|[A-Z]+: )(gdb[.]\w+/\S+[.]exp)(?: \Q...\E|: .*)$};
10   my $this;
11   if (!$thisname || ($last && $thisname eq $last->{"name"})) {
12 #if (!$thisname) { print "X: !thisname\n"; } else { print "X: \"".$last->{"name"}."\" -> \"$thisname\"\n"; }
13     $this=$last;
14   } else {
15 #print "X: new \"$thisname\"\n";
16     $last=$this={"name"=>$thisname,"+Running"=>(/^[+]/||0)};
17   }
18   next if /^@@ .* @@\n$/;
19   if ($this->{"print"}) {
20     print;
21     next;
22   }
23   if (/^--- /) {
24     $lastfile=$_;
25     next;
26   }
27   if (/^\Q+++\E /) {
28     $lastfile.=$_;
29     next;
30   }
31   $this->{"buffer"}.=$_;
32   next if /^ /;
33   next if /^[+]Running / && $thisname;
34   next if /^[+]PASS: /;
35   next if /^[+]KPASS: /;
36   next if /^-PASS: /;
37   next if /^-KPASS: /;
38   next if /^-FAIL: /;
39   next if /^-KFAIL: /;
40   next if /^-XFAIL: /;
41   next if /^[+]FAIL: / && $this->{"+Running"};
42   next if /^[+]KFAIL: / && $this->{"+Running"};
43   next if /^[+]XFAIL: / && $this->{"+Running"};
44   next if /^[+]UNTESTED: / && $this->{"+Running"};
45   next if /^[+]gdb compile failed, / && $this->{"+Running"};
46   next if /^[+].*: Error: bad register name `%.*'\n$/ && $this->{"+Running"};
47   next if /^[+].*: Error: `.*' is only supported in 64-bit mode\n$/ && $this->{"+Running"};
48
49   $this->{"print"}=1;
50   print $lastfile||""; $lastfile=undef();
51   print "\n#".$this->{"name"}."\n";
52   print $this->{"buffer"}; $this->{"buffer"}=undef();
53   next;
54 }