summaryrefslogtreecommitdiffstats
path: root/t/dh_installman
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
commitd827c6cf1631209f5042a9d1d8a7ecc24223c8a0 (patch)
tree91a431d301efd0e524bdfb0c46e97d591a9d7b03 /t/dh_installman
parentInitial commit. (diff)
downloaddebhelper-upstream.tar.xz
debhelper-upstream.zip
Adding upstream version 13.11.4.upstream/13.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/dh_installman')
-rwxr-xr-xt/dh_installman/01-basics.t94
-rw-r--r--t/dh_installman/libmanpage.so.1.2.3.pod17
-rw-r--r--t/dh_installman/libmanpage.so.9.2.31
-rw-r--r--t/dh_installman/manpage-compressed.pod17
-rw-r--r--t/dh_installman/manpage-perl.pod17
-rw-r--r--t/dh_installman/manpage-uncompressed.pod17
6 files changed, 163 insertions, 0 deletions
diff --git a/t/dh_installman/01-basics.t b/t/dh_installman/01-basics.t
new file mode 100755
index 0000000..141059a
--- /dev/null
+++ b/t/dh_installman/01-basics.t
@@ -0,0 +1,94 @@
+#!/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);
+
+sub has_man_db_tool {
+ my ($tool) = @_;
+ open(my $old_stderr, '>&', *STDERR) or error("dup(STDERR, tmp_fd): $!");
+ open(*STDERR, '>', '/dev/null') or error("re-open stderr as /dev/null: $!");
+
+ my $res = defined(`$tool --version`);
+ open(*STDERR, '>&', $old_stderr) or error("dup(tmp_fd, STDERR): $!");
+ close($old_stderr);
+ return $res;
+}
+
+if (has_man_db_tool('man') || has_man_db_tool('man-recode')) {
+ plan(tests => 2);
+} else {
+ plan(skip_all => 'Test requires man or man-recode');
+}
+
+our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
+ manpage-uncompressed.pod
+ manpage-compressed.pod
+ manpage-perl.pod
+ libmanpage.so.1.2.3.pod
+ libmanpage.so.9.2.3
+));
+
+each_compat_subtest {
+ my ($compat) = @_;
+ if (! -d 'generated-manpages') {
+ # Static data that can be reused. Generate only in the first test
+ make_path('generated-manpages');
+ for my $basename (qw(manpage-uncompressed manpage-compressed manpage-perl libmanpage.so.1.2.3)) {
+ doit('pod2man', '--utf8', '-c', 'Debhelper', '-r', '1.0', "${basename}.pod",
+ "generated-manpages/${basename}.1");
+ }
+ doit('pod2man', '--utf8', '-c', 'Debhelper', '-r', '1.0', '-s', '3', 'manpage-perl.pod',
+ 'generated-manpages/manpage-perl.3perl');
+ doit('gzip', '-9n', 'generated-manpages/manpage-compressed.1');
+ }
+ ok(run_dh_tool('dh_installman', 'generated-manpages/manpage-uncompressed.1',
+ 'generated-manpages/manpage-compressed.1.gz',
+ 'generated-manpages/manpage-perl.3perl',
+ 'generated-manpages/libmanpage.so.1.2.3.1',
+ 'libmanpage.so.9.2.3'));
+
+ ok(-e 'debian/debhelper/usr/share/man/man1/manpage-uncompressed.1');
+ ok(-e 'debian/debhelper/usr/share/man/man1/manpage-compressed.1');
+ ok(-e 'debian/debhelper/usr/share/man/man3/manpage-perl.3');
+ ok(-e 'debian/debhelper/usr/share/man/man1/libmanpage.so.1.2.3.1');
+ ok(! -e 'debian/debhelper/usr/share/man/man9/libmanpage.so.9.2.9.2.3');
+ ok(-l 'debian/debhelper/usr/share/man/man3/libmanpage.so.9.2.3');
+ remove_tree('debian/debhelper', 'debian/tmp', 'debian/.debhelper');
+};
+
+each_compat_subtest {
+ my ($compat) = @_;
+ if (! -d 'generated-manpages') {
+ # Static data that can be reused. Generate only in the first test
+ make_path('generated-manpages');
+ for my $basename (qw(manpage-uncompressed manpage-compressed libmanpage.so.1.2.3)) {
+ doit('pod2man', '--utf8', '-c', 'Debhelper', '-r', '1.0', "${basename}.pod",
+ "generated-manpages/${basename}.1");
+ }
+ doit('pod2man', '--utf8', '-c', 'Debhelper', '-r', '1.0', '-s', '3', 'manpage-perl.pod',
+ 'generated-manpages/manpage-perl.3perl');
+ doit('gzip', '-9n', 'generated-manpages/manpage-compressed.1');
+ }
+ mkdirs('debian/debhelper/usr/share/man/man1');
+ mkdirs('debian/debhelper/usr/share/man/man3');
+ copy_file('generated-manpages/manpage-uncompressed.1', 'debian/debhelper/usr/share/man/man1/manpage-uncompressed.1');
+ copy_file('generated-manpages/manpage-compressed.1.gz', 'debian/debhelper/usr/share/man/man1/manpage-compressed.1.gz');
+ copy_file('generated-manpages/manpage-perl.3perl', 'debian/debhelper/usr/share/man/man3/manpage-perl.3perl');
+ copy_file('generated-manpages/libmanpage.so.1.2.3.1', 'debian/debhelper/usr/share/man/man1/libmanpage.so.1.2.3.1');
+ copy_file('libmanpage.so.9.2.3', 'debian/debhelper/usr/share/man/man3/libmanpage.so.9.2.3');
+ ok(run_dh_tool('dh_installman'));
+ ok(-e 'debian/debhelper/usr/share/man/man1/manpage-uncompressed.1');
+ ok(-e 'debian/debhelper/usr/share/man/man1/manpage-compressed.1');
+ ok(-e 'debian/debhelper/usr/share/man/man3/manpage-perl.3perl');
+ ok(-e 'debian/debhelper/usr/share/man/man1/libmanpage.so.1.2.3.1');
+ ok(! -e 'debian/debhelper/usr/share/man/man9/libmanpage.so.9.2.9.2.3');
+ ok(-l 'debian/debhelper/usr/share/man/man3/libmanpage.so.9.2.3');
+ remove_tree('debian/debhelper', 'debian/tmp', 'debian/.debhelper');
+};
+
diff --git a/t/dh_installman/libmanpage.so.1.2.3.pod b/t/dh_installman/libmanpage.so.1.2.3.pod
new file mode 100644
index 0000000..0b68dec
--- /dev/null
+++ b/t/dh_installman/libmanpage.so.1.2.3.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+libmanpage.so.1.2.3 - Something very exciting
+
+=head1 SYNOPSIS
+
+This tool does not exist but would be awesome.
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHORS
+
+Niels Thykier <niels@thykier.net>
+
+=cut
diff --git a/t/dh_installman/libmanpage.so.9.2.3 b/t/dh_installman/libmanpage.so.9.2.3
new file mode 100644
index 0000000..07658f3
--- /dev/null
+++ b/t/dh_installman/libmanpage.so.9.2.3
@@ -0,0 +1 @@
+.so man1/manpage-uncompressed.1
diff --git a/t/dh_installman/manpage-compressed.pod b/t/dh_installman/manpage-compressed.pod
new file mode 100644
index 0000000..d2c0596
--- /dev/null
+++ b/t/dh_installman/manpage-compressed.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+manpage - Something very exciting
+
+=head1 SYNOPSIS
+
+This tool does not exist but would be awesome.
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHORS
+
+Niels Thykier <niels@thykier.net>
+
+=cut
diff --git a/t/dh_installman/manpage-perl.pod b/t/dh_installman/manpage-perl.pod
new file mode 100644
index 0000000..9b66d9d
--- /dev/null
+++ b/t/dh_installman/manpage-perl.pod
@@ -0,0 +1,17 @@
+=head3 NAME
+
+manpage-uncompressed - Something very exciting
+
+=head3 SYNOPSIS
+
+This tool does not exist but would be awesome.
+
+=head3 SEE ALSO
+
+L<debhelper(7)>
+
+=head3 AUTHORS
+
+Niels Thykier <niels@thykier.net>
+
+=cut
diff --git a/t/dh_installman/manpage-uncompressed.pod b/t/dh_installman/manpage-uncompressed.pod
new file mode 100644
index 0000000..c95037c
--- /dev/null
+++ b/t/dh_installman/manpage-uncompressed.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+manpage-uncompressed - Something very exciting
+
+=head1 SYNOPSIS
+
+This tool does not exist but would be awesome.
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHORS
+
+Niels Thykier <niels@thykier.net>
+
+=cut