msm: consistency for equally ranked keys
[platform/upstream/rpm.git] / tests / rpmverify.at
1 #    rpmverify.at: rpm verification tests
2
3 AT_BANNER([RPM verification])
4
5 # ------------------------------
6
7 AT_SETUP([dependency problems])
8 AT_KEYWORDS([verify])
9 AT_CHECK([
10 RPMDB_CLEAR
11 RPMDB_INIT
12 rm -rf "${TOPDIR}"
13
14 runroot rpmbuild --quiet -bb \
15         --define "pkg one" \
16         --define "reqs deptest-two" \
17           /data/SPECS/deptest.spec
18
19 runroot rpm -U --nodeps "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
20 runroot rpm -Va
21 ],
22 [1],
23 [Unsatisfied dependencies for deptest-one-1.0-1.noarch:
24         deptest-two is needed by (installed) deptest-one-1.0-1.noarch
25 ],
26 [])
27 AT_CLEANUP
28
29 # Test file verify when no errors expected.
30 # Ignore dependencies here as we're not testing for them, and
31 # --nogroup --nouser is required when running tests as non-root.
32 AT_SETUP([files with no problems])
33 AT_KEYWORDS([verify])
34 AT_CHECK([
35 RPMDB_CLEAR
36 RPMDB_INIT
37
38 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
39         /data/RPMS/hello-1.0-1.i386.rpm
40 runroot rpm -Va --nodeps --nouser --nogroup
41 ],
42 [0],
43 [],
44 [])
45 AT_CLEANUP
46
47 # Test file verify when no errors expected in verbose mode.
48 AT_SETUP([files with no problems in verbose mode])
49 AT_KEYWORDS([verify])
50 AT_CHECK([
51 RPMDB_CLEAR
52 RPMDB_INIT
53
54 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
55         /data/RPMS/hello-1.0-1.i386.rpm
56 runroot rpm -Vva --nodeps --nouser --nogroup
57 ],
58 [0],
59 [.........    /usr/local/bin/hello
60 .........    /usr/share/doc/hello-1.0
61 .........  d /usr/share/doc/hello-1.0/FAQ
62 ],
63 [])
64 AT_CLEANUP
65
66 # Test file verify after mutilating the files a bit.
67 AT_SETUP([verify from db, with problems present])
68 AT_KEYWORDS([verify])
69 AT_CHECK([
70 RPMDB_CLEAR
71 RPMDB_INIT
72
73 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
74         /data/RPMS/hello-1.0-1.i386.rpm
75 rm -f "${RPMTEST}"/usr/share/doc/hello-1.0/FAQ
76 chmod u-x "${RPMTEST}"/usr/local/bin/hello
77 dd if=/dev/zero of="${RPMTEST}"/usr/local/bin/hello \
78    conv=notrunc bs=1 seek=5 count=6 2> /dev/null
79 runroot rpm -Va --nodeps --nouser --nogroup
80 ],
81 [1],
82 [.M5....T.    /usr/local/bin/hello
83 missing   d /usr/share/doc/hello-1.0/FAQ
84 ],
85 [])
86 AT_CLEANUP
87
88 # Test file verify from original package after mutilating the files a bit.
89 AT_SETUP([verify from package, with problems present])
90 AT_KEYWORDS([verify])
91 AT_CHECK([
92 RPMDB_CLEAR
93 RPMDB_INIT
94
95 runroot rpm -U --nodeps --noscripts --ignorearch --ignoreos \
96         /data/RPMS/hello-1.0-1.i386.rpm
97 rm -f "${RPMTEST}"/usr/share/doc/hello-1.0/FAQ
98 chmod u-x "${RPMTEST}"/usr/local/bin/hello
99 dd if=/dev/zero of="${RPMTEST}"/usr/local/bin/hello \
100    conv=notrunc bs=1 seek=5 count=6 2> /dev/null
101 runroot rpm -Vp --nodeps --nouser --nogroup /data/RPMS/hello-1.0-1.i386.rpm
102 ],
103 [1],
104 [.M5....T.    /usr/local/bin/hello
105 missing   d /usr/share/doc/hello-1.0/FAQ
106 ],
107 [])
108 AT_CLEANUP
109
110 # Test verify script success & failure behavior
111 # Ignoring stderr spew for now
112 AT_SETUP([verifyscript failure])
113 AT_KEYWORDS([verify])
114 AT_CHECK([
115 RPMDB_CLEAR
116 RPMDB_INIT
117
118 rm -rf "${TOPDIR}"
119 runroot rpmbuild --quiet -bb /data/SPECS/verifyscript.spec
120 runroot rpm -U --nodeps "${TOPDIR}"/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
121 rm -f "${RPMTEST}"/var/checkme
122 runroot rpm -V --nodeps verifyscript
123 ],
124 [1],
125 [],
126 [ignore])
127 AT_CLEANUP
128
129 AT_SETUP([verifyscript success])
130 AT_KEYWORDS([verify])
131 AT_CHECK([
132 RPMDB_CLEAR
133 RPMDB_INIT
134
135 rm -rf "${TOPDIR}"
136 runroot rpmbuild --quiet -bb /data/SPECS/verifyscript.spec
137 runroot rpm -U --nodeps "${TOPDIR}"/RPMS/noarch/verifyscript-1.0-1.noarch.rpm
138 touch "${RPMTEST}"/var/checkme
139 runroot rpm -V --nodeps verifyscript
140 ],
141 [0],
142 [],
143 [])
144 AT_CLEANUP
145
146 # ------------------------------
147 # shared file timestamp behavior
148 AT_SETUP([shared file timestamp behavior])
149 AT_KEYWORDS([verify])
150 AT_CHECK([
151 RPMDB_CLEAR
152 RPMDB_INIT
153 rm -rf "${TOPDIR}"
154
155 # create packages sharing a file but with different timestamp
156 for p in "one" "two"; do
157     runroot rpmbuild --quiet -bb \
158         --define "pkg $p" \
159         --define "filedata same_stuff" \
160           /data/SPECS/conflicttest.spec
161     sleep 1
162 done
163
164 # first instance of a shared file is the one that actually gets created,
165 # force the order so we know what to expect as these dont depend on each other
166 runroot rpm -U --noorder "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
167 runroot rpm -e conflicttwo
168 runroot rpm -Va --nouser --nogroup
169 ],
170 [0],
171 [],
172 [])
173 AT_CLEANUP