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

lintian: r192 - in branches/1.23.0: debian testset



Author: jeroen
Date: 2004-04-18 21:34:20 +0200 (Sun, 18 Apr 2004)
New Revision: 192

Removed:
   branches/1.23.0/testset/check_info.pl
Modified:
   branches/1.23.0/debian/changelog
   branches/1.23.0/testset/runtests
Log:
testset/runtests:
+ [JvW] Rewrote so that it is actually useful: 
  - sort output to nullify filesystem directory ordering differences
  - run lintian just once
  - check that all tests that are triggered have a description, if verbose
    specified, warn about tests that are not tested


Modified: branches/1.23.0/debian/changelog
===================================================================
--- branches/1.23.0/debian/changelog	2004-04-18 19:26:46 UTC (rev 191)
+++ branches/1.23.0/debian/changelog	2004-04-18 19:34:20 UTC (rev 192)
@@ -17,13 +17,13 @@
     + [HE] Change known_obsolete_fields to allow checks/fields to
       report the Bugs field als obsolete.
   * checks/copyright-file:
-    + [HE] Change usr-doc-symlink-to-foreign-package check to throw an 
+    + [HE] Change usr-doc-symlink-to-foreign-package check to throw an
       error when a package doesn't depend on the *same* version of the
       package its /usr/share/doc/$foo dir is symlinked to. This is supposed
       to ensure that both come from the same source and the same source
       version. (Closes: #201470)
   * checks/cruft.desc:
-    + [HE] Reworded some parts and bumped the Standards-Version after 
+    + [HE] Reworded some parts and bumped the Standards-Version after
       checking for changes. (Closes: #235735)
   * checks/debconf{,.desc}:
     + [JvW] Add an error for a bogus default for a boolean template
@@ -42,14 +42,14 @@
   * checks/deb-format:
     + [HE] Add a check for the data member of a deb. dpkg 1.11 introduces
       support for configurable compression algorithms (bzip2, for example),
-      but this shouldn't be allowed before dpkg 1.11 hits stable. 
+      but this shouldn't be allowed before dpkg 1.11 hits stable.
       (Closes: #159874)
   * checks/fields:
     + [HE, FL] Nearly complete rewrite for clean up:
       - bad-relation seems to work better now (Closes: #171763)
       - duplicate relations checking now works for different fields, too
         (Closes: #234978, #235356)
-    + [HE] Add check for an Origin field with "Debian" as value. 
+    + [HE] Add check for an Origin field with "Debian" as value.
       (Closes: #119618)
     + [HE] Reintroduce build-depends-without-arch-dep check with the patch
       I proposed in #214231. (Closes: #242484)
@@ -84,13 +84,13 @@
     + [FL] Parse contents of man page and implement more new checks:
       - Section number of file and header differ (Closes: #89488)
       - Try to search for hyphens that should be minus signs
-        (Closes: #205924). First patch by Eduard Bloch, final 
+        (Closes: #205924). First patch by Eduard Bloch, final
         regex by Josip Rodin.
       - Search for FSSTND directories referenced in man pages. Only
         an info tag. (Closes: #111098)
     + [FL, HE] Fix false positives of
       manpage-for-non-x11-binary-in-wrong-directory when a link
-      from a normal bin/ is pointing to a binary in an X11 dir. Based 
+      from a normal bin/ is pointing to a binary in an X11 dir. Based
       on patch by FL. (Closes: #203389)
   * checks/menu-format:
     + [FL] Only issue one warning about needs=dwww, not two
@@ -125,11 +125,11 @@
   * collection/override-file:
     + [FL] add support for source overrides (Closes: #129510)
       See the User Manual for more information.
-  
+
   * debian/control,debian/copyright:
     + [FL] Add Marc 'HE' Brockschmidt to Uploaders and
       to copyright file
-  
+
   * doc/lintian.sgml:
     + [FL] Some updates, some more verbatim explantions
       (Closes: #197955)
@@ -137,14 +137,14 @@
       source packages, too
   * doc/README:
     + [FL] Update options
-  
+
   * frontend/lintian:
     + [HE] Added a --dont-check-parts|-X option to allow users to specify
       which tests should not be run. Also added infos about this to the
       manpage. (Closes: #206674)
   * frontend/lintian-info:
-    + [JvW] Fixed that lintian -I also displays info for I: tags
-  
+    + [JvW] Fixed that lintian -I also displays info for I: entries
+
   * lib/Dep.pm:
     + [FL] Fixed some semantic errors (since noone ever observed the
       correspoding perl warnings the fixed parts are probably never
@@ -153,13 +153,20 @@
     + [HE] Changed {read,parse}_dpkg_control a bit to cope with the fact
       that template files sometimes contain lines consisting only of
       whitespace which do *not* separate to blocks. (Closes: #242479)
-  
+
+  * testset/runtests:
+    + [JvW] Rewrote so that it is actually useful: 
+      - sort output to nullify filesystem directory ordering differences
+      - run lintian just once
+      - check that all tests that are triggered have a description, if verbose
+        specified, warn about tests that are not tested
+
   * unpack/list-binpkg:
     + [HE] Try to open Packages.gz if no Packages file can be found. Fix
       based on patch by Robert Lemmen <robertle@semistable.com>, thanks!
       (Closes: #198617)
 
- -- Debian Lintian Maintainers <lintian-maint@debian.org>  Sun, 18 Apr 2004 21:26:09 +0200
+ -- Debian Lintian Maintainers <lintian-maint@debian.org>  Sun, 18 Apr 2004 21:23:21 +0200
 
 lintian (1.22.12) unstable; urgency=low
 

Deleted: branches/1.23.0/testset/check_info.pl
===================================================================
--- branches/1.23.0/testset/check_info.pl	2004-04-18 19:26:46 UTC (rev 191)
+++ branches/1.23.0/testset/check_info.pl	2004-04-18 19:34:20 UTC (rev 192)
@@ -1,32 +0,0 @@
-#! /usr/bin/perl -w
-
-use strict;
-
-BEGIN {
-  # determine LINTIAN_ROOT
-  my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'} || '/usr/share/lintian';
-  $ENV{'LINTIAN_ROOT'} = $LINTIAN_ROOT
-    unless exists $ENV{'LINTIAN_ROOT'};
-}
-
-use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Util;
-
-my $problems = 0;
-
-for my $f (<$ENV{'LINTIAN_ROOT'}/checks/*.desc>) {
-    my @sections = read_dpkg_control($f);
-    for (my $i = 0; $i <= $#sections; $i++) {
-	if (exists $sections[$i]->{'tag'}) {
-	    if (not exists $sections[$i]->{'info'}) {
-		print "E: no info for $sections[$i]->{'tag'} in $f\n";
-		$problems++;
-	    }
-	}
-    }
-}
-
-if ($problems) {
-    print "Found $problems missing info section(s)\n";
-    exit(-1);
-}

Modified: branches/1.23.0/testset/runtests
===================================================================
--- branches/1.23.0/testset/runtests	2004-04-18 19:26:46 UTC (rev 191)
+++ branches/1.23.0/testset/runtests	2004-04-18 19:34:20 UTC (rev 192)
@@ -85,16 +85,23 @@
 }
 
 # --- Set and unset environment variables that lintian is sensitive to
-my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'};
-if (not $LINTIAN_ROOT) {
-    use Cwd;
-    $ENV{'LINTIAN_ROOT'} = $LINTIAN_ROOT = cwd();
+BEGIN {
+    my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'};
+    if (not $LINTIAN_ROOT) {
+	use Cwd ();
+	$ENV{'LINTIAN_ROOT'} = $LINTIAN_ROOT = Cwd::cwd();
+    }
+    delete $ENV{'LINTIAN_CFG'};
+    delete $ENV{'LINTIAN_LAB'};
+    delete $ENV{'LINTIAN_DIST'};
+    delete $ENV{'LINTIAN_UNPACK_LEVEL'};
 }
-delete $ENV{'LINTIAN_CFG'};
-delete $ENV{'LINTIAN_LAB'};
-delete $ENV{'LINTIAN_DIST'};
-delete $ENV{'LINTIAN_UNPACK_LEVEL'};
 
+my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'};
+
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
+
 # --- Set the ways to call lintian and dpkg-buildpackage
 my $lintian_options = '-I';
 my $lintian_info_options = '-I -i';
@@ -102,6 +109,8 @@
 my $lintian_path = $LINTIAN_ROOT . "/frontend/lintian";
 
 my $testok = 0;
+my %tags;
+my %types = ( 'E' => 'error', 'W' => 'warning', 'I' => 'info' );
 
 # --- Display output immediately
 $| = 1;
@@ -111,19 +120,36 @@
 -d $rundir
     or fail("test directory $rundir does not exist\n");
 
-if ( -d "$LINTIAN_ROOT/testset" ) {
-    # does every tag have an info section?
-    my $check = "$LINTIAN_ROOT/testset/check_info.pl";
-    print "Checking for missing info tags ... ";
-    $testok = runsystem_ok("$check $LINTIAN_ROOT");
-    if ($testok) {
-	print "done.\n";
-    } else {
-	print "FAILED!\n";
-	exit 1 unless $run_all_tests;
+# does every tag have an info section?
+print "Checking for missing info tags ... ";
+
+$testok = 1;
+for my $desc_file (<$LINTIAN_ROOT/checks/*.desc>) {
+    for my $i (read_dpkg_control($desc_file)) {
+	$desc_file =~ s#.*/##;
+	if (exists $i->{'tag'}) {
+	    if (not exists $i->{'info'}) {
+		print "E: test-has-no-info $i->{'tag'} in $desc_file\n";
+		$testok = 0;
+	    }
+	    if (not exists $i->{'type'}) {
+		print "E: test-has-no-type $i->{'tag'} in $desc_file\n";
+		$testok = 0;
+		next;
+	    }
+	    $tags{$i->{'tag'}}{'desc_file'} = $desc_file;
+	    $tags{$i->{'tag'}}{'desc_type'} = $i->{'type'};
+	}
     }
 }
 
+if ($testok) {
+    print "done.\n";
+} else {
+    print "FAILED!\n";
+    exit 1 unless $run_all_tests;
+}
+
 # can I make a lab?
 print "Running static lab test ... ";
 $testok = runsystem_ok("$lintian_path --lab $rundir/test_lab --setup-lab");
@@ -164,7 +190,7 @@
     $line =~ s/\).*$//;
     
     my ($pkg, $ver) = ($pkgdir, $line);
-    print "Running test on $pkg $ver ... ";
+    print "Running test on $pkg $ver: copying... ";
 
     print "Cleaning up and repopulating $rundir/$pkgdir...\n" if $verbose;
     runsystem_ok("rm -rf $rundir/$pkgdir");
@@ -178,12 +204,20 @@
     closedir D;
     runsystem("find $rundir -name CVS -o -name .svn -print0 | xargs -0r rm -R");
 
+    print "building... ";
     print "Running dpkg-buildpackage $dpkg_buildpackage_options in $rundir/$pkgdir...\n" if $verbose;
     runsystem("cd $rundir/$pkgdir && dpkg-buildpackage $dpkg_buildpackage_options >../build.$pkg 2>&1");
 
+    print "testing... ";
     print "Running lintian $lintian_options on $rundir/$pkg\_$ver*.changes...\n" if $verbose;
-    runsystem_ok("$lintian_path $lintian_options $rundir/$pkg\_$ver*.changes >$rundir/tags.$pkg");
+    runsystem_ok("$lintian_path $lintian_options $rundir/$pkg\_$ver*.changes".
+    	" 2>&1 | sort > $rundir/tags.$pkg");
 
+    # Run a sed-script if it exists, for tests that have slightly varialbe
+    # output
+    runsystem_ok("sed -i -f $testset/tags.$pkg.sed $rundir/tags/$pkg")
+	if -e "$testset/tags.$pkg.sed";
+
     $testok = runsystem_ok("cmp -s $rundir/tags.$pkg $testset/tags.$pkg");
     if ($testok) {
 	print "done.\n";
@@ -194,25 +228,43 @@
 	next;
     }
 
-    print "Running info test on $pkg $ver ... ";
+    open TAGS, "$rundir/tags.$pkg" or fail("Cannot open $rundir/tags.$pkg");
+    while (<TAGS>) {
+	if (not /^(.): (\S+)(?: source)?: (\S+)/) {
+	    print "E: Invalid line:\n$_";
+	    next;
+	}
+	$tags{$3}{'tested_type'} = $types{$1};
+	$tags{$3}{'tested_package'} = $2;
+    }
+    close TAGS;
+}
 
-    runsystem_ok("$lintian_path $lintian_info_options $rundir/$pkg\_$ver*.changes >$rundir/info_tags.$pkg");
-    $testok = runsystem_ok("cmp -s $rundir/info_tags.$pkg $testset/info_tags.$pkg");
-    if ($testok) {
-	print "done.\n";
-    } else {
-	print "FAILED:\n";
-	runsystem_ok("diff -u $testset/info_tags.$pkg $rundir/info_tags.$pkg");
-	exit 1 unless $run_all_tests;
+print "Checking whether all tags are tested and tags have description ... \n";
+$testok = 1;
+for (keys %tags) {
+    my $values = $tags{$_};
+    if (not defined $values->{'desc_type'}) {
+	print "E: test-has-no-description $_ in $values->{'tested_package'}\n";
+	$testok = 0;
+    } elsif (not defined $values->{'tested_type'}) {
+	print "I: test-is-not-tested $_ in $values->{'desc_file'}\n"
+	    if $verbose;
+    } elsif ($values->{'desc_type'} ne $values->{'tested_type'}) {
+	print "E: test-has-inconsistent-type $_ $values->{'tested_type'} vs ".
+	    "$values->{'desc_type'}\n";
+	$testok = 0;
     }
 }
 
-# --------------
-sub fail {
-    print STDERR @_;
-    exit 2;
+if ($testok) {
+    print "done.\n";
+} else {
+    print "FAILED\n";
+    exit 1 unless $run_all_tests;
 }
 
+# --------------
 sub runsystem {
     system(@_) == 0
 	or fail("failed: @_\n");
@@ -224,3 +276,5 @@
 	or fail("failed: @_\n");
     return $errcode == 0;
 }
+
+# vim: ts=8 sw=4



Reply to: