summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-05-30 13:40:01 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-05-30 13:40:01 +0300
commit077db96e9da9018787b796b0b566f2489c92fe19 (patch)
tree7d2ddc4a82a7e6a335c911f1eaf829c6894baaf8 /tests
parent6e4e5ebd87ed5b2e237c9929253e3628e82850e9 (diff)
downloadrpm-077db96e9da9018787b796b0b566f2489c92fe19.tar.gz
rpm-077db96e9da9018787b796b0b566f2489c92fe19.tar.bz2
rpm-077db96e9da9018787b796b0b566f2489c92fe19.zip
Add a test-case for various %files manifest globbing scenarios
- In particular (aside from basics working) we're interested in the broken symlink behavior: at least glibc and Solaris have a weird glob() which doesn't return broken symlinks at all, yet we need to be able to package them (and that's why rpm carries its own copy of a differently broken, old glibc glob) - Also test for directory-only match (RhBug:505995 cases)
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/data/SPECS/globtest.spec41
-rw-r--r--tests/rpmbuild.at32
3 files changed, 74 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b4bd71ac4..fb3922961 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -35,6 +35,7 @@ EXTRA_DIST += data/SPECS/attrtest.spec
EXTRA_DIST += data/SPECS/hello.spec
EXTRA_DIST += data/SPECS/hello-script.spec
EXTRA_DIST += data/SPECS/foo.spec
+EXTRA_DIST += data/SPECS/globtest.spec
EXTRA_DIST += data/SPECS/versiontest.spec
EXTRA_DIST += data/SPECS/conflicttest.spec
EXTRA_DIST += data/SPECS/configtest.spec
diff --git a/tests/data/SPECS/globtest.spec b/tests/data/SPECS/globtest.spec
new file mode 100644
index 000000000..80f45de73
--- /dev/null
+++ b/tests/data/SPECS/globtest.spec
@@ -0,0 +1,41 @@
+Name: globtest
+Version: 1.0
+Release: 1
+Summary: Testing file glob behavior
+Group: Testing
+License: GPL
+BuildArch: noarch
+
+%description
+%{summary}
+
+%define testdir /opt/%{name}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+mkdir -p $RPM_BUILD_ROOT/%{testdir}
+echo "foo" > $RPM_BUILD_ROOT/%{testdir}/weird%%name
+for f in bif baf zab zeb zib; do
+ echo "$f" > $RPM_BUILD_ROOT/%{testdir}/$f
+done
+for f in bing bang bong; do
+ mkdir -p $RPM_BUILD_ROOT/%{testdir}/$f
+done
+mkdir -p $RPM_BUILD_ROOT/%{testdir}/foo
+for f in one two three; do
+ echo "$f" > $RPM_BUILD_ROOT/%{testdir}/foo/$f
+done
+
+ln -s %{testdir}/zab $RPM_BUILD_ROOT/%{testdir}/linkgood
+ln -s %{testdir}/zub $RPM_BUILD_ROOT/%{testdir}/linkbad
+
+%files
+%defattr(-,root,root,-)
+%{testdir}/b??
+%{testdir}/weird?name
+%{testdir}/z*
+%{testdir}/l*
+%{testdir}/b*g/
+%dir %{testdir}/foo
+%{testdir}/foo/*
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 20142a21f..7661e35f5 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -153,3 +153,35 @@ ls -i "${RPMTEST}"/foo/hello* | awk {'print $1'} | sort -u | wc -l
],
[])
AT_CLEANUP
+
+AT_SETUP([rpmbuild glob])
+AT_KEYWORDS([build])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+rm -rf ${TOPDIR}
+
+runroot rpmbuild -bb --quiet /data/SPECS/globtest.spec
+runroot rpm -qp \
+ --qf "[[%{filemodes:perms} %{filenames}\n]]" \
+ "${TOPDIR}"/RPMS/noarch/globtest-1.0-1.noarch.rpm
+],
+[0],
+[-rw-r--r-- /opt/globtest/baf
+drwxr-xr-x /opt/globtest/bang
+-rw-r--r-- /opt/globtest/bif
+drwxr-xr-x /opt/globtest/bing
+drwxr-xr-x /opt/globtest/bong
+drwxr-xr-x /opt/globtest/foo
+-rw-r--r-- /opt/globtest/foo/one
+-rw-r--r-- /opt/globtest/foo/three
+-rw-r--r-- /opt/globtest/foo/two
+lrwxrwxrwx /opt/globtest/linkbad
+lrwxrwxrwx /opt/globtest/linkgood
+-rw-r--r-- /opt/globtest/weird%name
+-rw-r--r-- /opt/globtest/zab
+-rw-r--r-- /opt/globtest/zeb
+-rw-r--r-- /opt/globtest/zib
+],
+[])
+AT_CLEANUP