diff options
author | Felipe Sateler <fsateler@debian.org> | 2016-12-14 22:31:27 -0300 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2016-12-15 07:23:17 +0000 |
commit | dc22817e139ba9924bd428c0a244c878117372ca (patch) | |
tree | 06f9d1eb6a0dfa27ab6601adead34af99551cc5a /t | |
parent | 8bf26d222b21c89794d9ff19886145527eef6992 (diff) |
installinit: do not process systemd files from compat 11 onwards
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 't')
-rw-r--r-- | t/dh_installinit/debian/changelog | 5 | ||||
-rw-r--r-- | t/dh_installinit/debian/compat | 1 | ||||
-rw-r--r-- | t/dh_installinit/debian/control | 20 | ||||
-rw-r--r-- | t/dh_installinit/debian/foo.service | 5 | ||||
-rwxr-xr-x | t/dh_installinit/dh_installinit.t | 57 |
5 files changed, 88 insertions, 0 deletions
diff --git a/t/dh_installinit/debian/changelog b/t/dh_installinit/debian/changelog new file mode 100644 index 00000000..5850f0e2 --- /dev/null +++ b/t/dh_installinit/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_installinit/debian/compat b/t/dh_installinit/debian/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/t/dh_installinit/debian/compat @@ -0,0 +1 @@ +10 diff --git a/t/dh_installinit/debian/control b/t/dh_installinit/debian/control new file mode 100644 index 00000000..48d4de2f --- /dev/null +++ b/t/dh_installinit/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_installinit/debian/foo.service b/t/dh_installinit/debian/foo.service new file mode 100644 index 00000000..aa216362 --- /dev/null +++ b/t/dh_installinit/debian/foo.service @@ -0,0 +1,5 @@ +[Unit] +Description=A unit + +[Service] +ExecStart=/bin/true diff --git a/t/dh_installinit/dh_installinit.t b/t/dh_installinit/dh_installinit.t new file mode 100755 index 00000000..d05c2074 --- /dev/null +++ b/t/dh_installinit/dh_installinit.t @@ -0,0 +1,57 @@ +#!/usr/bin/perl +use strict; +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 = "../.."; +my $rootcmd; + +if ($< == 0) { + $rootcmd = ''; +} +else { + system("fakeroot true 2>/dev/null"); + $rootcmd = $? ? undef : 'fakeroot'; +} + +if (not defined($rootcmd)) { + plan skip_all => 'fakeroot required'; +} +else { + plan(tests => 5); +} + +system("$TOPDIR/dh_clean"); + +my $service = "debian/foo.service"; + +system("mkdir -p debian/foo debian/bar debian/baz"); +system("$rootcmd $TOPDIR/dh_installinit"); +ok(-e "debian/foo/lib/systemd/system/foo.service"); +ok(-e "debian/foo.postinst.debhelper"); +system("$TOPDIR/dh_clean"); + +system("mkdir -p debian/foo debian/bar debian/baz"); +system("DH_COMPAT=11 $rootcmd $TOPDIR/dh_installinit"); +ok(! -e "debian/foo/lib/systemd/system/foo.service"); +ok(! -e "debian/foo.postinst.debhelper"); +system("$TOPDIR/dh_clean"); + +system("mkdir -p debian/foo debian/bar debian/baz"); +system("mkdir -p debian/foo/lib/systemd/system/"); +system("cp debian/foo.service debian/foo/lib/systemd/system/"); +system("DH_COMPAT=11 $rootcmd $TOPDIR/dh_installinit"); +ok(! -e "debian/foo.postinst.debhelper"); +system("$TOPDIR/dh_clean"); + +system("$TOPDIR/dh_clean"); + +# Local Variables: +# indent-tabs-mode: t +# tab-width: 4 +# cperl-indent-level: 4 +# End: |