diff options
Diffstat (limited to 't/dh_installdocs')
-rwxr-xr-x | t/dh_installdocs/01-868204-ignore-broken-symlinks.t | 30 | ||||
-rw-r--r-- | t/dh_installdocs/debian/changelog | 5 | ||||
-rw-r--r-- | t/dh_installdocs/debian/control | 22 | ||||
-rw-r--r-- | t/dh_installdocs/debian/copyright | 1 | ||||
-rw-r--r-- | t/dh_installdocs/debian/docfile | 1 | ||||
-rwxr-xr-x | t/dh_installdocs/dh_installdocs.t | 75 |
6 files changed, 134 insertions, 0 deletions
diff --git a/t/dh_installdocs/01-868204-ignore-broken-symlinks.t b/t/dh_installdocs/01-868204-ignore-broken-symlinks.t new file mode 100755 index 0000000..b9801d2 --- /dev/null +++ b/t/dh_installdocs/01-868204-ignore-broken-symlinks.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; +use File::Path qw(remove_tree make_path); +use Debian::Debhelper::Dh_Lib qw(!dirname); + +plan(tests => 1); + +each_compat_subtest { + my ($compat) = @_; + # #868204 - dh_installdocs did not replace dangling symlink + make_path('debian/debhelper/usr/share/doc/debhelper'); + make_symlink_raw_target('../to/nowhere/bar', + 'debian/debhelper/usr/share/doc/debhelper/README.Debian'); + create_empty_file('debian/README.Debian'); + + ok(-l 'debian/debhelper/usr/share/doc/debhelper/README.Debian'); + ok(!-e 'debian/debhelper/usr/share/doc/debhelper/README.Debian'); + + ok(run_dh_tool('dh_installdocs')); + ok(!-l 'debian/debhelper/usr/share/doc/debhelper/README.Debian', "#868204 [${compat}]"); + ok(-f 'debian/debhelper/usr/share/doc/debhelper/README.Debian', "#868204 [${compat}]"); + remove_tree('debian/debhelper', 'debian/tmp'); +}; + diff --git a/t/dh_installdocs/debian/changelog b/t/dh_installdocs/debian/changelog new file mode 100644 index 0000000..5850f0e --- /dev/null +++ b/t/dh_installdocs/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_installdocs/debian/control b/t/dh_installdocs/debian/control new file mode 100644 index 0000000..16e6285 --- /dev/null +++ b/t/dh_installdocs/debian/control @@ -0,0 +1,22 @@ +Source: foo +Section: misc +Priority: optional +Maintainer: Test <testing@nowhere> +Rules-Requires-Root: no +Standards-Version: 3.9.8 +X-DH-Compat: @DH_COMPAT_LEVEL@ + +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_installdocs/debian/copyright b/t/dh_installdocs/debian/copyright new file mode 100644 index 0000000..7e6ffb0 --- /dev/null +++ b/t/dh_installdocs/debian/copyright @@ -0,0 +1 @@ +Some test copyright file diff --git a/t/dh_installdocs/debian/docfile b/t/dh_installdocs/debian/docfile new file mode 100644 index 0000000..2719eec --- /dev/null +++ b/t/dh_installdocs/debian/docfile @@ -0,0 +1 @@ +This file must not be empty, or dh_installdocs won't install it. diff --git a/t/dh_installdocs/dh_installdocs.t b/t/dh_installdocs/dh_installdocs.t new file mode 100755 index 0000000..64f1254 --- /dev/null +++ b/t/dh_installdocs/dh_installdocs.t @@ -0,0 +1,75 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Test::More; + + +use File::Path qw(remove_tree); +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/docfile + debian/copyright +)); + +plan(tests => 5); + + +my $NODOC_PROFILE = { + 'env' => { + 'DEB_BUILD_PROFILES' => 'nodoc', + }, +}; + +my $doc = "debian/docfile"; + +each_compat_subtest { + ok(run_dh_tool('dh_installdocs', '-pbar', $doc)); + ok(-e "debian/bar/usr/share/doc/bar/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +each_compat_subtest { + #regression in debhelper 9.20160702 (#830309) + ok(run_dh_tool('dh_installdocs', '-pbaz', '--link-doc=foo', $doc)); + + ok(-l "debian/baz/usr/share/doc/baz"); + ok(readlink("debian/baz/usr/share/doc/baz") eq 'foo'); + ok(-e "debian/baz/usr/share/doc/foo/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +each_compat_subtest { + ok(run_dh_tool('dh_installdocs', '-pfoo', '--link-doc=bar', $doc)); + + ok(-l "debian/foo/usr/share/doc/foo"); + ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar'); + ok(-e "debian/foo/usr/share/doc/bar/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +# ... and with nodoc + +each_compat_subtest { + # docs are ignored, but copyright file is still there + ok(run_dh_tool($NODOC_PROFILE, 'dh_installdocs', $doc)); + for my $pkg (qw(foo bar baz)) { + ok(! -e "debian/$pkg/usr/share/doc/$pkg/docfile"); + ok(-e "debian/$pkg/usr/share/doc/$pkg/copyright"); + } + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + +each_compat_subtest { + # docs are ignored, but symlinked doc dir is still there + ok(run_dh_tool($NODOC_PROFILE, 'dh_installdocs', '-pfoo', '--link-doc=bar', $doc)); + ok(-l "debian/foo/usr/share/doc/foo"); + ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar'); + ok(! -e "debian/foo/usr/share/doc/bar/docfile"); + remove_tree(qw(debian/foo debian/bar debian/baz)); +}; + |