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
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
+
+
+
+
+
-
+
-
-
-
+
+
-
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
|
#! /bin/bash
VERSIONS="8.4.19 8.5.9 cvs_HEAD"
# Find the base directory
for x in 1 2 3 __fail__; do
if [ "${x}" = "${fail}" ]; then
echo 'Unable to find KitCreator, aborting.' >&2
exit 1
fi
if [ -x kitcreator ]; then
break
fi
cd ..
done
ROOTDIR="$(pwd)"
TESTDIR="${ROOTDIR}/build/test"
export ROOTDIR TESTDIR
# Handle command-line arguments
if [ "$1" = "clean" ]; then
rm -rf "${TESTDIR}/kits"
fi
# Create place to put kits
mkdir "${TESTDIR}/kits" >/dev/null 2>/dev/null
if [ ! -d "${TESTDIR}/kits" ]; then
echo 'Unable to create kits/ directory, aborting.' >&2
exit 1
fi
# Cleanup
for file in "${TESTDIR}"/kits/*.log; do
if echo "${file}" | grep -- '-build.log$' >/dev/null; then
continue
fi
rm -f "${TESTDIR}"/tclkit-*
rm -f "${file}"
done
failed=""
for kit in normal threaded min static win32 arm; do
for kit in normal normal-zip normal-threaded normal-threaded-zip normal-notk normal-threaded-notk normal-threaded-zip-notk min min-static win32 win32-zip win32-threaded win32-threaded-zip win32-notk win32-threaded-notk arm-min; do
kitcreator="./kitcreator"
args=""
runnable="1"
iszip="0"
statictk="0"
notk="0"
# Handle base configuration
case "${kit}" in
normal)
normal|normal-*)
true
;;
threaded)
args="--enable-threads"
;;
min)
kitcreator="./build/make-minkit"
iszip="1"
notk="1"
;;
static)
min-static)
kitcreator="./build/make-minkit-static"
iszip="1"
notk="1"
;;
win32)
win32|win32-*)
kitcreator="./build/make-kit-win32"
runnable="0"
;;
arm)
arm-min)
kitcreator="./build/make-kit-arm"
runnable="0"
notk="1"
iszip="1"
;;
esac
# Handle additional configuration
tempkit="-${kit}-"
for try in 1 2 3 4 5 6 7 8 9; do
case "-${tempkit}-" in
*-threaded-*)
tempkit="$(echo "${tempkit}" | sed 's@-threaded-@-@')"
args="${args} --enable-threads"
;;
*-zip-*)
tempkit="$(echo "${tempkit}" | sed 's@-zip-@-@')"
args="${args} --enable-kit-storage=zip"
iszip="1"
;;
*-statictk-*)
tempkit="$(echo "${tempkit}" | sed 's@-statictk-@-@')"
if [ "${notk}" = "0" ]; then
statictk="1"
else
echo "${kit}: Unable to create StaticTk and NoTk, ignoring StaticTk" >&2
fi
;;
*-notk-*)
tempkit="$(echo "${tempkit}" | sed 's@-notk-@-@')"
if [ "${statictk}" = "0" ]; then
notk="1"
else
echo "${kit}: Unable to create StaticTk and NoTk, ignoring NoTk" >&2
fi
;;
esac
done
for version in ${VERSIONS}; do
# Create Tclkit
createdkit="tclkit-${version}"
outputname="${TESTDIR}/tclkit-${version}-${kit}"
outputname="${TESTDIR}/kits/tclkit-${version}-${kit}"
buildlog="${outputname}-build.log"
if [ ! -f "${outputname}" ]; then
unset KITCREATOR_PKGS STATICTK
echo "Creating Tclkit ${version}/${kit}..."
if [ "${notk}" = "1" ]; then
KITCREATOR_PKGS='itcl mk4tcl'
export KITCREATOR_PKGS
fi
if [ "${statictk}" = "1" ]; then
STATICTK="1"
export STATICTK
fi
buildfailed="0"
"${kitcreator}" "${version}" ${args}
"${kitcreator}" "${version}" ${args} > "${buildlog}" 2>&1 || buildfailed="1"
grep -n '^' */build.log >> "${buildlog}" 2>&1
if [ ! -f "${createdkit}" ]; then
echo "Failed to create kit ${version}/${kit}" >&2
if [ ! -f "${createdkit}" ]; then
echo "Failed to create kit ${version}/${kit}" >&2
failed="${failed} ${version}/${kit}-build"
failed="${failed} ${version}/${kit}-build"
continue
fi
continue
fi
# Verify sanity of created kit
issane=1
## Verify the Win32 kits are
case "-${version}-${kit}-" in
*-win32-notk-*|*-win32-*-notk-*)
if ! file "${createdkit}" | grep 'MS Windows (console)' >/dev/null; then
echo "Kit failed sanity check for being a console application" >&2
issane=0
fi
;;
*-win32-*)
if ! file "${createdkit}" | grep 'MS Windows (GUI)' >/dev/null; then
echo "Kit failed sanity check for being a GUI application" >&2
issane=0
fi
;;
esac
## Verify the build completed without warnings
if [ "${buildfailed}" = "1" ]; then
echo "Kit failed sanity check for Building" >&2
issane=0
fi
# Make note of sanity failure
if [ "${issane}" != "1" ]; then
echo "Kit failed sanity ${version}/${kit}" >&2
failed="${failed} ${version}/${kit}-sanity"
rm -f "${createdkit}"
continue
fi
# Rename created kit to final destination
mv "${createdkit}" "${outputname}"
mv "${createdkit}" "${outputname}"
fi
# Test zip status
if unzip -l "${outputname}" 2>&1 | grep 'boot\.tcl' >/dev/null; then
canunzip="1"
else
canunzip="0"
fi
if [ "${iszip}" != "${canunzip}" ]; then
echo "Failed to unzip zipkit or was able to unzip non-zipkit ${version}/${kit}" >&2
failed="${failed} ${version}/${kit}-zip"
continue
fi
# Do not continue past here for un-runnable kits
if [ "${runnable}" != "1" ]; then
continue
fi
# Perform battery of tests
for testscp in "${TESTDIR}"/tests/*.tcl; do
testscp_tag="$(basename "${testscp}" .tcl)"
testscppre="$(dirname "${testscp}")/${testscp_tag}.sh"
scplogfile="${outputname}-${testscp_tag}.log"
(
if [ -f "${testscppre}" ]; then
scriptid=0
for testscp in 'exit 0' 'if {[::tcl::pkgconfig get 64bit] == 0} { exit 0 } else { exit 1}'; do
scriptid=$[${scriptid} + 1]
if ! echo "${testscp}" | "${outputname}" >/dev/null 2>/dev/null; then
echo "Script failed: ${testscp} on ${version}/${kit}" >&2
. "${testscppre}"
fi
"${outputname}" "${testscp}" "${outputname}" "${kit}" "${version}"
) > "${scplogfile}" 2>&1
if [ "$?" != "0" ]; then
echo "Script failed: ${testscp_tag} on ${version}/${kit}" >&2
failed="${failed} ${version}/${kit}-test-${scriptid}"
failed="${failed} ${version}/${kit}-test-${testscp_tag}"
continue
fi
done
done
done
if [ -n "${failed}" ]; then
echo "Failed: ${failed}"
fi
|