2
0

run-gcov.sh 4.4 KB

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