[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.10-78-g2e14c55



The following commit has been merged in the master branch:
commit 2e14c558f9179bc1d646b06fc877ebb847785d19
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Jul 22 22:22:21 2012 +0200

    update-coverage: Track coverage of checks as well
    
    Also fix the error message if update-coverage is run from the wrong
    dir.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/private/update-coverage b/private/update-coverage
index 728ddbf..f9fe2d6 100755
--- a/private/update-coverage
+++ b/private/update-coverage
@@ -31,25 +31,30 @@ use Lintian::Util qw(read_dpkg_control);
 # Check that we're being run from the right place (although the above probably
 # died if we weren't).
 unless (-f 't/runtests') {
-    warn "update-never-seen source be run from the top level of the Lintian\n";
-    warn "source tree or LINTIAN_ROOT must be set in the environment.\n\n";
+    warn "update-coverage source be run from the top level of the Lintian\n";
+    warn "source tree.\n\n";
     die "Cannot find t/runtests -- run from the right directory?\n";
 }
 
 # Gather a list of all tags.
 my %tags;
+my %checks;
 my $total;
+my $check_total;
 my ($tc, $ltc);
+my ($ctc, $cltc);
 for my $desc (<checks/*.desc>) {
     for my $data (read_dpkg_control($desc)) {
         $desc =~ s,.*/,,;
         $desc =~ s/\.desc$//;
         if (exists $data->{tag}) {
             $tags{$data->{tag}} = $desc;
+            $checks{$desc}++;
         }
     }
 }
 $total = scalar keys %tags;
+$check_total = scalar keys %checks;
 
 
 # Parse all test configuration files from the new test suite looking for
@@ -58,12 +63,17 @@ for my $desc (<t/tests/*/desc>, <t/changes/*.desc>, <t/debs/*/desc>, <t/source/*
     my ($data) = read_dpkg_control($desc);
     if (exists $data->{'test-for'}) {
         for my $tag (split(' ', $data->{'test-for'})) {
+            my $check = $tags{$tag};
             delete $tags{$tag};
+            if ($check) {
+                delete $checks{$check} unless --$checks{$check};
+            }
         }
     }
 }
 
 $tc = $total - scalar keys %tags;
+$ctc = $check_total - scalar keys %checks;
 
 # Now parse all tags files from the old test suite looking for what tags that
 # test reveals.
@@ -79,6 +89,8 @@ for my $tagfile (<testset/tags.*>) {
         if (/^.: \S+(?: (?:changes|source|udeb))?: (\S+)/) {
             my $tag = $1;
             if (exists $tags{$tag}) {
+                my $check = $tags{$tag};
+                delete $checks{$check} unless --$checks{$check};
                 $legacy{$tag} = $tags{$tag};
                 delete $tags{$tag};
                 push (@{ $legacy_test{$case} }, $tag);
@@ -89,13 +101,17 @@ for my $tagfile (<testset/tags.*>) {
 }
 
 $ltc = $total - scalar keys %tags;
+$cltc = $check_total - scalar keys %checks;
 
 my $tcr = $total ? sprintf ' (%.02f%%)', ($tc / $total) * 100 : '';
 my $ltcr = $total ? sprintf ' (%.02f%%)', ($ltc / $total) * 100 : '';
+my $ctcr = $check_total ? sprintf ' (%.02f%%)', ($ctc / $check_total) * 100 : '';
+my $cltcr = $check_total ? sprintf ' (%.02f%%)', ($cltc / $check_total) * 100 : '';
 # Open COVERAGE and print out a date stamp.
 open(OUT, '>', 't/COVERAGE') or die "Cannot create t/COVERAGE: $!\n";
 print OUT 'Last generated ', strftime ('%Y-%m-%d', gmtime), "\n";
-print OUT "Coverage: $tc/$total$tcr, w. legacy tests: $ltc/$total$ltcr\n\n";
+print OUT "Coverage (Tags): $tc/$total$tcr, w. legacy tests: $ltc/$total$ltcr\n";
+print OUT "Coverage (Checks): $ctc/$check_total$ctcr, w. legacy tests: $cltc/$check_total$cltcr\n\n";
 
 # Whatever is left in the %tags hash are untested.  Print them out sorted by
 # checks file.
diff --git a/t/COVERAGE b/t/COVERAGE
index 43decdb..17f6d50 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,5 +1,6 @@
 Last generated 2012-07-22
-Coverage: 837/962 (87.01%), w. legacy tests: 935/962 (97.19%)
+Coverage (Tags): 837/962 (87.01%), w. legacy tests: 935/962 (97.19%)
+Coverage (Checks): 30/41 (73.17%), w. legacy tests: 35/41 (85.37%)
 
 The following tags are not tested by the test suite:
 

-- 
Debian package checker


Reply to: