summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2022-03-24 10:23:54 +0200
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commit25e64a5032e1350044843fce6db8e5990a7c3df6 (patch)
treed3970fa6f87c8a6f0c681b61b77ba56c416a46e0
parent05c8f26f1b08191b0845370b4043cef4578dcc1e (diff)
downloadrpm-25e64a5032e1350044843fce6db8e5990a7c3df6.tar.gz
Add a bunch of file-erasure related testcases
Replace the two very basic file erase tests from "rpmdb" group with a more elaborate set of tests in their own file. Some embarrassing failures here, eg "shared" colored files getting left behind on erase. Oops. (cherry picked from commit a7ceb572cfe1066a6dc425a272ed6b99747eaccc)
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/rpmdb.at37
-rw-r--r--tests/rpme.at280
-rw-r--r--tests/rpmtests.at1
4 files changed, 282 insertions, 37 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c66e801da..c7bfaf7b8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,6 +19,7 @@ TESTSUITE_AT += rpmdb.at
TESTSUITE_AT += rpmbuild.at
TESTSUITE_AT += rpmbuildid.at
TESTSUITE_AT += rpmi.at
+TESTSUITE_AT += rpme.at
TESTSUITE_AT += rpmvercmp.at
TESTSUITE_AT += rpmdeps.at
TESTSUITE_AT += rpmconflict.at
diff --git a/tests/rpmdb.at b/tests/rpmdb.at
index 4c32c4fc0..08249062a 100644
--- a/tests/rpmdb.at
+++ b/tests/rpmdb.at
@@ -338,40 +338,3 @@ not installed /usr/share/flangtest/pl.txt
[])
AT_CLEANUP
-# ------------------------------
-# Install and verify files exist on disk
-AT_SETUP([rpm -U and verify files on disk])
-AT_KEYWORDS([install rpmdb])
-AT_CHECK([
-RPMDB_INIT
-rm -rf "${RPMTEST}"/opt/*
-
-runroot rpmbuild --quiet -bb /data/SPECS/selfconflict.spec
-runroot rpm -U /build/RPMS/noarch/selfconflict-1.0-1.noarch.rpm
-find "${RPMTEST}"/opt | wc -l
-],
-[0],
-[6
-],
-[])
-AT_CLEANUP
-
-# ------------------------------
-# Install, erase and oerify files removed from disk
-# Note /opt is not owned by the pkg so it gets left behind
-AT_SETUP([rpm -e and verify files removed])
-AT_KEYWORDS([install rpmdb])
-AT_CHECK([
-RPMDB_INIT
-rm -rf "${RPMTEST}"/opt/*
-
-runroot rpmbuild --quiet -bb /data/SPECS/selfconflict.spec
-runroot rpm -U /build/RPMS/noarch/selfconflict-1.0-1.noarch.rpm
-runroot rpm -e selfconflict
-find "${RPMTEST}"/opt | wc -l
-],
-[0],
-[1
-],
-[])
-AT_CLEANUP
diff --git a/tests/rpme.at b/tests/rpme.at
new file mode 100644
index 000000000..c41348f2f
--- /dev/null
+++ b/tests/rpme.at
@@ -0,0 +1,280 @@
+
+AT_SETUP([rpm -e and verify files removed])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+
+AT_CHECK([
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -Vv --nodeps --nogroup --nouser hello
+runroot rpm -e hello
+runroot rpm -Vv --nodeps --nogroup --nouser /data/RPMS/hello-2.0-1.x86_64.rpm
+],
+[1],
+[......... /usr/bin/hello
+......... /usr/share/doc/hello-2.0
+......... d /usr/share/doc/hello-2.0/COPYING
+......... d /usr/share/doc/hello-2.0/FAQ
+......... d /usr/share/doc/hello-2.0/README
+missing /usr/bin/hello
+missing /usr/share/doc/hello-2.0
+missing d /usr/share/doc/hello-2.0/COPYING
+missing d /usr/share/doc/hello-2.0/FAQ
+missing d /usr/share/doc/hello-2.0/README
+],
+[])
+AT_CLEANUP
+
+AT_SETUP([rpm -e and shared files removed 1.1])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+AT_CHECK([
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 3" \
+ --define "_prefer_color 2" \
+ --nodocs \
+ /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -Vv --nodeps --nogroup --nouser hello
+
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 3" \
+ --define "_prefer_color 2" \
+ /data/RPMS/hello-2.0-1.i686.rpm
+runroot rpm -Vv --nodeps --nogroup --nouser hello.x86_64 hello.i686
+
+runroot rpm -e hello.x86_64
+runroot rpm -Vv --nodeps --nogroup --nouser /data/RPMS/hello-2.0-1.x86_64.rpm
+],
+[1],
+[......... /usr/bin/hello
+......... /usr/share/doc/hello-2.0 (not installed)
+......... d /usr/share/doc/hello-2.0/COPYING (not installed)
+......... d /usr/share/doc/hello-2.0/FAQ (not installed)
+......... d /usr/share/doc/hello-2.0/README (not installed)
+......... /usr/bin/hello
+......... /usr/share/doc/hello-2.0 (not installed)
+......... d /usr/share/doc/hello-2.0/COPYING (not installed)
+......... d /usr/share/doc/hello-2.0/FAQ (not installed)
+......... d /usr/share/doc/hello-2.0/README (not installed)
+......... /usr/bin/hello (wrong color)
+......... /usr/share/doc/hello-2.0
+......... d /usr/share/doc/hello-2.0/COPYING
+......... d /usr/share/doc/hello-2.0/FAQ
+......... d /usr/share/doc/hello-2.0/README
+missing /usr/bin/hello
+......... /usr/share/doc/hello-2.0
+......... d /usr/share/doc/hello-2.0/COPYING
+......... d /usr/share/doc/hello-2.0/FAQ
+......... d /usr/share/doc/hello-2.0/README
+],
+[])
+AT_CLEANUP
+
+AT_SETUP([rpm -e and shared files removed 1.2])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+AT_CHECK([
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 3" \
+ --define "_prefer_color 2" \
+ --nodocs \
+ /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -Vv --nodeps --nogroup --nouser hello
+
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 3" \
+ --define "_prefer_color 2" \
+ /data/RPMS/hello-2.0-1.i686.rpm
+runroot rpm -Vv --nodeps --nogroup --nouser hello.x86_64 hello.i686
+
+runroot rpm -e hello.i686
+runroot rpm -Vv --nodeps --nogroup --nouser /data/RPMS/hello-2.0-1.x86_64.rpm
+],
+[1],
+[......... /usr/bin/hello
+......... /usr/share/doc/hello-2.0 (not installed)
+......... d /usr/share/doc/hello-2.0/COPYING (not installed)
+......... d /usr/share/doc/hello-2.0/FAQ (not installed)
+......... d /usr/share/doc/hello-2.0/README (not installed)
+......... /usr/bin/hello
+......... /usr/share/doc/hello-2.0 (not installed)
+......... d /usr/share/doc/hello-2.0/COPYING (not installed)
+......... d /usr/share/doc/hello-2.0/FAQ (not installed)
+......... d /usr/share/doc/hello-2.0/README (not installed)
+......... /usr/bin/hello (wrong color)
+......... /usr/share/doc/hello-2.0
+......... d /usr/share/doc/hello-2.0/COPYING
+......... d /usr/share/doc/hello-2.0/FAQ
+......... d /usr/share/doc/hello-2.0/README
+......... /usr/bin/hello
+missing /usr/share/doc/hello-2.0
+missing d /usr/share/doc/hello-2.0/COPYING
+missing d /usr/share/doc/hello-2.0/FAQ
+missing d /usr/share/doc/hello-2.0/README
+],
+[])
+
+AT_CLEANUP
+# Test that removing shared or wrong colored files has no effect
+AT_SETUP([rpm -e and verify colored files removed 1.1])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+AT_CHECK([
+
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 3" \
+ --define "_prefer_color 2" \
+ /data/RPMS/hello-2.0-1.i686.rpm /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -V --nodeps --nogroup --nouser hello.x86_64 hello.i686
+runroot rpm -e hello.i686
+runroot rpm -Vv --nodeps --nogroup --nouser hello
+],
+[0],
+[......... /usr/bin/hello
+......... /usr/share/doc/hello-2.0
+......... d /usr/share/doc/hello-2.0/COPYING
+......... d /usr/share/doc/hello-2.0/FAQ
+......... d /usr/share/doc/hello-2.0/README
+],
+[])
+AT_CLEANUP
+
+# XXX This is wrong really, rpm shouldn't let the real provider of
+# a shared file get removed - and unforced action shouldn't result
+# in verify failure.
+AT_SETUP([rpm -e and verify colored files removed 1.2])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+AT_CHECK([
+RPMDB_INIT
+
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 3" \
+ --define "_prefer_color 2" \
+ /data/RPMS/hello-2.0-1.i686.rpm /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -e hello.x86_64
+runroot rpm -Vv --nodeps --nogroup --nouser hello
+],
+[1],
+[missing /usr/bin/hello (wrong color)
+......... /usr/share/doc/hello-2.0
+......... d /usr/share/doc/hello-2.0/COPYING
+......... d /usr/share/doc/hello-2.0/FAQ
+......... d /usr/share/doc/hello-2.0/README
+],
+[])
+AT_CLEANUP
+
+# Test that shared colored files actually get removed regardless of order 1
+AT_SETUP([rpm -e and verify colored files removed 2.1])
+AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+AT_CHECK([
+RPMDB_INIT
+
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 2" \
+ --define "_prefer_color 2" \
+ /data/RPMS/hello-2.0-1.i686.rpm /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -e hello.i686 hello.x86_64
+runroot rpm -Vp --nodeps --nogroup --nouser /data/RPMS/hello-2.0-1.x86_64.rpm
+],
+[1],
+[missing /usr/bin/hello
+missing /usr/share/doc/hello-2.0
+missing d /usr/share/doc/hello-2.0/COPYING
+missing d /usr/share/doc/hello-2.0/FAQ
+missing d /usr/share/doc/hello-2.0/README
+],
+[])
+AT_CLEANUP
+
+# Test that shared colored files actually get removed regardless of order 2
+AT_SETUP([rpm -e and verify colored files removed 2.2])
+AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+AT_CHECK([
+RPMDB_INIT
+
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ --define "_transaction_color 2" \
+ --define "_prefer_color 2" \
+ /data/RPMS/hello-2.0-1.i686.rpm /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -e hello.x86_64 hello.i686
+runroot rpm -Vp --nodeps --nogroup --nouser /data/RPMS/hello-2.0-1.x86_64.rpm
+],
+[1],
+[missing /usr/bin/hello
+missing /usr/share/doc/hello-2.0
+missing d /usr/share/doc/hello-2.0/COPYING
+missing d /usr/share/doc/hello-2.0/FAQ
+missing d /usr/share/doc/hello-2.0/README
+],
+[])
+AT_CLEANUP
+
+AT_SETUP([rpm -e and verify conflicting files removed 1])
+AT_KEYWORDS([install erase rpmdb])
+RPMDB_INIT
+for p in a b; do
+ runroot rpmbuild -bb --quiet \
+ --define "pkg ${p}" \
+ --define "filedata pkg-${p}" \
+ /data/SPECS/conflicttest.spec
+done
+
+AT_CHECK([
+runroot rpm -U --ignoreos /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm
+runroot rpm -U --ignoreos --force /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
+runroot rpm -Vav --nogroup --nouser conflicta conflictb
+runroot rpm -e conflicta
+runroot rpm -Vav --nogroup --nouser conflictb
+runroot rpm -e conflictb
+runroot rpm -Vp --nogroup --nouser /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
+],
+[1],
+[......... /usr/share/my.version (replaced)
+......... /usr/share/my.version
+......... /usr/share/my.version
+missing /usr/share/my.version
+],
+[])
+
+AT_CHECK([
+runroot rpm -U --ignoreos /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm
+runroot rpm -U --ignoreos --force /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
+runroot rpm -Vav --nogroup --nouser conflicta conflictb
+runroot rpm -e conflictb
+runroot rpm -Vav --nogroup --nouser conflicta
+runroot rpm -e conflicta
+],
+[0],
+[......... /usr/share/my.version (replaced)
+......... /usr/share/my.version
+missing /usr/share/my.version (replaced)
+],
+[])
+AT_CLEANUP
+
+# Test %_netsharedpath erasure. It's a bit weird as we're abusing verify
+# on non-installed package to see if files are there.
+AT_SETUP([rpm -e and verify netshared files not removed])
+AT_KEYWORDS([install erase rpmdb])
+AT_CHECK([
+RPMDB_INIT
+
+runroot rpm -U --ignoreos --ignorearch --nodeps \
+ /data/RPMS/hello-2.0-1.x86_64.rpm
+runroot rpm -e \
+ --define "_netsharedpath /usr/share" \
+ hello
+runroot rpm -Vp --nodeps --nogroup --nouser /data/RPMS/hello-2.0-1.x86_64.rpm
+],
+[1],
+[missing /usr/bin/hello
+],
+[])
+AT_CLEANUP
+
diff --git a/tests/rpmtests.at b/tests/rpmtests.at
index a1adab8e0..153c796f2 100644
--- a/tests/rpmtests.at
+++ b/tests/rpmtests.at
@@ -11,6 +11,7 @@ m4_include([rpmio.at])
m4_include([rpmverify.at])
m4_include([rpmdb.at])
m4_include([rpmi.at])
+m4_include([rpme.at])
m4_include([rpmorder.at])
m4_include([rpmbuild.at])
m4_include([rpmbuildid.at])