summaryrefslogtreecommitdiffstats
path: root/t/dh_missing
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xt/dh_missing/01-no-missing.t28
-rwxr-xr-xt/dh_missing/02-fail-on-missing.t33
-rwxr-xr-xt/dh_missing/03-dh_install-redirection.t30
-rwxr-xr-xt/dh_missing/04-not-installed-glob.t37
-rw-r--r--t/dh_missing/template/Makefile7
-rw-r--r--t/dh_missing/template/debian/changelog5
-rw-r--r--t/dh_missing/template/debian/control20
-rw-r--r--t/dh_missing/template/debian/foo.install1
-rw-r--r--t/dh_missing/template/file-for-foo1
9 files changed, 162 insertions, 0 deletions
diff --git a/t/dh_missing/01-no-missing.t b/t/dh_missing/01-no-missing.t
new file mode 100755
index 0000000..e3cd311
--- /dev/null
+++ b/t/dh_missing/01-no-missing.t
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More;
+
+use File::Basename qw(dirname);
+use lib dirname(dirname(__FILE__));
+use Test::DH;
+
+our $TEST_DH_FIXTURE_DIR = 'template';
+our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
+ debian/changelog
+ debian/control
+ debian/foo.install
+ file-for-foo
+ Makefile
+));
+
+plan(tests => 1);
+
+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');
+};
+
diff --git a/t/dh_missing/02-fail-on-missing.t b/t/dh_missing/02-fail-on-missing.t
new file mode 100755
index 0000000..e97b6eb
--- /dev/null
+++ b/t/dh_missing/02-fail-on-missing.t
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More;
+
+use File::Basename qw(dirname);
+use lib dirname(dirname(__FILE__));
+use Test::DH;
+
+our $TEST_DH_FIXTURE_DIR = 'template';
+our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
+ debian/changelog
+ debian/control
+ debian/foo.install
+ file-for-foo
+ Makefile
+));
+
+plan(tests => 1);
+
+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, 255, 'dh_missing exited with exit code 255');
+};
+
diff --git a/t/dh_missing/03-dh_install-redirection.t b/t/dh_missing/03-dh_install-redirection.t
new file mode 100755
index 0000000..2235b08
--- /dev/null
+++ b/t/dh_missing/03-dh_install-redirection.t
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More;
+
+use File::Basename qw(dirname);
+use lib dirname(dirname(__FILE__));
+use Test::DH;
+
+our $TEST_DH_FIXTURE_DIR = 'template';
+our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
+ debian/changelog
+ debian/control
+ debian/foo.install
+ file-for-foo
+ Makefile
+));
+
+plan(tests => 1);
+
+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'));
+});
+
diff --git a/t/dh_missing/04-not-installed-glob.t b/t/dh_missing/04-not-installed-glob.t
new file mode 100755
index 0000000..b46eca3
--- /dev/null
+++ b/t/dh_missing/04-not-installed-glob.t
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More;
+
+use File::Basename qw(dirname);
+use lib dirname(dirname(__FILE__));
+use Test::DH;
+use Debian::Debhelper::Dh_Lib qw(!dirname);
+
+our $TEST_DH_FIXTURE_DIR = 'template';
+our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
+ debian/changelog
+ debian/control
+ debian/foo.install
+ file-for-foo
+ Makefile
+));
+
+plan(tests => 1);
+
+each_compat_subtest {
+ rm_files('debian/not-installed');
+ open(my $fd, '>', 'debian/not-installed') or error("open(d/not-installed): $!");
+ # Non-glob match
+ print {$fd} "usr/bin/file-for-foo\n";
+ # Glob match (note that it must not match the above)
+ print {$fd} "usr/bin/file-for-foo-*\n";
+ # Non-matches (silently ignored)
+ print {$fd} "usr/bin/does-not-exist\n";
+ print {$fd} "usr/bin/does-not-exist-*\n";
+ close($fd) or error("close(d/not-installed: $!");
+ ok(run_dh_tool('dh_clean'));
+ is(system('make', 'installmore'), 0);
+ ok(run_dh_tool('dh_missing', '--fail-missing'));
+};
+
diff --git a/t/dh_missing/template/Makefile b/t/dh_missing/template/Makefile
new file mode 100644
index 0000000..e33e1df
--- /dev/null
+++ b/t/dh_missing/template/Makefile
@@ -0,0 +1,7 @@
+install:
+ install -m 755 -d debian/tmp/usr/bin
+ install -m 644 file-for-foo debian/tmp/usr/bin/file-for-foo
+
+installmore: install
+ install -m 644 file-for-foo debian/tmp/usr/bin/file-for-foo-more
+ install -m 644 file-for-foo debian/tmp/usr/bin/file-for-foo-lots
diff --git a/t/dh_missing/template/debian/changelog b/t/dh_missing/template/debian/changelog
new file mode 100644
index 0000000..5850f0e
--- /dev/null
+++ b/t/dh_missing/template/debian/changelog
@@ -0,0 +1,5 @@
+foo (1.0-1) unstable; urgency=low
+
+ * Initial release. (Closes: #XXXXXX)
+
+ -- Test <testing@nowhere> Mon, 11 Jul 2016 18:10:59 +0200
diff --git a/t/dh_missing/template/debian/control b/t/dh_missing/template/debian/control
new file mode 100644
index 0000000..48d4de2
--- /dev/null
+++ b/t/dh_missing/template/debian/control
@@ -0,0 +1,20 @@
+Source: foo
+Section: misc
+Priority: optional
+Maintainer: Test <testing@nowhere>
+Standards-Version: 3.9.8
+
+Package: foo
+Architecture: all
+Description: package foo
+ Package foo
+
+Package: bar
+Architecture: all
+Description: package bar
+ Package bar
+
+Package: baz
+Architecture: all
+Description: package baz
+ Package baz
diff --git a/t/dh_missing/template/debian/foo.install b/t/dh_missing/template/debian/foo.install
new file mode 100644
index 0000000..eddea57
--- /dev/null
+++ b/t/dh_missing/template/debian/foo.install
@@ -0,0 +1 @@
+usr/bin/*-for-foo \ No newline at end of file
diff --git a/t/dh_missing/template/file-for-foo b/t/dh_missing/template/file-for-foo
new file mode 100644
index 0000000..8773f39
--- /dev/null
+++ b/t/dh_missing/template/file-for-foo
@@ -0,0 +1 @@
+file content \ No newline at end of file