Add some basic tests for config file behavior
[platform/upstream/rpm.git] / tests / rpmconfig.at
1 #    rpmvercmp.at: rpm config file behavior tests
2
3 # ------------------------------
4 # (Build and) upgrade package with config file, no backup here
5 AT_SETUP([rpm -U to package with unchanged config file])
6 AT_CHECK([
7 RPMDB_CLEAR
8 rm -rf "${TOPDIR}"
9 rm -rf "${RPMTEST}/etc/my.conf"
10
11 for v in "1.0" "2.0"; do
12     run rpmbuild --quiet -bb \
13         --define "ver $v" \
14         --define "filedata foo" \
15           ${RPMDATA}/SPECS/configtest.spec
16 done
17
18 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
19 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
20 ],
21 [0],
22 )
23 AT_CLEANUP
24 #
25 # ------------------------------
26 # Upgrade package with locally modified config file, unchanged in pkg
27 AT_SETUP([rpm -U to package with locally modified config file])
28 AT_CHECK([
29 RPMDB_CLEAR
30 rm -rf "${TOPDIR}"
31 rm -rf "${RPMTEST}/etc/my.conf"
32
33 for v in "1.0" "2.0"; do
34     run rpmbuild --quiet -bb \
35         --define "ver $v" \
36         --define "filedata foo" \
37           ${RPMDATA}/SPECS/configtest.spec
38 done
39
40 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
41 echo "otherstuff" > "${RPMTEST}"/etc/my.conf
42 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
43 ],
44 [0],
45 )
46 AT_CLEANUP
47
48 # ------------------------------
49 # Upgrade package with unmodified config file, changed in pkg
50 AT_SETUP([rpm -U to package with unchanged config file])
51 AT_CHECK([
52 RPMDB_CLEAR
53 rm -rf "${TOPDIR}"
54 rm -rf "${RPMTEST}/etc/my.conf"
55
56 for v in "1.0" "2.0"; do
57     run rpmbuild --quiet -bb \
58         --define "ver $v" \
59         --define "filedata foo-$v" \
60           ${RPMDATA}/SPECS/configtest.spec
61 done
62
63 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
64 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
65 ],
66 [0],
67 )
68 AT_CLEANUP
69
70 # ------------------------------
71 # Upgrade package with locally modified config file, changed in pkg
72 AT_SETUP([rpm -U to package with modified config file])
73 AT_CHECK([
74 RPMDB_CLEAR
75 rm -rf "${TOPDIR}"
76 rm -rf "${RPMTEST}/etc/my.conf"
77
78 for v in "1.0" "2.0"; do
79     run rpmbuild --quiet -bb \
80         --define "ver $v" \
81         --define "filedata foo-$v" \
82           ${RPMDATA}/SPECS/configtest.spec
83 done
84
85 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
86 echo "otherstuff" > "${RPMTEST}"/etc/my.conf
87 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
88 ],
89 [0],
90 [ignore],
91 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
92 )
93 AT_CLEANUP