[dh-make-perl] 01/03: rework dists.t using IPC::Run
Damyan Ivanov
dmn at alioth.debian.org
Fri Aug 9 09:55:58 UTC 2013
This is an automated email from the git hooks/post-receive script.
dmn pushed a commit to branch master
in repository dh-make-perl.
commit 23163ea993e22a40ca8cad87a712f542c7625d71
Author: Damyan Ivanov <dmn at debian.org>
Date: Fri Aug 9 11:52:01 2013 +0200
rework dists.t using IPC::Run
this gives us more diagnostic opportunities
---
Build.PL | 1 +
debian/control | 1 +
t/dists.t | 147 ++++++++++++++++++++++++++++++++++++++------------------
3 files changed, 102 insertions(+), 47 deletions(-)
diff --git a/Build.PL b/Build.PL
index 904ed8e..bc0605f 100644
--- a/Build.PL
+++ b/Build.PL
@@ -54,6 +54,7 @@ my $builder = My::Builder->new(
'YAML' => 0,
},
build_requires => {
+ 'IPC::Run' => 0,
'File::DirCompare' => 0,
'File::Touch' => 0,
'Test::Compile' => 0,
diff --git a/debian/control b/debian/control
index 9b06d24..435c171 100644
--- a/debian/control
+++ b/debian/control
@@ -21,6 +21,7 @@ Build-Depends-Indep: libapt-pkg-perl,
libdpkg-perl,
libemail-address-perl,
libemail-date-format-perl,
+ libipc-run-perl,
libfile-dircompare-perl,
libfile-find-rule-perl,
libfile-touch-perl,
diff --git a/t/dists.t b/t/dists.t
index 6bc4443..c709ba8 100755
--- a/t/dists.t
+++ b/t/dists.t
@@ -88,77 +88,130 @@ sub dist_ok($) {
my $dist_dir = shift;
my $dist = "$Bin/dists/$dist_dir";
- system( "$Bin/../dh-make-perl", "--no-verbose",
- "--home-dir", "$Bin/contents",
- "--apt-contents-dir", "$Bin/contents",
- "--data-dir", "$Bin/../share",
- $ENV{NO_NETWORK} ? '--no-network' : (),
- "--vcs", "none",
- "--sources-list",
- "$Bin/contents/sources.list", "--email", "joemaint\@test.local",
- $dist );
-
- is( $?, 0, "$dist_dir: system returned 0" );
+ my ( @cmd, $out, $err );
+
+ use IPC::Run qw( run );
+
+# plain make
+
+ $out = $err = '';
+ @cmd = (
+ "$Bin/../dh-make-perl", "--no-verbose",
+ "--home-dir", "$Bin/contents",
+ "--apt-contents-dir", "$Bin/contents",
+ "--data-dir", "$Bin/../share",
+ $ENV{NO_NETWORK} ? '--no-network' : (), "--vcs",
+ "none", "--sources-list",
+ "$Bin/contents/sources.list", "--email",
+ "joemaint\@test.local", $dist
+ );
+
+ my $ok = run \@cmd, \undef, \$out, \$err;
+
+ unless ($ok) {
+ diag "\$! = $!, \$? = $?";
+ diag $out if $out;
+ diag $err if $err;
+ }
+
+ ok( $ok, "$dist_dir run ok" );
compare_tree( "$dist/debian", "$dist/wanted-debian", 'initial' );
- system( "$Bin/../dh-make-perl", "--no-verbose",
- "--home-dir", "$Bin/contents",
- "--apt-contents-dir", "$Bin/contents",
- "--data-dir", "$Bin/../share",
- $ENV{NO_NETWORK} ? '--no-network' : (),
- "--vcs", "none",
- "--sources-list",
- "$Bin/contents/sources.list", "--email", "joemaint\@test.local",
- "refresh",
- $dist );
+# --refresh
+
+ $out = $err = '';
+ @cmd = (
+ "$Bin/../dh-make-perl", "--no-verbose",
+ "--home-dir", "$Bin/contents",
+ "--apt-contents-dir", "$Bin/contents",
+ "--data-dir", "$Bin/../share",
+ $ENV{NO_NETWORK} ? '--no-network' : (), "--vcs",
+ "none", "--sources-list",
+ "$Bin/contents/sources.list", "--email",
+ "joemaint\@test.local", "refresh",
+ $dist
+ );
- is( $?, 0, "$dist_dir refresh: system returned 0" );
+ $ok = run \@cmd, \undef, \$out, \$err;
+
+ unless ($ok) {
+ diag "\$! = $!, \$? = $?";
+ diag $out if $out;
+ diag $err if $err;
+ }
+
+ ok( $ok, "$dist_dir refresh: run ok" );
compare_tree( "$dist/debian", "$dist/wanted-debian--refresh", 'refresh' );
unlink File::Find::Rule->file->name('*.bak')->in("$dist/debian");
- system( "$Bin/../dh-make-perl", "--no-verbose",
- "--home-dir", "$Bin/contents",
- "--apt-contents-dir", "$Bin/contents",
- "--data-dir", "$Bin/../share",
- $ENV{NO_NETWORK} ? '--no-network' : (),
- "--vcs", "none",
- "--sources-list",
- "$Bin/contents/sources.list", "--email", "joemaint\@test.local",
- "refresh", '--source-format', '3.0 (quilt)',
- $dist );
-
- is( $?, 0,
- "$dist_dir refresh --source-format '3.0 (quilt)': system returned 0"
+# --refresh --source-format '3.0 (quilt)'
+
+ $out = $err = '';
+ @cmd = (
+ "$Bin/../dh-make-perl", "--no-verbose",
+ "--home-dir", "$Bin/contents",
+ "--apt-contents-dir", "$Bin/contents",
+ "--data-dir", "$Bin/../share",
+ $ENV{NO_NETWORK} ? '--no-network' : (), "--vcs",
+ "none", "--sources-list",
+ "$Bin/contents/sources.list", "--email",
+ "joemaint\@test.local", "refresh",
+ '--source-format', '3.0 (quilt)',
+ $dist
);
+ $ok = run \@cmd, \undef, \$out, \$err;
+
+ unless ($ok) {
+ diag "\$! = $!, \$? = $?";
+ diag $out if $out;
+ diag $err if $err;
+ }
+
+ ok( $ok, "$dist_dir refresh --source-format '3.0 (quilt)': run ok" );
+
compare_tree(
"$dist/debian",
"$dist/wanted-debian--refresh--source-format=3.0_quilt",
'refresh --source-format 3.0 (quilt)'
);
+# refresh with changed email
+
modify_changelog($dist);
local $ENV{DEBFULLNAME} = 'Florian Geekwurt';
local $ENV{DEBEMAIL} = 'florian at geekwurt.org';
- system( "$Bin/../dh-make-perl", "--no-verbose",
- "--home-dir", "$Bin/contents",
- "--apt-contents-dir", "$Bin/contents",
- "--data-dir", "$Bin/../share",
- $ENV{NO_NETWORK} ? '--no-network' : (),
- "--vcs", "none",
- "--sources-list",
- "$Bin/contents/sources.list",
- "refresh",
- $dist );
-
- is( $?, 0, "$dist_dir refresh: system returned 0" );
+
+ $out = $err = '';
+ @cmd = (
+ "$Bin/../dh-make-perl", "--no-verbose",
+ "--home-dir", "$Bin/contents",
+ "--apt-contents-dir", "$Bin/contents",
+ "--data-dir", "$Bin/../share",
+ $ENV{NO_NETWORK} ? '--no-network' : (), "--vcs",
+ "none", "--sources-list",
+ "$Bin/contents/sources.list", "refresh",
+ $dist
+ );
+
+ $ok = run \@cmd, \undef, \$out, \$err;
+
+ unless ($ok) {
+ diag "\$! = $!, \$? = $?";
+ diag $out if $out;
+ diag $err if $err;
+ }
+
+ ok( $ok, "$dist_dir refresh with changed email: run ok" );
compare_tree( "$dist/debian", "$dist/wanted-debian--refresh-email", 'email' );
+# clean up
+
unlink File::Find::Rule->file->name('*.bak')->in("$dist/debian");
# clean after the test
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/dh-make-perl.git
More information about the Pkg-perl-cvs-commits
mailing list