Diff

Differences From Artifact [41f958cc6e]:

To Artifact [39ea564cba]:


49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72







-
+








+







	Xvfb :31 -screen 0 800x600x24 -nolisten tcp >/dev/null 2>/dev/null &
	echo "$!"
)"
DISPLAY=:31
export DISPLAY

failed=""
for kit in normal normal-zip normal-threaded normal-threaded-zip normal-statictk normal-notk normal-threaded-notk normal-threaded-zip-notk normal-nomk4 min min-static win32-i586 win32-i586-zip win32-i586-threaded win32-i586-threaded-zip win32-i586-notk win32-i586-threaded-notk win32-i586-nomk4 linux-arm-min; do
for kit in normal normal-zip normal-threaded normal-threaded-zip normal-statictk normal-notk normal-threaded-notk normal-threaded-zip-notk normal-nomk4 min min-static normal-kitdll normal-threaded-kitdll normal-notk-kitdll normal-nomk4-notk-kitdll min-kitdll win32-i586 win32-i586-zip win32-i586-threaded win32-i586-threaded-zip win32-i586-notk win32-i586-threaded-notk win32-i586-nomk4 win32-i586-kitdll win32-i586-threaded-kitdll win32-i586-notk-kitdll win32-i586-nomk4-notk-kitdll linux-arm-min linux-arm-min-kitdll; do
	kitcreator="./kitcreator"
	args=""
	runnable="1"
	iszip="0"
	statictk="0"
	notk="0"
	nomk4="0"
	xcompile="0"
	kitdll="0"
	kitruncmd=""

	# Handle base configuration
	os="$(uname -s | dd conv=lcase 2>/dev/null)"
	cpu="$(uname -m | dd conv=lcase 2>/dev/null)"
	case "${kit}" in
		normal|normal-*)
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
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







+
+
+











+
+
+
+
+
-
-
-
+
+
+
+















+
+
+
















+
+
+
+
+
+
+
+
+







				fi
				;;
			*-nomk4-*)
				tempkit="$(echo "${tempkit}" | sed 's@-nomk4-@-@')"
				nomk4="1"
				iszip="1"
				;;
			*-kitdll-*)
				kitdll="1"
				;;
		esac
	done

	for version in ${VERSIONS}; do
		# Work around changes in default behaviour
		if [ "${version}" = "cvs_HEAD" ]; then
			kit="$(echo "${kit}" | sed 's@-threaded@-unthreaded@')"
			args="$(echo "${args}" | sed 's@ --enable-threads@ --disable-threads@')"
		fi

		# Create Tclkit
		if [ "${kitdll}" = "1" ]; then
			createdkit="libtclkit*.dll libtclkit*.*"
			outputname="${TESTDIR}/kits/libtclkit-${version}-${kit}"
			failoutputname="${TESTDIR}/kits/failed/libtclkit-${version}-${kit}"
		else
		createdkit="tclkit-${version}"
		outputname="${TESTDIR}/kits/tclkit-${version}-${kit}"
		failoutputname="${TESTDIR}/kits/failed/tclkit-${version}-${kit}"
			createdkit="tclkit-${version}"
			outputname="${TESTDIR}/kits/tclkit-${version}-${kit}"
			failoutputname="${TESTDIR}/kits/failed/tclkit-${version}-${kit}"
		fi
		buildlog="${outputname}-build.log"
		failbuildlog="${failoutputname}-build.log"
		testresultslog="${outputname}-tests.log"

		if [ ! -f "${outputname}" ]; then
			unset KITCREATOR_PKGS STATICTK

			if [ -f "${failoutputname}" ]; then
				echo "Skipping rebuilding failed kit ${version}/${kit} ..."

				failed="${failed} ${version}/${kit}-build"

				continue
			fi

			rm -f tclsh
			./kitcreator clean >/dev/null 2>/dev/null

			echo "Creating Tclkit ${version}/${kit}..."
			echo " *** Build started $(whoami)@$(hostname) on $(date)" > "${buildlog}"
			echo '' >> "${buildlog}"
			echo " *** Build Script" >> "${buildlog}"

			if [ "${notk}" = "1" ]; then
				KITCREATOR_PKGS='itcl mk4tcl'
			fi

			if [ "${nomk4}" = "1" ]; then
				if [ -z "${KITCREATOR_PKGS}" ]; then
					KITCREATOR_PKGS='itcl tk'
				else
					KITCREATOR_PKGS="$(echo "${KITCREATOR_PKGS}" | sed 's@mk4tcl@@')"
				fi
			fi

			if [ "${kitdll}" = "1" ]; then
				if [ -z "${KITCREATOR_PKGS}" ]; then
					KITCREATOR_PKGS='tk itcl mk4tcl kitdll'
				else
					KITCREATOR_PKGS="${KITCREATOR_PKGS} kitdll"
				fi
			fi

			export KITCREATOR_PKGS

			if [ -n "${KITCREATOR_PKGS}" ]; then
				echo "  KITCREATOR_PKGS=\"${KITCREATOR_PKGS}\"" >> "${buildlog}"
				echo "  export KITCREATOR_PKGS" >> "${buildlog}"
			fi

217
218
219
220
221
222
223


















224
225
226
227
228
229
230
231


232
233
234
235
236
237

238

239










240
241
242
243
244
245
246
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280

281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








+
+






+
-
+

+
+
+
+
+
+
+
+
+
+







			echo " *** Build Results" >> "${buildlog}"
			echo '' >> "${buildlog}"

			buildfailed="0"
			"${kitcreator}" "${version}" ${args} >> "${buildlog}" 2>&1 || buildfailed="1"
			grep -n '^' */build.log >> "${buildlog}" 2>&1

			if [ "${kitdll}" = "1" ]; then
				# Create test drivers for KitDLL
				(
					echo ""
					echo ""
					echo ""
					echo " *** Building KitDLL test driver (tclsh)"
					echo ""

					cd kitdll/build/kitdll-*/ || exit 1
					make tclsh
					cp tclsh ../../../
				) >> "${buildlog}" 2>&1
			fi

			# Perform wildcard expansion
			createdkit="$(ls -f1 ${createdkit} 2>/dev/null | head -n 1)"

			if [ ! -f "${createdkit}" ]; then
				echo "Failed to create kit ${version}/${kit}" >&2

				failed="${failed} ${version}/${kit}-build"

				touch "${failoutputname}"
				mv "${buildlog}" "${failbuildlog}"

				rm -f tclsh

				continue
			fi

			# Verify sanity of created kit
			issane=1

			## Verify that Win32 builds are of correct type
			## Verify the Win32 kits are 
			## Verify that DLL builds are of correct type
			case "-${version}-${kit}-" in
				*-win32-kitdll-*|*-win32-*-kitdll-*)
					if ! file "${createdkit}" | grep 'MS Windows (DLL)' >/dev/null; then
						issane=0
					fi
					;;
				*-kitdll-*)
					if ! file "${createdkit}" | grep 'shared object' >/dev/null; then
						issane=0
					fi
					;;
				*-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-*)
263
264
265
266
267
268
269


270
271
272
273
274








275
276
277
278
279
280
281
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344







+
+





+
+
+
+
+
+
+
+







				echo "Kit failed sanity ${version}/${kit}" >&2

				failed="${failed} ${version}/${kit}-sanity"

				mv "${createdkit}" "${failoutputname}"
				mv "${buildlog}" "${failbuildlog}"

				rm -f tclsh

				continue
			fi

			# Rename created kit to final destination
			mv "${createdkit}" "${outputname}"
			if [ -f "tclsh" ]; then
				mv "tclsh" "${outputname}-tclsh"
			fi

			# For KitDLL, make a note of the original name
			if [ "${kitdll}" = "1" ]; then
				echo "${createdkit}" > "${outputname}-origname"
			fi
		fi

		# Test zip status
		if unzip -l "${outputname}" 2>&1 | grep 'boot\.tcl' >/dev/null; then
			canunzip="1"
		else
			canunzip="0"
289
290
291
292
293
294
295







296
297
298
299
300
301
302
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372







+
+
+
+
+
+
+







			continue
		fi

		# Do not continue past here for un-runnable kits
		if [ "${runnable}" != "1" ]; then
			continue
		fi

		# If the name of the original build matters, symlink it up
		if [ -f "${outputname}-origname" ]; then
			createdkit="$(cat "${outputname}-origname")"

			ln -s "${outputname}" "${createdkit}"
		fi

		# Perform battery of tests
		## Clean tests log
		rm -f "${testresultslog}"
		for testscp in "${TESTDIR}"/tests/*.tcl; do
			testscp_tag="$(basename "${testscp}" .tcl)"
			testscppre="$(dirname "${testscp}")/${testscp_tag}.sh"
318
319
320
321
322
323
324



325


326
327
328
329
330
331
332
388
389
390
391
392
393
394
395
396
397

398
399
400
401
402
403
404
405
406







+
+
+
-
+
+







			fi

			(
				if [ -f "${testscppre}" ]; then
					. "${testscppre}"
				fi

				if [ "${kitdll}" = "1" ]; then
					${kitruncmd} "${outputname}-tclsh" "${testscp}" "${outputname}" "${kit}" "${version}"
				else
				${kitruncmd} "${outputname}" "${testscp}" "${outputname}" "${kit}" "${version}"
					${kitruncmd} "${outputname}" "${testscp}" "${outputname}" "${kit}" "${version}"
				fi
			) > "${scplogfile}" 2>&1

			if [ "$?" != "0" ]; then
				echo "Script failed: ${testscp_tag} on ${version}/${kit}" >&2

				failed="${failed} ${version}/${kit}-test-${testscp_tag}"

340
341
342
343
344
345
346




347
348
349
350
351
352
353
354
355




414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437







+
+
+
+









+
+
+
+
				kill -9 "${kitrunkillpid}" >/dev/null 2>/dev/null
			fi

			echo "${testscp_tag}: PASS" >>  "${testresultslog}"

			rm -f "${scplogfile}"
		done

		if [ -f "${outputname}-origname" ]; then
			rm -f "${createdkit}"
		fi
	done
done

if [ -n "${failed}" ]; then
	echo "Failed: ${failed}"
fi

# Terminate Xvfb
kill -9 "${XVFB_PID}"

# Cleanup
./kitcreator clean
rm -f tclsh