Add testcases detail column to status page
[buildfarm-server.git] / cgi-bin / show_status.pl
index 187925f4ee2ebb25b617ded2cb4ffa540613c2d5..baf9623197acae357d3ad9f7606a7abcb035bf8b 100755 (executable)
@@ -15,14 +15,14 @@ use CGI;
 
 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir);
 
-
-require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+use FindBin qw($RealBin);
+require "$RealBin/../BuildFarmWeb.pl";
 
 my $query = new CGI;
 my @members = $query->param('member');
 map { s/[^a-zA-Z0-9_ -]//g; } @members;
 
-my $dsn="dbi:mysql:dbname=$dbname";
+my $dsn="dbi:Pg:dbname=$dbname";
 $dsn .= ";host=$dbhost" if $dbhost;
 $dsn .= ";port=$dbport" if $dbport;
 
@@ -48,11 +48,14 @@ my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0})
 my $statement =<<EOS;
 
 
-  select timezone('GMT'::text, now())::timestamp(0) without time zone - b.snapshot AS when_ago, b.*
-  from dashboard_mat b
-  order by branch = 'HEAD' desc,
-        branch desc, $sort_clause 
-        snapshot desc
+  SELECT timezone('GMT'::text, now())::timestamp(0) without time zone - b.snapshot AS when_ago,
+       b.*,
+       s.log_text
+  FROM dashboard_mat b LEFT JOIN build_status_log s
+  ON b.snapshot = s.snapshot AND s.log_stage = 'test-results.log'
+  ORDER BY b.branch = 'master' desc,
+        b.branch desc, $sort_clause 
+        b.snapshot desc
 
 EOS
 ;
@@ -65,21 +68,12 @@ while (my $row = $sth->fetchrow_hashref)
     next if (@members && ! grep {$_ eq $row->{sysname} } @members);
     $row->{build_flags}  =~ s/^\{(.*)\}$/$1/;
     $row->{build_flags}  =~ s/,/ /g;
-       # enable-integer-datetimes is now the default
-       if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE')
-       {
-               $row->{build_flags} .= " --enable-integer-datetimes "
-                       unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/);
-       }
-       # enable-thread-safety is now the default
-       if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE')
-       {
-               $row->{build_flags} .= " --enable-thread-safety "
-                       unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/);
-       }
-    $row->{build_flags}  =~ s/--((enable|with)-)?//g;
-       $row->{build_flags} =~ s/libxml/xml/;
-    $row->{build_flags}  =~ s/\S+=\S+//g;
+    $row->{build_flags}  =~ s/_PC\b//g;
+    $row->{build_flags} = lc($row->{build_flags});
+    if (defined($row->{log_text}))
+      {                # convert to a hash
+      $row->{log_text} = { split /\s+/, $row->{log_text} };
+      }
     push(@$statrows,$row);
 }
 $sth->finish;