diff options
author | Felipe Sateler <fsateler@debian.org> | 2017-10-04 15:01:39 -0300 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2017-10-13 18:08:28 +0000 |
commit | f833b5676016d9f71dda92fe65f000acffc2ae77 (patch) | |
tree | 1436b08b1ab488fedf4db13b5b728518b0e9c87a /t/dh_installsystemd | |
parent | 6b10472023a991b09a14bbefb7709cfd421fffe3 (diff) | |
download | debhelper-f833b5676016d9f71dda92fe65f000acffc2ae77.tar.gz |
Add dh_installsystemd script with a simple test
Diffstat (limited to 't/dh_installsystemd')
-rwxr-xr-x | t/dh_installsystemd/dh_installsystemd.t | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/t/dh_installsystemd/dh_installsystemd.t b/t/dh_installsystemd/dh_installsystemd.t new file mode 100755 index 00000000..b8a6665b --- /dev/null +++ b/t/dh_installsystemd/dh_installsystemd.t @@ -0,0 +1,46 @@ +#!/usr/bin/perl +use strict; +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); + +our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw( + debian/changelog + debian/control + debian/foo.service +)); + +if (uid_0_test_is_ok()) { + plan(tests => 2); +} else { + plan skip_all => 'fakeroot required'; +} + +each_compat_from_and_above_subtest(11, sub { + make_path(qw(debian/foo debian/bar debian/baz)); + ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd')); + ok(-e "debian/foo/lib/systemd/system/foo.service"); + ok(-e "debian/foo.postinst.debhelper"); + ok(run_dh_tool('dh_clean')); + +}); + +each_compat_up_to_and_incl_subtest(10, sub { + make_path(qw(debian/foo debian/bar debian/baz)); + + ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd')); + ok(! -e "debian/foo/lib/systemd/system/foo.service"); + ok(! -e "debian/foo.postinst.debhelper"); + ok(run_dh_tool('dh_clean')); + + make_path(qw(debian/foo/lib/systemd/system/ debian/bar debian/baz)); + install_file('debian/foo.service', 'debian/foo/lib/systemd/system/foo.service'); + ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd')); + ok(! -e "debian/foo.postinst.debhelper"); + ok(run_dh_tool('dh_clean')); +}); + |