add RSS to the webifier. temporary URL for now
authorJason Etheridge <jason@esilibrary.com>
Mon, 12 Aug 2013 17:09:35 +0000 (13:09 -0400)
committerJason Etheridge <jason@esilibrary.com>
Mon, 12 Aug 2013 17:09:35 +0000 (13:09 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
qa/test_output_webifier.pl

index c3e35fa..bf22997 100755 (executable)
@@ -11,6 +11,8 @@ print MAIN_PAGE "<h1>Test Output Summary</h1>\n";
 print MAIN_PAGE 'HTML generated on ' . `date` . "\n";
 print MAIN_PAGE "<ul>\n";
 
+open PASS_FAIL, ">pass_fail.txt";
+
 while (my $line = <>) {
     if ($line =~ /_\.-~= (.*)$/) {
         $state = 'outputting';
@@ -75,6 +77,8 @@ while (my $line = <>) {
 print_pass_or_fail();
 print MAIN_PAGE html_footer();
 close MAIN_PAGE;
+close PASS_FAIL;
+update_rss();
 
 sub html_header {
     my $title = shift;
@@ -97,10 +101,41 @@ sub html_footer {
 sub print_pass_or_fail {
     if ($error_count) {
         print MAIN_PAGE ' - <span class="fail">Failed</span>';
+        print PASS_FAIL "Failed\n";
     } else {
         if ($subpage_count) {
             print MAIN_PAGE ' - <span class="pass">Passed</span>';
+            print PASS_FAIL "Passed\n";
         }
     }
 }
 
+sub update_rss {
+    `touch pass_fail.txt.prev`;
+    if (`diff pass_fail.txt pass_fail.txt.prev`) {
+        $fail = `grep Failed pass_fail.txt`;
+        open RSS_FILE, ">test_rss.xml";
+        print RSS_FILE q^<?xml version="1.0"?>
+<rss version="2.0">
+    <channel>
+        <title>Test Output Summary</title>
+        <link>http://phasefx.evergreencatalog.com/~opensrf/test.html</link>
+        <description>Live Test Suite</description>
+        <item>^ . (
+            $fail
+            ? q^<title>Test Failure - http://tinyurl.com/kb9lrzu</title>
+                <link>http://phasefx.evergreencatalog.com/~opensrf/test.html</link>
+                <description>One or more tests failed</description>
+                ^
+            : q^<title>Test Success - http://tinyurl.com/kb9lrzu</title>
+                <link>http://phasefx.evergreencatalog.com/~opensrf/test.html</link>
+                <description>All tests passed</description>
+                ^
+        ) . q^</item>
+    </channel>
+</rss>
+^;
+        close RSS_FILE;
+    }
+    `mv pass_fail.txt pass_fail.txt.prev`;
+}