Add some basic tests for file conflict behavior

This commit is contained in:
Panu Matilainen 2008-11-21 23:59:25 +02:00
parent ab3e32ad97
commit 9844bfc9b7
4 changed files with 103 additions and 1 deletions

View File

@ -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

View File

@ -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

76
tests/rpmconflict.at Normal file
View File

@ -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

View File

@ -4,3 +4,4 @@ m4_include([rpmdb.at])
m4_include([rpmi.at])
m4_include([rpmbuild.at])
m4_include([rpmvercmp.at])
m4_include([rpmconflict.at])