Index: build/test/publish-tests ================================================================== --- build/test/publish-tests +++ build/test/publish-tests @@ -59,13 +59,16 @@ return "Tcl $version for [string totitle $os] on $cpu" } proc pretty_print_buildinfo {buildinfo} { set desc [list] - foreach tag [list min static notk nomk4 statictk unthreaded threaded zip] { + foreach tag [list kitdll min static notk nomk4 statictk unthreaded threaded zip] { if {[lsearch -exact $buildinfo $tag] != -1} { switch -- $tag { + "kitdll" { + lappend desc "Built as a Library" + } "min" { lappend desc "Minimally Built" } "static" { lappend desc "Statically Linked" Index: build/test/test ================================================================== --- build/test/test +++ build/test/test @@ -51,19 +51,20 @@ )" 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)" @@ -133,10 +134,13 @@ *-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 @@ -144,13 +148,19 @@ kit="$(echo "${kit}" | sed 's@-threaded@-unthreaded@')" args="$(echo "${args}" | sed 's@ --enable-threads@ --disable-threads@')" fi # Create Tclkit - createdkit="tclkit-${version}" - outputname="${TESTDIR}/kits/tclkit-${version}-${kit}" - failoutputname="${TESTDIR}/kits/failed/tclkit-${version}-${kit}" + 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}" + fi buildlog="${outputname}-build.log" failbuildlog="${failoutputname}-build.log" testresultslog="${outputname}-tests.log" if [ ! -f "${outputname}" ]; then @@ -162,10 +172,13 @@ 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}" @@ -178,10 +191,19 @@ 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}" @@ -219,26 +241,57 @@ 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 the Win32 kits are + ## Verify that Win32 builds are of correct type + ## 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 @@ -265,15 +318,25 @@ 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" @@ -291,10 +354,17 @@ # 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 @@ -320,11 +390,15 @@ ( if [ -f "${testscppre}" ]; then . "${testscppre}" fi - ${kitruncmd} "${outputname}" "${testscp}" "${outputname}" "${kit}" "${version}" + if [ "${kitdll}" = "1" ]; then + ${kitruncmd} "${outputname}-tclsh" "${testscp}" "${outputname}" "${kit}" "${version}" + else + ${kitruncmd} "${outputname}" "${testscp}" "${outputname}" "${kit}" "${version}" + fi ) > "${scplogfile}" 2>&1 if [ "$?" != "0" ]; then echo "Script failed: ${testscp_tag} on ${version}/${kit}" >&2 @@ -342,14 +416,22 @@ 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 Index: build/test/tests/02-nameofexe.tcl ================================================================== --- build/test/tests/02-nameofexe.tcl +++ build/test/tests/02-nameofexe.tcl @@ -1,8 +1,14 @@ #! /usr/bin/env tclsh set outputname [lindex $argv 0] +set buildflags [split [lindex $argv 1] -] + +# If we built a KitDLL, the executable name will be "./tclsh" +if {[lsearch -exact $buildflags "kitdll"] != -1} { + set outputname "${outputname}-tclsh" +} if {[info nameofexecutable] == $outputname} { exit 0 }