diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-08-21 12:30:04 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-08-21 12:30:04 +0300 |
commit | f6cf0a13cd7eab5bd89f03f24addf1ab1ec19e4c (patch) | |
tree | ab18fb5343cbfff4d5abcfa09b9604df7cce5481 | |
parent | 4eca2f866207fb24249a93cd88c16d3096ab7eff (diff) | |
download | librpm-tizen-f6cf0a13cd7eab5bd89f03f24addf1ab1ec19e4c.tar.gz librpm-tizen-f6cf0a13cd7eab5bd89f03f24addf1ab1ec19e4c.tar.bz2 librpm-tizen-f6cf0a13cd7eab5bd89f03f24addf1ab1ec19e4c.zip |
Add a third set of config tests for file type changes testing
- Several (expected) breakages here too, some backups missing, and
some redundant backups taken
- This is by no means complete set of the possible changes but
gotta start someplace...
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/rpmconfig3.at | 326 |
2 files changed, 327 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index af00d3b66..d8fe0f376 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,6 +25,7 @@ TESTSUITE_AT += rpmdeps.at TESTSUITE_AT += rpmconflict.at TESTSUITE_AT += rpmconfig.at TESTSUITE_AT += rpmconfig2.at +TESTSUITE_AT += rpmconfig3.at TESTSUITE_AT += rpmmacro.at TESTSUITE_AT += rpmpython.at TESTSUITE_AT += rpmdepmatch.at diff --git a/tests/rpmconfig3.at b/tests/rpmconfig3.at new file mode 100644 index 000000000..b6d395fa8 --- /dev/null +++ b/tests/rpmconfig3.at @@ -0,0 +1,326 @@ +# rpmconfig2.at: rpm config symlink behavior tests + +AT_BANNER([RPM config filetype changes]) + +# non-modified config changes to non-config and back, no backups +AT_SETUP([upgrade config to/from non-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 "filetype file" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype file" \ + --define "filedata bar" \ + --define "noconfig 1" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +cat "${cf}" +runroot rpm -U --oldpackage "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +], +[0], +[foo +bar +foo +], +[]) +AT_CLEANUP + +# modified config changes to non-config and back, back up on first upgrade +AT_SETUP([upgrade modified config to/from non-config 1]) +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 "filetype file" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype file" \ + --define "filedata bar" \ + --define "noconfig 1" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +echo "otherstuff" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +cat "${cf}" +cat "${cf}.rpmsave" +runroot rpm -U --oldpackage "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +], +[0], +[foo +otherstuff +bar +otherstuff +foo +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP + +# modified config changes to identical non-config and back, no backups +AT_SETUP([upgrade modified config to/from non-config 2]) +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 "filetype file" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype file" \ + --define "filedata bar" \ + --define "noconfig 1" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +echo "bar" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +cat "${cf}" +runroot rpm -U --oldpackage "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +], +[0], +[foo +bar +bar +foo +], +[]) +AT_CLEANUP + +# non-modified config file changes to config symlink and back, no backups +AT_SETUP([upgrade config to/from config link]) +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 "filetype file" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype link" \ + --define "filedata bar" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +readlink "${cf}" +runroot rpm -U --oldpackage "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +], +[0], +[foo +bar +foo +], +[]) +AT_CLEANUP + +# Modified config changes to config symlink +# Broken, no backup taken +AT_SETUP([upgrade modified config to config link]) +AT_KEYWORDS([install]) +AT_XFAIL_IF([test $RPM_XFAIL -gt 0]) +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 "filetype file" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype link" \ + --define "filedata bar" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +echo "otherstuff" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +readlink "${cf}" +cat "${cf}.rpmsave" +], +[0], +[foo +otherstuff +bar +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP + +# Modified config link changes to config file +# Broken, no backup taken +AT_SETUP([upgrade modified config link to config]) +AT_XFAIL_IF([test $RPM_XFAIL -gt 0]) +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 "filetype link" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype file" \ + --define "filedata bar" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +readlink "${cf}" +ln -sf "otherstuff" "${cf}" +readlink "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +cat "${cf}" +readlink "${cf}.rpmsave" +], +[0], +[foo +otherstuff +bar +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP + +# Non-modified config file changes to directory and back +# Seems broken, unwanted backup of the directory (directory renamed) taken +# when changing back from directory to file. OTOH what if the directory +# is not empty? +AT_SETUP([upgrade config to/from directory]) +AT_KEYWORDS([install]) +AT_XFAIL_IF([test $RPM_XFAIL -gt 0]) +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 "filetype file" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype dir" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +test -d "${cf}" +runroot rpm -U --oldpackage "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +test ! -d "${cf}.rpmsave" +], +[0], +[foo +foo +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP + +# Modified config changes to directory +# Broken, no backup taken +AT_SETUP([upgrade modified config to directory]) +AT_KEYWORDS([install]) +AT_XFAIL_IF([test $RPM_XFAIL -gt 0]) +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 "filetype file" \ + --define "filedata foo" \ + /data/SPECS/configtest.spec + +runroot rpmbuild --quiet -bb \ + --define "ver 2.0" \ + --define "filetype dir" \ + /data/SPECS/configtest.spec + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +echo "otherstuff" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +test -d "${cf}" +cat "${cf}.rpmsave" +], +[0], +[foo +otherstuff +], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP + |