test: Pass -T+1 to xz to workaround spurious warning with xz 5.6.0
[dpkg.git] / tests / t-filtering / Makefile
blob01c7b997282b1649cbbd539593d18e97b69c502c
1 TESTS_DEB := pkg-somefiles
3 include ../Test.mk
5 DEB_FILES_COUNT = $(shell dpkg-deb -c pkg-somefiles.deb | wc -l )
7 TEST_CASES += test-no-filter
8 TEST_CASES += test-no-doc-sub
9 TEST_CASES += test-no-doc-all
10 TEST_CASES += test-no-doc-except-copyright
11 TEST_CASES += test-no-doc-except-copyright-subdir
12 TEST_CASES += test-no-doc-except-copyright-and-readme
13 TEST_CASES += test-include-only
14 TEST_CASES += test-reinclude-subdir
15 TEST_CASES += test-same-include-exclude
16 TEST_CASES += test-upgrade test-help
18 build-hook:
19 ln -fsT pkg-somefiles pkg-somefiles/test/share/doc/pkg-symlinked
21 clean-hook:
22 $(RM) pkg-somefiles/test/share/doc/pkg-symlinked
24 test-case: $(TEST_CASES)
26 test-clean:
27 $(DPKG_PURGE) pkg-somefiles
29 test-no-filter:
30 # no filter, should have all files
31 $(DPKG_INSTALL) pkg-somefiles.deb
32 test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT)
33 $(DPKG_PURGE) pkg-somefiles
35 test-no-doc-sub:
36 # filter out /test/share/doc/*/*; this keeps the actual
37 # /test/share/doc/pkg-somefiles dir and
38 # /test/share/doc/pkg-symlinked symlink around.
39 $(DPKG_INSTALL) \
40 --path-exclude '/test/share/doc/*/*' \
41 pkg-somefiles.deb
42 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
43 test -d "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles"
44 test "`ls '$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles'`" = ""
45 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
46 $(DPKG_PURGE) pkg-somefiles
48 test-no-doc-all:
49 # filter out /test/share/doc/*
50 $(DPKG_INSTALL) \
51 --path-exclude '/test/share/doc/*' \
52 pkg-somefiles.deb
53 ! test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
54 ! test -d "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles"
55 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
56 $(DPKG_PURGE) pkg-somefiles
58 test-no-doc-except-copyright:
59 # filter out /test/share/doc/*/* except copyright
60 $(DPKG_INSTALL) \
61 --path-exclude '/test/share/doc/*/*' \
62 --path-include '/test/share/doc/*/copyright' \
63 pkg-somefiles.deb
64 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
65 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright"
66 ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html"
67 ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README"
68 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
69 $(DPKG_PURGE) pkg-somefiles
71 test-no-doc-except-copyright-subdir:
72 # prune the entire doc dir; this triggers the special case that
73 # /test/share/doc/pkg-somefiles is matched by the exclude, but still
74 # needs to be created due to the following include
75 $(DPKG_INSTALL) \
76 --path-exclude '/test/share/doc/*' \
77 --path-include '/test/share/doc/*/copyright' \
78 pkg-somefiles.deb
79 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
80 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright"
81 ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html"
82 ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README"
83 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
84 $(DPKG_PURGE) pkg-somefiles
86 test-no-doc-except-copyright-and-readme:
87 # two includes which revert an exclude, second of which matches
88 # several subdirs with one *
89 $(DPKG_INSTALL) \
90 --path-exclude '/test/share/doc/*' \
91 --path-include '/test/share/doc/*/copyright' \
92 --path-include '/test*/READ*' \
93 pkg-somefiles.deb
94 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
95 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright"
96 ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html"
97 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README"
98 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
99 $(DPKG_PURGE) pkg-somefiles
101 test-include-only:
102 # only includes, should be a no-op and have all files
103 $(DPKG_INSTALL) \
104 --path-include '/test/*' \
105 --path-include '/test/share/doc' \
106 --path-include '/test/lib/*/*' \
107 pkg-somefiles.deb
108 test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT)
109 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
110 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright"
111 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html"
112 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
113 $(DPKG_PURGE) pkg-somefiles
115 test-reinclude-subdir:
116 # Exclude a directory tree and reinclude some of its subdirectories
117 $(DPKG_INSTALL) \
118 --path-exclude '/test/share/locale/*' \
119 --path-include '/test/share/locale/de/*' \
120 pkg-somefiles.deb
121 test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT)
122 test -d "$(DPKG_INSTDIR)/test/share/locale/de"
123 test -f "$(DPKG_INSTDIR)/test/share/locale/de/foo.mo"
124 ! test -f "$(DPKG_INSTDIR)/test/share/locale/ca/foo.mo"
125 ! test -f "$(DPKG_INSTDIR)/test/share/locale/es/foo.mo"
126 $(DPKG_PURGE) pkg-somefiles
128 test-same-include-exclude:
129 # include the same things than exclude, should be a no-op and have
130 # all files
131 $(DPKG_INSTALL) \
132 --path-exclude '/test/share/*' \
133 --path-include '/test/share/*' \
134 pkg-somefiles.deb
135 test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT)
136 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html"
137 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
138 $(DPKG_PURGE) pkg-somefiles
140 # now doubly so
141 $(DPKG_INSTALL) \
142 --path-exclude '/test/share/*' \
143 --path-include '/test/share/*' \
144 --path-exclude '/test/share/*' \
145 --path-include '/test/share/*' \
146 pkg-somefiles.deb
147 test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT)
148 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html"
149 test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run"
150 $(DPKG_PURGE) pkg-somefiles
152 test-upgrade:
153 # files are removed/re-added on upgrades
154 $(DPKG_INSTALL) pkg-somefiles.deb
155 test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT)
156 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
157 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright"
159 $(DPKG_INSTALL) \
160 --path-exclude '/test/share/doc/*' \
161 pkg-somefiles.deb
162 ! test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
163 ! test -d "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles"
165 $(DPKG_INSTALL) \
166 --path-exclude '/test/share/doc/*' \
167 --path-include '/test/share/doc/*/copyright' \
168 pkg-somefiles.deb
169 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
170 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright"
171 ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README"
173 $(DPKG_INSTALL) pkg-somefiles.deb
174 test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT)
175 test -L "$(DPKG_INSTDIR)/test/share/doc/pkg-symlinked"
176 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright"
177 test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README"
178 $(DPKG_PURGE) pkg-somefiles
180 # --help output explains the options
181 test-help:
182 $(DPKG) --help | grep -q -- --path-include
183 $(DPKG) --help | grep -q -- --path-exclude