Hello Raphael, Raphael Hertzog [2010-05-19 16:03 +0200]: > I pushed some changes in pkg-tests.git, all tests should work now. Thanks, rebased format-patch attached. Right now it doesn't work for me at all, though. Current git head on current sid, even without my dpkg patch, constantly fails with dpkg: ../../../lib/dpkg/dump.c:147: w_booleandefno: Assertion `value==1' failed. Weird, it still worked fine yesterday, but since then I updated my dpkg checkout as well. I'll investigate this further. Thanks, Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
From f0280e46695a6403edf66b7e9698857858426b1a Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Mon, 17 May 2010 19:30:55 +0200 Subject: [PATCH] Add filtering test cases. This checks the --include and --exclude options for package installation. --- t-filtering/Makefile | 101 ++++++++++++++++++++ t-filtering/pkg-somefiles/DEBIAN/control | 8 ++ 2 files changed, 109 insertions(+), 0 deletions(-) create mode 100644 t-filtering/Makefile create mode 100644 t-filtering/pkg-somefiles/DEBIAN/control create mode 100644 t-filtering/pkg-somefiles/usr/lib/pkg-somefiles/run create mode 100644 t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/README create mode 100644 t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/copyright create mode 100644 t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/html/index.html create mode 100644 t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/html/topic1/1.html diff --git a/t-filtering/Makefile b/t-filtering/Makefile new file mode 100644 index 0000000..e191f72 --- /dev/null +++ b/t-filtering/Makefile @@ -0,0 +1,101 @@ +TESTS_DEB := pkg-somefiles + +include ../Test.mk + +test-case: test-no-filter test-no-doc-sub test-no-doc-all test-no-doc-except-copyright \ + test-no-doc-except-copyright-subdir test-no-doc-except-copyright-and-readme \ + test-include-only test-same-include-exclude test-upgrade test-help + +test-clean: + $(DPKG_PURGE) pkg-somefiles + +# no filter, should have all files +test-no-filter: + $(DPKG_INSTALL) pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = 15 + $(DPKG_PURGE) pkg-somefiles + +# filter out /usr/share/doc/*/*; this keeps the actual +# /usr/share/doc/pkg-somefiles dir around +test-no-doc-sub: + $(DPKG_INSTALL) --exclude '/usr/share/doc/*/*' pkg-somefiles.deb + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles. + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/lib/pkg-somefiles/run + $(DPKG_PURGE) pkg-somefiles + +# filter out /usr/share/doc/* +test-no-doc-all: + $(DPKG_INSTALL) --exclude '/usr/share/doc/*' pkg-somefiles.deb + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/lib/pkg-somefiles/run + $(DPKG_PURGE) pkg-somefiles + +# filter out /usr/share/doc/*/* except copyright +test-no-doc-except-copyright: + $(DPKG_INSTALL) --exclude '/usr/share/doc/*/*' --include '/usr/share/doc/*/copyright' pkg-somefiles.deb + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/copyright + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/html/index.html + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/README + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/lib/pkg-somefiles/run + $(DPKG_PURGE) pkg-somefiles + +# prune the entire doc dir; this triggers the special case that +# /usr/share/doc/pkg-somefiles is matched by the exclude, but still needs to be +# created due to the following include +test-no-doc-except-copyright-subdir: + $(DPKG_INSTALL) --exclude '/usr/share/doc/*' --include '/usr/share/doc/*/copyright' pkg-somefiles.deb + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/copyright + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/html/index.html + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/README + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/lib/pkg-somefiles/run + $(DPKG_PURGE) pkg-somefiles + +# two includes which revert an exclude, second of which matches several subdirs +# with one * +test-no-doc-except-copyright-and-readme: + $(DPKG_INSTALL) --exclude '/usr/share/doc/*' --include '/usr/share/doc/*/copyright' --include '/usr*/READ*' pkg-somefiles.deb + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/copyright + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/html/index.html + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/README + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/lib/pkg-somefiles/run + $(DPKG_PURGE) pkg-somefiles + +# only includes, should be a no-op and have all files +test-include-only: + $(DPKG_INSTALL) --include '/usr/*' --include '/usr/share/doc' --include '/usr/lib/*/*' pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = 15 + $(DPKG_PURGE) pkg-somefiles + +# include the same things than exclude, should be a no-op and have all files +test-same-include-exclude: + $(DPKG_INSTALL) --exclude '/usr/share/*' --include '/usr/share/*' pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = 15 + $(DPKG_PURGE) pkg-somefiles + + # now doubly so + $(DPKG_INSTALL) --exclude '/usr/share/*' --include '/usr/share/*' --exclude '/usr/share/*' --include '/usr/share/*' pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = 15 + $(DPKG_PURGE) pkg-somefiles + +# files are removed/re-added on upgrades +test-upgrade: + $(DPKG_INSTALL) pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = 15 + + $(DPKG_INSTALL) --exclude '/usr/share/doc/*' pkg-somefiles.deb + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles + + $(DPKG_INSTALL) --exclude '/usr/share/doc/*' --include '/usr/share/doc/*/copyright' pkg-somefiles.deb + $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/copyright + ! $(DPKG_QUERY) -L pkg-somefiles | grep -q /usr/share/doc/pkg-somefiles/README + + $(DPKG_INSTALL) pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = 15 + $(DPKG_PURGE) pkg-somefiles + + +# --help output explains the options +test-help: + $(DPKG) --help | grep -q -- --include + $(DPKG) --help | grep -q -- --exclude diff --git a/t-filtering/pkg-somefiles/DEBIAN/control b/t-filtering/pkg-somefiles/DEBIAN/control new file mode 100644 index 0000000..2b24276 --- /dev/null +++ b/t-filtering/pkg-somefiles/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-somefiles +Version: 0 +Section: test +Priority: extra +Maintainer: Guillem Jover <guillem@debian.org> +Architecture: all +Description: test package - provide some files + diff --git a/t-filtering/pkg-somefiles/usr/lib/pkg-somefiles/run b/t-filtering/pkg-somefiles/usr/lib/pkg-somefiles/run new file mode 100644 index 0000000..e69de29 diff --git a/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/README b/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/README new file mode 100644 index 0000000..e69de29 diff --git a/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/copyright b/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/copyright new file mode 100644 index 0000000..e69de29 diff --git a/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/html/index.html b/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/html/index.html new file mode 100644 index 0000000..e69de29 diff --git a/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/html/topic1/1.html b/t-filtering/pkg-somefiles/usr/share/doc/pkg-somefiles/html/topic1/1.html new file mode 100644 index 0000000..e69de29 -- 1.7.0.4
Attachment:
signature.asc
Description: Digital signature