diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-11-22 01:15:20 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-11-22 01:15:20 +0200 |
commit | 0bcdd93151c21b78ff64d05c05711b0bf79966c5 (patch) | |
tree | decf559e827b180a82c1b9723771fa0a75fa8316 /tests | |
parent | 9844bfc9b776b00c56dd389bfe5fb4807b189d59 (diff) | |
download | librpm-tizen-0bcdd93151c21b78ff64d05c05711b0bf79966c5.tar.gz librpm-tizen-0bcdd93151c21b78ff64d05c05711b0bf79966c5.tar.bz2 librpm-tizen-0bcdd93151c21b78ff64d05c05711b0bf79966c5.zip |
Add some basic tests for config file behavior
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/data/SPECS/configtest.spec | 23 | ||||
-rw-r--r-- | tests/rpmconfig.at | 93 | ||||
-rw-r--r-- | tests/rpmtests.at | 1 |
4 files changed, 119 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 54e2b86d3..f777640a8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -21,6 +21,7 @@ TESTSUITE_AT += rpmbuild.at TESTSUITE_AT += rpmi.at TESTSUITE_AT += rpmvercmp.at TESTSUITE_AT += rpmconflict.at +TESTSUITE_AT += rpmconfig.at EXTRA_DIST += $(TESTSUITE_AT) ## testsuite data @@ -28,6 +29,7 @@ EXTRA_DIST += data/SPECS/hello.spec EXTRA_DIST += data/SPECS/foo.spec EXTRA_DIST += data/SPECS/versiontest.spec EXTRA_DIST += data/SPECS/conflicttest.spec +EXTRA_DIST += data/SPECS/configtest.spec EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz EXTRA_DIST += data/RPMS/foo-1.0-1.noarch.rpm EXTRA_DIST += data/RPMS/hello-1.0-1.i386.rpm diff --git a/tests/data/SPECS/configtest.spec b/tests/data/SPECS/configtest.spec new file mode 100644 index 000000000..5ea7cae72 --- /dev/null +++ b/tests/data/SPECS/configtest.spec @@ -0,0 +1,23 @@ +Name: configtest +Version: %{ver} +Release: 1 +Summary: Testing config file behavior + +Group: Testing +License: GPL +BuildArch: noarch + +%description +%{summary} + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir} +echo "%{filedata}" > $RPM_BUILD_ROOT/%{_sysconfdir}/my.conf + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%config %{_sysconfdir}/my.conf diff --git a/tests/rpmconfig.at b/tests/rpmconfig.at new file mode 100644 index 000000000..db16307e6 --- /dev/null +++ b/tests/rpmconfig.at @@ -0,0 +1,93 @@ +# rpmvercmp.at: rpm config file behavior tests + +# ------------------------------ +# (Build and) upgrade package with config file, no backup here +AT_SETUP([rpm -U to package with unchanged config file]) +AT_CHECK([ +RPMDB_CLEAR +rm -rf "${TOPDIR}" +rm -rf "${RPMTEST}/etc/my.conf" + +for v in "1.0" "2.0"; do + run rpmbuild --quiet -bb \ + --define "ver $v" \ + --define "filedata foo" \ + ${RPMDATA}/SPECS/configtest.spec +done + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +], +[0], +) +AT_CLEANUP +# +# ------------------------------ +# Upgrade package with locally modified config file, unchanged in pkg +AT_SETUP([rpm -U to package with locally modified config file]) +AT_CHECK([ +RPMDB_CLEAR +rm -rf "${TOPDIR}" +rm -rf "${RPMTEST}/etc/my.conf" + +for v in "1.0" "2.0"; do + run rpmbuild --quiet -bb \ + --define "ver $v" \ + --define "filedata foo" \ + ${RPMDATA}/SPECS/configtest.spec +done + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +echo "otherstuff" > "${RPMTEST}"/etc/my.conf +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +], +[0], +) +AT_CLEANUP + +# ------------------------------ +# Upgrade package with unmodified config file, changed in pkg +AT_SETUP([rpm -U to package with unchanged config file]) +AT_CHECK([ +RPMDB_CLEAR +rm -rf "${TOPDIR}" +rm -rf "${RPMTEST}/etc/my.conf" + +for v in "1.0" "2.0"; do + run rpmbuild --quiet -bb \ + --define "ver $v" \ + --define "filedata foo-$v" \ + ${RPMDATA}/SPECS/configtest.spec +done + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +], +[0], +) +AT_CLEANUP + +# ------------------------------ +# Upgrade package with locally modified config file, changed in pkg +AT_SETUP([rpm -U to package with modified config file]) +AT_CHECK([ +RPMDB_CLEAR +rm -rf "${TOPDIR}" +rm -rf "${RPMTEST}/etc/my.conf" + +for v in "1.0" "2.0"; do + run rpmbuild --quiet -bb \ + --define "ver $v" \ + --define "filedata foo-$v" \ + ${RPMDATA}/SPECS/configtest.spec +done + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +echo "otherstuff" > "${RPMTEST}"/etc/my.conf +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +], +[0], +[ignore], +[warning: /etc/my.conf saved as /etc/my.conf.rpmsave] +) +AT_CLEANUP diff --git a/tests/rpmtests.at b/tests/rpmtests.at index ebcb0c659..f18b78928 100644 --- a/tests/rpmtests.at +++ b/tests/rpmtests.at @@ -5,3 +5,4 @@ m4_include([rpmi.at]) m4_include([rpmbuild.at]) m4_include([rpmvercmp.at]) m4_include([rpmconflict.at]) +m4_include([rpmconfig.at]) |