1 # rpmverify.at: rpm verification tests
3 AT_BANNER([RPM verification])
5 # ------------------------------
7 AT_SETUP([dependency problems])
14 runroot rpmbuild --quiet -bb \
16 --define "reqs deptest-two" \
17 /data/SPECS/deptest.spec
19 runroot rpm -U --nodeps /build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
20 runroot rpm -Va --nofiles
23 [Unsatisfied dependencies for deptest-one-1.0-1.noarch:
24 deptest-two is needed by (installed) deptest-one-1.0-1.noarch
29 # Test file verify when no errors expected.
30 # Ignore dependencies here as we're not testing for them, and
31 # --nogroup --nouser is required when running tests as non-root.
32 AT_SETUP([files with no problems])
38 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
39 /data/RPMS/hello-1.0-1.i386.rpm
40 runroot rpm -Va --nodeps --nouser --nogroup
47 # Test file verify when no errors expected in verbose mode.
48 AT_SETUP([files with no problems in verbose mode])
54 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
55 /data/RPMS/hello-1.0-1.i386.rpm
56 runroot rpm -Vva --nodeps --nouser --nogroup
59 [......... /usr/local/bin/hello
60 ......... /usr/share/doc/hello-1.0
61 ......... d /usr/share/doc/hello-1.0/FAQ
66 # Test file verify when no errors expected in verbose mode.
67 AT_SETUP([directory replaced with a directory symlink])
72 tf="${RPMTEST}"/opt/foo
73 rm -rf "${RPMTEST}"/opt/*
76 runroot rpmbuild --quiet -bb \
78 --define "filetype datadir" \
79 --define "filedata README1" \
80 --define "user $(id -u -n)" \
81 --define "grp $(id -g -n)" \
82 /data/SPECS/replacetest.spec
84 runroot rpm -U /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
85 mv "${RPMTEST}"/opt/foo "${RPMTEST}"/opt/was
86 ln -s was "${RPMTEST}"/opt/foo
87 runroot rpm -Vv replacetest
91 ......... /opt/foo/README1
98 AT_SETUP([directory replaced with an invalid directory symlink])
103 tf="${RPMTEST}"/opt/foo
104 rm -rf "${RPMTEST}"/opt/*
107 runroot rpmbuild --quiet -bb \
109 --define "filetype datadir" \
110 --define "filedata README1" \
111 /data/SPECS/replacetest.spec
113 runroot rpm -U /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
114 mv "${RPMTEST}"/opt/foo "${RPMTEST}"/opt/was
115 ln -s was "${RPMTEST}"/opt/foo
116 runroot rpm -Vv --nouser --nogroup replacetest
120 ......... /opt/foo/README1
127 # Test file verify after mutilating the files a bit.
128 AT_SETUP([verify from db, with problems present])
129 AT_KEYWORDS([verify])
134 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
135 /data/RPMS/hello-1.0-1.i386.rpm
136 rm -f "${RPMTEST}"/usr/share/doc/hello-1.0/FAQ
137 chmod u-x "${RPMTEST}"/usr/local/bin/hello
138 dd if=/dev/zero of="${RPMTEST}"/usr/local/bin/hello \
139 conv=notrunc bs=1 seek=5 count=6 2> /dev/null
140 runroot rpm -Va --nodeps --nouser --nogroup
143 [.M5....T. /usr/local/bin/hello
144 missing d /usr/share/doc/hello-1.0/FAQ
149 # Test file verify from original package after mutilating the files a bit.
150 AT_SETUP([verify from package, with problems present])
151 AT_KEYWORDS([verify])
156 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
157 /data/RPMS/hello-1.0-1.i386.rpm
158 rm -f "${RPMTEST}"/usr/share/doc/hello-1.0/FAQ
159 chmod u-x "${RPMTEST}"/usr/local/bin/hello
160 dd if=/dev/zero of="${RPMTEST}"/usr/local/bin/hello \
161 conv=notrunc bs=1 seek=5 count=6 2> /dev/null
162 runroot rpm -Vp --nodeps --nouser --nogroup /data/RPMS/hello-1.0-1.i386.rpm
165 [.M5....T. /usr/local/bin/hello
166 missing d /usr/share/doc/hello-1.0/FAQ
171 AT_SETUP([verify file attribute filtering])
174 runroot rpmbuild -bb --quiet \
175 /data/SPECS/vattrtest.spec
177 runroot rpm -U /build/RPMS/noarch/vattrtest-1.0-1.noarch.rpm
178 runroot_other touch /opt/vattrtest/g
179 runroot_other chmod 644 /opt/vattrtest/g
181 cmd="rpm -Vv --nouser --nogroup"
182 for filter in --noconfig --noghost --noartifact; do
184 runroot ${cmd} ${filter} vattrtest
189 ......... /opt/vattrtest
190 ......... a /opt/vattrtest/a
191 ......... d /opt/vattrtest/d
192 ......... g /opt/vattrtest/g
193 ......... l /opt/vattrtest/l
194 ......... m /opt/vattrtest/m
195 ......... r /opt/vattrtest/r
197 ......... /opt/vattrtest
198 ......... a /opt/vattrtest/a
199 ......... c /opt/vattrtest/c
200 ......... c /opt/vattrtest/cn
201 ......... d /opt/vattrtest/d
202 ......... l /opt/vattrtest/l
203 ......... m /opt/vattrtest/m
204 ......... r /opt/vattrtest/r
206 ......... /opt/vattrtest
207 ......... c /opt/vattrtest/c
208 ......... c /opt/vattrtest/cn
209 ......... d /opt/vattrtest/d
210 ......... g /opt/vattrtest/g
211 ......... l /opt/vattrtest/l
212 ......... m /opt/vattrtest/m
213 ......... r /opt/vattrtest/r
218 # Test verify script success & failure behavior
219 # Ignoring stderr spew for now
220 AT_SETUP([verifyscript failure])
221 AT_KEYWORDS([verify])
227 runroot rpmbuild --quiet -bb /data/SPECS/verifyscript.spec
228 runroot rpm -U --nodeps /build/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
229 rm -f "${RPMTEST}"/var/checkme
230 runroot rpm -V --nodeps verifyscript
237 AT_SETUP([verifyscript success])
238 AT_KEYWORDS([verify])
244 runroot rpmbuild --quiet -bb /data/SPECS/verifyscript.spec
245 runroot rpm -U --nodeps /build/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
246 touch "${RPMTEST}"/var/checkme
247 runroot rpm -V --nodeps verifyscript
254 # ------------------------------
255 # shared file timestamp behavior
256 AT_SETUP([shared file timestamp behavior])
257 AT_KEYWORDS([verify])
263 # create packages sharing a file but with different timestamp
264 for p in "one" "two"; do
265 runroot rpmbuild --quiet -bb \
267 --define "filedata same_stuff" \
268 /data/SPECS/conflicttest.spec
272 # first instance of a shared file is the one that actually gets created,
273 # force the order so we know what to expect as these dont depend on each other
274 runroot rpm -U --noorder /build/RPMS/noarch/conflictone-1.0-1.noarch.rpm /build/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
275 runroot rpm -e conflicttwo
276 runroot rpm -Va --nouser --nogroup
283 # ------------------------------
284 # Upgraded verification with min_writes 1 (files)
285 AT_SETUP([Upgraded verification with min_writes 1 (files)])
286 AT_KEYWORDS([upgrade verify min_writes])
290 tf="${RPMTEST}"/opt/foo
291 rm -rf "${tf}" "${tf}".rpm*
294 for v in "1.0" "2.0"; do
295 runroot rpmbuild --quiet -bb \
297 --define "filetype file" \
298 --define "filedata foo" \
299 /data/SPECS/replacetest.spec
302 for v in "3.0" "4.0"; do
303 runroot rpmbuild --quiet -bb \
305 --define "filetype file" \
306 --define "filedata fox" \
307 /data/SPECS/replacetest.spec
310 runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
312 touch -t 201703171717 ${tf}
315 --define "_minimize_writes 1" \
316 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm
317 runroot rpm -Va --nouser --nogroup replacetest
321 --define "_minimize_writes 1" \
322 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
323 runroot rpm -Va --nouser --nogroup replacetest
330 --define "_minimize_writes 1" \
331 /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm
332 runroot rpm -Va --nouser --nogroup replacetest
335 touch -t 201703171717 ${tf}
337 runroot rpm -U --oldpackage \
338 --define "_minimize_writes 1" \
339 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
340 runroot rpm -Va --nouser --nogroup replacetest
355 # ------------------------------
356 # Upgraded verification with min_writes 2 (files)
357 AT_SETUP([Upgraded verification with min_writes 2 (files)])
358 AT_KEYWORDS([upgrade verify min_writes])
362 tf="${RPMTEST}"/opt/foo
363 rm -rf "${tf}" "${tf}".rpm*
366 for v in "1.0" "2.0"; do
367 runroot rpmbuild --quiet -bb \
369 --define "filetype file" \
370 --define "filedata foo" \
371 /data/SPECS/replacetest.spec
374 for v in "3.0" "4.0"; do
375 runroot rpmbuild --quiet -bb \
377 --define "filetype file" \
378 --define "filedata fox" \
379 /data/SPECS/replacetest.spec
382 runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
384 touch -t 201703171717 ${tf}
386 runroot rpm -Uvv --fsmdebug \
387 --define "_minimize_writes 1" \
388 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm > output.txt 2>&1
389 runroot rpm -Va --nouser --nogroup replacetest
390 grep -c "touch" output.txt
394 runroot rpm -Uvv --fsmdebug \
395 --define "_minimize_writes 1" \
396 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
397 runroot rpm -Va --nouser --nogroup replacetest
398 grep -c "touch" output.txt
403 runroot rpm -Uvv --fsmdebug \
404 --define "_minimize_writes 1" \
405 /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm > output.txt 2>&1
406 runroot rpm -Va --nouser --nogroup replacetest
407 grep -c "touch" output.txt
410 touch -t 201703171717 ${tf}
412 runroot rpm -U -Uvv --fsmdebug --oldpackage \
413 --define "_minimize_writes 1" \
414 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
415 runroot rpm -Va --nouser --nogroup replacetest
416 grep -c "touch" output.txt
434 # ------------------------------
435 # Upgraded verification with min_writes 3 (LINKs)
436 AT_SETUP([Upgraded verification with min_writes 3 (LINKs)])
437 AT_KEYWORDS([upgrade verify min_writes])
441 tf="${RPMTEST}"/opt/foo
442 rm -rf "${tf}" "${tf}".rpm*
445 for v in "1.0" "2.0"; do
446 runroot rpmbuild --quiet -bb \
448 --define "filetype link" \
449 --define "filedata foo" \
450 /data/SPECS/replacetest.spec
453 for v in "3.0" "4.0"; do
454 runroot rpmbuild --quiet -bb \
456 --define "filetype link" \
457 --define "filedata fox" \
458 /data/SPECS/replacetest.spec
461 runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
465 --define "_minimize_writes 1" \
466 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm
467 runroot rpm -Va --nouser --nogroup replacetest
471 --define "_minimize_writes 1" \
472 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
473 runroot rpm -Va --nouser --nogroup replacetest
480 --define "_minimize_writes 1" \
481 /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm
482 runroot rpm -Va --nouser --nogroup replacetest
485 runroot rpm -U --oldpackage \
486 --define "_minimize_writes 1" \
487 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
488 runroot rpm -Va --nouser --nogroup replacetest
501 # ------------------------------
502 # Upgraded verification with min_writes 4 (LINKs)
503 AT_SETUP([Upgraded verification with min_writes 4 (LINKs)])
504 AT_KEYWORDS([upgrade verify min_writes])
508 tf="${RPMTEST}"/opt/foo
509 rm -rf "${tf}" "${tf}".rpm*
512 for v in "1.0" "2.0"; do
513 runroot rpmbuild --quiet -bb \
515 --define "filetype link" \
516 --define "filedata foo" \
517 /data/SPECS/replacetest.spec
520 for v in "3.0" "4.0"; do
521 runroot rpmbuild --quiet -bb \
523 --define "filetype link" \
524 --define "filedata fox" \
525 /data/SPECS/replacetest.spec
528 runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
531 runroot rpm -Uvv --fsmdebug \
532 --define "_minimize_writes 1" \
533 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm > output.txt 2>&1
534 runroot rpm -Va --nouser --nogroup replacetest
535 grep -c "touch" output.txt
539 runroot rpm -Uvv --fsmdebug \
540 --define "_minimize_writes 1" \
541 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
542 runroot rpm -Va --nouser --nogroup replacetest
543 grep -c "touch" output.txt
548 runroot rpm -Uvv --fsmdebug \
549 --define "_minimize_writes 1" \
550 /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm > output.txt 2>&1
551 runroot rpm -Va --nouser --nogroup replacetest
552 grep -c "touch" output.txt
555 runroot rpm -U -Uvv --fsmdebug --oldpackage \
556 --define "_minimize_writes 1" \
557 /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
558 runroot rpm -Va --nouser --nogroup replacetest
559 grep -c "touch" output.txt