msm: consistency for equally ranked keys
[platform/upstream/rpm.git] / tests / rpmbuild.at
1 #    rpmbuild.at: test rpmbuild
2 #
3 #    Copyright (C) 2007  Ralf Corsépius <corsepiu@fedoraproject.org>
4 #
5 #    This program is free software; you can redistribute it and/or modify
6 #    it under the terms of the GNU General Public License as published by
7 #    the Free Software Foundation; either version 2 of the License, or
8 #    (at your option) any later version.
9 #
10 #    This program is distributed in the hope that it will be useful,
11 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #    GNU General Public License for more details.
14 #
15 #    You should have received a copy of the GNU General Public License
16 #    along with this program; if not, write to the Free Software
17 #    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18
19 AT_BANNER([RPM build])
20
21 # ------------------------------
22 # Check if rpmbuild -ba *.spec works
23 AT_SETUP([rpmbuild -ba *.spec])
24 AT_KEYWORDS([build])
25 AT_CHECK([
26 rm -rf ${TOPDIR}
27 AS_MKDIR_P(${TOPDIR}/SOURCES)
28
29 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
30
31 run rpmbuild \
32   -ba "${abs_srcdir}"/data/SPECS/hello.spec
33 ],
34 [0],
35 [ignore],
36 [ignore])
37 AT_CLEANUP
38
39 # ------------------------------
40 # Check if rpmbuild --rebuild *.src.rpm works
41 AT_SETUP([rpmbuild --rebuild])
42 AT_KEYWORDS([build])
43 AT_CHECK([
44 rm -rf ${TOPDIR}
45
46 run rpmbuild \
47   --rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
48 ],
49 [0],
50 [ignore],
51 [ignore])
52 AT_CLEANUP
53
54 # ------------------------------
55 # Check if tar unpacking works
56 AT_SETUP([rpmbuild -tb <tar with bad spec>])
57 AT_KEYWORDS([build])
58 AT_CHECK([
59 rm -rf ${TOPDIR}
60
61 run rpmbuild \
62   -tb "${RPMDATA}/SOURCES/hello-1.0.tar.gz"
63 ],
64 [1],
65 [ignore],
66 [error: line 5: Unknown tag: Serial:    1
67 ])
68 AT_CLEANUP
69
70 # ------------------------------
71 # Check if tar build works
72 # TODO: test that the rpms are actually created...
73 AT_SETUP([rpmbuild -tb])
74 AT_KEYWORDS([build])
75 AT_CHECK([
76 rm -rf ${TOPDIR}
77
78 run rpmbuild \
79   -ta "${RPMDATA}/SOURCES/hello-2.0.tar.gz"
80 ],
81 [0],
82 [ignore],
83 [ignore])
84 AT_CLEANUP
85
86 # ------------------------------
87 # %attr/%defattr tests
88 AT_SETUP([rpmbuild %attr and %defattr])
89 AT_KEYWORDS([build])
90 AT_CHECK([[
91 rm -rf ${TOPDIR}
92
93 runroot rpmbuild \
94   -bb --quiet /data/SPECS/attrtest.spec
95
96 runroot rpm -qp --qf \
97   "\n[%{filemodes:perms} %-8{fileusername} %-8{filegroupname} %{filenames}\n]"\
98   "${TOPDIR}"/RPMS/noarch/attrtest-1.0-1.noarch.rpm
99 ]],
100 [0],
101 [
102 drwx------ root     root     /a/dir
103 -r-------- root     root     /a/file
104 drwx------ daemon   adm      /b/dir
105 -r-------- daemon   adm      /b/file
106 drwxr-x--- root     adm      /c/dir
107 -rw-r----- daemon   root     /c/file
108 drwxr-x--x daemon   bin      /d/dir
109 -rw-r--r-- bin      daemon   /d/file
110 drwx------ foo      bar      /e/dir
111 -r-------- foo      bar      /e/file
112 drwxrwx--- bar      foo      /f/dir
113 -rw-rw---- bar      foo      /f/file
114 drwx------ adm      foo      /g/dir
115 -r-------- bar      adm      /g/file
116 drwxr-xr-x foo      bar      /h/dir
117 -rw-r--r-- foo      bar      /h/file
118 drwxr-x--- adm      root     /i/dir
119 -rwsr-xr-x root     adm      /i/file
120 drwxrwxrwx zoot     zoot     /j/dir
121 --w--w--w- zoot     zoot     /j/file
122 ],
123 [])
124 AT_CLEANUP
125
126 # ------------------------------
127 # hardlink tests
128 AT_SETUP([rpmbuild hardlink])
129 AT_KEYWORDS([build])
130 AT_CHECK([
131 RPMDB_CLEAR
132 RPMDB_INIT
133 rm -rf ${TOPDIR}
134
135 runroot rpmbuild \
136   -bb --quiet /data/SPECS/hlinktest.spec
137
138 runroot rpm -i "${TOPDIR}"/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
139
140 runroot rpm -q --qf "[[%{filenlinks} %{filenames}\n]]%{longsize}\n" hlinktest
141 runroot rpm -V --nouser --nogroup hlinktest
142 ls -i "${RPMTEST}"/foo/hello* | awk {'print $1'} | sort -u | wc -l
143
144 ],
145 [0],
146 [1 /foo/copyllo
147 4 /foo/hello
148 4 /foo/hello-bar
149 4 /foo/hello-foo
150 4 /foo/hello-world
151 78
152 1
153 ],
154 [])
155 AT_CLEANUP
156
157 AT_SETUP([rpmbuild glob])
158 AT_KEYWORDS([build])
159 AT_CHECK([
160 RPMDB_CLEAR
161 RPMDB_INIT
162 rm -rf ${TOPDIR}
163
164 runroot rpmbuild -bb --quiet /data/SPECS/globtest.spec
165 runroot rpm -qp \
166         --qf "[[%{filemodes:perms} %{filenames}\n]]" \
167         "${TOPDIR}"/RPMS/noarch/globtest-1.0-1.noarch.rpm
168 ],
169 [0],
170 [-rw-r--r-- /opt/globtest/baf
171 drwxr-xr-x /opt/globtest/bang
172 -rw-r--r-- /opt/globtest/bif
173 drwxr-xr-x /opt/globtest/bing
174 drwxr-xr-x /opt/globtest/bong
175 drwxr-xr-x /opt/globtest/foo
176 -rw-r--r-- /opt/globtest/foo/one
177 -rw-r--r-- /opt/globtest/foo/three
178 -rw-r--r-- /opt/globtest/foo/two
179 lrwxrwxrwx /opt/globtest/linkbad
180 lrwxrwxrwx /opt/globtest/linkgood
181 -rw-r--r-- /opt/globtest/weird%name
182 -rw-r--r-- /opt/globtest/zab
183 -rw-r--r-- /opt/globtest/zeb
184 -rw-r--r-- /opt/globtest/zib
185 ],
186 [])
187 AT_CLEANUP