summaryrefslogtreecommitdiffstats
path: root/tests/t-switch-dir-to-symlink-rel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/t-switch-dir-to-symlink-rel')
-rw-r--r--tests/t-switch-dir-to-symlink-rel/Makefile156
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/conffiles1
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/control7
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/test-path/test-subpath/file-conf0
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/control7
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postinst6
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postrm6
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/preinst6
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/DEBIAN/control7
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/test-dir/file-normal0
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/DEBIAN/control7
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/test-path/test-subpath/file-other0
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/DEBIAN/control7
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/test-path/test-subpath/file-normal0
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/control8
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postinst6
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postrm6
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/preinst6
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/DEBIAN/control7
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/test-path/test-subpath/file-normal0
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/control7
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postinst6
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postrm6
-rwxr-xr-xtests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/preinst6
-rw-r--r--tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/test-dir/file-other0
25 files changed, 268 insertions, 0 deletions
diff --git a/tests/t-switch-dir-to-symlink-rel/Makefile b/tests/t-switch-dir-to-symlink-rel/Makefile
new file mode 100644
index 0000000..833ac38
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/Makefile
@@ -0,0 +1,156 @@
+TESTS_DEB := \
+ pkg-dir-conffile-0 pkg-dir-conffile-1 \
+ pkg-dir-file-other pkg-dir-symlink-int-0 pkg-dir-symlink-int-1 \
+ pkg-dir-file-moved pkg-dir-symlink-ext-0 pkg-dir-symlink-ext-1
+
+include ../Test.mk
+
+build-hook:
+ mkdir -p pkg-dir-conffile-1/test-path
+ ln -sfT ../test-dir pkg-dir-conffile-1/test-path/test-subpath
+ mkdir -p pkg-dir-symlink-ext-1/test-path
+ ln -sfT ../test-dir pkg-dir-symlink-ext-1/test-path/test-subpath
+ mkdir -p pkg-dir-symlink-int-1/test-path
+ ln -sfT ../test-dir pkg-dir-symlink-int-1/test-path/test-subpath
+
+clean-hook:
+ $(RM) pkg-dir-conffile-1/test-path/test-subpath
+ -rmdir pkg-dir-conffile-1/test-path
+ $(RM) pkg-dir-symlink-ext-1/test-path/test-subpath
+ -rmdir pkg-dir-symlink-ext-1/test-path
+ $(RM) pkg-dir-symlink-int-1/test-path/test-subpath
+ -rmdir pkg-dir-symlink-int-1/test-path
+
+test-case:
+ # Cannot switch a directory containing conffiles
+ $(DPKG_INSTALL) pkg-dir-conffile-0.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ ! $(DPKG_INSTALL) pkg-dir-conffile-1.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_PURGE) pkg-dir-conffile
+
+ # Cannot switch a directory containing files owned by another package
+ $(DPKG_INSTALL) pkg-dir-file-other.deb
+ $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_PURGE) pkg-dir-symlink-int
+ $(DPKG_PURGE) pkg-dir-file-other
+
+ # Cannot switch a directory containing local files
+ $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ touch '$(DPKG_INSTDIR)/test-path/test-subpath/local file'
+ ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ rm '$(DPKG_INSTDIR)/test-path/test-subpath/local file'
+ $(DPKG_PURGE) pkg-dir-symlink-int
+
+ #
+ # Otherwise allow the switch
+ #
+
+ # Switch a directory to a symlink, contents moved within the package,
+ # with intermediate full installs.
+ $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb
+ test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_PURGE) pkg-dir-symlink-int
+ ! test -e '$(DPKG_INSTDIR)/test-path/test-subpath'
+
+ # Switch a directory to a symlink, contents moved within the package,
+ # with full install, upgrade with upack and configure.
+ $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_CONFIGURE) pkg-dir-symlink-int
+ test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_PURGE) pkg-dir-symlink-int
+ ! test -e '$(DPKG_INSTDIR)/test-path/test-subpath'
+
+ # Switch a directory to a symlink, contents moved within the package,
+ # with two unpacks and configure.
+ $(DPKG_UNPACK) pkg-dir-symlink-int-0.deb
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb
+ ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_CONFIGURE) pkg-dir-symlink-int
+ test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_PURGE) pkg-dir-symlink-int
+ ! test -e '$(DPKG_INSTDIR)/test-path/test-subpath'
+
+ # Switch a directory to a symlink, contents moved to another package,
+ # with intermediate full installs.
+ $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_INSTALL) pkg-dir-file-moved.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ $(DPKG_INSTALL) pkg-dir-symlink-ext-1.deb
+ test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test "`readlink '$(DPKG_INSTDIR)/test-path/test-subpath'`" = "../test-dir"
+ ! test -h '$(DPKG_INSTDIR)/test-dir'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ test -f '$(DPKG_INSTDIR)/test-dir/file-normal'
+ $(DPKG_PURGE) pkg-dir-symlink-ext
+ $(DPKG_PURGE) pkg-dir-file-moved
+
+ # Switch a directory to a symlink, contents moved to another package,
+ # with full installs, upgrade with upack and configure.
+ $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_INSTALL) pkg-dir-file-moved.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ $(DPKG_CONFIGURE) -a
+ test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test "`readlink '$(DPKG_INSTDIR)/test-path/test-subpath'`" = "../test-dir"
+ ! test -h '$(DPKG_INSTDIR)/test-dir'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ test -f '$(DPKG_INSTDIR)/test-dir/file-normal'
+ $(DPKG_PURGE) pkg-dir-symlink-ext
+ $(DPKG_PURGE) pkg-dir-file-moved
+
+ # Switch a directory to a symlink, contents moved to another package,
+ # with three unpacks and configure.
+ $(DPKG_UNPACK) pkg-dir-symlink-ext-0.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ $(DPKG_UNPACK) pkg-dir-file-moved.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ $(DPKG_CONFIGURE) -a
+ test -h '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test -d '$(DPKG_INSTDIR)/test-path/test-subpath'
+ test "`readlink '$(DPKG_INSTDIR)/test-path/test-subpath'`" = "../test-dir"
+ ! test -h '$(DPKG_INSTDIR)/test-dir'
+ test -d '$(DPKG_INSTDIR)/test-dir'
+ test -f '$(DPKG_INSTDIR)/test-dir/file-normal'
+ $(DPKG_PURGE) pkg-dir-symlink-ext
+ $(DPKG_PURGE) pkg-dir-file-moved
+
+test-clean:
+ $(DPKG_PURGE) pkg-dir-conffile
+ $(DPKG_PURGE) pkg-dir-symlink-int
+ $(DPKG_PURGE) pkg-dir-symlink-ext
+ $(DPKG_PURGE) pkg-dir-file-other
+ $(DPKG_PURGE) pkg-dir-file-moved
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/conffiles b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/conffiles
new file mode 100644
index 0000000..77b39da
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/conffiles
@@ -0,0 +1 @@
+/test-path/test-subpath/file-conf
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/control
new file mode 100644
index 0000000..57fdc53
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-conffile
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package with dir to be switched to symlink
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/test-path/test-subpath/file-conf b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/test-path/test-subpath/file-conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/test-path/test-subpath/file-conf
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/control
new file mode 100644
index 0000000..69f4d74
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-conffile
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package switching dir to symlink
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postinst
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postrm
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postrm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/preinst
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/preinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/DEBIAN/control
new file mode 100644
index 0000000..db492dd
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-file-moved
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package with file moved from dir-to-symlink switch
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/test-dir/file-normal b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/test-dir/file-normal
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/test-dir/file-normal
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/DEBIAN/control
new file mode 100644
index 0000000..985c6db
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-file-other
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package with real dir and contents
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/test-path/test-subpath/file-other b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/test-path/test-subpath/file-other
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/test-path/test-subpath/file-other
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/DEBIAN/control
new file mode 100644
index 0000000..f9aca91
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-symlink-ext
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package with dir to be switched to symlink
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/test-path/test-subpath/file-normal b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/test-path/test-subpath/file-normal
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/test-path/test-subpath/file-normal
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/control
new file mode 100644
index 0000000..255195b
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-dir-symlink-ext
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Depends: pkg-dir-file-moved (>= 1)
+Description: test package - package switching dir to symlink
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postinst
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postrm
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postrm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/preinst
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/preinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/DEBIAN/control
new file mode 100644
index 0000000..3526664
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-symlink-int
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package with dir to be switched to symlink
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/test-path/test-subpath/file-normal b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/test-path/test-subpath/file-normal
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/test-path/test-subpath/file-normal
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/control
new file mode 100644
index 0000000..6852587
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-symlink-int
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package switching dir to symlink
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postinst
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postrm
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postrm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/preinst
new file mode 100755
index 0000000..572dfa2
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/preinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+ dpkg-maintscript-helper dir_to_symlink \
+ /test-path/test-subpath ../test-dir 0 -- "$@"
+fi
diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/test-dir/file-other b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/test-dir/file-other
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/test-dir/file-other