summaryrefslogtreecommitdiff
path: root/tests/rpmverify.at
diff options
context:
space:
mode:
authorPavlina Moravcova Varekova <pmoravco@redhat.com>2017-04-21 11:45:42 +0200
committerPanu Matilainen <pmatilai@redhat.com>2017-04-21 13:50:50 +0300
commit29c48e14de414ca512e404a2d773c3fcb3578040 (patch)
treeecf9cb8268b2756c08dd56711022fe56ffa98ce5 /tests/rpmverify.at
parentf7d4b2b726c4ef3c6e0e33b05e1febd8470d89b5 (diff)
downloadrpm-29c48e14de414ca512e404a2d773c3fcb3578040.tar.gz
Add mode for updating with minimal writing (RhBug:783480)
How does the number of writes change? I compared number of writes with and without minimal writing for upgrade from RHEL 7.0 to RHEL 7.1, from RHEL 7.1 to RHEL 7.2, ... In more details, the size of memory used for writing regular files. The following table contains in the second column percentages of files which can be only touched from all installed files. In the third column, there are percentages of sum of their sizes. | Touched | Touched | Updated files | Updated bytes ------------------------------------------------------------------------ RHEL 7.0 -> RHEL 7.1 | 63 % | 66 % RHEL 7.1 -> RHEL 7.2 | 53 % | 43 % RHEL 7.2 -> RHEL 7.3 | 60 % | 42 % ------------------------------------------------------------------------ F24 -> F25 | 63 % | 40 % F25-> Fraw | 49 % | 28 % Does the speed change? The update speed for classical disks or SSD almost does not change. How it works? If there is a file in the new package, which has the equal digest as the corresponding file in the old package and the same file on the disk (thus the contents are expected to be equal), rpm will not install the whole file, but rather only upgrade the file's meta data. In other cases, it will install the whole file.
Diffstat (limited to 'tests/rpmverify.at')
-rw-r--r--tests/rpmverify.at167
1 files changed, 167 insertions, 0 deletions
diff --git a/tests/rpmverify.at b/tests/rpmverify.at
index cf7abc3fa..5283de9f1 100644
--- a/tests/rpmverify.at
+++ b/tests/rpmverify.at
@@ -193,3 +193,170 @@ runroot rpm -Va --nouser --nogroup
[],
[])
AT_CLEANUP
+
+# ------------------------------
+# Upgraded package verification with min_writes 1
+AT_SETUP([Upgraded package verification with min_writes 1])
+AT_KEYWORDS([upgrade verify min_writes])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${tf}" "${tf}".rpm*
+rm -rf "${TOPDIR}"
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 1.0" \
+ --define "filetype file" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 2.0" \
+ --define "filetype file" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 3.0" \
+ --define "filetype file" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 4.0" \
+ --define "filetype file" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+
+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 package verification with min_writes 2
+AT_SETUP([Upgraded package verification with min_writes 2])
+AT_KEYWORDS([upgrade verify min_writes])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+tf="${RPMTEST}"/opt/foo
+rm -rf "${tf}" "${tf}".rpm*
+rm -rf "${TOPDIR}"
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 1.0" \
+ --define "filetype file" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 2.0" \
+ --define "filetype file" \
+ --define "filedata foo" \
+ /data/SPECS/replacetest.spec
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 3.0" \
+ --define "filetype file" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+
+runroot rpmbuild --quiet -bb \
+ --define "ver 4.0" \
+ --define "filetype file" \
+ --define "filedata fox" \
+ /data/SPECS/replacetest.spec
+
+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