1 ! Copyright (C) 2008, 2009 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: benchmark combinators.smart debugger fry io assocs
4 io.encodings.utf8 io.files io.sockets io.streams.string kernel
5 locals mason.common mason.config mason.platform math namespaces
6 prettyprint sequences xml.syntax xml.writer ;
9 : common-report ( -- xml )
16 <h1>Build report for <->/<-></h1>
18 <tr><td>Build machine:</td><td><-></td></tr>
19 <tr><td>Build directory:</td><td><-></td></tr>
20 <tr><td>GIT ID:</td><td><-></td></tr>
24 : with-report ( quot -- )
29 [XML <html><body><-><-></body></html> XML]
31 ] with-file-writer ; inline
33 :: failed-report ( error file what -- )
35 error [ error. ] with-string-writer :> error
36 file utf8 file-contents 400 short tail* :> output
47 : compile-failed-report ( error -- )
48 "compile-log" "VM compilation failed" failed-report ;
50 : boot-failed-report ( error -- )
51 "boot-log" "Bootstrap failed" failed-report ;
53 : test-failed-report ( error -- )
54 "test-log" "Tests failed" failed-report ;
56 : timings-table ( -- xml )
65 dup utf8 file-contents milli-seconds>time
66 [XML <tr><td><-></td><td><-></td></tr> XML]
67 ] map [XML <h2>Timings</h2> <table><-></table> XML] ;
69 : fail-dump ( heading vocabs-file messages-file -- xml )
70 [ eval-file ] dip over empty? [ 3drop f ] [
72 [ [ [XML <li><-></li> XML] ] map [XML <ul><-></ul> XML] ]
73 [ utf8 file-contents ]
75 [XML <h1><-></h1> <-> Details: <pre><-></pre> XML]
78 : benchmarks-table ( assoc -- xml )
81 [XML <tr><td><-></td><td><-></td></tr> XML]
82 ] { } assoc>map [XML <h2>Benchmarks</h2> <table><-></table> XML] ;
84 : successful-report ( -- )
90 load-everything-vocabs-file
91 load-everything-errors-file
94 "Compiler warnings and errors"
96 compiler-error-messages-file
105 help-lint-vocabs-file
106 help-lint-errors-file
110 benchmark-error-vocabs-file
111 benchmark-error-messages-file
115 benchmarks-file eval-file benchmarks-table