gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] html regression views


From: Evan Berggren Daniel
Subject: [gnugo-devel] html regression views
Date: Fri, 9 May 2003 16:02:13 -0400 (EDT)

Here is the documentation I promised Dan ages ago on setting up the html
views.  I haven't actually tested the documentation, but I think I got
everything (ie, it would be really nice if somebody tried going through it
and informed me of any missing steps).  Also included is a patch to
regress.plx that this setup requires.

As an FYI, evand.rh.ncsu.edu will disappear when I go home for the summer,
sometime on wednesday 5/14.  If needed, I can probably find an alternate
home for the regression views, but it would probably be simpler for
someone else to put them up.

Evan Daniel


Setting up the html regression views

This documentation assumes an apache configured as per Debian's Apache 1.3
distribution, but it should be fairly close to the config for other 
distributions.

First, you will need to configure Apache to run CGI scripts in the directory
you wish to serve the html views from.  To do this, add the following to
/etc/apache/httpd.conf (or to a user-specific conf file if applicable):

<Directory /path/to/script/>
    Options +ExecCGI
</Directory>

This allows CGI scripts to be executed in the directory used by regress.plx.
Next, you need to tell Apache that .plx is a CGI script ending.  Your httpd.conf
file should contain a section <IfModule mod_mime.c>.  Within that section, there
may or may not be a line
AddHandler cgi-script ....

If there isn't already, add it; add .plx to the list of extensions.

You will also need to make sure you have the necessary modules loaded to run CGI
scripts; mod_cgi and mod_mime should be sufficient.  Your httpd.conf should have
the relevant LoadModule lines; uncomment them if neccessary.

Next, you need to put a copy of regress.plx in the directory that you plan to
serve the html views from.

You will also need to install the Perl module GD, available from CPAN or via
apt-get install libgd-perl on Debian.

Finally, run regression/regress.pl to create the xml data used to generate the
html views; then, copy the html/ directory to the same directory as regress.plx
resides in.

At this point, you should have a working copy of the html regression views.




Index: regression/regress.plx
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/regress.plx,v
retrieving revision 1.19
diff -u -d -r1.19 regress.plx
--- regression/regress.plx      22 Sep 2002 19:38:51 -0000      1.19
+++ regression/regress.plx      9 May 2003 19:38:34 -0000
@@ -54,6 +54,11 @@
 use HTML::Entities ;#qw/encode_entity/;


+#set $name to whatever this script is called in the URL.
+#eg, if you access it from http://example.com/regress/
+#then set $name = ""
+
+my $name = "regress.plx";

 my $debug=2;

@@ -87,7 +92,7 @@
 sub sgfFile(%);


-print "HTTP/1.0 200 OK\r\n";
+#print "HTTP/1.0 200 OK\r\n";
 print "Content-type: " .
         do {
           my $plain = $trace;
@@ -225,7 +230,7 @@

   open I, ">html/index.html";

-  print I '<HTML>
+  print I qq@<HTML>
  <HEAD>
   <TITLE>Regression test summary - </TITLE>
   <META NAME="ROBOTS" CONTENT="NOFOLLOW">
@@ -233,11 +238,11 @@
  <BODY>
  <H3> Regression test summary - </H3>
  Program: _CMDLINE_TBD_ <BR>
- <A href="?bycat=1">View by category</A><BR>
- <A href="?unexpected=1">View unexpected results</A><BR>
+ <A href="$name?bycat=1">View by category</A><BR>
+ <A href="$name?unexpected=1">View unexpected results</A><BR>
  <TABLE border=1>
  <TR><TD>file</TD><TD>passed</TD><TD>PASSED</TD><TD>failed</TD><TD>FAILED</TD>
- </TR>';
+ </TR>@;

   my @pflist = ("passed", "PASSED", "failed", "FAILED");
   my %totHash;
@@ -255,14 +260,14 @@
     if ($k1 !~ /^$curfile:/) {
       if ($curfile ne "") {
         #New file = print old totals
-        print I qq@<TR>\n <TD><A 
href="?tstfile=$curfile&sortby=result">$curfile</A></TD>\n@;
+        print I qq@<TR>\n <TD><A 
href="$name?tstfile=$curfile&sortby=result">$curfile</A></TD>\n@;
         foreach my $k2 (@pflist) {
           my $c = @{$subTotHash{$k2}};  #i.e. length of array.
           $totHash{$k2} += $c;
           if ($k2 !~ /passed/ and $c) {
             print I " <TD>$c:<BR>\n";
             foreach (sort {$a<=>$b} @{$subTotHash{$k2}}) {
-              print I qq@  <A HREF="?$curfile:$_">$_</A>\n@;
+              print I qq@  <A href="$name?$curfile:$_">$_</A>\n@;
             }
             print I " </TD>\n";
           } else {
@@ -281,14 +286,14 @@
       #direct copy from above - don't miss last time through - HACK!
         if ($curfile ne "") {
         #New file = print old totals
-        print I qq@<TR>\n <TD><A 
href="?tstfile=$curfile&sortby=result">$curfile</A></TD>\n@;
+        print I qq@<TR>\n <TD><A 
href="$name?tstfile=$curfile&sortby=result">$curfile</A></TD>\n@;
         foreach my $k2 (@pflist) {
           my $c = @{$subTotHash{$k2}};  #i.e. length of array.
           $totHash{$k2} += $c;
           if ($k2 !~ /passed/ and $c) {
             print I " <TD>$c:<BR>\n";
             foreach (sort {$a<=>$b} @{$subTotHash{$k2}}) {
-              print I qq@  <A HREF="?$curfile:$_">$_</A>\n@;
+              print I qq@  <A href="$name?$curfile:$_">$_</A>\n@;
             }
             print I " </TD>\n";
           } else {
@@ -421,8 +426,8 @@
   print qq@<HR>\n\n@;
   print qq@
 <TABLE border=0>
-<TR><TD><A HREF="?tstfile=$tstfile&num=$num&sgf=1">SGF File</A>
-</TD><TD>&nbsp;&nbsp;&nbsp;<A HREF="?tstfile=$tstfile&num=$num&trace=1" 
target=tracefile>Trace File</A>
+<TR><TD><A href="$name?tstfile=$tstfile&num=$num&sgf=1">SGF File</A>
+</TD><TD>&nbsp;&nbsp;&nbsp;<A href="$name?tstfile=$tstfile&num=$num&trace=1" 
target=tracefile>Trace File</A>
 </TD></TR></TABLE>
 @;

@@ -476,7 +481,7 @@
       }

       my $colorboard_imgsrc = createPngFile($bw, $img_pix_size, "", 
$dragonletter, $dragoncolor, $owlletter, $owlcolor, $markcolor);
-      $colorboard .= qq@  <TD><A href="?tstfile=$tstfile&num=$num&move=$coord" 
target=movewin>@ .
+      $colorboard .= qq@  <TD><A 
href="$name?tstfile=$tstfile&num=$num&move=$coord" target=movewin>@ .
                      qq@<IMG border=0 HEIGHT=$img_pix_size WIDTH=$img_pix_size 
@ .
                      
address@hidden"html/images/$colorboard_imgsrc"></A></TD>\n@;
     }
@@ -555,7 +560,7 @@

     my %attribs = %{game_parse($content, 1)};

-    print qq@<HR><A 
HREF="?$tstfile:$attribs{num}">$tstfile:$attribs{num}</A>\n@;
+    print qq@<HR><A 
href="$name?$tstfile:$attribs{num}">$tstfile:$attribs{num}</A>\n@;

     my $boardsize = $attribs{"boardsize"};  #need to add to export.
     my $colorboard;
@@ -611,16 +616,16 @@
   print TF "<H3>$tstfile regression results - _VERSION_</H3>\n";
   print TF qq@<TABLE border=1>
 <tr>
-  <TH><A HREF="?tstfile=$tstfile&sortby=filepos">line</A></TH>
-  <TH><A href="?tstfile=$tstfile&sortby=num">number</A></TH>
-  <TH><A href="?tstfile=$tstfile&sortby=result">result</A></TH>
+  <TH><A href="$name?tstfile=$tstfile&sortby=filepos">line</A></TH>
+  <TH><A href="$name?tstfile=$tstfile&sortby=num">number</A></TH>
+  <TH><A href="$name?tstfile=$tstfile&sortby=result">result</A></TH>
   <TH>expected </TH>
   <TH>got</TH>
   <TH>gtp</TH>
-  <TH><A href="?tstfile=$tstfile&sortby=cputime">cputime</A></TH>
-  <TH><A href="?tstfile=$tstfile&sortby=owl_node">owl_node</A></TH>
-  <TH><A href="?tstfile=$tstfile&sortby=reading_node">reading_node</A></TH>
-  <TH><A href="?tstfile=$tstfile&sortby=msperowl">1000*time/owl_node</A></TH>
+  <TH><A href="$name?tstfile=$tstfile&sortby=cputime">cputime</A></TH>
+  <TH><A href="$name?tstfile=$tstfile&sortby=owl_node">owl_node</A></TH>
+  <TH><A 
href="$name?tstfile=$tstfile&sortby=reading_node">reading_node</A></TH>
+  <TH><A 
href="$name?tstfile=$tstfile&sortby=msperowl">1000*time/owl_node</A></TH>
 </TR>\n@;

   my @files = glob("html/$tstfile.tst/*.xml");
@@ -707,7 +712,7 @@

   foreach my $curfile (sort {filesby($sortby)} keys %files) {
     my %h = %{$files{$curfile}};
-    my $numURL = qq@<A HREF="?$tstfile:$h{num}">$h{num}</A>@;
+    my $numURL = qq@<A href="$name?$tstfile:$h{num}">$h{num}</A>@;
     my $r = $h{result};
     $r =~ address@hidden([A-Z]*)$@<B>$1</B>@;
     print TF 
"<TR><TD>$h{filepos}</TD><TD>$numURL</TD><TD>$r</TD><TD>$h{expected}</TD>"
@@ -880,7 +885,7 @@
   foreach my $k (sort $by_cputime keys %h) {
     $i++;
     last if $i > 50;
-    print qq@<TR><TD><A HREF="?$k">$k</TD><TD>$h{$k}->{status}</TD>@;
+    print qq@<TR><TD><A href="$name?$k">$k</TD><TD>$h{$k}->{status}</TD>@;
     print qq@    <TD>$h{$k}->{cputime}</TD></TR>@;
     my ($p, $n) = $k =~ /(\w+):(\d+)/;
     open (F, "html/$p.tst/$n.trace") or do {print "Missing trace file for 
$k<BR>"; next;};
@@ -919,7 +924,7 @@
     open (BF, $sfile);
     while (<BF>) {
       if (/^((\w+):(\d+))/) {
-        print qq@<TR><TD><A HREF="?$1">$1</A></TD><TD>$h{$1}->{status}</TD>@ .
+        print qq@<TR><TD><A 
href="$name?$1">$1</A></TD><TD>$h{$1}->{status}</TD>@ .
               qq@<TD>$h{$1}->{cputime}</TD></TR>\n@;
       }
     }
@@ -999,16 +1004,16 @@
     print "<TABLE border=1>";
     print "<TR><TD><B>Problem</B></TD><TD><B>Status</B></TD></TR>\n";
     foreach (@ufails) {
-      print qq@<TR><TD><A HREF="?$_">$_</A></TD><TD>FAILED</TD></TR>\n@;
+      print qq@<TR><TD><A href="$name?$_">$_</A></TD><TD>FAILED</TD></TR>\n@;
     }
     foreach (@fails) {
-      print qq@<TR><TD><A HREF="?$_">$_</A></TD><TD>failed</TD></TR>\n@;
+      print qq@<TR><TD><A href="$name?$_">$_</A></TD><TD>failed</TD></TR>\n@;
     }
     foreach (@upasses) {
-      print qq@<TR><TD><A HREF="?$_">$_</A></TD><TD>PASSED</TD></TR>\n@;
+      print qq@<TR><TD><A href="$name?$_">$_</A></TD><TD>PASSED</TD></TR>\n@;
     }
     foreach (@passes) {
-      print qq@<TR><TD><A HREF="?$_">$_</A></TD><TD>passed</TD></TR>\n@;
+      print qq@<TR><TD><A href="$name?$_">$_</A></TD><TD>passed</TD></TR>\n@;
     }
     print "</TABLE>\n";
     print "</body></html>\n";
@@ -1095,7 +1100,7 @@
        <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
       </HEAD>\n@;
     print "<BODY><H4>Failures by category</H4>";
-    print qq@<A href="?">main index</A>@;
+    print qq@<A href="$name?">main index</A>@;


     print "<TABLE border=1>";
@@ -1114,7 +1119,7 @@
         $sev = getsev($fails{$k});
         print "<TD>$sev</TD><TD>\n";
       }
-      print qq@<A href="?$k">$k</A>&nbsp&nbsp</A>\n@;
+      print qq@<A href="$name?$k">$k</A>&nbsp&nbsp</A>\n@;
     }
     print "</TABLE>\n";
     print "</body></html>\n";







reply via email to

[Prev in Thread] Current Thread [Next in Thread]