2010-09-05 18:22:02 -04:00
|
|
|
! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
|
2008-09-16 00:20:33 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2014-11-15 19:20:49 -05:00
|
|
|
USING: assocs combinators.smart debugger fry io.encodings.utf8
|
|
|
|
io.files io.streams.string kernel literals locals mason.common
|
|
|
|
mason.config mason.disk math namespaces sequences xml.syntax
|
|
|
|
xml.writer ;
|
2008-09-16 00:20:33 -04:00
|
|
|
IN: mason.report
|
|
|
|
|
2009-11-20 01:12:28 -05:00
|
|
|
: git-link ( id -- link )
|
2012-05-29 19:58:58 -04:00
|
|
|
[ "http://github.com/slavapestov/factor/commit/" "" prepend-as ] keep
|
2009-11-20 01:12:28 -05:00
|
|
|
[XML <a href=<->><-></a> XML] ;
|
|
|
|
|
2009-04-17 18:55:33 -04:00
|
|
|
: common-report ( -- xml )
|
|
|
|
target-os get
|
|
|
|
target-cpu get
|
2009-05-21 20:15:04 -04:00
|
|
|
short-host-name
|
2010-09-05 18:22:02 -04:00
|
|
|
disk-usage
|
2009-04-17 18:55:33 -04:00
|
|
|
build-dir
|
2009-11-20 01:12:28 -05:00
|
|
|
current-git-id get git-link
|
2009-04-17 18:55:33 -04:00
|
|
|
[XML
|
|
|
|
<h1>Build report for <->/<-></h1>
|
|
|
|
<table>
|
|
|
|
<tr><td>Build machine:</td><td><-></td></tr>
|
2010-09-05 18:22:02 -04:00
|
|
|
<tr><td>Disk usage:</td><td><-></td></tr>
|
2009-04-17 18:55:33 -04:00
|
|
|
<tr><td>Build directory:</td><td><-></td></tr>
|
|
|
|
<tr><td>GIT ID:</td><td><-></td></tr>
|
|
|
|
</table>
|
|
|
|
XML] ;
|
2008-09-16 00:20:33 -04:00
|
|
|
|
|
|
|
: with-report ( quot -- )
|
2009-04-17 18:55:33 -04:00
|
|
|
[ "report" utf8 ] dip
|
|
|
|
'[
|
2011-10-21 16:34:08 -04:00
|
|
|
common-report
|
|
|
|
_ call( -- xml )
|
|
|
|
[XML <html><body><-><-></body></html> XML]
|
|
|
|
write-xml
|
2009-04-17 18:55:33 -04:00
|
|
|
] with-file-writer ; inline
|
2008-09-16 00:20:33 -04:00
|
|
|
|
2009-05-18 17:50:11 -04:00
|
|
|
: file-tail ( file encoding lines -- seq )
|
|
|
|
[ file-lines ] dip short tail* "\n" join ;
|
|
|
|
|
2009-04-17 21:59:59 -04:00
|
|
|
:: failed-report ( error file what -- status )
|
2008-09-16 00:20:33 -04:00
|
|
|
[
|
2009-04-17 18:55:33 -04:00
|
|
|
error [ error. ] with-string-writer :> error
|
2009-05-18 17:50:11 -04:00
|
|
|
file utf8 400 file-tail :> output
|
2012-05-29 19:58:58 -04:00
|
|
|
|
2009-04-17 18:55:33 -04:00
|
|
|
[XML
|
|
|
|
<h2><-what-></h2>
|
|
|
|
Build output:
|
|
|
|
<pre><-output-></pre>
|
|
|
|
Launcher error:
|
|
|
|
<pre><-error-></pre>
|
|
|
|
XML]
|
2009-04-17 21:59:59 -04:00
|
|
|
] with-report
|
|
|
|
status-error ;
|
2008-09-16 00:20:33 -04:00
|
|
|
|
2009-04-17 21:59:59 -04:00
|
|
|
: compile-failed ( error -- status )
|
2009-04-17 18:55:33 -04:00
|
|
|
"compile-log" "VM compilation failed" failed-report ;
|
|
|
|
|
2009-04-17 21:59:59 -04:00
|
|
|
: boot-failed ( error -- status )
|
2009-04-17 18:55:33 -04:00
|
|
|
"boot-log" "Bootstrap failed" failed-report ;
|
2008-09-16 00:20:33 -04:00
|
|
|
|
2009-04-17 21:59:59 -04:00
|
|
|
: test-failed ( error -- status )
|
2009-04-17 18:55:33 -04:00
|
|
|
"test-log" "Tests failed" failed-report ;
|
|
|
|
|
|
|
|
: timings-table ( -- xml )
|
2009-05-21 01:08:43 -04:00
|
|
|
${
|
|
|
|
boot-time-file
|
|
|
|
load-time-file
|
|
|
|
test-time-file
|
|
|
|
help-lint-time-file
|
|
|
|
benchmark-time-file
|
|
|
|
html-help-time-file
|
2009-04-17 18:55:33 -04:00
|
|
|
} [
|
2009-11-20 00:50:30 -05:00
|
|
|
dup eval-file nanos>time
|
2009-04-17 18:55:33 -04:00
|
|
|
[XML <tr><td><-></td><td><-></td></tr> XML]
|
|
|
|
] map [XML <h2>Timings</h2> <table><-></table> XML] ;
|
|
|
|
|
2009-04-17 21:59:59 -04:00
|
|
|
: error-dump ( heading vocabs-file messages-file -- xml )
|
2009-04-17 18:55:33 -04:00
|
|
|
[ eval-file ] dip over empty? [ 3drop f ] [
|
|
|
|
[ ]
|
|
|
|
[ [ [XML <li><-></li> XML] ] map [XML <ul><-></ul> XML] ]
|
|
|
|
[ utf8 file-contents ]
|
|
|
|
tri*
|
|
|
|
[XML <h1><-></h1> <-> Details: <pre><-></pre> XML]
|
|
|
|
] if ;
|
|
|
|
|
|
|
|
: benchmarks-table ( assoc -- xml )
|
2008-09-16 00:20:33 -04:00
|
|
|
[
|
2009-11-20 19:20:45 -05:00
|
|
|
1,000,000,000 /f
|
2009-04-17 18:55:33 -04:00
|
|
|
[XML <tr><td><-></td><td><-></td></tr> XML]
|
2009-11-20 19:20:45 -05:00
|
|
|
] { } assoc>map
|
|
|
|
[XML
|
|
|
|
<h2>Benchmarks</h2>
|
|
|
|
<table>
|
|
|
|
<tr><th>Benchmark</th><th>Time (seconds)</th></tr>
|
|
|
|
<->
|
|
|
|
</table>
|
|
|
|
XML] ;
|
2008-09-16 00:20:33 -04:00
|
|
|
|
|
|
|
: successful-report ( -- )
|
|
|
|
[
|
2009-04-17 18:55:33 -04:00
|
|
|
[
|
|
|
|
timings-table
|
2008-09-16 00:20:33 -04:00
|
|
|
|
2009-04-17 18:55:33 -04:00
|
|
|
"Load failures"
|
2009-05-04 07:44:17 -04:00
|
|
|
load-all-vocabs-file
|
|
|
|
load-all-errors-file
|
2009-04-17 21:59:59 -04:00
|
|
|
error-dump
|
2008-09-16 00:20:33 -04:00
|
|
|
|
2009-04-23 23:17:25 -04:00
|
|
|
"Compiler errors"
|
2009-04-17 18:55:33 -04:00
|
|
|
compiler-errors-file
|
|
|
|
compiler-error-messages-file
|
2009-04-17 21:59:59 -04:00
|
|
|
error-dump
|
2008-09-16 00:20:33 -04:00
|
|
|
|
2009-04-17 18:55:33 -04:00
|
|
|
"Unit test failures"
|
|
|
|
test-all-vocabs-file
|
|
|
|
test-all-errors-file
|
2009-04-17 21:59:59 -04:00
|
|
|
error-dump
|
2012-05-29 19:58:58 -04:00
|
|
|
|
2009-04-17 18:55:33 -04:00
|
|
|
"Help lint failures"
|
|
|
|
help-lint-vocabs-file
|
|
|
|
help-lint-errors-file
|
2009-04-17 21:59:59 -04:00
|
|
|
error-dump
|
2008-11-16 14:46:45 -05:00
|
|
|
|
2009-04-17 18:55:33 -04:00
|
|
|
"Benchmark errors"
|
|
|
|
benchmark-error-vocabs-file
|
|
|
|
benchmark-error-messages-file
|
2009-04-17 21:59:59 -04:00
|
|
|
error-dump
|
2009-05-08 22:33:49 -04:00
|
|
|
|
2009-04-17 18:55:33 -04:00
|
|
|
benchmarks-file eval-file benchmarks-table
|
|
|
|
] output>array
|
2009-04-17 21:59:59 -04:00
|
|
|
] with-report ;
|
|
|
|
|
|
|
|
: build-clean? ( -- ? )
|
2009-05-21 01:08:43 -04:00
|
|
|
${
|
|
|
|
load-all-vocabs-file
|
|
|
|
test-all-vocabs-file
|
|
|
|
help-lint-vocabs-file
|
|
|
|
compiler-errors-file
|
|
|
|
benchmark-error-vocabs-file
|
|
|
|
} [ eval-file empty? ] all? ;
|
2009-04-17 21:59:59 -04:00
|
|
|
|
|
|
|
: success ( -- status )
|
2012-05-29 19:58:58 -04:00
|
|
|
successful-report build-clean? status-clean status-dirty ? ;
|