1#!/bin/sh 2 3if [ ! -d coverage ]; then 4 mkdir coverage 5fi 6cd coverage 7 8# It would be really nice to find a better way to do this than copying the 9# HTML into this script. But, I am being lazy right now. 10cat > index.html << EOF 11<!-- This is a generated file, do not edit --> 12<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 13"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 14<html> 15 <head> 16 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> 17 <meta name="author" content="APR Developers" /><meta name="email" content="[email protected]" /> 18 <title>Test Coverage</title> 19 </head> 20 <body bgcolor="#ffffff" text="#000000" link="#525D76"> 21<p><a href="/"><img src="./images/apr_logo_wide.png" alt="The Apache Portable Runtime Project" border="0"/></a></p> 22 <table border="0" width="100%" cellspacing="4"> 23 <tr> 24 <!-- LEFT SIDE NAVIGATION --> 25 <td valign="top" nowrap="nowrap"> 26 <a href="http://apachecon.com/" 27 ><img src="http://www.apache.org/images/ac2003-150.gif" height="86" 28 width="150" border="0" alt="ApacheCon" /></a> 29 <p><b>Get Involved</b></p> 30 <menu compact="compact"> 31 <li><a href="/anoncvs.txt">CVS</a></li> 32 <li><a href="/mailing-lists.html">Mailing Lists</a></li> 33 <li><a href="http://cvs.apache.org/snapshots/apr/">Snapshots</a></li> 34 <li><a href="/compiling_win32.html">Build on Win32</a></li> 35 <li><a href="/compiling_unix.html">Build on Unix</a></li> 36 </menu> 37 <p><b>Download!</b></p> 38 <menu compact="compact"> 39 <li><a href="http://www.apache.org/dyn/closer.cgi/apr/">from a mirror</a></li> 40 </menu> 41 <p><b>Docs</b></p> 42 <menu compact="compact"> 43 <li><a href="/docs/apr/">APR</a></li> 44 <li><a href="/docs/apr-util/">APR-util</a></li> 45 <li>APR-iconv</li> 46 </menu> 47 <p><b>Guidelines</b></p> 48 <menu compact="compact"> 49 <li><a href="/guidelines.html">Project Guidelines</a></li> 50 <li><a href="/patches.html">Contributing</a></li> 51 <li><a href="/versioning.html">Version Numbers</a></li> 52 </menu> 53 <p><b><a href="/info/">Miscellaneous</a></b></p> 54 <menu compact="compact"> 55 <li><a href="http://www.apache.org/LICENSE.txt">License</a></li> 56 <li><a href="/projects.html">Projects using APR</a></li> 57 </menu> 58 </td> 59 <!-- RIGHT SIDE INFORMATION --> 60 <td align="left" valign="top"> 61 <table border="0" cellspacing="0" cellpadding="2" width="100%"> 62 <tr><td bgcolor="#525D76"> 63 <font color="#ffffff" face="arial,helvetica,sanserif"> 64 <strong>APR Test Coverage</strong> 65 </font> 66 </td></tr> 67 <tr><td> 68 <blockquote> 69<p>This should give us some idea of how well our tests actually stress our 70code. To generate this data, do the following:</p> 71<menu compact="compact"> 72 <li>./buildconf</li> 73 <li>CFLAGS="-fprofile-arcs -ftest-coverage ./configure</li> 74 <li>make</li> 75 <li>cd test</li> 76 <li>make</li> 77 <li>./testall</li> 78 <li>cd ..</li> 79 <li>make gcov</li> 80</menu> 81<p>Note that this will only generate test coverage data for the testall script, 82but all tests should be moving to the unified framework, so this is correct.</p> 83 </blockquote> 84 85 <table border="0" width="100%" cellspacing="0"> 86EOF 87 88for i in `find .. -name "*.bb" -maxdepth 1 | sort`; do 89 percent=`gcov $i -o .. | grep "%" | awk -F'%' {'print $1'}` 90 name=`echo $i | awk -F'/' {'print $2'}` 91 basename=`echo $name | awk -F'.' {'print $1'}` 92 93 if [ "x$percent" = "x" ]; then 94 echo "<tr>" >> index.html 95 echo "<td bgcolor=#ffffff> Error generating data for $basename<br>" >> index.html 96 continue; 97 fi 98 intpercent=`echo "$percent/1" | bc` 99 if [ $intpercent -lt 33 ]; then 100 color="#ffaaaa" 101 else if [ $intpercent -lt 66 ]; then 102 color="#ffff77" 103 else 104 color="#aaffaa" 105 fi 106 fi 107 108 echo "<tr>" >> index.html 109 echo "<td bgcolor=$color><a href=\"$basename.c.gcov\">$basename</a><br>" >> index.html 110 echo "<td bgcolor=$color>$percent% tested" >> index.html 111done 112 113echo "</table><p>Last generated `date`</p>" >> index.html 114 115cat >> index.html << EOF 116</td></tr> 117</table> 118 <!-- FOOTER --> 119 <tr><td colspan="2"><hr noshade="noshade" size="1"/></td></tr> 120 <tr><td colspan="2" align="center"> 121 <font size="-1"> 122 <em>Copyright © 1999-2004, The Apache Software Foundation</em> 123 </font> 124 </td> 125 </tr> 126 </table> 127 </body> 128</html> 129 130EOF 131