summaryrefslogtreecommitdiff
path: root/tests/rpmverify.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rpmverify.at')
-rw-r--r--tests/rpmverify.at412
1 files changed, 407 insertions, 5 deletions
diff --git a/tests/rpmverify.at b/tests/rpmverify.at
index 473ac494f..7e6a1b0dc 100644
--- a/tests/rpmverify.at
+++ b/tests/rpmverify.at
@@ -16,8 +16,8 @@ runroot rpmbuild --quiet -bb \
--define "reqs deptest-two" \
/data/SPECS/deptest.spec
-runroot rpm -U --nodeps "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
-runroot rpm -Va
+runroot rpm -U --nodeps /build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
+runroot rpm -Va --nofiles
],
[1],
[Unsatisfied dependencies for deptest-one-1.0-1.noarch:
@@ -63,6 +63,67 @@ runroot rpm -Vva --nodeps --nouser --nogroup
[])
AT_CLEANUP
+# Test file verify when no errors expected in verbose mode.
+AT_SETUP([directory replaced with a directory symlink])
+AT_KEYWORDS([verify])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${RPMTEST}"/opt/*
+rm -rf "${TOPDIR}"
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 1.0" \
+ --define "filetype datadir" \
+ --define "filedata README1" \
+ --define "user $(id -u -n)" \
+ --define "grp $(id -g -n)" \
+ /data/SPECS/replacetest.spec
+
+runroot rpm -U /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
+mv "${RPMTEST}"/opt/foo "${RPMTEST}"/opt/was
+ln -s was "${RPMTEST}"/opt/foo
+runroot rpm -Vv replacetest
+],
+[0],
+[......... /opt/foo
+......... /opt/foo/README1
+......... /opt/goo
+......... /opt/zoo
+],
+[])
+AT_CLEANUP
+
+AT_SETUP([directory replaced with an invalid directory symlink])
+AT_KEYWORDS([verify])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${RPMTEST}"/opt/*
+rm -rf "${TOPDIR}"
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 1.0" \
+ --define "filetype datadir" \
+ --define "filedata README1" \
+ /data/SPECS/replacetest.spec
+
+runroot rpm -U /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
+mv "${RPMTEST}"/opt/foo "${RPMTEST}"/opt/was
+ln -s was "${RPMTEST}"/opt/foo
+runroot rpm -Vv --nouser --nogroup replacetest
+],
+[1],
+[....L.... /opt/foo
+......... /opt/foo/README1
+......... /opt/goo
+......... /opt/zoo
+],
+[])
+AT_CLEANUP
+
# Test file verify after mutilating the files a bit.
AT_SETUP([verify from db, with problems present])
AT_KEYWORDS([verify])
@@ -107,6 +168,53 @@ missing d /usr/share/doc/hello-1.0/FAQ
[])
AT_CLEANUP
+AT_SETUP([verify file attribute filtering])
+AT_KEYWORDS([query])
+AT_CHECK([
+runroot rpmbuild -bb --quiet \
+ /data/SPECS/vattrtest.spec
+
+runroot rpm -U /build/RPMS/noarch/vattrtest-1.0-1.noarch.rpm
+runroot_other touch /opt/vattrtest/g
+runroot_other chmod 644 /opt/vattrtest/g
+
+cmd="rpm -Vv --nouser --nogroup"
+for filter in --noconfig --noghost --noartifact; do
+ echo ${filter}
+ runroot ${cmd} ${filter} vattrtest
+done
+],
+[ignore],
+[--noconfig
+......... /opt/vattrtest
+......... a /opt/vattrtest/a
+......... d /opt/vattrtest/d
+......... g /opt/vattrtest/g
+......... l /opt/vattrtest/l
+......... m /opt/vattrtest/m
+......... r /opt/vattrtest/r
+--noghost
+......... /opt/vattrtest
+......... a /opt/vattrtest/a
+......... c /opt/vattrtest/c
+......... c /opt/vattrtest/cn
+......... d /opt/vattrtest/d
+......... l /opt/vattrtest/l
+......... m /opt/vattrtest/m
+......... r /opt/vattrtest/r
+--noartifact
+......... /opt/vattrtest
+......... c /opt/vattrtest/c
+......... c /opt/vattrtest/cn
+......... d /opt/vattrtest/d
+......... g /opt/vattrtest/g
+......... l /opt/vattrtest/l
+......... m /opt/vattrtest/m
+......... r /opt/vattrtest/r
+],
+[])
+AT_CLEANUP
+
# Test verify script success & failure behavior
# Ignoring stderr spew for now
AT_SETUP([verifyscript failure])
@@ -117,7 +225,7 @@ RPMDB_INIT
rm -rf "${TOPDIR}"
runroot rpmbuild --quiet -bb /data/SPECS/verifyscript.spec
-runroot rpm -U --nodeps "${TOPDIR}"/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
+runroot rpm -U --nodeps /build/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
rm -f "${RPMTEST}"/var/checkme
runroot rpm -V --nodeps verifyscript
],
@@ -134,7 +242,7 @@ RPMDB_INIT
rm -rf "${TOPDIR}"
runroot rpmbuild --quiet -bb /data/SPECS/verifyscript.spec
-runroot rpm -U --nodeps "${TOPDIR}"/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
+runroot rpm -U --nodeps /build/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
touch "${RPMTEST}"/var/checkme
runroot rpm -V --nodeps verifyscript
],
@@ -163,7 +271,7 @@ done
# first instance of a shared file is the one that actually gets created,
# force the order so we know what to expect as these dont depend on each other
-runroot rpm -U --noorder "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
+runroot rpm -U --noorder /build/RPMS/noarch/conflictone-1.0-1.noarch.rpm /build/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
runroot rpm -e conflicttwo
runroot rpm -Va --nouser --nogroup
],
@@ -171,3 +279,297 @@ runroot rpm -Va --nouser --nogroup
[],
[])
AT_CLEANUP
+
+# ------------------------------
+# Upgraded verification with min_writes 1 (files)
+AT_SETUP([Upgraded verification with min_writes 1 (files)])
+AT_KEYWORDS([upgrade verify min_writes])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${tf}" "${tf}".rpm*
+rm -rf "${TOPDIR}"
+
+for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype file" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+done
+
+for v in "3.0" "4.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype file" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+done
+
+runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
+cat "${tf}"
+touch -t 201703171717 ${tf}
+
+runroot rpm -U \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+cat "${tf}"
+
+runroot rpm -U \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+cat "${tf}"
+
+echo "xx" > "${tf}"
+cat "${tf}"
+
+runroot rpm -U \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+cat "${tf}"
+
+touch -t 201703171717 ${tf}
+
+runroot rpm -U --oldpackage \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+cat "${tf}"
+],
+[0],
+[foo
+foo
+fox
+xx
+fox
+fox
+],
+[])
+AT_CLEANUP
+
+
+# ------------------------------
+# Upgraded verification with min_writes 2 (files)
+AT_SETUP([Upgraded verification with min_writes 2 (files)])
+AT_KEYWORDS([upgrade verify min_writes])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${tf}" "${tf}".rpm*
+rm -rf "${TOPDIR}"
+
+for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype file" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+done
+
+for v in "3.0" "4.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype file" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+done
+
+runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
+cat "${tf}"
+touch -t 201703171717 ${tf}
+
+runroot rpm -Uvv --fsmdebug \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+cat "${tf}"
+
+
+runroot rpm -Uvv --fsmdebug \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+cat "${tf}"
+echo "xx" > "${tf}"
+cat "${tf}"
+
+runroot rpm -Uvv --fsmdebug \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+cat "${tf}"
+
+touch -t 201703171717 ${tf}
+
+runroot rpm -U -Uvv --fsmdebug --oldpackage \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+cat "${tf}"
+],
+[0],
+[foo
+2
+foo
+1
+fox
+xx
+1
+fox
+2
+fox
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+# Upgraded verification with min_writes 3 (LINKs)
+AT_SETUP([Upgraded verification with min_writes 3 (LINKs)])
+AT_KEYWORDS([upgrade verify min_writes])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${tf}" "${tf}".rpm*
+rm -rf "${TOPDIR}"
+
+for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype link" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+done
+
+for v in "3.0" "4.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype link" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+done
+
+runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
+readlink "${tf}"
+
+runroot rpm -U \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+readlink "${tf}"
+
+runroot rpm -U \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+readlink "${tf}"
+
+ln -sf "xx" "${tf}"
+readlink "${tf}"
+
+runroot rpm -U \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+readlink "${tf}"
+
+runroot rpm -U --oldpackage \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
+runroot rpm -Va --nouser --nogroup replacetest
+readlink "${tf}"
+],
+[0],
+[foo
+foo
+fox
+xx
+fox
+fox
+],
+[])
+AT_CLEANUP
+# ------------------------------
+# Upgraded verification with min_writes 4 (LINKs)
+AT_SETUP([Upgraded verification with min_writes 4 (LINKs)])
+AT_KEYWORDS([upgrade verify min_writes])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${tf}" "${tf}".rpm*
+rm -rf "${TOPDIR}"
+
+for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype link" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+done
+
+for v in "3.0" "4.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "ver $v" \
+ --define "filetype link" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+done
+
+runroot rpm -i /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
+readlink "${tf}"
+
+runroot rpm -Uvv --fsmdebug \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+readlink "${tf}"
+
+
+runroot rpm -Uvv --fsmdebug \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+readlink "${tf}"
+ln -sf "xx" "${tf}"
+readlink "${tf}"
+
+runroot rpm -Uvv --fsmdebug \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-4.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+readlink "${tf}"
+
+runroot rpm -U -Uvv --fsmdebug --oldpackage \
+ --define "_minimize_writes 1" \
+ /build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
+runroot rpm -Va --nouser --nogroup replacetest
+grep -c "touch" output.txt
+readlink "${tf}"
+],
+[0],
+[foo
+2
+foo
+1
+fox
+xx
+1
+fox
+2
+fox
+],
+[])
+AT_CLEANUP