blob: 87335cb9288027fbbadb151d667ca0f1d958058a (
plain)
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
|
#!/usr/bin/perl
# tracks gaps (missing records) and repeats in the transport-testing
# output. If there aren't any missing records or repeats, it prints
# "test passed", otherwise "test failed"
#
# Usage: transport-counts <output file>
$prev = 0;
$total_missing = 0;
$repeats = 0;
open TRACEFILE, $ARGV[0]
or die "Couldn't open trace file $ARGV[0]";
while (<TRACEFILE>) {
chomp;
if (/\[(\d*)/) {
if ($prev + 1 != $1) {
$start_missing = $prev + 1;
$end_missing = $1 - 1;
if ($start_missing > $end_missing) {
$repeats++;
} else {
$total_missing += $end_missing - $start_missing;
}
}
$prev = $1;
}
}
print "total missing: $total_missing\n";
print "repeats: $repeats\n";
print "last event logged: $prev\n";
if ($total_missing == 0 && $repeats == 0) {
print "test passed\n";
} else {
print "test failed\n";
}
|