Overview
| Comment: | Added new script to publish test results Updated existing publish script to include failure count | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA1: | f8e23f8a39a1c2df28f042f945d44163 | 
| User & Date: | rkeene on 2010-09-26 04:46:55 | 
| Other Links: | manifest | tags | 
Context
| 2010-09-26 | ||
| 04:47 | Replaced publish-tests script with HTML'ified Tcl version check-in: 824e5d844d user: rkeene tags: trunk | |
| 04:46 | Added new script to publish test results Updated existing publish script to include failure countcheck-in: f8e23f8a39 user: rkeene tags: trunk | |
| 04:46 | Updated to clean up all log files from succesful tests check-in: 7720fda215 user: rkeene tags: trunk | |
Changes
Modified build/test/publish-tests from [db5cad6f63] to [6cafb5c1e8].
| ︙ | ︙ | |||
| 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 
rm -rf "${WEBDIR}"
mkdir -p "${WEBDIR}" || exit 1
cp -r kits/* "${WEBDIR}"
ln -s ../index.ttml "${WEBDIR}/" >/dev/null 2>/dev/null
for file in "${WEBDIR}"/*; do
	if [ -d "${file}" ]; then
		continue
	fi
	if echo "${file}" | egrep '\.(log|desc|ttml)$' >/dev/null; then
		continue
	fi
	descfile="${file}.desc"
	shortfile="$(basename "${file}")"
	desc=""
	tclversion="$(echo "${shortfile}" | cut -f 2 -d -)"
	parts="$(echo "${shortfile}" | cut -f 3- -d -)"
 | > > > > > > > > > > > > > > > | 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 | 
rm -rf "${WEBDIR}"
mkdir -p "${WEBDIR}" || exit 1
cp -r kits/* "${WEBDIR}"
ln -s ../index.ttml "${WEBDIR}/" >/dev/null 2>/dev/null
totaltests_count="$(ls -1 tests/*.tcl | wc -l)"
for file in "${WEBDIR}"/*; do
	if [ -d "${file}" ]; then
		continue
	fi
	if echo "${file}" | egrep '\.(log|desc|ttml)$' >/dev/null; then
		continue
	fi
	# Find out which tests failed
	failedtests_count="0"
	failedtests=""
	for faillog in "${file}"-[0-9][0-9]-*.log; do
		if [ ! -f "${faillog}" ]; then
			continue
		fi
		failedtests_count=$[${failedtests} + 1]
		failedtests="${failedtests} $(basename "${faillog}")"
	done
	# Generate description
	descfile="${file}.desc"
	shortfile="$(basename "${file}")"
	desc=""
	tclversion="$(echo "${shortfile}" | cut -f 2 -d -)"
	parts="$(echo "${shortfile}" | cut -f 3- -d -)"
 | 
| ︙ | ︙ | |||
| 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 
		fi
	done
	if [ -z "${desc}" ]; then
		continue
	fi
	case "${tclversion}" in
		cvs_HEAD)
			tclversion="from CVS HEAD"
			;;
		cvs_*)
			tclversion="from CVS tag $(echo "${tclversion}" | cut -f 2 -d _)"
			;;
	esac
	desc="is a Tclkit for Tcl ${tclversion}${desc}"
 | > > > > > > < < | 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 | 
		fi
	done
	if [ -z "${desc}" ]; then
		continue
	fi
	# Generate better Tcl version
	case "${tclversion}" in
		cvs_HEAD)
			tclversion="from CVS HEAD"
			;;
		cvs_*)
			tclversion="from CVS tag $(echo "${tclversion}" | cut -f 2 -d _)"
			;;
	esac
	# Update description with count of failed tests
	if [ "${failedtests_count}" != "0" ]; then
		desc="${desc} (FAILED ${failedtests_count} of ${totaltests_count} tests)"
	fi
	desc="is a Tclkit for Tcl ${tclversion}${desc}"
done
rmdir "${WEBDIR}/failed" >/dev/null 2>/dev/null
ln -s ../index.ttml "${WEBDIR}/failed/" >/dev/null 2>/dev/null
exit 0
 | 
Added build/test/publish-tests.tcl version [b70c6b112e].
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 
#! /usr/bin/env tclsh
package require Tcl 8.5
set WEBDIR "/web/rkeene/devel/kitcreator/kitbuild"
if {![file isdir "kits"]} {
	puts stderr "Could not find kits/ directory, aborting."
        exit 1
}
set noncriticaltests [list "05-locale"]
##########################################################################
## PROCEDURES ############################################################
##########################################################################
proc pretty_print_key {key} {
	set version [lindex $key 0]
	set os [lindex $key 1]
	set cpu [lindex $key 2]
	switch -glob -- $version {
		"cvs_HEAD" {
			set version "from CVS HEAD"
		}
		"cvs_*" {
			set tag [join [lrange [split $version _] 1 end] _]
			set version "from CVS tag $tag"
		}
		default {
			set version "version $version"
		}
	}
	return "Tcl $version for [string totitle $os] on $cpu"
}
proc pretty_print_buildinfo {buildinfo} {
	set desc [list]
	foreach tag [list min static notk statictk threaded zip] {
		if {[lsearch -exact $buildinfo $tag] != -1} {
			switch -- $tag {
				"min" {
					lappend desc "Minimally Built"
				}
				"static" {
					lappend desc "Statically Linked"
				}
				"notk" {
					lappend desc "Without Tk"
				}
				"statictk" {
					lappend desc "Tk linked to Kit"
				}
				"threaded" {
					lappend desc "Threaded"
				}
				"zip" {
					lappend desc "Kit Filesystem in Zip"
				}
			}
		}
	}
	if {[llength $desc] == 0} {
		return "Default Build"
	}
	return [join $desc {, }]
}
proc pretty_print_size {size} {
	foreach unit [list "" K M G T P] {
		if {$size < 1024} {
			return "$size [string trim ${unit}B]"
		}
		set size [expr {${size} / 1024}]
	}
}
##########################################################################
## MAIN BODY #############################################################
##########################################################################
file delete -force -- $WEBDIR
file mkdir $WEBDIR
set fd [open [file join $WEBDIR index.html] w]
file copy -force -- {*}[glob kits/*] $WEBDIR
set totaltests_count [llength [glob tests/*.tcl]]
foreach file [lsort -dictionary [glob -directory $WEBDIR *]] {
	if {[file isdirectory $file]} {
		continue
	}
	switch -glob -- $file {
		"*.log" - "*.ttml" - "*.html" - "*.desc" {
			continue
		}
	}
	# Derive what we can from the filename
	set shortfile [file tail $file]
	set buildfile "${shortfile}-build.log"
	set failedtests [glob -nocomplain -tails -directory $WEBDIR "${shortfile}-\[0-9\]\[0-9\]-*.log"]
	## Split the filename into parts and store each part
	set kitbuildinfo [split $shortfile -]
	set tclversion [lindex $kitbuildinfo 1]
	set kitbuildinfo [lsort -dictionary [lrange $kitbuildinfo 2 end]]
	## Determine Kit OS from random file names
	unset -nocomplain kitos kitcpu
	if {[lsearch -exact $kitbuildinfo "win32"] != -1} {
		set idx [lsearch -exact $kitbuildinfo "win32"]
		set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
		set kitos "windows"
		set kitcpu "i586"
	} elseif {[lsearch -exact $kitbuildinfo "arm"] != -1} {
		set idx [lsearch -exact $kitbuildinfo "arm"]
		set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
		set kitos "linux"
		set kitcpu "arm"
	} else {
		set idx [lsearch -exact $kitbuildinfo "normal"]
		if {$idx != -1} {
			set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
		}
		set kitos [string tolower $tcl_platform(os)]
		set kitcpu [string tolower $tcl_platform(machine)]
	}
	# Generate array to describe this kit
	unset -nocomplain kitinfo
	set kitinfo(version) $tclversion
	set kitinfo(file) $shortfile
	set kitinfo(buildfile) $buildfile
	set kitinfo(failedtests) $failedtests
	set kitinfo(buildflags) $kitbuildinfo
	set kitinfo(os) $kitos
	set kitinfo(cpu) $kitcpu
	# Store kit information with all kits
	set key [list $tclversion $kitos $kitcpu]
	lappend allkitinfo($key) [array get kitinfo]
}
puts $fd "<html>"
puts $fd "  <head>"
puts $fd "    <title>KitCreator Build Status</title>"
puts $fd "  </head>"
puts $fd "  <body>"
puts $fd "    <table cellpadding=\"2\" border=\"1\">"
foreach key [lsort -dictionary [array names allkitinfo]] {
	puts $fd "      <tr>"
	puts $fd "        <th><u>Tclkit for [pretty_print_key $key]</u></th>"
	puts $fd "        <th>Status</th>"
	puts $fd "        <th>Log</th>"
	puts $fd "        <th>Failed Tests</th>"
	puts $fd "      </tr>"
	foreach kitinfo_list $allkitinfo($key) {
		puts $fd "      <tr>"
		unset -nocomplain kitinfo
		array set kitinfo $kitinfo_list
		if {[llength $kitinfo(failedtests)] == 0} {
			set status "OK"
			set bgcolor "green"
		} else {
			set status "FAILED"
			set bgcolor "yellow"
		}
		set failedtestshtml [list]
		foreach test [lsort -dictionary $kitinfo(failedtests)] {
			set testname [file rootname $test]
			set testname [split $testname -]
			for {set idx 0} {$idx < [llength $testname]} {incr idx} {
				set val [lindex $testname $idx]
				if {[string match {[0-9][0-9]} $val]} {
					set testname [join [lrange $testname $idx end] -]
					break
				}
			}
			if {[lsearch -exact $noncriticaltests $testname] == -1} {
				set bgcolor "red"
			}
			lappend failedtestshtml "<small><a href=\"$test\">$testname</a></small>"
		}
		puts $fd "        <td><a href=\"$kitinfo(file)\">[pretty_print_buildinfo $kitinfo(buildflags)]</a></td>"
		puts $fd "        <td bgcolor=\"$bgcolor\">$status</td>"
		puts $fd "        <td><small><a href=\"$kitinfo(buildfile)\">([pretty_print_size [file size [file join $WEBDIR $kitinfo(buildfile)]]])</a></small></td>"
		puts $fd "        <td>[join $failedtestshtml {, }]</td>"
		puts $fd "      </tr>"
	}
}
puts $fd "    </table>"
puts $fd "  </body>"
puts $fd "</html>"
close $fd
 |