summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-08-20 10:48:31 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-08-20 10:55:20 +0300
commitfe62087ac9210eced259c38364df8affef7a4685 (patch)
tree5c28e72e6da35c25346ec8f5bcaa6bbd629fafe8 /tests
parent69850340e666c1b77f0db328afb0721d8e731514 (diff)
downloadrpm-fe62087ac9210eced259c38364df8affef7a4685.tar.gz
rpm-fe62087ac9210eced259c38364df8affef7a4685.tar.bz2
rpm-fe62087ac9210eced259c38364df8affef7a4685.zip
Yet more %config test-cases - shared configs have quirks of their own
Diffstat (limited to 'tests')
-rw-r--r--tests/rpmconfig.at287
1 files changed, 287 insertions, 0 deletions
diff --git a/tests/rpmconfig.at b/tests/rpmconfig.at
index ec0a54355..4c314eebe 100644
--- a/tests/rpmconfig.at
+++ b/tests/rpmconfig.at
@@ -333,3 +333,290 @@ foo-2.0
[warning: /etc/my.conf created as /etc/my.conf.rpmnew]
)
AT_CLEANUP
+
+# Shared config file variants of the same cases
+# ------------------------------
+# (Build and) upgrade package with config file, no backup here
+AT_SETUP([upgrade unchanged shared config])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -f "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for s in "A" "B"; do
+ for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "sub $s" \
+ --define "ver $v" \
+ --define "filedata foo" \
+ /data/SPECS/configtest.spec
+ done
+done
+
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
+cat "${cf}"
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
+cat "${cf}"
+],
+[0],
+[foo
+foo
+],
+[])
+
+AT_CLEANUP
+#
+# ------------------------------
+# Upgrade package with locally modified config file, unchanged in pkg
+AT_SETUP([upgrade modified shared config])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -f "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for s in "A" "B"; do
+ for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "sub $s" \
+ --define "ver $v" \
+ --define "filedata foo" \
+ /data/SPECS/configtest.spec
+ done
+done
+
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
+cat "${cf}"
+echo "otherstuff" > "${cf}"
+cat "${cf}"
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
+cat "${cf}"
+],
+[0],
+[foo
+otherstuff
+otherstuff
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+# Upgrade package with unmodified config file, changed in pkg
+AT_SETUP([upgrade changing shared config])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -f "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for s in "A" "B"; do
+ for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "sub $s" \
+ --define "ver $v" \
+ --define "filedata foo-$v" \
+ /data/SPECS/configtest.spec
+ done
+done
+
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
+cat "${cf}"
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
+cat "${cf}"
+],
+[0],
+[foo-1.0
+foo-2.0
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+# Upgrade package with locally modified config file, changed in pkg
+AT_SETUP([upgrade changing, modified shared config 1])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -f "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for s in "A" "B"; do
+ for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "sub $s" \
+ --define "ver $v" \
+ --define "filedata foo-$v" \
+ /data/SPECS/configtest.spec
+ done
+done
+
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
+cat "${cf}"
+echo "otherstuff" > "${RPMTEST}"/etc/my.conf
+cat "${cf}"
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
+cat "${cf}"
+],
+[0],
+[foo-1.0
+otherstuff
+foo-2.0
+],
+[warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
+)
+AT_CLEANUP
+
+# ------------------------------
+# Modified config file matches the content from new package. Creating a
+# backup makes no sense in this case, but that's what currently happens.
+AT_SETUP([upgrade changing, modified shared config 2])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -f "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for s in "A" "B"; do
+ for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "sub $s" \
+ --define "ver $v" \
+ --define "filedata foo-$v" \
+ /data/SPECS/configtest.spec
+ done
+done
+
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
+cat "${cf}"
+echo "foo-2.0" > "${RPMTEST}"/etc/my.conf
+cat "${cf}"
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
+cat "${cf}"
+],
+[0],
+[foo-1.0
+foo-2.0
+foo-2.0
+],
+[warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
+)
+AT_CLEANUP
+
+# Shared config(noreplace) variants of the more interesting cases
+# ------------------------------
+# Upgrade package with locally modified config file, changed in pkg.
+# Creating *two* backups makes no sense, but that's what currently happens.
+AT_SETUP([upgrade changing, modified shared config(noreplace) 1])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -f "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for s in "A" "B"; do
+ for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "sub $s" \
+ --define "ver $v" \
+ --define "filedata foo-$v" \
+ --define "noreplace 1" \
+ /data/SPECS/configtest.spec
+ done
+done
+
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
+cat "${cf}"
+echo "otherstuff" > "${RPMTEST}"/etc/my.conf
+cat "${cf}"
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
+cat "${cf}"
+],
+[0],
+[foo-1.0
+otherstuff
+otherstuff
+],
+[warning: /etc/my.conf created as /etc/my.conf.rpmnew
+warning: /etc/my.conf created as /etc/my.conf.rpmnew]
+)
+AT_CLEANUP
+
+# ------------------------------
+# Modified config file matches the content from new package. Creating a
+# backup makes no sense in this case, but that's what currently happens.
+AT_SETUP([upgrade changing, modified shared config(noreplace) 2])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -f "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for s in "A" "B"; do
+ for v in "1.0" "2.0"; do
+ runroot rpmbuild --quiet -bb \
+ --define "sub $s" \
+ --define "ver $v" \
+ --define "filedata foo-$v" \
+ --define "noreplace 1" \
+ /data/SPECS/configtest.spec
+ done
+done
+
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
+cat "${cf}"
+echo "foo-2.0" > "${RPMTEST}"/etc/my.conf
+cat "${cf}"
+runroot rpm -U \
+ "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
+ "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
+cat "${cf}"
+],
+[0],
+[foo-1.0
+foo-2.0
+foo-2.0
+],
+[warning: /etc/my.conf created as /etc/my.conf.rpmnew]
+)
+AT_CLEANUP