File: check_coverage

package info (click to toggle)
os-autoinst 4.3%2Bgit20160919-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,860 kB
  • ctags: 665
  • sloc: perl: 7,624; cpp: 1,584; python: 216; makefile: 188; sh: 63
file content (23 lines) | stat: -rwxr-xr-x 579 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env perl

use strict;
use warnings;
use autodie;


die "Need threshold as argument" unless @ARGV;

my $filename = 'cover_db/coverage.html';

open (my $fh, '<', $filename);
my @log = <$fh>;
close($fh);
my @summary = grep { /Total/ } @log;
chomp @summary;
my $summary_line = $summary[0];

my @matches = $summary_line =~ /(?<=>)[0-9.]+(?=<)/g;
# for now just compare the last number, i.e. the total coverage against a
# threshold
die "No coverage found" unless scalar @matches > 0;
die "Coverage is below threshold: $matches[-1] < $ARGV[0]" if ($matches[-1] < $ARGV[0]);