1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
## Autotest testsuite for msitools.
# Copyright (C) 2012 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
m4_include([package.m4])
AT_INIT
# AT_MSIDATA - copy data file from source tree
m4_define([AT_MSIDATA], [
dir=`dirname $1`
AS_MKDIR_P([$dir])
AT_CHECK([cp $abs_srcdir/tests/data/$1 m4_default([$2], [$1])])])
# AT_DATA_UNQUOTED - define data file while allowing shell variables
m4_define([AT_DATA_UNQUOTED],
[cat >$1 <<_ATEOF
$2[]_ATEOF
])
# AT_CR - literal carriage return
m4_define([AT_CR], [`echo X | tr X '\015'`])
# AT_CHECK_MSIBUILD/AT_CHECK_MSIINFO - add exeext automatically
m4_define([AT_CHECK_MSIBUILD], [
AT_CHECK([_msibuild ]$@)])
m4_define([AT_CHECK_MSIINFO], [
AT_CHECK([_msiinfo ]$@)])
# Cannot use AT_TESTED because of $EXEEXT (Autotest bug)
AT_BANNER([libmsi tests])
AT_SETUP([testdatabase])
AT_KEYWORDS([testdatabase])
AT_SKIP_IF([! test -f $abs_builddir/tests/testdatabase$EXEEXT])
AT_CHECK([$abs_builddir/tests/testdatabase$EXEEXT], [ignore], [stdout], [ignore])
AT_CHECK([grep ^FAIL stdout], [1], [], [])
AT_CLEANUP
AT_SETUP([testrecord])
AT_KEYWORDS([testrecord])
AT_SKIP_IF([! test -f $abs_builddir/tests/testrecord$EXEEXT])
AT_CHECK([$abs_builddir/tests/testrecord$EXEEXT], [ignore], [stdout], [ignore])
AT_CHECK([grep ^FAIL stdout], [1], [], [])
AT_CLEANUP
AT_SETUP([testsuminfo])
AT_KEYWORDS([testsuminfo])
AT_SKIP_IF([! test -f $abs_builddir/tests/testsuminfo$EXEEXT])
AT_CHECK([$abs_builddir/tests/testsuminfo$EXEEXT], [ignore], [stdout], [ignore])
AT_CHECK([grep ^FAIL stdout], [1], [], [])
AT_CLEANUP
AT_BANNER([msibuild])
AT_SETUP([Invalid command line])
AT_CHECK_MSIBUILD([], [1], [ignore], [ignore])
AT_CHECK_MSIBUILD([out.msi], [1], [ignore], [ignore])
AT_CHECK([test -f out.msi], [1])
AT_CLEANUP
AT_SETUP([Empty MSI])
AT_CHECK_MSIBUILD([out.msi -s 'Project name'])
AT_CHECK_MSIINFO([suminfo out.msi], [ignore], [stdout])
AT_CHECK([grep ^Subject stdout], [0],
[Subject: Project name
])
AT_CHECK([grep ^Template stdout], [0],
[Template: ;1033
])
AT_CHECK([grep ^Version stdout], [0],
[Version: 200 (c8)
])
AT_CLEANUP
AT_SETUP([Valid UUID])
AT_SKIP_IF([test $have_uuid = no])
AT_CHECK_MSIBUILD([out.msi -s 'Project name'])
AT_CHECK_MSIINFO([suminfo out.msi], [ignore], [stdout])
AT_CHECK([[
UUID='\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}'
grep -E "^Revision number \\(UUID\\): $UUID\$" stdout]], [0],
[ignore])
AT_CLEANUP
AT_SETUP([UUID does not change])
AT_SKIP_IF([test $have_uuid = no])
AT_CHECK_MSIBUILD([out.msi -s 'Project name'])
AT_CHECK_MSIINFO([suminfo out.msi | grep ^Revision > expout], [0])
AT_CHECK_MSIBUILD([out.msi -s 'Project name2'])
AT_CHECK_MSIINFO([suminfo out.msi], [ignore], [stdout])
AT_CHECK([grep ^Subject stdout], [0],
[Subject: Project name2
])
AT_CHECK_MSIINFO([suminfo out.msi | grep ^Revision], [0], [expout])
AT_CLEANUP
AT_SETUP([Add stream])
AT_DATA([test.txt], [This is test.txt
])
AT_CHECK_MSIBUILD([out.msi -a Binary.testtxt test.txt])
AT_CHECK_MSIINFO([streams out.msi | grep -v SummaryInformation], [0],
[Binary.testtxt
])
cp test.txt expout
AT_CHECK_MSIINFO([extract out.msi Binary.testtxt], [0], [expout])
AT_CLEANUP
dnl AT_SETUP([Invalid import table])
dnl AT_XFAIL_IF(:)
dnl AT_DATA([tables.txt],
dnl [Name
dnl s64
dnl Binary
dnl ])
dnl AT_CHECK_MSIBUILD([out.msi -i tables.txt])
dnl AT_CLEANUP
AT_SETUP([Add tables])
AT_DATA([tables.txt],
[Name
s64
_Tables
Binary
])
AT_CHECK_MSIBUILD([out.msi -i tables.txt])
AT_CHECK_MSIINFO([tables out.msi], [0],
[_SummaryInformation
_ForceCodepage
Binary
])
AT_CLEANUP
AT_SETUP([Add tables and definitions])
AT_MSIDATA([tables.txt])
AT_MSIDATA([columns.txt])
AT_CHECK_MSIBUILD([out.msi -i tables.txt columns.txt])
AT_DATA_UNQUOTED([expout],
[Name Data[]AT_CR
s72 v0[]AT_CR
Icon Name[]AT_CR
])
AT_CHECK_MSIINFO([export out.msi Icon], [0], [expout])
AT_CLEANUP
AT_SETUP([Separate invocations])
AT_MSIDATA([tables.txt])
AT_MSIDATA([columns.txt])
AT_CHECK_MSIBUILD([out.msi -i tables.txt])
AT_CHECK_MSIINFO([tables out.msi > expout])
AT_CHECK_MSIBUILD([out.msi -i columns.txt])
AT_CHECK_MSIINFO([tables out.msi], [0], [expout])
AT_CLEANUP
AT_SETUP([Add table with data])
AT_MSIDATA([tables.txt])
AT_MSIDATA([columns.txt])
AT_MSIDATA([button.txt])
AT_CHECK_MSIBUILD([out.msi -i tables.txt columns.txt button.txt])
cp button.txt expout
AT_CHECK_MSIINFO([export out.msi RadioButton], [0], [expout])
AT_CLEANUP
AT_SETUP([Add table with streams])
AT_MSIDATA([tables.txt])
AT_MSIDATA([columns.txt])
AT_MSIDATA([icon.txt])
AT_MSIDATA([Icon/firefox.16.0.2.0.ico.exe])
AT_CHECK_MSIBUILD([out.msi -i tables.txt columns.txt icon.txt])
cp icon.txt expout
AT_CHECK_MSIINFO([streams out.msi | grep -v SummaryInformation], [0],
[Icon.firefox.16.0.2.0.ico.exe
])
rm -f expout
cp Icon/firefox.16.0.2.0.ico.exe expout
AT_CHECK_MSIINFO([extract out.msi Icon.firefox.16.0.2.0.ico.exe > stdout], [0])
AT_CHECK([cmp stdout expout])
AT_CLEANUP
AT_SETUP([Add tables])
AT_DATA([tables.txt],
[Name
s64
_Tables
Binary
])
AT_CHECK_MSIBUILD([-i out.msi tables.txt])
AT_CHECK_MSIINFO([tables out.msi], [0],
[_SummaryInformation
_ForceCodepage
Binary
])
AT_CLEANUP
AT_SETUP([Update _SummaryInformation table])
AT_MSIDATA([_SummaryInformation.idt])
AT_CHECK_MSIBUILD([-i out.msi _SummaryInformation.idt])
AT_CHECK_MSIINFO([suminfo out.msi], [0],
[Title: Installation Database
Subject: Acme's Foobar 1.0 Installer
Author: Acme Ltd.
Keywords: Installer
Comments: Foobar is a registered trademark of Acme Ltd.
Template: Intel;1033
Revision number (UUID): {D045A303-F114-4A3B-A01D-24FC2D2A67D7}
Created: Wed Dec 18 15:12:50 3912
Last saved: Wed Dec 18 15:12:50 3912
Version: 100 (64)
Source: 2 (2)
Restrict: 0 (0)
Application: Windows Installer XML (3.7.1119.0)
Security: 2 (2)
])
AT_CLEANUP
m4_include([wixl.at])
|