X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Frpmconfig.at;h=91c03ba571bc564d8825168ad4e74ea0e81aa592;hb=9cf156d6583a9f9581000bb12ff047980ebcef03;hp=4c314eebec12d4a683098a46f491e4f46fbcb073;hpb=fe62087ac9210eced259c38364df8affef7a4685;p=platform%2Fupstream%2Frpm.git diff --git a/tests/rpmconfig.at b/tests/rpmconfig.at index 4c314ee..91c03ba 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 -rf "${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 -rf "${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 -rf "${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 -rf "${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 -rf "${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 -rf "${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]) @@ -10,7 +182,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -40,7 +212,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -73,7 +245,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -103,7 +275,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -119,26 +291,27 @@ echo "otherstuff" > "${RPMTEST}"/etc/my.conf cat "${cf}" runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm cat "${cf}" +cat "${cf}.rpmsave" ], [0], [foo-1.0 otherstuff foo-2.0 +otherstuff ], [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. +# Modified config file matches the content from new package. AT_SETUP([upgrade changing, modified config 2]) AT_KEYWORDS([install]) AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -160,8 +333,7 @@ cat "${cf}" foo-2.0 foo-2.0 ], -[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] -) +[]) AT_CLEANUP # config(noreplace) variants of the same cases. @@ -174,7 +346,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -206,7 +378,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -240,7 +412,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -271,7 +443,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -288,26 +460,27 @@ echo "otherstuff" > "${RPMTEST}"/etc/my.conf cat "${cf}" runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm cat "${cf}" +cat "${cf}.rpmnew" ], [0], [foo-1.0 otherstuff otherstuff +foo-2.0 ], [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. +# Modified config file matches the content from new package. AT_SETUP([upgrade changing, modified config(noreplace) 2]) AT_KEYWORDS([install]) AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for v in "1.0" "2.0"; do @@ -330,8 +503,7 @@ cat "${cf}" foo-2.0 foo-2.0 ], -[warning: /etc/my.conf created as /etc/my.conf.rpmnew] -) +[]) AT_CLEANUP # Shared config file variants of the same cases @@ -343,7 +515,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for s in "A" "B"; do @@ -381,7 +553,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for s in "A" "B"; do @@ -421,7 +593,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for s in "A" "B"; do @@ -458,7 +630,7 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT cf="${RPMTEST}"/etc/my.conf -rm -f "${cf}" "${cf}".rpm* +rm -rf "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for s in "A" "B"; do @@ -481,26 +653,27 @@ 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}" +cat "${cf}.rpmsave" ], [0], [foo-1.0 otherstuff foo-2.0 +otherstuff ], [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. +# Modified config file matches the content from new package. 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 "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for s in "A" "B"; do @@ -529,21 +702,19 @@ cat "${cf}" 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 "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for s in "A" "B"; do @@ -567,27 +738,27 @@ 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}" +cat "${cf}.rpmnew" ], [0], [foo-1.0 otherstuff otherstuff +foo-2.0 ], -[warning: /etc/my.conf created as /etc/my.conf.rpmnew -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. +# Modified config file matches the content from new package. 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 "${cf}" "${cf}".rpm* rm -rf "${TOPDIR}" for s in "A" "B"; do @@ -617,6 +788,58 @@ cat "${cf}" foo-2.0 foo-2.0 ], -[warning: /etc/my.conf created as /etc/my.conf.rpmnew] -) +[]) +AT_CLEANUP + +--------- +# Test pre-existing and post-install config ghost survival and erasure +AT_SETUP([install/upgrade/erase ghost config]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -rf "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +for v in 1.0 2.0; do + runroot rpmbuild --quiet -bb \ + --define "ver ${v}" \ + --define "filetype file" \ + --define "filedata buster" \ + --define "fileattr %ghost" \ + /data/SPECS/configtest.spec +done + +# pre-existing config, install, erase +test ! -f "${cf}" && echo OK1 +echo "keaton" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +cat "${cf}" +rm -f "${cf}" + +# post-install config, upgrade, erase +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +test ! -f "${cf}" && echo OK2 +echo "buster" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +cat "${cf}" +], +[], +[OK1 +keaton +keaton +keaton +OK2 +buster +buster +buster +], +[]) AT_CLEANUP