diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2013-01-30 13:46:45 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2013-01-30 14:32:57 +0200 |
commit | 3de09d5e5092ddb9682b1fc2b01bcbab8ac5eeca (patch) | |
tree | 6ef7654a4ec476f9eccf4b45752c78aad68cc605 /tests | |
parent | f5d5e728fea7ab3c8c01f8a4a7981871efe4cda3 (diff) | |
download | rpm-3de09d5e5092ddb9682b1fc2b01bcbab8ac5eeca.tar.gz rpm-3de09d5e5092ddb9682b1fc2b01bcbab8ac5eeca.tar.bz2 rpm-3de09d5e5092ddb9682b1fc2b01bcbab8ac5eeca.zip |
Add testcase for %ghost %config behavior
- Further parametrize configtest.spec to allow for different attributes
- Verify pre-existing %ghost %config is preserved on install,
that it survives upgrades and gets removed on erase.
This fails now because it IS broken due to commit
a712252392eca75443ca45c10a72873cabec7963.
(cherry picked from commit 5121ea2151f13e58740b7b4e7dc20cff5f2475fb)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/SPECS/configtest.spec | 2 | ||||
-rw-r--r-- | tests/rpmconfig.at | 52 |
2 files changed, 53 insertions, 1 deletions
diff --git a/tests/data/SPECS/configtest.spec b/tests/data/SPECS/configtest.spec index e9b72c093..5f15c349f 100644 --- a/tests/data/SPECS/configtest.spec +++ b/tests/data/SPECS/configtest.spec @@ -32,4 +32,4 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%{!?noconfig:%config%{?noreplace:(noreplace)}} %{_sysconfdir}/my.conf +%{?fileattr} %{!?noconfig:%config%{?noreplace:(noreplace)}} %{_sysconfdir}/my.conf diff --git a/tests/rpmconfig.at b/tests/rpmconfig.at index 6bdbf39fe..80323bc10 100644 --- a/tests/rpmconfig.at +++ b/tests/rpmconfig.at @@ -790,3 +790,55 @@ foo-2.0 ], []) 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 +test ! -f "${cf}" && echo OK1 + +# 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 +test ! -f "${cf}" && echo OK2 +], +[], +[OK1 +keaton +keaton +OK1 +OK2 +buster +buster +OK2 +], +[]) +AT_CLEANUP |