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';
10 my $evergreen_tip = '';
12 open MAIN_PAGE, ">test.html";
13 print MAIN_PAGE html_header('Test Output Summary');
14 print MAIN_PAGE qq^<a href="$ARGV[0]">Raw Output</a>\n^;
15 print MAIN_PAGE "<h1>Test Output Summary</h1>\n";
16 print MAIN_PAGE 'HTML generated on ' . `date` . "\n";
17 print MAIN_PAGE "<ul>\n";
19 open PASS_FAIL, ">pass_fail.txt";
21 while (my $line = <>) {
22 if ($line =~ /Tip of OpenSRF: (.*)/) {
25 if ($line =~ /Tip of Evergreen: (.*)/) {
28 if ($line =~ /_\.-~= (.*)$/) {
29 $state = 'outputting';
33 print MAIN_PAGE qq^\n<li><a href="test.$subpage_count.html">$1</a>^;
34 open SUB_PAGE, ">test.$subpage_count.html";
35 print SUB_PAGE html_header($1);
36 print SUB_PAGE "<h1>$1</h1>\n<pre>";
38 if ($state eq 'outputting') {
39 my $class = 'output ';
44 || $line =~ /\* Jabber successfully connected/
45 || $line =~ /\* Database has the expected server encoding /
49 $class .= 'error ' if ($line =~ /^err/i);
50 if (($line =~ /^not ok/ && !($line =~ /TODO/))
51 || $line =~ /\. not ok/
52 || $line =~ /\* ERROR/
53 || $line =~ /\* WARNING/
58 if ($line =~ /^not ok/ && $line =~ /TODO/) {
61 $class .= 'result ' if ($line =~ /^Result:/);
62 $class .= 'pass ' if ($line =~ /^Result: PASS/);
63 if ($line =~ /^Result: FAIL/) {
79 my $html_line = "<span class='$class'>$line</span>";
80 print SUB_PAGE "$html_line\n";
82 if ($line =~ /=~-\._/) {
83 print SUB_PAGE "</pre>\n" . html_footer();
89 print MAIN_PAGE "</ul>\n" . branch_tips() . "\n" . html_footer();
100 <link rel="stylesheet" type="text/css" href="test_output.css">
101 <link rel="alternate" title="Test RSS" href="http://testing.evergreen-ils.org/~live/test_rss.xml" type="application/rss+xml">
113 sub print_pass_or_fail {
115 print MAIN_PAGE ' - <span class="fail">Failed</span>';
116 print PASS_FAIL "Failed\n";
118 if ($subpage_count) {
119 print MAIN_PAGE ' - <span class="pass">Passed</span>';
120 print PASS_FAIL "Passed\n";
126 my $html = "<h2>Current OpenSRF tip:</h2>\n<pre>$opensrf_tip</pre>\n";
127 $html .= "<h2>Current Evergreen tip:</h2>\n<pre>$evergreen_tip</pre>\n";
128 my $opensrf_tip_hash = '';
129 if ($opensrf_tip =~ /^(\S+)\s/) {
130 $opensrf_tip_hash = $1;
132 my $evergreen_tip_hash = '';
133 if ($evergreen_tip =~ /^(\S+)\s/) {
134 $evergreen_tip_hash = $1;
136 `touch prev_evergreen_tip.hash`;
137 `touch prev_opensrf_tip.hash`;
138 my $prev_opensrf_tip_hash = `cat prev_opensrf_tip.hash`;
139 chop $prev_opensrf_tip_hash;
140 my $prev_evergreen_tip_hash = `cat prev_evergreen_tip.hash`;
141 chop $prev_evergreen_tip_hash;
142 $html .= "<h2>OpenSRF commits since last build:</h2>\n<pre>";
143 $html .= `cd ~/git/OpenSRF/ ; git fetch 2> /dev/null ; git log --format=oneline $prev_opensrf_tip_hash..$opensrf_tip_hash`;
144 $html .= "</pre><h2>Evergreen commits since last build:</h2>\n<pre>";
145 $html .= `cd ~/git/Evergreen/ ; git fetch 2> /dev/null ; git log --format=oneline $prev_evergreen_tip_hash..$evergreen_tip_hash`;
146 `echo $opensrf_tip_hash > prev_opensrf_tip.hash`;
147 `echo $evergreen_tip_hash > prev_evergreen_tip.hash`;
153 `touch pass_fail.txt.prev`;
154 if (`diff pass_fail.txt pass_fail.txt.prev`) {
155 $fail = `grep Failed pass_fail.txt`;
156 open RSS_FILE, ">test_rss.xml";
157 print RSS_FILE q^<?xml version="1.0"?>
160 <title>Test Output Summary</title>
161 <link>http://testing.evergreen-ils.org/~live/test.html</link>
162 <description>Live Test Suite</description>
165 ? q^<title>Test Failure - http://testing.evergreen-ils.org/~live/test.html</title>
166 <link>http://testing.evergreen-ils.org/~live/test.html</link>
167 <description>One or more tests failed</description>
169 : q^<title>Test Success - http://testing.evergreen-ils.org/~live/test.html</title>
170 <link>http://testing.evergreen-ils.org/~live/test.html</link>
171 <description>All tests passed</description>
179 `mv pass_fail.txt pass_fail.txt.prev`;