Skip to content

Instantly share code, notes, and snippets.

@kinow
Created July 18, 2012 21:49
Show Gist options
  • Save kinow/3139152 to your computer and use it in GitHub Desktop.
Save kinow/3139152 to your computer and use it in GitHub Desktop.
parse_tlbug.pl
#!/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