[SCM] Debian package checker branch, master, updated. 2.2.18-33-g3cfd89c
The following commit has been merged in the master branch:
commit 4cbd7b8e23533fdb4cbc3c89ddef7a5e62911d76
Author: Russ Allbery <rra@debian.org>
Date: Wed Dec 23 20:39:09 2009 -0800
Improve runtests error handling and tag syntax checking
* t/runtests:
+ [RA] Put all error output from lintian unsorted before the regular
output, making it easier to diagnose errors.
+ [RA] Suppress checking the syntax of the lintian output if neither
Test-For nor Test-Against are set and Sort: no is set.
diff --git a/debian/changelog b/debian/changelog
index 3221693..3f197ec 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,12 +64,16 @@ lintian (2.3.0) UNRELEASED; urgency=low
* t/runtests:
+ [RA] Unwrap the Options field so that it can be continued.
+ [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
+ 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.
+ 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.
+ that the lintian options may contain shell metacharacters.
+ + [RA] Put all error output from lintian unsorted before the regular
+ output, making it easier to diagnose errors.
+ + [RA] Suppress checking the syntax of the lintian output if neither
+ Test-For nor Test-Against are set and Sort: no is set.
-- Russ Allbery <rra@debian.org> Mon, 23 Nov 2009 02:20:29 -0800
diff --git a/t/runtests b/t/runtests
index 77c2213..a7c71ca 100755
--- a/t/runtests
+++ b/t/runtests
@@ -417,20 +417,20 @@ sub test_package {
my @options = split(' ', $testdata->{options});
my ($file) = glob("$RUNDIR/$pkg\_$version*.changes");
print "testing... ";
+ my $opts = { err => "$RUNDIR/tags.$pkg", fail => 'never' };
+ my $status;
if ($testdata->{sort}) {
- my $status = spawn({ out => "$RUNDIR/tags.$pkg" },
- [ $LINTIAN, @options, $file ],
- '|', [ 'sort' ]);
- unless ($status == 0 or $status == (1 << 8)) {
- fail("failed: @_\n");
- }
+ $status = spawn($opts, [ $LINTIAN, @options, $file ], '|', [ 'sort' ]);
} else {
- my $status = spawn({ out => "$RUNDIR/tags.$pkg" },
- [ $LINTIAN, @options, $file ]);
- unless ($status == 0 or $status == (1 << 8)) {
- fail("failed: @_\n");
- }
+ $status = spawn($opts, [ $LINTIAN, @options, $file ]);
+ }
+ unless ($status == 0 or $status == (1 << 8)) {
+ fail("failed: @_\n");
}
+ open(OUT, '>>', "$RUNDIR/tags.$pkg")
+ or fail("cannot append to $RUNDIR/tags.$pkg: $!");
+ print OUT ${ $opts->{out} };
+ close OUT;
# Run a sed-script if it exists, for tests that have slightly variable
# output
@@ -448,34 +448,40 @@ sub test_package {
}
# Check the output for invalid lines. Also verify that all Test-For tags
- # are seen and all Test-Against tags are not.
+ # are seen and all Test-Against tags are not. Skip this part of the test
+ # if neither Test-For nor Test-Against are set and Sort is also not set,
+ # since in that case we probably have non-standard output.
my %test_for = map { $_ => 1 } split(' ', $testdata->{'test-for'});
my %test_against = map { $_ => 1 } split(' ', $testdata->{'test-against'});
- my $okay = 1;
- open TAGS, "$RUNDIR/tags.$pkg" or fail("Cannot open $RUNDIR/tags.$pkg");
- while (<TAGS>) {
- next if m/^N: /;
- if (not /^(.): (\S+)(?: (?:source|udeb))?: (\S+)/) {
- print "E: Invalid line:\n$_";
- $okay = 0;
- next;
- }
- my $tag = $3;
- if ($test_against{$tag}) {
- print "E: Tag $tag seen but listed in Test-Against\n";
- $okay = 0;
+ if (not %test_for and not %test_against and not $testdata->{sort}) {
+ return 1;
+ } else {
+ my $okay = 1;
+ open TAGS, "$RUNDIR/tags.$pkg" or fail("Cannot open $RUNDIR/tags.$pkg");
+ while (<TAGS>) {
+ next if m/^N: /;
+ if (not /^(.): (\S+)(?: (?:source|udeb))?: (\S+)/) {
+ print "E: Invalid line:\n$_";
+ $okay = 0;
+ next;
+ }
+ my $tag = $3;
+ if ($test_against{$tag}) {
+ print "E: Tag $tag seen but listed in Test-Against\n";
+ $okay = 0;
+ }
+ delete $test_for{$tag};
}
- delete $test_for{$tag};
- }
- close TAGS;
- if (%test_for) {
- for my $tag (sort keys %test_for) {
- print "E: Tag $tag listed in Test-For but not found\n";
- $okay = 0;
+ close TAGS;
+ if (%test_for) {
+ for my $tag (sort keys %test_for) {
+ print "E: Tag $tag listed in Test-For but not found\n";
+ $okay = 0;
+ }
}
+ return 1 if $okay;
+ return;
}
- return 1 if $okay;
- return;
}
# --- Changes file testing
--
Debian package checker
Reply to: