[libconfig-crontab-perl] 02/04: Add a mock crontab(1) command for the test suite
Niko Tyni
ntyni at moszumanska.debian.org
Mon Sep 19 20:02:19 UTC 2016
This is an automated email from the git hooks/post-receive script.
ntyni pushed a commit to branch master
in repository libconfig-crontab-perl.
commit 05367e3d666fc6769485a88f1e7eaad2f384c8d2
Author: Niko Tyni <ntyni at debian.org>
Date: Mon Sep 19 22:40:57 2016 +0300
Add a mock crontab(1) command for the test suite
This both avoids a build dependency on cron and makes sure
the test suite does not accidentally modify user crontabs.
See #838089
---
debian/fake-bin/crontab | 16 ++++++++++++++++
debian/rules | 3 +++
debian/tests/pkg-perl/smoke-env | 2 ++
debian/tests/pkg-perl/smoke-files | 2 ++
4 files changed, 23 insertions(+)
diff --git a/debian/fake-bin/crontab b/debian/fake-bin/crontab
new file mode 100755
index 0000000..bf56b93
--- /dev/null
+++ b/debian/fake-bin/crontab
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+use strict;
+
+# mock crontab command for the test suite that only knows '-l'
+# see https://bugs.debian.org/838089
+
+my $me = $ENV{USER} || '(none)';
+
+my $opt = shift || '';
+if ($opt eq '-l') {
+ print STDERR "no crontab for $me\n";
+ exit 1;
+}
+
+print STDERR "mock command $0 called without -l, exiting\n";
+exit 255;
diff --git a/debian/rules b/debian/rules
index 2d33f6a..7ec5c1c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,3 +2,6 @@
%:
dh $@
+
+override_dh_auto_test:
+ PATH=$(CURDIR)/debian/fake-bin:$$PATH dh_auto_test
diff --git a/debian/tests/pkg-perl/smoke-env b/debian/tests/pkg-perl/smoke-env
new file mode 100644
index 0000000..1e4297f
--- /dev/null
+++ b/debian/tests/pkg-perl/smoke-env
@@ -0,0 +1,2 @@
+# mock 'crontab -l' (see #838089)
+PATH=${TDIR}/debian/fake-bin:${PATH}
diff --git a/debian/tests/pkg-perl/smoke-files b/debian/tests/pkg-perl/smoke-files
new file mode 100644
index 0000000..c0badba
--- /dev/null
+++ b/debian/tests/pkg-perl/smoke-files
@@ -0,0 +1,2 @@
+t
+debian/fake-bin
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-crontab-perl.git
More information about the Pkg-perl-cvs-commits
mailing list