#!/usr/bin/perl # # # Copyright (c) 2004 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # # Neither the name of the Advanced Micro Devices, Inc. nor the names of its # contributors may be used to endorse or promote products derived from this # software without specific prior written permission. # # # # # my $failures = $ARGV[0] || die "Usage: parse_failures.pl failures.txt > report.txt"; my $failuretext = ""; open(FAILURES, $failures) || die "File: $failures not found"; while(my $line = ) { $failuretext=sprintf("%s%s",$failuretext,$line); } my @failures_hash = (); my @failed_characters = (); foreach my $section (split(/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/, $failuretext)) { $section =~ /(.*)(Character:\s*)(\d+)(\s*)(Location:\s*)(\d+)(\s*)(Table:\s*)(\S+)(\s*)(Name:\s*)(.+)(\sDump)/; my $this_character = $3; my $this_location = $6; my $this_table = $9; my $this_name = $12; my $found = 0; my $y = 0; foreach my $this_failure (@failures_hash) { if($this_failure->{name} eq $this_name && $this_failure->{table} eq $this_table) { my $x = 0; while($this_failure->{character}->[$x]) {$x++;} $this_failure->{character}->[$x] = $this_character; $this_failure->{location}->[$x] = $this_location; $found++; } $y++; } if(!$found && $this_name && $this_table) { $failures_hash[$y]->{name} = $this_name; $failures_hash[$y]->{table} = $this_table; $failures_hash[$y]->{character}->[0] = $this_character; $failures_hash[$y]->{location}->[0] = $this_location; } #print "Character: ",$this_character,"\n"; #print "Location: ",$this_location,"\n"; #print "Table: ",$this_table,"\n"; #print "Name: ",$this_name,"\n"; } foreach my $this_failure (@failures_hash) { printf("Table: %s Name: %s\n",$this_failure->{table},$this_failure->{name}); my $x = 0; while($this_failure->{character}->[$x]) { printf(" Character %i at location %i\n",$this_failure->{character}->[$x],$this_failure->{location}->[$x]); my $found = 0; foreach my $this_char (@failed_characters) { if($this_char eq $this_failure->{character}->[$x]) { $found++; } } if(!$found) { push(@failed_characters,$this_failure->{character}->[$x]); } $x++; } print "\n\n"; } my $failed_characters = @failed_characters; print "$failed_characters different characters found:\n"; foreach my $this_char (sort(@failed_characters)) { print $this_char, "\n"; }