Created
July 18, 2012 21:49
-
-
Save kinow/3139152 to your computer and use it in GitHub Desktop.
parse_tlbug.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $file = "TestLinkBUG5079_1.log"; | |
my $latestResult = ""; | |
my $currentResult = ""; | |
my $flag = 0; | |
open(FL, "<$file"); | |
while(<FL>) { | |
my $line = $_; | |
chomp($line); | |
if($flag == 0 && $line =~ /latest exec: null/) { | |
$latestResult = "null"; | |
$flag = 1; # can we match the results? | |
next; | |
} elsif($flag == 0 && $line =~ /latest exec.*notes=Sample report (.*)\]/) { | |
$latestResult = $1; | |
$flag = 1; | |
next; | |
} | |
if($flag == 1 && $line =~ /latest exec.*notes=Sample report (.*)\]/) { | |
$flag = 0; | |
$currentResult = $1; | |
if($currentResult ne $latestResult) { | |
print "OK! Previous result: $latestResult - Current result: $currentResult\n"; | |
} else { | |
print "ERROR! Previous result: $latestResult - Current result: $currentResult\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment