summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/dh_installsystemd/dh_installsystemd_tmpfiles.t36
-rw-r--r--t/dh_installsystemduser/debian/foo.baz.user.service (renamed from t/dh_installsystemduser/debian/baz.user.service)0
-rwxr-xr-xt/dh_installsystemduser/dh_installsystemduser.t2
3 files changed, 37 insertions, 1 deletions
diff --git a/t/dh_installsystemd/dh_installsystemd_tmpfiles.t b/t/dh_installsystemd/dh_installsystemd_tmpfiles.t
index 1041ebe..c91a97b 100755
--- a/t/dh_installsystemd/dh_installsystemd_tmpfiles.t
+++ b/t/dh_installsystemd/dh_installsystemd_tmpfiles.t
@@ -68,8 +68,24 @@ each_compat_from_and_above_subtest(13, sub {
each_compat_from_and_above_subtest(13, sub {
+ my ($compat) = @_;
+
make_path('debian/foo/usr/lib/tmpfiles.d');
create_empty_file('debian/foo/usr/lib/tmpfiles.d/foo.conf');
+
+ my $purge_file = <<END;
+# Some comment
+
+d /tmp/somedir
+f /tmp/somedir/somefile - - - - baz
+d /tmp/otherdir
+R /tmp/yetotherdir
+END
+
+ open(my $fd, '>', 'debian/foo/usr/lib/tmpfiles.d/bar.conf') or error("open(bar.conf) failed: $!");
+ print $fd $purge_file;
+ close($fd) or error("close(bar.conf) failed: $!");
+
ok(run_dh_tool('dh_installtmpfiles'));
# dh_installtmpfiles do not install services
ok(!-e "debian/foo/etc/init.d/foo");
@@ -84,5 +100,25 @@ each_compat_from_and_above_subtest(13, sub {
ok(! grep { m/(?:invoke|update)-rc.d|deb-systemd-invoke/ } @{$snippet});
ok(grep { m/systemd-tmpfiles/ } @{$snippet});
}
+
+ my @postrm = find_script('foo', 'postrm');
+ if ($compat <= 13) {
+ # No factory reset on compat 13
+ is(scalar(@postrm), 0);
+ } else {
+ # We should have an inlined snippets for removal/purge
+ is(scalar(@postrm), 1);
+ if (scalar(@postrm) == 1) {
+ open(my $fd, '<', $postrm[0]) or error("open($postrm[0]) failed: $!");
+ my $snippet = readlines($fd);
+ close($fd);
+ ok(grep { m/# Some comment/ } @{$snippet});
+ ok(grep { m/d \/tmp\/somedir/ } @{$snippet});
+ ok(grep { m/f \/tmp\/somedir\/somefile - - - - baz/ } @{$snippet});
+ ok(grep { m/d \/tmp\/otherdir/ } @{$snippet});
+ ok(grep { m/R \/tmp\/yetotherdir/ } @{$snippet});
+ }
+ }
+
ok(run_dh_tool('dh_clean'));
});
diff --git a/t/dh_installsystemduser/debian/baz.user.service b/t/dh_installsystemduser/debian/foo.baz.user.service
index 3af041d..3af041d 100644
--- a/t/dh_installsystemduser/debian/baz.user.service
+++ b/t/dh_installsystemduser/debian/foo.baz.user.service
diff --git a/t/dh_installsystemduser/dh_installsystemduser.t b/t/dh_installsystemduser/dh_installsystemduser.t
index 5171728..e9a143e 100755
--- a/t/dh_installsystemduser/dh_installsystemduser.t
+++ b/t/dh_installsystemduser/dh_installsystemduser.t
@@ -13,7 +13,7 @@ our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
debian/changelog
debian/control
debian/foo.user.service
- debian/baz.user.service
+ debian/foo.baz.user.service
));