[dpkg] 136/187: scripts/t: Output STDERR when commands fail

Reiner Herrmann reiner at reiner-h.de
Sun Nov 6 12:46:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository dpkg.

commit 0bbc4f7b75f257807ea5d789a8226e8434bd6f58
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Oct 30 19:48:30 2016 +0100

    scripts/t: Output STDERR when commands fail
    
    Store the STDERR output and emit it as diag() output on exit failure.
    Also check the exit value for expected success. And do not abort on
    error from the dpkg-buildpackage command.
---
 scripts/t/dpkg_buildpackage.t | 11 ++++++++---
 scripts/t/dpkg_source.t       | 10 +++++++---
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/scripts/t/dpkg_buildpackage.t b/scripts/t/dpkg_buildpackage.t
index a369665..9b01708 100644
--- a/scripts/t/dpkg_buildpackage.t
+++ b/scripts/t/dpkg_buildpackage.t
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 7;
+use Test::More tests => 12;
 use Test::Dpkg qw(test_neutralize_checksums);
 
 use File::Spec::Functions qw(rel2abs);
@@ -177,13 +177,18 @@ sub test_build
     set_build_type($type, 'buildtype', nocheck => 1);
     my $typename = get_build_options_from_type();
 
+    my $stderr;
+
     chdir $dirname;
     spawn(exec => [ "$srcdir/dpkg-buildpackage.pl", '--host-arch=amd64',
                     "--build=$typename", '--check-command=' ],
-          error_to_file => '/dev/null',
-          wait_child => 1);
+          error_to_string => \$stderr,
+          wait_child => 1, nocheck => 1);
     chdir '..';
 
+    ok($? == 0, "dpkg-buildpackage --build=$typename succeeded");
+    diag($stderr) unless $? == 0;
+
     if (build_has_all(BUILD_ARCH_DEP)) {
         # Rename the file to preserve on consecutive invokations.
         move("$basename\_amd64.changes", "$basename\_$typename.changes");
diff --git a/scripts/t/dpkg_source.t b/scripts/t/dpkg_source.t
index d9c46a3..974e371 100644
--- a/scripts/t/dpkg_source.t
+++ b/scripts/t/dpkg_source.t
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 4;
+use Test::More tests => 8;
 use Test::Dpkg qw(test_neutralize_checksums);
 
 use File::Spec::Functions qw(rel2abs);
@@ -132,11 +132,15 @@ sub test_diff
 sub test_build_source
 {
     my ($name) = shift;
+    my $stderr;
 
-    spawn(exec => [ "$srcdir/dpkg-source.pl", '-b', $name ],
-          error_to_file => '/dev/null',
+    spawn(exec => [ "$srcdir/dpkg-source.pl", '--build', $name ],
+          error_to_string => \$stderr,
           wait_child => 1, nocheck => 1);
 
+    ok($? == 0, 'dpkg-source --build succeeded');
+    diag($stderr) unless $? == 0;
+
     my $basename = $name =~ tr/-/_/r;
 
     test_diff("$basename.dsc");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list