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="cronoutput.txt">test.sh output</a>]\n^;
17 print MAIN_PAGE qq^[<a href="$ARGV[0]">installer_installer.sh output</a>]\n^;
18 print MAIN_PAGE qq^[<a href="archive/">Previous Runs</a>]\n^;
19 print MAIN_PAGE qq^[<a href="http://git.evergreen-ils.org/?p=working/random.git;a=shortlog;h=refs/heads/collab/phasefx/wheezy_installer">Git</a>]\n^;
20 print MAIN_PAGE "<h1>Test Output Summary</h1>\n";
21 print MAIN_PAGE 'HTML generated on ' . `date` . "\n";
22 print MAIN_PAGE "<ul>\n";
24 open PASS_FAIL, ">pass_fail.txt";
26 while (my $line = <>) {
27 push @all_lines, $line;
28 if ($line =~ /Tip of OpenSRF: (.*)/) {
31 if ($line =~ /Tip of Evergreen: (.*)/) {
34 if ($line =~ /_\.-~= (.*)$/) {
35 $prev_subpage = $subpage;
37 $state = 'outputting';
38 print_pass_or_fail($prev_subpage);
41 print MAIN_PAGE qq^\n<li><a href="test.$subpage_count.html">$subpage</a>^;
42 open SUB_PAGE, ">test.$subpage_count.html";
43 print SUB_PAGE html_header($subpage);
44 print SUB_PAGE "<h1>$subpage</h1>\n<pre>";
46 if ($state eq 'outputting') {
47 my $class = 'output ';
52 || $line =~ /\* Jabber successfully connected/
53 || $line =~ /\* Database has the expected server encoding /
57 $class .= 'error ' if ($line =~ /^err/i);
58 if (($line =~ /^not ok/ && !($line =~ /TODO/))
59 || $line =~ /\. not ok/
60 || $line =~ /\* ERROR/
61 || $line =~ /\* WARNING/
64 || $line =~ /Please install/
69 if ($line =~ /^not ok/ && $line =~ /TODO/) {
72 $class .= 'result ' if ($line =~ /^Result:/);
73 $class .= 'pass ' if ($line =~ /^Result: PASS/);
74 if ($line =~ /^Result: FAIL/) {
78 if ($line =~ /^Return Value = (.+)$/) {
95 if ($subpage eq 'Gathering system information'
96 || $subpage eq 'Gathering log summary'
101 my $html_line = "<span class='$class'>$line</span>";
102 print SUB_PAGE "$html_line\n";
104 if ($line =~ /=~-\._/) {
105 print SUB_PAGE "</pre>\n" . html_footer();
110 print_pass_or_fail();
111 print MAIN_PAGE "</ul>\n";
112 print MAIN_PAGE "<h2>Timing</h2>\n<pre>";
113 my $sys_time = pop @all_lines;
114 my $user_time = pop @all_lines;
115 my $real_time = pop @all_lines;
116 print MAIN_PAGE "$real_time$user_time$sys_time";
117 print MAIN_PAGE "</pre>\n";
118 print MAIN_PAGE branch_tips() . "\n";
119 print MAIN_PAGE html_footer();
129 <meta charset="utf-8">
130 <title>$title</title>
131 <link rel="stylesheet" type="text/css" href="test_output.css">
132 <link rel="alternate" title="Test RSS" href="http://testing.evergreen-ils.org/~live/test_rss.xml" type="application/rss+xml">
144 sub print_pass_or_fail {
146 my $exception = {}; # keyed on subpage, value = # of expected errors
147 $exception{'Installing Evergreen pre-requisites'} = 1; # Class-DBI-Frozen test failure
148 $exception{'Log Output: osrfsys.log'} = 3; # open-ils.cstore ERROR from live_t/08-lp1366964-libdbi-error.t (and related)
149 if (! defined $exception{$subpage}) {
150 $exception{$subpage} = 0;
152 #print "subpage = <$subpage> error_count = $error_count\n";
153 if ($error_count && $error_count != $exception{$subpage} ) {
154 print MAIN_PAGE ' - <span class="fail">Failed</span>';
155 if ($exception{$subpage} > 0) {
156 print MAIN_PAGE " - Expected $exception{$subpage} errors but encountered $error_count."
158 print PASS_FAIL "Failed\n";
160 if ($subpage_count) {
161 print MAIN_PAGE ' - <span class="pass">Passed</span>';
162 print PASS_FAIL "Passed\n";
168 my $html = "<h2>Current OpenSRF tip:</h2>\n<pre>$opensrf_tip</pre>\n";
169 $html .= "<h2>Current Evergreen tip:</h2>\n<pre>$evergreen_tip</pre>\n";
170 my $opensrf_tip_hash = '';
171 if ($opensrf_tip =~ /^(\S+)\s/) {
172 $opensrf_tip_hash = $1;
174 my $evergreen_tip_hash = '';
175 if ($evergreen_tip =~ /^(\S+)\s/) {
176 $evergreen_tip_hash = $1;
178 `touch prev_evergreen_tip.hash`;
179 `touch prev_opensrf_tip.hash`;
180 my $prev_opensrf_tip_hash = `cat prev_opensrf_tip.hash`;
181 chop $prev_opensrf_tip_hash;
182 my $prev_evergreen_tip_hash = `cat prev_evergreen_tip.hash`;
183 chop $prev_evergreen_tip_hash;
184 $html .= "<h2>OpenSRF commits since last build:</h2>\n<pre>";
185 $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`;
186 $html .= "</pre><h2>Evergreen commits since last build:</h2>\n<pre>";
187 $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`;
188 `echo $opensrf_tip_hash > prev_opensrf_tip.hash`;
189 `echo $evergreen_tip_hash > prev_evergreen_tip.hash`;
195 `touch pass_fail.txt.prev`;
196 if (`diff pass_fail.txt pass_fail.txt.prev`) {
197 $fail = `grep Failed pass_fail.txt`;
198 open RSS_FILE, ">test_rss.xml";
199 print RSS_FILE q^<?xml version="1.0"?>
202 <title>Test Output Summary</title>
203 <link>http://testing.evergreen-ils.org/~live/test.html</link>
204 <description>Live Test Suite</description>
207 ? q^<title>Test Failure - http://testing.evergreen-ils.org/~live/test.html</title>
208 <link>http://testing.evergreen-ils.org/~live/test.html</link>
209 <description>One or more tests failed</description>
211 : q^<title>Test Success - http://testing.evergreen-ils.org/~live/test.html</title>
212 <link>http://testing.evergreen-ils.org/~live/test.html</link>
213 <description>All tests passed</description>
221 `mv pass_fail.txt pass_fail.txt.prev`;