summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-04-16 14:14:37 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-04-16 14:14:37 +0300
commitdf475ec90cee171049ed7eb2edfcbba9b4d4993f (patch)
treefd027ffc04b91374868087df15505ebabf0ce0a7 /tests
parent8e4c7a56150407bd99edf29f009d1014a1d61626 (diff)
downloadrpm-df475ec90cee171049ed7eb2edfcbba9b4d4993f.tar.gz
rpm-df475ec90cee171049ed7eb2edfcbba9b4d4993f.tar.bz2
rpm-df475ec90cee171049ed7eb2edfcbba9b4d4993f.zip
Add test-cases for identical basenames within package
- One test for the normal situation where identical basenames are not a problem, and another one where this causes a self-conflict because of a directory symlink.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/data/SPECS/selfconflict.spec21
-rw-r--r--tests/rpmconflict.at38
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8b490f5f1..b4bd71ac4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,6 +45,7 @@ EXTRA_DIST += data/SPECS/deptest.spec
EXTRA_DIST += data/SPECS/verifyscript.spec
EXTRA_DIST += data/SPECS/fakeshell.spec
EXTRA_DIST += data/SPECS/scripts.spec
+EXTRA_DIST += data/SPECS/selfconflict.spec
EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch
EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
diff --git a/tests/data/SPECS/selfconflict.spec b/tests/data/SPECS/selfconflict.spec
new file mode 100644
index 000000000..73794ec93
--- /dev/null
+++ b/tests/data/SPECS/selfconflict.spec
@@ -0,0 +1,21 @@
+Name: selfconflict
+Version: 1.0
+Release: 1
+Summary: Testing file conflict behavior within package itself
+
+Group: Testing
+License: GPL
+BuildArch: noarch
+
+%description
+%{summary}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/opt/mydir/{one,two}
+echo "foo" > $RPM_BUILD_ROOT/opt/mydir/one/somefile
+echo "bar" > $RPM_BUILD_ROOT/opt/mydir/two/somefile
+
+%files
+%defattr(-,root,root,-)
+/opt/mydir
diff --git a/tests/rpmconflict.at b/tests/rpmconflict.at
index 1463a3896..13ad17423 100644
--- a/tests/rpmconflict.at
+++ b/tests/rpmconflict.at
@@ -85,6 +85,44 @@ runroot rpm -U \
AT_CLEANUP
# ------------------------------
+# (Build and) install package with identical basename in different directories
+AT_SETUP([rpm -U with non-conflicting identical basenames])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+rm -rf "${TOPDIR}"
+
+runroot rpmbuild --quiet -bb /data/SPECS/selfconflict.spec
+rm -rf "${RPMTEST}"/opt/mydir
+runroot rpm -U "${TOPDIR}"/RPMS/noarch/selfconflict-1.0-1.noarch.rpm
+],
+[0],
+[],
+[])
+AT_CLEANUP
+
+# ------------------------------
+# (Build and) install package with a self-conflict due to directory symlinks
+AT_SETUP([rpm -U with conflicting identical basenames])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+rm -rf "${TOPDIR}"
+
+runroot rpmbuild --quiet -bb /data/SPECS/selfconflict.spec
+rm -rf "${RPMTEST}"/opt/mydir
+mkdir -p "${RPMTEST}"/opt/mydir/one
+ln -s one "${RPMTEST}"/opt/mydir/two
+runroot rpm -U "${TOPDIR}"/RPMS/noarch/selfconflict-1.0-1.noarch.rpm
+],
+[1],
+[],
+[ file /opt/mydir/two/somefile conflicts between attempted installs of selfconflict-1.0-1.noarch and selfconflict-1.0-1.noarch
+])
+AT_CLEANUP
+# ------------------------------
# File conflict between colored files, prefer 64bit
AT_SETUP([rpm -U multilib elf conflict, prefer 64bit])
AT_KEYWORDS([install])