<%perl>
# testing-state.html
#
# @author D. Chang
#
</%perl>

<%args>
$test_run_id
</%args>

<%perl>
# Retrieve and display testing state for a test run.

use DBI;
my $dbuser="root";
my $dbpass="panstar1";
my $dbname="psmops_testing_results";
my $dbhost="schmopc01.ifa.hawaii.edu";
my $dbconnect="DBI:mysql:$dbname:$dbhost";
my $dbh=DBI->connect($dbconnect,$dbuser,$dbpass) || die "ERROR: Cannot connect to database $dbname.";
my $sql="SELECT test_run_id,module,cvs_version,DATE_FORMAT(cvs_time,'%Y-%b-%d %a %H:%i') FROM test_versions
         WHERE test_run_id=$test_run_id
         ORDER BY module";
my $sth=$dbh->prepare($sql);
my $result=$sth->execute;
my $ts;
if($result){
    $ts=$sth->fetchall_arrayref();
}
$sql="SELECT DATE_FORMAT(time,'%Y-%b-%d %a %H:%i') FROM test_runs WHERE id=$test_run_id";
$sth=$dbh->prepare($sql);
$result=$sth->execute;
my $test_run_time;
if($result){
    $test_run_time=$sth->fetchall_arrayref();
}

</%perl>

<& header.mas &>

<table>
<tr>
<td>
&nbsp;<a href="/testing/unit-test-results.html?test_run_id=<% $test_run_id %>">Unit Test Results (<% $test_run_id %>)</a><br>
</td>
</tr>
</table>

<h2>Testing State</h2>
<p>
Test Run ID = <% $test_run_id %>, Time = <% $test_run_time->[0]->[0] %> GMT
</p>
<table border="1">
<tr>
<td>Module</td>
<td>Version</td>
<td>Time (GMT)</td>
</tr>

% for(my $i=0;$i<scalar(@$ts);$i++) {

<tr>
<td>
<% $ts->[$i]->[1] %>
</td>
<td>
<% $ts->[$i]->[2] %>
</td>
<td>
<% $ts->[$i]->[3] %>
</td>
</tr>

% }

</table>
<p>
<font size="-1">
<b>Version</b> CVS version.<br>
<b>Time</b> CVS time.<br>
</font>
</body>
</html>
