diff --git a/tests/Makefile.am b/tests/Makefile.am index 635504841..54e2b86d3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,13 +19,15 @@ TESTSUITE_AT += rpmquery.at TESTSUITE_AT += rpmdb.at TESTSUITE_AT += rpmbuild.at TESTSUITE_AT += rpmi.at -TESTSUITE_AT = rpmvercmp.at +TESTSUITE_AT += rpmvercmp.at +TESTSUITE_AT += rpmconflict.at EXTRA_DIST += $(TESTSUITE_AT) ## testsuite data 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/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/conflicttest.spec b/tests/data/SPECS/conflicttest.spec new file mode 100644 index 000000000..894b63210 --- /dev/null +++ b/tests/data/SPECS/conflicttest.spec @@ -0,0 +1,23 @@ +Name: conflict%{pkg} +Version: 1.0 +Release: 1 +Summary: Testing file conflict behavior + +Group: Testing +License: GPL +BuildArch: noarch + +%description +%{summary} + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT/%{_datadir} +echo "%{filedata}" > $RPM_BUILD_ROOT/%{_datadir}/my.version + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%{_datadir}/my.version diff --git a/tests/rpmconflict.at b/tests/rpmconflict.at new file mode 100644 index 000000000..5b72c89c5 --- /dev/null +++ b/tests/rpmconflict.at @@ -0,0 +1,76 @@ +# rpmvercmp.at: rpm version comparison tests + +# ------------------------------ +# (Build and) install conflicting package (should fail) +AT_SETUP([rpm -U to package with file conflict]) +AT_CHECK([ +RPMDB_CLEAR +rm -rf "${TOPDIR}" + +for p in "one" "two"; do + run rpmbuild --quiet -bb \ + --define "pkg $p" \ + --define "filedata $p" \ + ${RPMDATA}/SPECS/conflicttest.spec +done + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm +runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm +], +[1], +[ignore], +[ignore]) +AT_CLEANUP + +# ------------------------------ +# Install conflicting packages in same transaction (should fail) +AT_SETUP([rpm -U two packages with a conflicting file]) +AT_CHECK([ +RPMDB_CLEAR + +runroot rpm -U \ + "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm \ + "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm +], +[2], +[ignore], +[ignore]) +AT_CLEANUP + +# ------------------------------ +# (Build and) install package with shareable file +AT_SETUP([rpm -U package with shareable file]) +AT_CHECK([ +RPMDB_CLEAR +rm -rf "${TOPDIR}" + +for p in "one" "two"; do + run rpmbuild --quiet -bb \ + --define "pkg $p" \ + --define "filedata same_stuff" \ + ${RPMDATA}/SPECS/conflicttest.spec +done + +runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm +runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm +], +[0], +[ignore], +[ignore]) +AT_CLEANUP + +# ------------------------------ +# Install packages with shareable file in same transaction +AT_SETUP([rpm -U two packages with shareable file]) +AT_CHECK([ +RPMDB_CLEAR + +runroot rpm -U \ + "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm \ + "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm +], +[0], +[ignore], +[ignore]) +AT_CLEANUP + diff --git a/tests/rpmtests.at b/tests/rpmtests.at index 975f3971b..ebcb0c659 100644 --- a/tests/rpmtests.at +++ b/tests/rpmtests.at @@ -4,3 +4,4 @@ m4_include([rpmdb.at]) m4_include([rpmi.at]) m4_include([rpmbuild.at]) m4_include([rpmvercmp.at]) +m4_include([rpmconflict.at])