diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-08-21 08:59:29 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-08-21 08:59:29 +0300 |
commit | 3f67160a2edb7050835eefa861c5ef85d2d00db0 (patch) | |
tree | af15ea7397445f52c49072b3fd7835b1732c2621 /tests | |
parent | 7a50e9de80ab3c47618dad1e9a5b2d9b79bfc8dc (diff) | |
download | rpm-3f67160a2edb7050835eefa861c5ef85d2d00db0.tar.gz |
And yet more %config test-cases
- Test behavior when installing over a pre-existing file
- Test behavior on erasure
- Two of the erasure-tests are currently failing due to regression
introduced in commit 1845c1d711b88723e596c88e8a7730a360029089
Diffstat (limited to 'tests')
-rw-r--r-- | tests/rpmconfig.at | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/tests/rpmconfig.at b/tests/rpmconfig.at index bc040509f..e7324b71c 100644 --- a/tests/rpmconfig.at +++ b/tests/rpmconfig.at @@ -2,6 +2,178 @@ AT_BANNER([RPM config file behavior]) +# Install over existing config file +AT_SETUP([install config on existiting file]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -f "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +runroot rpmbuild --quiet -bb \ + --define "ver 1.0" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +echo "otherstuff" > "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +cat "${cf}.rpmorig" +], +[0], +[foo +otherstuff +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmorig] +) +AT_CLEANUP + +# Install over existing config file +AT_SETUP([install config(noreplace) on existiting file]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -f "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +runroot rpmbuild --quiet -bb \ + --define "ver 1.0" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +echo "otherstuff" > "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +cat "${cf}.rpmorig" +], +[0], +[foo +otherstuff +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmorig] +) +AT_CLEANUP + +# Install over existing identical config file, no backup needed +AT_SETUP([install config on existiting identical file]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -f "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +runroot rpmbuild --quiet -bb \ + --define "ver 1.0" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +echo "foo" > "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +test ! -f "${cf}" +], +[0], +[foo +], +[]) +AT_CLEANUP + +# Erase unmodified config file, no backup here +AT_SETUP([erase unchanged config]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -f "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +runroot rpmbuild --quiet -bb \ + --define "ver 1.0" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +test ! -f "${cf}" +], +[0], +[foo +], +[]) +AT_CLEANUP + +# Erase modified config file +AT_SETUP([erase changed config]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -f "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +runroot rpmbuild --quiet -bb \ + --define "ver 1.0" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +echo "otherstuff" > "${cf}" +runroot rpm -e configtest +cat "${cf}.rpmsave" +test ! -f "${cf}" +], +[0], +[foo +otherstuff +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP + +# Erase modified config(noreplace) file +AT_SETUP([erase changed config(noreplace)]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -f "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +runroot rpmbuild --quiet -bb \ + --define "ver 1.0" \ + --define "filedata foo" \ + --define "noreplace 1" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +echo "otherstuff" > "${cf}" +runroot rpm -e configtest +cat "${cf}.rpmsave" +test ! -f "${cf}" +], +[0], +[foo +otherstuff +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP + # ------------------------------ # (Build and) upgrade package with config file, no backup here AT_SETUP([upgrade unchanged config]) |