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

[SCM] Debian package checker branch, master, updated. 2.5.0-rc2-8-gf7e676a



The following commit has been merged in the master branch:
commit 109676bc08d6910ed56b1bf3b6e7262b76b12622
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Mar 26 10:57:32 2011 +0100

    Added option to dump build logs for tests that FTBFS
    
    This is useful to get the build logs from buildds, where the
    build logs cannot (easily) be obtained otherwise.

diff --git a/debian/changelog b/debian/changelog
index ad2c9e7..6ab361f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,10 @@ lintian (2.5.0~rc3) UNRELEASED; urgency=low
   * data/files/triplets:
     + [NT] Updated to include armhf triplet.
 
+  * private/runtests:
+    + [NT] Added support for dumping build logs if a test fails.
+      (Closes: #621658)
+
  -- Niels Thykier <niels@thykier.net>  Thu, 07 Apr 2011 19:00:59 +0200
 
 lintian (2.5.0~rc2) unstable; urgency=low
diff --git a/private/runtests b/private/runtests
index b4add05..9e4dd83 100755
--- a/private/runtests
+++ b/private/runtests
@@ -37,7 +37,7 @@ if [ ! -e "$LOCPATH"/en_US.UTF-8 ] ; then
         --quiet "$LOCPATH"/en_US.UTF-8 || fail "Locale generation failed"
 fi
 
-t/runtests -k $PARALLEL_ARGS t debian/tests "$@"
+t/runtests --dump-logs -k $PARALLEL_ARGS t debian/tests "$@"
 if [ "$TAG" = "" ] ; then
     testset/runtests -k testset debian/tests "$@"
 fi
diff --git a/t/runtests b/t/runtests
index 268a488..15db79b 100755
--- a/t/runtests
+++ b/t/runtests
@@ -97,6 +97,7 @@ our $VERBOSE = 0;
 our $RUNDIR;
 our $TESTSET;
 our $JOBS = -1;
+our $DUMP_LOGS = '';
 
 my ($run_all_tests, $tag);
 Getopt::Long::Configure('bundling');
@@ -104,6 +105,7 @@ GetOptions('d|debug'      => \$DEBUG,
 	   'j|jobs:i'     => \$JOBS,
 	   'k|keep-going' => \$run_all_tests,
 	   't|tag=s'      => \$tag,
+	   'dump-logs!'   => \$DUMP_LOGS,
 	   'v|verbose'    => \$VERBOSE) or usage;
 if ($#ARGV < 1 || $#ARGV > 2) {
     usage;
@@ -515,7 +517,11 @@ sub test_package {
     }
 
     msg_print "building... ";
-    runsystem("cd $rundir/$pkgdir && $DPKG_BUILDPACKAGE >../build.$pkg 2>&1");
+    my $res = system("cd $rundir/$pkgdir && $DPKG_BUILDPACKAGE >../build.$pkg 2>&1");
+    if ($res){
+	dump_log($pkg, "$rundir/build.$pkg") if $DUMP_LOGS;
+	fail("cd $rundir/$pkgdir && $DPKG_BUILDPACKAGE >../build.$pkg 2>&1");
+    }
 
     my $version = $testdata->{version};
     $version =~ s/^(\d+)://;
@@ -798,6 +804,19 @@ sub unquote {
     return $string
 }
 
+sub dump_log{
+    my ($pkg, $logf) = @_;
+    if (open(my $log, '<', $logf)){
+	print "$pkg: ---- START BUILD LOG\n";
+	print "$pkg: $_" while (<$log>);
+	print "$pkg: ---- END BUILD LOG\n";
+	close($log);
+    } else {
+	msg_print "!!! Could not dump $logf: $!";
+    }
+    return 1;
+}
+
 sub runsystem {
     print "runsystem(@_)\n" if $DEBUG;
     system(@_) == 0

-- 
Debian package checker


Reply to: