3 # This script assumes git checkouts at ~/git/Evergreen and ~/git/OpenSRF that
4 # correspond to branches used to produce the test output being parsed.
6 my $state = 'skipping';
11 my $evergreen_tip = '';
14 open MAIN_PAGE, ">test.html";
15 print MAIN_PAGE html_header('Test Output Summary');
16 print MAIN_PAGE qq^<a href="$ARGV[0]">Raw Output</a>\n^;
17 print MAIN_PAGE "<h1>Test Output Summary</h1>\n";
18 print MAIN_PAGE 'HTML generated on ' . `date` . "\n";
19 print MAIN_PAGE "<ul>\n";
21 open PASS_FAIL, ">pass_fail.txt";
23 while (my $line = <>) {
24 push @all_lines, $line;
25 if ($line =~ /Tip of OpenSRF: (.*)/) {
28 if ($line =~ /Tip of Evergreen: (.*)/) {
31 if ($line =~ /_\.-~= (.*)$/) {
32 $prev_subpage = $subpage;
34 $state = 'outputting';
35 print_pass_or_fail($prev_subpage);
38 print MAIN_PAGE qq^\n<li><a href="test.$subpage_count.html">$subpage</a>^;
39 open SUB_PAGE, ">test.$subpage_count.html";
40 print SUB_PAGE html_header($subpage);
41 print SUB_PAGE "<h1>$subpage</h1>\n<pre>";
43 if ($state eq 'outputting') {
44 my $class = 'output ';
49 || $line =~ /\* Jabber successfully connected/
50 || $line =~ /\* Database has the expected server encoding /
54 $class .= 'error ' if ($line =~ /^err/i);
55 if (($line =~ /^not ok/ && !($line =~ /TODO/))
56 || $line =~ /\. not ok/
57 || $line =~ /\* ERROR/
58 || $line =~ /\* WARNING/
63 if ($line =~ /^not ok/ && $line =~ /TODO/) {
66 $class .= 'result ' if ($line =~ /^Result:/);
67 $class .= 'pass ' if ($line =~ /^Result: PASS/);
68 if ($line =~ /^Result: FAIL/) {
72 if ($line =~ /^Return Value = (.+)$/) {
89 if ($subpage eq 'Gathering system information'
90 || $subpage eq 'Gathering log summary'
95 my $html_line = "<span class='$class'>$line</span>";
96 print SUB_PAGE "$html_line\n";
98 if ($line =~ /=~-\._/) {
99 print SUB_PAGE "</pre>\n" . html_footer();
104 print_pass_or_fail();
105 print MAIN_PAGE "</ul>\n";
106 print MAIN_PAGE "<h2>Timing</h2>\n<pre>";
107 my $sys_time = pop @all_lines;
108 my $user_time = pop @all_lines;
109 my $real_time = pop @all_lines;
110 print MAIN_PAGE "$real_time$user_time$sys_time";
111 print MAIN_PAGE "</pre>\n";
112 print MAIN_PAGE branch_tips() . "\n";
113 print MAIN_PAGE html_footer();
123 <title>$title</title>
124 <link rel="stylesheet" type="text/css" href="test_output.css">
125 <link rel="alternate" title="Test RSS" href="http://testing.evergreen-ils.org/~live/test_rss.xml" type="application/rss+xml">
137 sub print_pass_or_fail {
139 my $exception = {}; # keyed on subpage, value = # of expected errors
140 $exception{'Installing Evergreen pre-requisites'} = 3;
141 #print "subpage = <$subpage> error_count = $error_count\n";
142 if ($error_count && $error_count > $exception{$subpage} ) {
143 print MAIN_PAGE ' - <span class="fail">Failed</span>';
144 print PASS_FAIL "Failed\n";
146 if ($subpage_count) {
147 print MAIN_PAGE ' - <span class="pass">Passed</span>';
148 print PASS_FAIL "Passed\n";
154 my $html = "<h2>Current OpenSRF tip:</h2>\n<pre>$opensrf_tip</pre>\n";
155 $html .= "<h2>Current Evergreen tip:</h2>\n<pre>$evergreen_tip</pre>\n";
156 my $opensrf_tip_hash = '';
157 if ($opensrf_tip =~ /^(\S+)\s/) {
158 $opensrf_tip_hash = $1;
160 my $evergreen_tip_hash = '';
161 if ($evergreen_tip =~ /^(\S+)\s/) {
162 $evergreen_tip_hash = $1;
164 `touch prev_evergreen_tip.hash`;
165 `touch prev_opensrf_tip.hash`;
166 my $prev_opensrf_tip_hash = `cat prev_opensrf_tip.hash`;
167 chop $prev_opensrf_tip_hash;
168 my $prev_evergreen_tip_hash = `cat prev_evergreen_tip.hash`;
169 chop $prev_evergreen_tip_hash;
170 $html .= "<h2>OpenSRF commits since last build:</h2>\n<pre>";
171 $html .= `cd ~/git/OpenSRF/ ; git fetch 2> /dev/null ; git pull 2> /dev/null ; git log --format=oneline $prev_opensrf_tip_hash..$opensrf_tip_hash`;
172 $html .= "</pre><h2>Evergreen commits since last build:</h2>\n<pre>";
173 $html .= `cd ~/git/Evergreen/ ; git fetch 2> /dev/null ; git pull 2> /dev/null ; git log --format=oneline $prev_evergreen_tip_hash..$evergreen_tip_hash`;
174 `echo $opensrf_tip_hash > prev_opensrf_tip.hash`;
175 `echo $evergreen_tip_hash > prev_evergreen_tip.hash`;
181 `touch pass_fail.txt.prev`;
182 if (`diff pass_fail.txt pass_fail.txt.prev`) {
183 $fail = `grep Failed pass_fail.txt`;
184 open RSS_FILE, ">test_rss.xml";
185 print RSS_FILE q^<?xml version="1.0"?>
188 <title>Test Output Summary</title>
189 <link>http://testing.evergreen-ils.org/~live/test.html</link>
190 <description>Live Test Suite</description>
193 ? q^<title>Test Failure - http://testing.evergreen-ils.org/~live/test.html</title>
194 <link>http://testing.evergreen-ils.org/~live/test.html</link>
195 <description>One or more tests failed</description>
197 : q^<title>Test Success - http://testing.evergreen-ils.org/~live/test.html</title>
198 <link>http://testing.evergreen-ils.org/~live/test.html</link>
199 <description>All tests passed</description>
207 `mv pass_fail.txt pass_fail.txt.prev`;