Sanitize python object -> tag number exception handling
[platform/upstream/rpm.git] / tests / rpmvercmp.at
1 #    rpmvercmp.at: rpm version comparison tests
2
3 AT_BANNER([RPM version comparison])
4
5 # ------------------------------
6 # Test normal upgrade
7 AT_SETUP([rpm -U upgrade to newer])
8 AT_CHECK([
9 RPMDB_CLEAR
10 rm -rf "${TOPDIR}"
11
12 for v in "1.0" "2.0"; do
13     run rpmbuild --quiet -bb \
14         --define "ver $v" \
15           ${RPMDATA}/SPECS/versiontest.spec
16 done
17
18 runroot rpm -U "${TOPDIR}"/RPMS/noarch/versiontest-1.0-1.noarch.rpm
19 runroot rpm -U "${TOPDIR}"/RPMS/noarch/versiontest-2.0-1.noarch.rpm
20 ],
21 [0],
22 [ignore],
23 [ignore])
24 AT_CLEANUP
25
26 # Test upgrading to older package (should fail)
27 AT_SETUP([rpm -U upgrade to older])
28 AT_CHECK([
29 RPMDB_CLEAR
30
31 runroot rpm -U "${TOPDIR}"/RPMS/noarch/versiontest-2.0-1.noarch.rpm
32 runroot rpm -U "${TOPDIR}"/RPMS/noarch/versiontest-1.0-1.noarch.rpm
33 ],
34 [2],
35 [ignore],
36 [ignore])
37 AT_CLEANUP
38
39 # Test downgrading to older package with --oldpackage
40 AT_SETUP([rpm -U --oldpackage downgrade])
41 AT_CHECK([
42 RPMDB_CLEAR
43
44 runroot rpm -U "${TOPDIR}"/RPMS/noarch/versiontest-2.0-1.noarch.rpm
45 runroot rpm -U --oldpackage "${TOPDIR}"/RPMS/noarch/versiontest-1.0-1.noarch.rpm
46 ],
47 [0],
48 [ignore],
49 [ignore])
50 AT_CLEANUP
51
52 # Test upgrade of different versions in same transaction
53 # XXX test that only 2.0-1 was installed
54 AT_SETUP([rpm -U two versions of same package])
55 AT_CHECK([
56 RPMDB_CLEAR
57
58 runroot rpm -U \
59   "${TOPDIR}"/RPMS/noarch/versiontest-1.0-1.noarch.rpm \
60   "${TOPDIR}"/RPMS/noarch/versiontest-2.0-1.noarch.rpm
61 ],
62 [0],
63 [ignore],
64 [ignore])
65 AT_CLEANUP
66
67 # Test install of two different versions in same transaction
68 # TODO: test that both got installed
69 AT_SETUP([rpm -i two versions of same package])
70 AT_CHECK([
71 RPMDB_CLEAR
72
73 runroot rpm -i \
74   "${TOPDIR}"/RPMS/noarch/versiontest-1.0-1.noarch.rpm \
75   "${TOPDIR}"/RPMS/noarch/versiontest-2.0-1.noarch.rpm
76 ],
77 [0],
78 [ignore],
79 [ignore])
80 AT_CLEANUP
81
82 # Test install of two different versions in same transaction
83 # TODO: test only one was installed
84 AT_SETUP([rpm -i identical versions of same package])
85 AT_CHECK([
86 RPMDB_CLEAR
87
88 # TODO test just one was installed, this only emits warnings
89 runroot rpm -ivh \
90   "${TOPDIR}"/RPMS/noarch/versiontest-1.0-1.noarch.rpm \
91   "${TOPDIR}"/RPMS/noarch/versiontest-1.0-1.noarch.rpm
92 ],
93 [0],
94 [ignore],
95 [ignore])
96 AT_CLEANUP
97
98 # TODO: the same with epoch vs no epoch