summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/dh_installsystemd/dh_installsystemd.t5
-rwxr-xr-xt/dh_installsystemd/dh_systemd.t5
2 files changed, 8 insertions, 2 deletions
diff --git a/t/dh_installsystemd/dh_installsystemd.t b/t/dh_installsystemd/dh_installsystemd.t
index a33a8359..50e737de 100755
--- a/t/dh_installsystemd/dh_installsystemd.t
+++ b/t/dh_installsystemd/dh_installsystemd.t
@@ -28,7 +28,10 @@ sub unit_is_enabled {
$num_masks = $num_masks // $num_enables;
my @postinst_snippets = find_script($package, 'postinst');
@output=`cat @postinst_snippets` if @postinst_snippets;
- $matches = grep { m{^if deb-systemd-helper .* was-enabled .*'\Q$unit\E\.service'} } @output;
+ # Match exactly one tab; the "dont-enable" script has an "enable"
+ # line for re-enabling the service if the admin had it enabled.
+ # But we do not want to include that in our count.
+ $matches = grep { m{^\tif deb-systemd-helper .* was-enabled .*'\Q$unit\E\.service'} } @output;
ok($matches == $num_enables) or diag("$unit appears to have been enabled $matches times (expected $num_enables)");
my @postrm_snippets = find_script($package, 'postrm');
@output=`cat @postrm_snippets` if @postrm_snippets;
diff --git a/t/dh_installsystemd/dh_systemd.t b/t/dh_installsystemd/dh_systemd.t
index dee70965..18f2f487 100755
--- a/t/dh_installsystemd/dh_systemd.t
+++ b/t/dh_installsystemd/dh_systemd.t
@@ -27,7 +27,10 @@ sub unit_is_enabled {
my $matches;
$num_masks = $num_masks // $num_enables;
@output=`cat debian/$package.postinst.debhelper`;
- $matches = grep { m{^if deb-systemd-helper .* was-enabled .*'\Q$unit\E\.service'} } @output;
+ # Match exactly one tab; the "dont-enable" script has an "enable"
+ # line for re-enabling the service if the admin had it enabled.
+ # But we do not want to include that in our count.
+ $matches = grep { m{^\tif deb-systemd-helper .* was-enabled .*'\Q$unit\E\.service'} } @output;
ok($matches == $num_enables) or diag("$unit appears to have been enabled $matches times (expected $num_enables)");
@output=`cat debian/$package.postrm.debhelper`;
$matches = grep { m{deb-systemd-helper mask.*'\Q$unit\E\.service'} } @output;