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

[SCM] Debian package checker branch, master, updated. 2.5.2-41-gf85156c



The following commit has been merged in the master branch:
commit f85156c2469de1f9637f444a4c4e8dd9396ee106
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Aug 18 22:23:18 2011 +0200

    Do not use Lintian::Command (or IPC::Run) in t/runtests
    
    Testing suggested that the dead-lock test dead-lock appears to be
    related to the lintian sub-process and only spawn (using IPC::Run)
    started that process.

diff --git a/t/runtests b/t/runtests
index 9ddd7de..133cf38 100755
--- a/t/runtests
+++ b/t/runtests
@@ -58,7 +58,6 @@ BEGIN {
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
 
-use Lintian::Command qw(spawn);
 use Util;
 
 # --- Global configuration
@@ -441,24 +440,31 @@ sub _builder_tests {
 sub run_lintian {
     my ($testdata, $file, $out) = @_;
     msg_print 'testing... ';
-    my $opts = { err => "$out", fail => 'never' };
-    my $status;
-    my @options = split(' ', $testdata->{options}//'');
+    my $status = 0;
+    # Quote (A test use -L <=, which blows up if we don't... plus it is safer that way)
+    my @options = map { quotemeta $_ } split(' ', $testdata->{options}//'');
+    my $cmd;
+    my $ret;
     unshift(@options, '--allow-root', '--no-cfg');
     unshift(@options, '--profile', $testdata->{profile}) if $testdata->{profile};
-    if ($testdata->{sort}) {
-	$status = spawn($opts, [ $LINTIAN, @options, $file ], '|', [ 'sort' ]);
+    $cmd = "$LINTIAN " . join(' ', @options). " $file 2>&1";
+    if (open my $in, '-|', $cmd) {
+	my @data = <$in>;
+	close $in;
+	$status = ($? >> 8) & 255;
+	@data = sort @data if $testdata->{sort};
+	open my $fd, '>', $out or fail "opening $out: $!";
+	print $fd $_ for @data;
+	close $fd or fail "closing $out: $!";
     } else {
-	$status = spawn($opts, [ $LINTIAN, @options, $file ]);
+	# Set it to 255 so it fails below
+	$status = 255;
     }
+
     unless ($status == 0 or $status == 1) {
 	msg_print "FAILED:\n";
 	fail("$LINTIAN @options $file exited with status $status\n");
     }
-    open(my $fd, '>>', "$out")
-	or fail("cannot append to $out: $!");
-    print $fd ${ $opts->{out} };
-    close $fd or fail "closing $out: $!";
     return 1;
 }
 

-- 
Debian package checker


Reply to: