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

[SCM] Debian package checker branch, master, updated. 2.2.18-33-g3cfd89c



The following commit has been merged in the master branch:
commit 9f54a7c1256cdc4ff474255589add47d51002a16
Author: Russ Allbery <rra@debian.org>
Date:   Wed Dec 23 17:42:45 2009 -0800

    Support suppressing sort and use spawn in t/runtests
    
    * t/runtests:
      + [RA] Support a new Sort: no field in package test metadata to
        suppress sorting of Lintian output, for testing output formatting.
      + [RA] Use Lintian::Command::spawn to run Lintian for package tests so
        that the Lintian options may contain shell metacharacters.

diff --git a/debian/changelog b/debian/changelog
index c6c89f4..3221693 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -66,6 +66,10 @@ lintian (2.3.0) UNRELEASED; urgency=low
     + [RA] Replace TESTSET in Options with the root of the test suite so
       that Lintian options referring to files can be tested with files in
       the test suite directory.
+    + [RA] Support a new Sort: no field in package test metadata to
+      suppress sorting of Lintian output, for testing output formatting.
+    + [RA] Use Lintian::Command::spawn to run Lintian for package tests so
+      that the Lintian options may contain shell metacharacters.
 
  -- Russ Allbery <rra@debian.org>  Mon, 23 Nov 2009 02:20:29 -0800
 
diff --git a/t/runtests b/t/runtests
index bdf69b6..77c2213 100755
--- a/t/runtests
+++ b/t/runtests
@@ -2,7 +2,7 @@
 
 # Copyright © 1998 Richard Braakman
 # Copyright © 2008 Frank Lichtenheld
-# Copyright © 2008 Russ Allbery
+# Copyright © 2008, 2009 Russ Allbery
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -51,6 +51,8 @@ BEGIN {
 }
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
+
+use Lintian::Command qw(spawn);
 use Util;
 
 # --- Global configuration
@@ -410,11 +412,25 @@ sub test_package {
     print "building... ";
     runsystem("cd $RUNDIR/$pkgdir && $DPKG_BUILDPACKAGE >../build.$pkg 2>&1");
 
-    my $epochless_ver = $testdata->{version};
-    $epochless_ver =~ s/^(\d+)://;
+    my $version = $testdata->{version};
+    $version =~ s/^(\d+)://;
+    my @options = split(' ', $testdata->{options});
+    my ($file) = glob("$RUNDIR/$pkg\_$version*.changes");
     print "testing... ";
-    runsystem_ok("$LINTIAN $testdata->{options} $RUNDIR/$pkg\_$epochless_ver*.changes".
-		 " 2>&1 | sort > $RUNDIR/tags.$pkg");
+    if ($testdata->{sort}) {
+	my $status = spawn({ out => "$RUNDIR/tags.$pkg" },
+			   [ $LINTIAN, @options, $file ],
+			   '|', [ 'sort' ]);
+	unless ($status == 0 or $status == (1 << 8)) {
+	    fail("failed: @_\n");
+	}
+    } else {
+	my $status = spawn({ out => "$RUNDIR/tags.$pkg" },
+			   [ $LINTIAN, @options, $file ]);
+	unless ($status == 0 or $status == (1 << 8)) {
+	    fail("failed: @_\n");
+	}
+    }
 
     # Run a sed-script if it exists, for tests that have slightly variable
     # output
@@ -498,8 +514,8 @@ sub test_changes {
     my $testdir = "$TESTSET/changes";
 
     print "testing... ";
-    runsystem_ok("$LINTIAN -I -E $testdir/$test.changes 2>&1".
-		 " | sort > $RUNDIR/tags.changes-$test");
+    runsystem_ok("$LINTIAN -I -E $testdir/$test.changes 2>&1"
+		 . " | sort > $RUNDIR/tags.changes-$test");
 
     # Compare the output to the expected tags.
     my $testok = runsystem_ok('cmp', '-s', "$testdir/$test.tags",
@@ -559,8 +575,8 @@ sub test_deb {
     runsystem("cd $targetdir && fakeroot make >../build.$test 2>&1");
 
     print "testing... ";
-    runsystem_ok("$LINTIAN -I -E $targetdir/$test.deb 2>&1" .
-		 " | sort > $RUNDIR/tags.$test");
+    runsystem_ok("$LINTIAN -I -E $targetdir/$test.deb 2>&1"
+		 . " | sort > $RUNDIR/tags.$test");
 
     # Compare the output to the expected tags.
     my $testok = runsystem_ok('cmp', '-s', "$testdir/tags",
@@ -619,8 +635,8 @@ sub test_source {
     runsystem("cd $targetdir && make >../build.$test 2>&1");
 
     print "testing... ";
-    runsystem_ok("$LINTIAN -I -E $targetdir/*.dsc 2>&1" .
-		 " | sort > $RUNDIR/tags.$test");
+    runsystem_ok("$LINTIAN -I -E $targetdir/*.dsc 2>&1"
+		 . " | sort > $RUNDIR/tags.$test");
 
     # Compare the output to the expected tags.
     my $testok = runsystem_ok('cmp', '-s', "$testdir/tags",
@@ -691,6 +707,7 @@ sub check_test_is_sane {
     $data->{architecture} ||= 'all';
     $data->{section} ||= 'devel';
     $data->{'standards_version'} ||= $STANDARDS_VERSION;
+    $data->{sort} = ($data->{sort} and $data->{sort} eq 'no') ? 0 : 1;
 
     $data->{'test-for'} ||= '';
     $data->{'test-against'} ||= '';
diff --git a/t/tests/README b/t/tests/README
index 8c67603..e42490b 100644
--- a/t/tests/README
+++ b/t/tests/README
@@ -74,6 +74,12 @@ the test suite (the whole test suite, not the test currently running) so
 that the Lintian options can refer to files in the test suite directory to
 test options like --suppress-tags-from-file.
 
+By default, the Lintian output is sorted before comparing it to the tags
+file.  To suppress the sort (when, for instance, checking non-standard
+output formats), use:
+
+    Sort: no
+
 By default, all tests are built as native Debian packages.  To build
 the test case as a non-native package, add:
 

-- 
Debian package checker


Reply to: