4 # this program processes a bunch of directories routed at
5 # $REGRESSRESULTS. Each one is examined for a file "status"
6 # the result is an HTML table with the directory name as
7 # left columns (it is the implied test name), and the status
10 # if the test status is negative, then the results are a hotlink
11 # to that directory's output.
13 # The test names are links to the file "description.txt" if it
20 $failedcolour="#990000";
21 $succeedcolour="#009900";
22 $missingcolour="#000099";
34 if(-f "$testname/description.txt") {
35 print HTMLFILE "<TR><TD><A HREF=\"$testname/description.txt\">$testname</A></TD>\n";
37 print HTMLFILE "<TR><TD>$testname</TD>\n";
40 if(open(STATUS,"$testname/status")) {
42 chop($result=<STATUS>);
43 if($result =~ /(Yes|True|1|Succeed|Passed)/i) {
45 $link="<FONT COLOR=\"$succeedcolour\">passed</FONT>";
49 $link="<FONT COLOR=\"$failedcolour\">FAILED</FONT>";
50 if(-d "$testname/OUTPUT") {
51 $output="$testname/OUTPUT";
52 $link="<A HREF=\"$output\">$link</A>";
54 push(@faillist, $testname);
59 $link="<FONT COLOR=\"$missingcolour\">missing</FONT>";
60 if(-d "$testname/OUTPUT") {
61 $output="$testname/OUTPUT";
62 $link="<A HREF=\"$output\">$link</A>";
67 print HTMLFILE "<TD>$link</TD>";
69 if(-f "$testname/regress.txt") {
70 open(PROBREPORT, "$testname/regress.txt") || die "$testname/regress.txt: $!\n";
71 chop($prnum=<PROBREPORT>);
73 print "<TD><A HREF=\"http://gnats.freeswan.org/bugs/gnatsweb.pl?database=freeswan&cmd=view+audit-trail&pr=$prnum\">PR#$prnum</A></TD>";
75 } elsif(-f "$testname/goal.txt") {
76 open(GOALREQ, "$testname/goal.txt") || die "$testname/regress.txt: $!\n";
77 chop($goalnum=<GOALREQ>);
80 $goalnum=sprintf("%03d", $goalnum);
81 print "<TD><A HREF=\"http://www.freeswan.org/freeswan_snaps/CURRENT-SNAP/klips/doc/klipsNGreq/requirements/$goalnum\">Requirement $goalnum</A></TD>";
83 } elsif(-f "$testname/exploit.txt") {
84 open(EXPLOIT, "$testname/exploit.txt") || die "$testname/exploit.txt: $!\n";
89 # test not categorized, output nothing.
92 print HTMLFILE "</TR>\n";
95 # the test names are sorted.
97 $REGRESSRESULTS=$ENV{'REGRESSRESULTS'};
99 if(defined($ARGV[0])) {
100 $REGRESSRESULTS=$ARGV[0];
103 if( ! -d $REGRESSRESULTS ) {
104 die "No such directory $REGRESSRESULTS.";
107 chdir($REGRESSRESULTS);
109 opendir(TESTS,".") || die "opendir $REGRESSRESULTS: $!\n";
110 @tests=readdir(TESTS);
113 @testnames=sort @tests;
116 # make pass through the tests, categorizing them.
121 foreach $testname (@testnames) {
122 if(-f "$testname/regress.txt") {
123 push(@regresstests,$testname);
124 } elsif(-f "$testname/goal.txt") {
125 push(@goaltests, $testname);
126 } elsif(-f "$testname/exploit.txt") {
127 push(@exploittests, $testname);
129 push(@regresstests,$testname);
133 if(open(DATE, "datestamp")) {
134 chop($timestamp=<DATE>);
136 $runtime=&ctime($timestamp);
138 $runtime="an unknown time";
140 $hostname=`uname -n`;
142 open(HTMLFILE, ">testresults.html") || die "Can not open testresults.html: $!\n";
144 print HTMLFILE "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n";
145 print HTMLFILE "<HTML> <HEAD>\n";
146 print HTMLFILE "<TITLE>FreeSWAN nightly testing results for $runtime</TITLE>\n";
147 print HTMLFILE "</HEAD> <BODY>\n";
148 print HTMLFILE "<H1>FreeSWAN nightly testing results for $runtime on $hostname</H1>\n";
149 print HTMLFILE "<TABLE>\n";
151 print HTMLFILE "<TR COLSPAN=3>Regression tests</TR>\n";
152 print HTMLFILE "<TR><TH>Test name</TH><TH>Result</TH><TH>Detail</TH></TR>\n";
154 foreach $testname (@regresstests) {
155 next if($testname =~ /^\./);
156 next unless(-d $testname);
158 &htmlize_test($testname);
161 print HTMLFILE "<TR COLSPAN=3>Goal tests</TR>\n";
162 print HTMLFILE "<TR><TH>Test name</TH><TH>Result</TH><TH>Detail</TH></TR>\n";
164 foreach $testname (@goaltests) {
165 next if($testname =~ /^\./);
166 next unless(-d $testname);
168 &htmlize_test($testname);
171 print HTMLFILE "<TR COLSPAN=3>Exploits</TR>\n";
172 print HTMLFILE "<TR><TH>Test name</TH><TH>Result</TH><TH>Detail</TH></TR>\n";
174 foreach $testname (@exploittests) {
175 next if($testname =~ /^\./);
176 next unless(-d $testname);
178 &htmlize_test($testname);
181 print HTMLFILE "</TABLE> \n";
182 print HTMLFILE "\n<BR><PRE>TOTAL tests: $total PASSED: $passed FAILED: $failed MISSED: $missed SUCCESS RATE: %".sprintf("%2.1d",(($passed*100)/$total))."</PRE><BR>\n";
183 print HTMLFILE "<A HREF=\"stdout.txt\">stdout</A><BR>\n";
184 print HTMLFILE "<A HREF=\"stderr.txt\">stderr</A><BR>\n";
185 print HTMLFILE "</BODY></HTML>\n";
188 open(FAILLIST, ">faillist.txt") || die "failed to write to faillist.txt: $!\n";
189 print FAILLIST join('\n', @faillist)."\n";