Check-in [824e5d844d]
Overview
Comment:Replaced publish-tests script with HTML'ified Tcl version
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:824e5d844da71dce9afdf4ec6899769bc23b0fef
User & Date: rkeene on 2010-09-26 04:47:00
Other Links: manifest | tags
Context
2010-09-26
04:47
Updated to include build script in build log

Updated to include size of kit in published data check-in: 8563b223da user: rkeene tags: trunk

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 count check-in: f8e23f8a39 user: rkeene tags: trunk

Changes

Modified build/test/publish-tests from [6cafb5c1e8] to [b70c6b112e].

     1         -#! /bin/bash
     2         -
     3         -WEBDIR="/web/rkeene/devel/kitcreator/kitbuild"
     4         -export WEBDIR
     5         -
     6         -if [ ! -d "kits" ]; then
     7         -	echo 'Could not find kits/ directory, aborting.' >&2
     8         -
     9         -	exit 1
    10         -fi
    11         -
    12         -rm -rf "${WEBDIR}"
    13         -mkdir -p "${WEBDIR}" || exit 1
    14         -
    15         -cp -r kits/* "${WEBDIR}"
    16         -
    17         -ln -s ../index.ttml "${WEBDIR}/" >/dev/null 2>/dev/null
    18         -
    19         -totaltests_count="$(ls -1 tests/*.tcl | wc -l)"
    20         -
    21         -for file in "${WEBDIR}"/*; do
    22         -	if [ -d "${file}" ]; then
    23         -		continue
    24         -	fi
    25         -
    26         -	if echo "${file}" | egrep '\.(log|desc|ttml)$' >/dev/null; then
    27         -		continue
    28         -	fi
    29         -
    30         -	# Find out which tests failed
    31         -	failedtests_count="0"
    32         -	failedtests=""
    33         -	for faillog in "${file}"-[0-9][0-9]-*.log; do
    34         -		if [ ! -f "${faillog}" ]; then
    35         -			continue
    36         -		fi
    37         -
    38         -		failedtests_count=$[${failedtests} + 1]
    39         -		failedtests="${failedtests} $(basename "${faillog}")"
    40         -	done
    41         -
    42         -	# Generate description
    43         -	descfile="${file}.desc"
    44         -	shortfile="$(basename "${file}")"
    45         -	desc=""
    46         -
    47         -	tclversion="$(echo "${shortfile}" | cut -f 2 -d -)"
    48         -	parts="$(echo "${shortfile}" | cut -f 3- -d -)"
    49         -
    50         -	while [ "${parts}" != "" ]; do
    51         -		case "${parts}-" in
    52         -			normal-*)
    53         -				true
    54         -				;;
    55         -			arm-*)
    56         -				desc="${desc} on the CPU architecture MIPSEL/uClibc"
    57         -				;;
    58         -			win32-*)
    59         -				desc="${desc} for Microsoft Windows"
    60         -				;;
    61         -			threaded-*)
    62         -				desc="${desc} with threads support"
    63         -				;;
    64         -			min-*)
    65         -				desc="${desc} compiled minimally"
    66         -				;;
    67         -			static-*)
    68         -				desc="${desc} and statically"
    69         -				;;
    70         -			notk-*)
    71         -				if echo "${desc}" | grep -i support >/dev/null; then
    72         -					desc="${desc} and"
    73         -				fi
    74         -				desc="${desc} without Tk"
    75         -				;;
    76         -			statictk-*)
    77         -				if echo "${desc}" | grep -i support >/dev/null; then
    78         -					desc="${desc} and"
    79         -				fi
    80         -				desc="${desc} with Tk linked directly to the kit"
    81         -				;;
    82         -			zip-*)
    83         -				desc="${desc} using ZIP for Kit storage"
    84         -				;;
    85         -			*)
    86         -				echo "Unknown part (\"${parts}\"), skipping \"${shortfile}\"" >&2
    87         -				break
    88         -				;;
    89         -		esac
    90         -
    91         -		newparts="$(echo "${parts}" | cut -f 2- -d -)"
    92         -		if [ "${newparts}" = "${parts}" ]; then
    93         -			parts=""
    94         -		else
    95         -			parts="${newparts}"
    96         -		fi
    97         -	done
    98         -
    99         -	if [ -z "${desc}" ]; then
            1  +#! /usr/bin/env tclsh
            2  +
            3  +package require Tcl 8.5
            4  +
            5  +set WEBDIR "/web/rkeene/devel/kitcreator/kitbuild"
            6  +if {![file isdir "kits"]} {
            7  +	puts stderr "Could not find kits/ directory, aborting."
            8  +
            9  +        exit 1
           10  +}
           11  +
           12  +set noncriticaltests [list "05-locale"]
           13  +
           14  +##########################################################################
           15  +## PROCEDURES ############################################################
           16  +##########################################################################
           17  +proc pretty_print_key {key} {
           18  +	set version [lindex $key 0]
           19  +	set os [lindex $key 1]
           20  +	set cpu [lindex $key 2]
           21  +
           22  +	switch -glob -- $version {
           23  +		"cvs_HEAD" {
           24  +			set version "from CVS HEAD"
           25  +		}
           26  +		"cvs_*" {
           27  +			set tag [join [lrange [split $version _] 1 end] _]
           28  +			set version "from CVS tag $tag"
           29  +		}
           30  +		default {
           31  +			set version "version $version"
           32  +		}
           33  +	}
           34  +
           35  +	return "Tcl $version for [string totitle $os] on $cpu"
           36  +}
           37  +
           38  +proc pretty_print_buildinfo {buildinfo} {
           39  +	set desc [list]
           40  +	foreach tag [list min static notk statictk threaded zip] {
           41  +		if {[lsearch -exact $buildinfo $tag] != -1} {
           42  +			switch -- $tag {
           43  +				"min" {
           44  +					lappend desc "Minimally Built"
           45  +				}
           46  +				"static" {
           47  +					lappend desc "Statically Linked"
           48  +				}
           49  +				"notk" {
           50  +					lappend desc "Without Tk"
           51  +				}
           52  +				"statictk" {
           53  +					lappend desc "Tk linked to Kit"
           54  +				}
           55  +				"threaded" {
           56  +					lappend desc "Threaded"
           57  +				}
           58  +				"zip" {
           59  +					lappend desc "Kit Filesystem in Zip"
           60  +				}
           61  +			}
           62  +		}
           63  +	}
           64  +
           65  +	if {[llength $desc] == 0} {
           66  +		return "Default Build"
           67  +	}
           68  +
           69  +	return [join $desc {, }]
           70  +}
           71  +
           72  +proc pretty_print_size {size} {
           73  +	foreach unit [list "" K M G T P] {
           74  +		if {$size < 1024} {
           75  +			return "$size [string trim ${unit}B]"
           76  +		}
           77  +
           78  +		set size [expr {${size} / 1024}]
           79  +	}
           80  +}
           81  +
           82  +##########################################################################
           83  +## MAIN BODY #############################################################
           84  +##########################################################################
           85  +
           86  +file delete -force -- $WEBDIR
           87  +file mkdir $WEBDIR
           88  +
           89  +set fd [open [file join $WEBDIR index.html] w]
           90  +
           91  +file copy -force -- {*}[glob kits/*] $WEBDIR
           92  +
           93  +set totaltests_count [llength [glob tests/*.tcl]]
           94  +
           95  +foreach file [lsort -dictionary [glob -directory $WEBDIR *]] {
           96  +	if {[file isdirectory $file]} {
   100     97   		continue
   101         -	fi
           98  +	}
           99  +
          100  +	switch -glob -- $file {
          101  +		"*.log" - "*.ttml" - "*.html" - "*.desc" {
          102  +			continue
          103  +		}
          104  +	}
          105  +
          106  +	# Derive what we can from the filename
          107  +	set shortfile [file tail $file]
          108  +	set buildfile "${shortfile}-build.log"
          109  +	set failedtests [glob -nocomplain -tails -directory $WEBDIR "${shortfile}-\[0-9\]\[0-9\]-*.log"]
          110  +
          111  +	## Split the filename into parts and store each part
          112  +	set kitbuildinfo [split $shortfile -]
          113  +	set tclversion [lindex $kitbuildinfo 1]
          114  +	set kitbuildinfo [lsort -dictionary [lrange $kitbuildinfo 2 end]]
          115  +
          116  +	## Determine Kit OS from random file names
          117  +	unset -nocomplain kitos kitcpu
          118  +	if {[lsearch -exact $kitbuildinfo "win32"] != -1} {
          119  +		set idx [lsearch -exact $kitbuildinfo "win32"]
          120  +		set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
          121  +		set kitos "windows"
          122  +		set kitcpu "i586"
          123  +	} elseif {[lsearch -exact $kitbuildinfo "arm"] != -1} {
          124  +		set idx [lsearch -exact $kitbuildinfo "arm"]
          125  +		set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
          126  +		set kitos "linux"
          127  +		set kitcpu "arm"
          128  +	} else {
          129  +		set idx [lsearch -exact $kitbuildinfo "normal"]
          130  +		if {$idx != -1} {
          131  +			set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
          132  +		}
          133  +
          134  +		set kitos [string tolower $tcl_platform(os)]
          135  +		set kitcpu [string tolower $tcl_platform(machine)]
          136  +	}
          137  +
          138  +	# Generate array to describe this kit
          139  +	unset -nocomplain kitinfo
          140  +	set kitinfo(version) $tclversion
          141  +	set kitinfo(file) $shortfile
          142  +	set kitinfo(buildfile) $buildfile
          143  +	set kitinfo(failedtests) $failedtests
          144  +	set kitinfo(buildflags) $kitbuildinfo
          145  +	set kitinfo(os) $kitos
          146  +	set kitinfo(cpu) $kitcpu
          147  +
          148  +	# Store kit information with all kits
          149  +	set key [list $tclversion $kitos $kitcpu]
          150  +	lappend allkitinfo($key) [array get kitinfo]
          151  +}
          152  +
          153  +puts $fd "<html>"
          154  +puts $fd "  <head>"
          155  +puts $fd "    <title>KitCreator Build Status</title>"
          156  +puts $fd "  </head>"
          157  +puts $fd "  <body>"
          158  +puts $fd "    <table cellpadding=\"2\" border=\"1\">"
          159  +foreach key [lsort -dictionary [array names allkitinfo]] {
          160  +	puts $fd "      <tr>"
          161  +	puts $fd "        <th><u>Tclkit for [pretty_print_key $key]</u></th>"
          162  +	puts $fd "        <th>Status</th>"
          163  +	puts $fd "        <th>Log</th>"
          164  +	puts $fd "        <th>Failed Tests</th>"
          165  +	puts $fd "      </tr>"
          166  +	foreach kitinfo_list $allkitinfo($key) {
          167  +		puts $fd "      <tr>"
          168  +		unset -nocomplain kitinfo
          169  +		array set kitinfo $kitinfo_list
          170  +
          171  +		if {[llength $kitinfo(failedtests)] == 0} {
          172  +			set status "OK"
          173  +			set bgcolor "green"
          174  +		} else {
          175  +			set status "FAILED"
          176  +			set bgcolor "yellow"
          177  +		}
          178  +
          179  +		set failedtestshtml [list]
          180  +		foreach test [lsort -dictionary $kitinfo(failedtests)] {
          181  +			set testname [file rootname $test]
          182  +			set testname [split $testname -]
          183  +
          184  +			for {set idx 0} {$idx < [llength $testname]} {incr idx} {
          185  +				set val [lindex $testname $idx]
          186  +				if {[string match {[0-9][0-9]} $val]} {
          187  +					set testname [join [lrange $testname $idx end] -]
          188  +
          189  +					break
          190  +				}
          191  +			}
          192  +
          193  +			if {[lsearch -exact $noncriticaltests $testname] == -1} {
          194  +				set bgcolor "red"
          195  +			}
          196  +
          197  +			lappend failedtestshtml "<small><a href=\"$test\">$testname</a></small>"
          198  +		}
          199  +
   102    200   
   103         -	# Generate better Tcl version
   104         -	case "${tclversion}" in
   105         -		cvs_HEAD)
   106         -			tclversion="from CVS HEAD"
   107         -			;;
   108         -		cvs_*)
   109         -			tclversion="from CVS tag $(echo "${tclversion}" | cut -f 2 -d _)"
   110         -			;;
   111         -	esac
          201  +		puts $fd "        <td><a href=\"$kitinfo(file)\">[pretty_print_buildinfo $kitinfo(buildflags)]</a></td>"
          202  +		puts $fd "        <td bgcolor=\"$bgcolor\">$status</td>"
          203  +		puts $fd "        <td><small><a href=\"$kitinfo(buildfile)\">([pretty_print_size [file size [file join $WEBDIR $kitinfo(buildfile)]]])</a></small></td>"
          204  +		puts $fd "        <td>[join $failedtestshtml {, }]</td>"
          205  +		puts $fd "      </tr>"
          206  +	}
   112    207   
   113         -	# Update description with count of failed tests
   114         -	if [ "${failedtests_count}" != "0" ]; then
   115         -		desc="${desc} (FAILED ${failedtests_count} of ${totaltests_count} tests)"
   116         -	fi
          208  +}
          209  +puts $fd "    </table>"
          210  +puts $fd "  </body>"
          211  +puts $fd "</html>"
   117    212   
   118         -	desc="is a Tclkit for Tcl ${tclversion}${desc}"
   119         -
   120         -done
   121         -
   122         -rmdir "${WEBDIR}/failed" >/dev/null 2>/dev/null
   123         -ln -s ../index.ttml "${WEBDIR}/failed/" >/dev/null 2>/dev/null
   124         -
   125         -exit 0
          213  +close $fd

Deleted build/test/publish-tests.tcl version [b70c6b112e].

     1         -#! /usr/bin/env tclsh
     2         -
     3         -package require Tcl 8.5
     4         -
     5         -set WEBDIR "/web/rkeene/devel/kitcreator/kitbuild"
     6         -if {![file isdir "kits"]} {
     7         -	puts stderr "Could not find kits/ directory, aborting."
     8         -
     9         -        exit 1
    10         -}
    11         -
    12         -set noncriticaltests [list "05-locale"]
    13         -
    14         -##########################################################################
    15         -## PROCEDURES ############################################################
    16         -##########################################################################
    17         -proc pretty_print_key {key} {
    18         -	set version [lindex $key 0]
    19         -	set os [lindex $key 1]
    20         -	set cpu [lindex $key 2]
    21         -
    22         -	switch -glob -- $version {
    23         -		"cvs_HEAD" {
    24         -			set version "from CVS HEAD"
    25         -		}
    26         -		"cvs_*" {
    27         -			set tag [join [lrange [split $version _] 1 end] _]
    28         -			set version "from CVS tag $tag"
    29         -		}
    30         -		default {
    31         -			set version "version $version"
    32         -		}
    33         -	}
    34         -
    35         -	return "Tcl $version for [string totitle $os] on $cpu"
    36         -}
    37         -
    38         -proc pretty_print_buildinfo {buildinfo} {
    39         -	set desc [list]
    40         -	foreach tag [list min static notk statictk threaded zip] {
    41         -		if {[lsearch -exact $buildinfo $tag] != -1} {
    42         -			switch -- $tag {
    43         -				"min" {
    44         -					lappend desc "Minimally Built"
    45         -				}
    46         -				"static" {
    47         -					lappend desc "Statically Linked"
    48         -				}
    49         -				"notk" {
    50         -					lappend desc "Without Tk"
    51         -				}
    52         -				"statictk" {
    53         -					lappend desc "Tk linked to Kit"
    54         -				}
    55         -				"threaded" {
    56         -					lappend desc "Threaded"
    57         -				}
    58         -				"zip" {
    59         -					lappend desc "Kit Filesystem in Zip"
    60         -				}
    61         -			}
    62         -		}
    63         -	}
    64         -
    65         -	if {[llength $desc] == 0} {
    66         -		return "Default Build"
    67         -	}
    68         -
    69         -	return [join $desc {, }]
    70         -}
    71         -
    72         -proc pretty_print_size {size} {
    73         -	foreach unit [list "" K M G T P] {
    74         -		if {$size < 1024} {
    75         -			return "$size [string trim ${unit}B]"
    76         -		}
    77         -
    78         -		set size [expr {${size} / 1024}]
    79         -	}
    80         -}
    81         -
    82         -##########################################################################
    83         -## MAIN BODY #############################################################
    84         -##########################################################################
    85         -
    86         -file delete -force -- $WEBDIR
    87         -file mkdir $WEBDIR
    88         -
    89         -set fd [open [file join $WEBDIR index.html] w]
    90         -
    91         -file copy -force -- {*}[glob kits/*] $WEBDIR
    92         -
    93         -set totaltests_count [llength [glob tests/*.tcl]]
    94         -
    95         -foreach file [lsort -dictionary [glob -directory $WEBDIR *]] {
    96         -	if {[file isdirectory $file]} {
    97         -		continue
    98         -	}
    99         -
   100         -	switch -glob -- $file {
   101         -		"*.log" - "*.ttml" - "*.html" - "*.desc" {
   102         -			continue
   103         -		}
   104         -	}
   105         -
   106         -	# Derive what we can from the filename
   107         -	set shortfile [file tail $file]
   108         -	set buildfile "${shortfile}-build.log"
   109         -	set failedtests [glob -nocomplain -tails -directory $WEBDIR "${shortfile}-\[0-9\]\[0-9\]-*.log"]
   110         -
   111         -	## Split the filename into parts and store each part
   112         -	set kitbuildinfo [split $shortfile -]
   113         -	set tclversion [lindex $kitbuildinfo 1]
   114         -	set kitbuildinfo [lsort -dictionary [lrange $kitbuildinfo 2 end]]
   115         -
   116         -	## Determine Kit OS from random file names
   117         -	unset -nocomplain kitos kitcpu
   118         -	if {[lsearch -exact $kitbuildinfo "win32"] != -1} {
   119         -		set idx [lsearch -exact $kitbuildinfo "win32"]
   120         -		set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
   121         -		set kitos "windows"
   122         -		set kitcpu "i586"
   123         -	} elseif {[lsearch -exact $kitbuildinfo "arm"] != -1} {
   124         -		set idx [lsearch -exact $kitbuildinfo "arm"]
   125         -		set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
   126         -		set kitos "linux"
   127         -		set kitcpu "arm"
   128         -	} else {
   129         -		set idx [lsearch -exact $kitbuildinfo "normal"]
   130         -		if {$idx != -1} {
   131         -			set kitbuildinfo [lreplace $kitbuildinfo $idx $idx]
   132         -		}
   133         -
   134         -		set kitos [string tolower $tcl_platform(os)]
   135         -		set kitcpu [string tolower $tcl_platform(machine)]
   136         -	}
   137         -
   138         -	# Generate array to describe this kit
   139         -	unset -nocomplain kitinfo
   140         -	set kitinfo(version) $tclversion
   141         -	set kitinfo(file) $shortfile
   142         -	set kitinfo(buildfile) $buildfile
   143         -	set kitinfo(failedtests) $failedtests
   144         -	set kitinfo(buildflags) $kitbuildinfo
   145         -	set kitinfo(os) $kitos
   146         -	set kitinfo(cpu) $kitcpu
   147         -
   148         -	# Store kit information with all kits
   149         -	set key [list $tclversion $kitos $kitcpu]
   150         -	lappend allkitinfo($key) [array get kitinfo]
   151         -}
   152         -
   153         -puts $fd "<html>"
   154         -puts $fd "  <head>"
   155         -puts $fd "    <title>KitCreator Build Status</title>"
   156         -puts $fd "  </head>"
   157         -puts $fd "  <body>"
   158         -puts $fd "    <table cellpadding=\"2\" border=\"1\">"
   159         -foreach key [lsort -dictionary [array names allkitinfo]] {
   160         -	puts $fd "      <tr>"
   161         -	puts $fd "        <th><u>Tclkit for [pretty_print_key $key]</u></th>"
   162         -	puts $fd "        <th>Status</th>"
   163         -	puts $fd "        <th>Log</th>"
   164         -	puts $fd "        <th>Failed Tests</th>"
   165         -	puts $fd "      </tr>"
   166         -	foreach kitinfo_list $allkitinfo($key) {
   167         -		puts $fd "      <tr>"
   168         -		unset -nocomplain kitinfo
   169         -		array set kitinfo $kitinfo_list
   170         -
   171         -		if {[llength $kitinfo(failedtests)] == 0} {
   172         -			set status "OK"
   173         -			set bgcolor "green"
   174         -		} else {
   175         -			set status "FAILED"
   176         -			set bgcolor "yellow"
   177         -		}
   178         -
   179         -		set failedtestshtml [list]
   180         -		foreach test [lsort -dictionary $kitinfo(failedtests)] {
   181         -			set testname [file rootname $test]
   182         -			set testname [split $testname -]
   183         -
   184         -			for {set idx 0} {$idx < [llength $testname]} {incr idx} {
   185         -				set val [lindex $testname $idx]
   186         -				if {[string match {[0-9][0-9]} $val]} {
   187         -					set testname [join [lrange $testname $idx end] -]
   188         -
   189         -					break
   190         -				}
   191         -			}
   192         -
   193         -			if {[lsearch -exact $noncriticaltests $testname] == -1} {
   194         -				set bgcolor "red"
   195         -			}
   196         -
   197         -			lappend failedtestshtml "<small><a href=\"$test\">$testname</a></small>"
   198         -		}
   199         -
   200         -
   201         -		puts $fd "        <td><a href=\"$kitinfo(file)\">[pretty_print_buildinfo $kitinfo(buildflags)]</a></td>"
   202         -		puts $fd "        <td bgcolor=\"$bgcolor\">$status</td>"
   203         -		puts $fd "        <td><small><a href=\"$kitinfo(buildfile)\">([pretty_print_size [file size [file join $WEBDIR $kitinfo(buildfile)]]])</a></small></td>"
   204         -		puts $fd "        <td>[join $failedtestshtml {, }]</td>"
   205         -		puts $fd "      </tr>"
   206         -	}
   207         -
   208         -}
   209         -puts $fd "    </table>"
   210         -puts $fd "  </body>"
   211         -puts $fd "</html>"
   212         -
   213         -close $fd