On 2011-08-21 22:12 +0200, Raphael Hertzog wrote:

> On Sun, 21 Aug 2011, Sven Joachim wrote:
>> > Can you also turn your testcase in a patch against pkg-tests.git?
>> 
>> Once I have acquainted myself with the testsuite, probably yes.  Might
>> take a few days, I have other things to to as well.
>
> You might find
> http://wiki.debian.org/Teams/Dpkg/Contribute#Contribute_a_non-regression_test
> helpful. I'll gladly expand it if there are things missing in your
> opinion.

Thanks, this was very helpful indeed.  After reading that, the only
pitfall I fell in was that git does not preserve hardlinks, so I needed
to handle that in build-hook/clean-hook targets.

The testcase in the attached patch slightly differs from the original
one in that the hardlink is not marked as a conffile itself.  This makes
no real difference when freshly installing the package, but on upgrades
the hardlink will be broken (since unchanged conffiles are not
replaced).

Cheers,
       Sven

>From 6d1aa097ea1f0c204f74bb744ad72e06667e7a7b Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Mon, 22 Aug 2011 18:44:01 +0200
Subject: [PATCH] New test t-conffile-hardlink

Test if a package with a hardlink to a conffile installs successfully.
See http://bugs.debian.org/638291.
---
 Makefile                                           |    1 +
 t-conffile-hardlink/.gitignore                     |    1 +
 t-conffile-hardlink/Makefile                       |   21 ++++++++++++++++++++
 .../pkg-conffile-hardlink/DEBIAN/conffiles         |    1 +
 .../pkg-conffile-hardlink/DEBIAN/control           |    7 ++++++
 .../pkg-conffile-hardlink/test-conffile            |    1 +
 6 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 t-conffile-hardlink/.gitignore
 create mode 100644 t-conffile-hardlink/Makefile
 create mode 100644 t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/conffiles
 create mode 100644 t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/control
 create mode 100644 t-conffile-hardlink/pkg-conffile-hardlink/test-conffile

diff --git a/Makefile b/Makefile
index aeb5a47..a2bbc4d 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,7 @@ TESTS_PASS := \
        t-conffile-replaces-disappear \
        t-conffile-versioned-replaces-downgrade \
        t-conffile-rename \
+       t-conffile-hardlink \
        t-package-type \
        t-symlink-dir \
        t-substvars \
diff --git a/t-conffile-hardlink/.gitignore b/t-conffile-hardlink/.gitignore
new file mode 100644
index 0000000..2815bab
--- /dev/null
+++ b/t-conffile-hardlink/.gitignore
@@ -0,0 +1 @@
+test-conffile-hardlink
diff --git a/t-conffile-hardlink/Makefile b/t-conffile-hardlink/Makefile
new file mode 100644
index 0000000..dc1d0b1
--- /dev/null
+++ b/t-conffile-hardlink/Makefile
@@ -0,0 +1,21 @@
+PKG := pkg-conffile-hardlink
+
+TESTS_DEB := $(PKG)
+
+include ../Test.mk
+
+$(PKG)/test-conffile-hardlink:
+       link $(PKG)/test-conffile $@
+
+build-hook: $(PKG)/test-conffile-hardlink
+
+clean-hook:
+       rm -f $(PKG)/test-conffile-hardlink
+
+test-case:
+       $(DPKG_INSTALL) $(PKG).deb
+       $(call pkg_is_installed,$(PKG))
+       $(DPKG_PURGE) $(PKG)
+
+test-clean:
+       -$(DPKG_PURGE) $(PKG)
diff --git a/t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/conffiles 
b/t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/conffiles
new file mode 100644
index 0000000..ced2481
--- /dev/null
+++ b/t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/conffiles
@@ -0,0 +1 @@
+test-conffile
diff --git a/t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/control 
b/t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/control
new file mode 100644
index 0000000..2542511
--- /dev/null
+++ b/t-conffile-hardlink/pkg-conffile-hardlink/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-conffile-hardlink
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Sven Joachim <svenj...@gmx.de>
+Architecture: all
+Description: test package - hardlink to conffile
diff --git a/t-conffile-hardlink/pkg-conffile-hardlink/test-conffile 
b/t-conffile-hardlink/pkg-conffile-hardlink/test-conffile
new file mode 100644
index 0000000..d414d58
--- /dev/null
+++ b/t-conffile-hardlink/pkg-conffile-hardlink/test-conffile
@@ -0,0 +1 @@
+test hardlink
-- 
1.7.5.4

Reply via email to