[debhelper-devel] [debhelper] 14/30: dh_missing.t: Convert to Test::DH

Niels Thykier nthykier at moszumanska.debian.org
Mon Jul 3 14:40:37 UTC 2017


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 823e57fc5dcd6e4cc78699e5837a836818632ff5
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Jul 2 15:28:38 2017 +0000

    dh_missing.t: Convert to Test::DH
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 t/dh_missing/dh_missing.t | 79 +++++++++++++++++++++++++++--------------------
 1 file changed, 45 insertions(+), 34 deletions(-)

diff --git a/t/dh_missing/dh_missing.t b/t/dh_missing/dh_missing.t
index 4de978c..8d87f77 100755
--- a/t/dh_missing/dh_missing.t
+++ b/t/dh_missing/dh_missing.t
@@ -1,41 +1,52 @@
 #!/usr/bin/perl
 use strict;
+use warnings;
 use Test::More;
-use File::Basename ();
 
-# Let the tests be run from anywhere, but current directory
-# is expected to be the one where this test lives in.
-chdir File::Basename::dirname($0) or die "Unable to chdir to ".File::Basename::dirname($0);
-
-my $TOPDIR = "../..";
-
-plan(tests => 5);
-
-
-# Verify dh_missing does not fail when all files are installed.
-system("$TOPDIR/dh_clean");
-system("make install");
-system("PATH=$TOPDIR:\$PATH $TOPDIR/dh_install");
-is(system("$TOPDIR/dh_missing --fail-missing"), 0, 'dh_missing failed');
-
-# Verify dh_missing does fail when not all files are installed.
-system("$TOPDIR/dh_clean");
-system("make installmore");
-system("PATH=$TOPDIR:\$PATH $TOPDIR/dh_install");
-system("$TOPDIR/dh_missing --fail-missing >/dev/null 2>&1");
-isnt($?, -1, 'dh_missing was executed');
-ok(! ($? & 127), 'dh_missing did not die due to a signal');
-my $exitcode = ($? >> 8);
-is($exitcode, 2, 'dh_missing exited with exit code 2');
-
-# Verify that dh_install -X --fail-missing is passed through to dh_missing (#863447)
-# dh_install -Xfile makes file-for-foo not be installed. Then we shouldn't
-# complain about it not being missing.
-system("$TOPDIR/dh_clean");
-system("make install");
-is(system("PATH=$TOPDIR:\$PATH $TOPDIR/dh_install -X more --exclude lots --fail-missing"),0, 'dh_install -X... --fail-missing failed');
-
-system("$TOPDIR/dh_clean");
+use File::Basename qw(dirname);
+use lib dirname(dirname(__FILE__));
+use Test::DH;
+
+our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
+    debian/changelog
+    debian/control
+    debian/foo.install
+    file-for-foo
+    Makefile
+));
+
+plan(tests => 3);
+
+each_compat_subtest {
+	# Verify dh_missing does not fail when all files are installed.
+	ok(run_dh_tool('dh_clean'));
+	is(system('make', 'install'), 0);
+	ok(run_dh_tool('dh_install', '--sourcedir', 'debian/tmp'));
+	ok(run_dh_tool('dh_missing', '--fail-missing'), 'dh_missing failed');
+};
+
+each_compat_subtest {
+	# Verify dh_missing does fail when not all files are installed.
+	ok(run_dh_tool('dh_clean'));
+	is(system('make', 'installmore'), 0);
+	ok(run_dh_tool('dh_install', '--sourcedir', 'debian/tmp'));
+	ok(!run_dh_tool({ 'quiet' => 1 }, 'dh_missing', '--fail-missing'));
+
+	isnt($?, -1, 'dh_missing was executed');
+	ok(! ($? & 127), 'dh_missing did not die due to a signal');
+	my $exitcode = ($? >> 8);
+	is($exitcode, 2, 'dh_missing exited with exit code 2');
+};
+
+each_compat_up_to_and_incl_subtest(10, sub {
+	# Verify that dh_install -X --fail-missing is passed through to dh_missing (#863447)
+	# dh_install -Xfile makes file-for-foo not be installed. Then we shouldn't
+	# complain about it not being missing.
+	ok(run_dh_tool('dh_clean'));
+	is(system('make', 'install'), 0);
+	ok(run_dh_tool({ 'quiet' => 1 }, 'dh_install', '--sourcedir', 'debian/tmp',
+				   '-X', 'more', '--exclude', 'lots', '--fail-missing'));
+});
 
 # Local Variables:
 # indent-tabs-mode: t

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




More information about the debhelper-devel mailing list