[debsums] 02/02: Add test case for conffiles
Axel Beckert
abe at deuxchevaux.org
Wed Mar 25 22:21:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to branch master
in repository debsums.
commit d62d49613622acdc013781477927283a8dd167fd
Author: Axel Beckert <abe at deuxchevaux.org>
Date: Wed Mar 25 23:19:48 2015 +0100
Add test case for conffiles
---
t/debsums.t | 25 ++++++++++++++++++++++++
t/fakechroot/etc/fakepkg-broken.cfg | 1 +
t/fakechroot/etc/fakepkg.cfg | 1 +
t/fakechroot/var/lib/dpkg/info/fakepkg.conffiles | 2 ++
t/fakechroot/var/lib/dpkg/info/fakepkg.list | 3 +++
t/fakechroot/var/lib/dpkg/status | 3 +++
6 files changed, 35 insertions(+)
diff --git a/t/debsums.t b/t/debsums.t
index 3dfa84b..0a4fc8f 100644
--- a/t/debsums.t
+++ b/t/debsums.t
@@ -41,4 +41,29 @@ t/fakechroot/usr/share/doc/fakepkg/README
EOT
is(rc >> 8, 2, 'Exit code is 2');
+# Test option -e
+run(@command);
+is(stderr, '', 'STDERR is empty');
+is(sort_lines(stdout), sort_lines(<<'EOT'), 'STDOUT as expected (1 OK, 1 FAILED)');
+t/fakechroot/etc/fakepkg.cfg OK
+t/fakechroot/etc/fakepkg-broken.cfg FAILED
+EOT
+is(rc >> 8, 2, 'Exit code is 2');
+
+# Test option -ce and variants
+foreach my $option (qw(-ce -ec)) {
+ run(@command, $option);
+ is(stderr, '', 'STDERR is empty');
+ is(stdout, <<'EOT', 'STDOUT as expected (1 FAILED)');
+t/fakechroot/etc/fakepkg-broken.cfg
+EOT
+ is(rc >> 8, 2, 'Exit code is 2');
+}
+
done_testing();
+
+sub sort_lines {
+ my $string = shift;
+ return join("\n", sort split("\n", $string)).
+ $string =~ m/\n\z/ ? "\n" : '';
+}
diff --git a/t/fakechroot/etc/fakepkg-broken.cfg b/t/fakechroot/etc/fakepkg-broken.cfg
new file mode 100644
index 0000000..d1ba75d
--- /dev/null
+++ b/t/fakechroot/etc/fakepkg-broken.cfg
@@ -0,0 +1 @@
+# Broken conffile
diff --git a/t/fakechroot/etc/fakepkg.cfg b/t/fakechroot/etc/fakepkg.cfg
new file mode 100644
index 0000000..362d60b
--- /dev/null
+++ b/t/fakechroot/etc/fakepkg.cfg
@@ -0,0 +1 @@
+# Valid conffile
diff --git a/t/fakechroot/var/lib/dpkg/info/fakepkg.conffiles b/t/fakechroot/var/lib/dpkg/info/fakepkg.conffiles
new file mode 100644
index 0000000..3e5394b
--- /dev/null
+++ b/t/fakechroot/var/lib/dpkg/info/fakepkg.conffiles
@@ -0,0 +1,2 @@
+/etc/fakepkg-broken.cfg
+/etc/fakepkg.cfg
diff --git a/t/fakechroot/var/lib/dpkg/info/fakepkg.list b/t/fakechroot/var/lib/dpkg/info/fakepkg.list
index d7d07a2..77a8665 100644
--- a/t/fakechroot/var/lib/dpkg/info/fakepkg.list
+++ b/t/fakechroot/var/lib/dpkg/info/fakepkg.list
@@ -5,3 +5,6 @@
/usr/share/doc/fakepkg/copyright
/usr/share/doc/fakepkg/changelog.Debian.gz
/usr/share/doc/fakepkg/README
+/etc
+/etc/fakepkg-broken.cfg
+/etc/fakepkg.cfg
diff --git a/t/fakechroot/var/lib/dpkg/status b/t/fakechroot/var/lib/dpkg/status
index 4c51cf0..539070f 100644
--- a/t/fakechroot/var/lib/dpkg/status
+++ b/t/fakechroot/var/lib/dpkg/status
@@ -8,3 +8,6 @@ Architecture: all
Version: 1
Description: dummy package for debsums' test suite
This is an empty dummy package just used for debsums' test suite.
+Conffiles:
+ /etc/fakepkg.cfg dc0b26e33cba0138a27aa00dcc90ae09
+ /etc/fakepkg-broken.cfg deadbeefcafebabedeadbeefcafebabe
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/debsums.git
More information about the Pkg-perl-cvs-commits
mailing list