Add test-cases for identical basenames within package
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 16 Apr 2012 11:14:37 +0000 (14:14 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 16 Apr 2012 11:14:37 +0000 (14:14 +0300)
- 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.

tests/Makefile.am
tests/data/SPECS/selfconflict.spec [new file with mode: 0644]
tests/rpmconflict.at

index 8b490f5..b4bd71a 100644 (file)
@@ -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 (file)
index 0000000..73794ec
--- /dev/null
@@ -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
index 1463a38..13ad174 100644 (file)
@@ -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])