summaryrefslogblamecommitdiffstats
path: root/rtems-coverage/generate_coverage_html
blob: 1df2fba13f16149394bdd9e272de93b1c628ecca (plain) (tree)
1
2
3
4



                                                      















                                                           


                                          
                                                  























                                                 
              


                        
                      


                                      
                         







                                         
                      
                           


                       
                               

  
 
             



         
            





                        


                                                                               
                     
                                
   

                                              
                                             
 
          



       






                                                                          




                                           
                                                           
                                                            
                                                              


         







               
            






                                                                               
                                      










                                                       
    
                                                           





                  





               






                                                         

 
                                
              


















                                  
               
 

                                                    
                                                            


                             
           


                          
   
                                   







                                                    

        
                 
    







                                                               
     




     
 
                                   








                                                                 
 



                                                      
 




                                                               



         



    
                                   

                                                       
 

                                                                         
 

                                                                   
 

                                                              
 


                                                                       



         

        

     








                                                               
    
                                    

                                                                                           

                                            
                                                                             





                                         
                         





                                    
                   
 
            
                                                                      
                  
      
                                                
          
                                                     
                                                                                






                                                
 


                               
                                                        
               

                                                            
           

                                             

                   



                  

            


                                                              
      
                                                  
                                                                
                                                               
                        
                                                        
                                 

 

         
                    



                                                    
                                                                           





                                                
 


      



















                                                              
                                                        






                                                                           





                                        
































































                                                                      
                            


                                 
 
                                                                              
                                                  
                                                                              
                                                  
                                                                              
                                                  
                                                                              
                                              



          
                                                              

                                                         








                                                           



                                         
                                   

                        






              













                                      






































































                                                                                                                            
                                   




                                                                        
                                                        
                        
                                                                      
 
                                                  
                        

                                                                

                        
                                                           
 
                                                 
                        



                                                                    

 



















                                                                           

                                                         



                               
 



                                          

                                                                         
                 
 
                                                           
                  





                                                    




                                                        

                                
 

                           
 
                                   

                       

                                                   
                  
  
                                          
              
                                   
 
                                   





                                                     
      










                                                                     
        







                                                                        
          
        
 



                                               
    
      
#! /bin/sh
#
#  Combine the various reports into a single html file
#

vfile=`dirname $0`/VERSIONS-COVERAGE
if [ ! -r ${vfile} ] ; then
  echo VERSIONS-COVERAGE file not found
  exit 1
fi

source ${vfile}

if [ ! -d ${BASEDIR} ] ; then
  echo Have you set the BASEDIR in VERSIONS correctly?
  exit 1
fi

progname=${0##*/}        # fast basename hack for ksh, bash

USAGE=\
"usage: $progname [ -opts ]
        -v         -- verbose (default=no)
        -p         -- generate plots (default=yes)
        -r VERSION -- RTEMS Version (default=CVS)
"

#   log an error to stderr
prerr()
{
    echo "$*" >&2
}

fatal() {
    prerr "$USAGE"
    [ "$1" ] && (prerr ; prerr $*);
    exit 1
}

toggle()
{
  case $1 in
    no)  echo "yes" ;;
    yes) echo "no" ;;
    *)   fatal "Unknown value to toggle ($1)" ;;
  esac
}

do_plots="yes"
verbose="no"
RTEMS_VERSION="CVS Head"

while getopts vpr: OPT
do
    case "$OPT" in
        r) RTEMS_VERSION="${OPTARG}";;
        p) do_plots=no ;;
        v) verbose=`toggle ${verbose}` ;;
        *) fatal;;
    esac
done

shiftcount=`expr $OPTIND - 1`
shift $shiftcount

if [ $# -ne 1 ] ; then
  fatal Usage: $0 directory
fi

if [ ! -d ${1} ] ; then
  fatal ${1} is not a directory
fi


print_index()
{
cat <<EOF
<HTML>
<HEAD>
<TITLE>RTEMS
EOF

echo ${RTEMS_VERSION}

cat <<EOF
Coverage Reports</TITLE>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link rel="stylesheet" type="text/css" href="rtems/style.css" media="screen" />
<div class="heading">
<div class="heading-title">RTEMS
EOF

echo ${RTEMS_VERSION}" Coverage Results</div>"
echo "<div class=\"datetime\">"`date`"</div>"

cat << EOF
</div>
</HEAD>
<body>
<br>
<p class="body">For more information on coverage analysis in general visit
<a href="http://www.rtems.org/wiki/index.php/Coverage_Analysis_Theory">
Coverage Analysis Theory</a>.</p>
<p class="body">For information on how the RTEMS Project
views coverage analysis, visit
<a href="http://www.rtems.org/wiki/index.php/RTEMS_Coverage_Analysis">
RTEMS Coverage Testing</a>.</p>
<strong>BSPs with Coverage Results</strong>
<ul>
EOF
for bsp in $BSPs
do
  cpu=`grep "^Target" ${bsp}/${bsp}-*/configuration.txt | \
	sed -e 's/^.*Target: *//' | cut -d'-' -f1 | sort -u`
  echo "<li><a href=\"${bsp}/${bsp}.html\">${cpu}/${bsp}</li>"
done
cat <<EOF
</ul>
EOF
}

print_doc_top()
{
cat <<EOF
<HTML>
<HEAD>
<TITLE>RTEMS
EOF

echo "${RTEMS_VERSION} Coverage Reports for ${1} </TITLE>"
cat <<EOF
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link rel="stylesheet" type="text/css" href="rtems/style.css" media="screen" />
<script src="rtems/table.js"></script>
<div class="heading">
<div class="heading-title">RTEMS
EOF

echo ${RTEMS_VERSION}" Coverage Results for ${1}</div>"
echo "<div class=\"datetime\">"`date`"</div>"

cat << EOF
</div>
</HEAD>
<body>
<br>
<table class="stats-table" cellspacing="1" cellpadding="2">
EOF
}

print_doc_bottom()
{
cat <<EOF
</body>
EOF
}

print_heading()
{
  if [ "${*}" = "Day" ] ; then
    echo "<th class=\"table-sortable:date\">${*}</th>"
  elif [ "${*}" = "Results" ] ; then
    echo "<th>${*}</th>"
  else
    echo "<th class=\"table-sortable:numeric\">${*}</th>"
  fi
}

# need to use ${1} for parameter
# need to pass
convert_flags() {
  opt=`echo "-${1}" | cut -c1-3`
  pos=`echo "${1}" | cut -c3`
  dev=`echo "${1}" | cut -c4`

  posix="POSIX Enabled"
  deve="Developmental"

  if [ X"${pos}" = X"p" ] ; then
    posix="POSIX Disabled"
  fi

  if [ X"${dev}" = X"d" ] ; then
    deve="Core Only"
  fi

  echo "${opt}, ${posix}, ${deve}"
}

do_perBSPPage()
{
  BSP=${1}
  cpu=`grep "^Target" ${bsp}-*/configuration.txt | \
        sed -e 's/^.*Target: *//' | cut -d'-' -f1 | sort -u`

  print_doc_top ${cpu}/${BSP}

  cat <<EOF
<table align="center">
<thead>
<tr class="heading-title">
EOF
  if [ ${do_plots} = "yes" ] ; then
    echo "<td width=\"30%\">Result Tables</td>"
    echo "<td width=\"30%\">Time Series Graphs</td>"
    echo "<td width=\"30%\">TimePlot Graphs</td>"
  else
    echo "<td>Result Tables</td>"
  fi

cat <<EOF
</thead>
</tr>
<td align="left">
<ul>
<li><a href="#O2pd">-O2, POSIX Disabled, Core Only</a></li>
<li><a href="#O2pD">-O2, POSIX Disabled, Developmental</a></li>
<li><a href="#O2Pd">-O2, POSIX Enabled, Core Only</a></li>
<li><a href="#O2PD">-O2, POSIX Enabled, Developmental</a></li>
<li><a href="#Ospd">-Os, POSIX Disabled, Core Only</a></li>
<li><a href="#OspD">-Os, POSIX Disabled, Developmental</a></li>
<li><a href="#OsPd">-Os, POSIX Enabled, Core Only</a></li>
<li><a href="#OsPD">-Os, POSIX Enabled, Developmental</a></li>
</ul>
</td>
<td>
<ul>
EOF


  if [ ${do_plots} = "yes" ] ; then
    echo "<li><a href=\"graphs/${BSP}-uncovered_percent-d.png\">"
    echo "  Uncovered Percentage (Core)</a></li>"
    echo "<li><a href=\"graphs/${BSP}-uncovered_percent-D.png\">"
    echo "  Uncovered Percentage (Developmental)</a></li>"

    echo "<li><a href=\"graphs/${BSP}-total_bytes-d.png\">"
    echo "  Total Bytes Analyzed (Core)</a></li>"
    echo "<li><a href=\"graphs/${BSP}-total_bytes-D.png\">"
    echo "  Total Bytes Analyzed (Developmental)</a></li>"

    echo "<li><a href=\"graphs/${BSP}-ranges-d.png\">"
    echo "  Uncovered Ranges (Core)</a></li>"
    echo "<li><a href=\"graphs/${BSP}-ranges-D.png\">"
    echo "  Uncovered Ranges (Developmental)</a></li>"

    echo "<li><a href=\"graphs/${BSP}-uncovered_bytes-d.png\">"
    echo "  Uncovered Bytes (Core)</a></li>"
    echo "<li><a href=\"graphs/${BSP}-uncovered_bytes-D.png\">"
    echo "  Uncovered Bytes (Developmental)</a></li>"
  fi

cat <<EOF
</ul>
</td>
<td>
<ul>
EOF

  if [ ${do_plots} = "yes" ] ; then
    echo "<li><a href=\"graphs/timeplot-${BSP}.html\">"
    echo "  TimePlot Graphs</a></li>"

    echo "<li><a href=\"graphs/timeplot-${BSP}.html#uncovered_percent\">"
    echo "  Uncovered Percentage</a></li>"

    echo "<li><a href=\"graphs/timeplot-${BSP}.html#total_bytes\">"
    echo "  Total Bytes Analyzed</a></li>"

    echo "<li><a href=\"graphs/timeplot-${BSP}.html#ranges\">"
    echo "  Uncovered Ranges</a></li>"

    echo "<li><a href=\"graphs/timeplot-${BSP}.html#uncovered_bytes\">"
    echo "  Uncovered Bytes</a></li>"
  fi

cat <<EOF
</ul>
</td>
</tr>
</table>
</br>
EOF

  #cat ${bsp}-*-*-*/row.html | sed -e 's/<TD>/<TD><CENTER>/g' \
  #   -e 's/<\/TD>/<\/CENTER><\/TD>/g'

  # 1   2      3      4
  #bsp-opt-yyyymmdd-hhmm.tar.bz2
  # sort 1,2 alphabetically, sort 3,4 reverse "version"
  first="yes"
  for build in O2pd O2pD O2Pd O2PD Ospd OspD OsPd OsPD
  do
    echo "<a name=\"${build}\"></a>"
    echo "<table class=\"stats-table table-autosort\" cellspacing=\"1\" cellpadding=\"2\">"
    echo "<thead>"
    echo "<tr class=\"stats-table-target\">"
    echo "<td colspan=\"10\">"
    echo "<strong>${cpu}/${bsp} `convert_flags ${build}` (${build})</strong>"
    echo "</td>"
    echo "</tr>"
    echo "<tr class=\"stats-table-top\">"
    ### generate header
    print_heading Day
    print_heading Time
    print_heading Version
    print_heading Uncovered Ranges
    # skip Uncovered Percentage
    print_heading Covered Percentage
    print_heading Uncovered Bytes
    print_heading Total Bytes
    print_heading Results
    echo "</thead>"

    first=no
    ls -1 ${bsp}-${build}-*-*/row.html | sort -t -  -k 1,2 -k 3,4r | \
    while read row
    do
     index=`echo ${row} | sed -e 's/row/index/'`
     sed \
      -e '1,1s/<TR>/<tr class="stats-table-row">/'  \
      -e '2,2s/<TD>\(20[0-9][0-9]\)\([0-1][0-9]\)\([0-3][0-9]\)/<TD>\1-\2-\3/' \
      -e '4,13d' \
     <$row
     version="unknown"
     if [ -r ${index} ] ; then
       version=`grep heading-title ${index} | \
          sed -e 's/<.*>RTEMS //' -e 's/<.*$//'`
     fi

     echo "<TD>${version}</TD>"
     sed \
      -e '1,6d' \
      -e '7,7s/<TD>0/<td class="stats-target-good">0/' \
      -e '8d' \
      -e '9,9s/<TD>100/<td class="stats-target-good">100/' \
      -e '10,10s/<TD>0/<td class="stats-target-good">0/' \
      <$row
    done | \
     sed -e 's/<[tT][dD]/<td align="center"/'
    echo "</table>"
    echo "</br>"
  done
  print_doc_bottom
}

genBSPList()
{
  find * -type d -name "*-O[s2][pP][dD]-2???[012]???-????" | \
    cut -d'-' -f1 | uniq | \
    while read dir
    do
      bsp=`basename ${dir} | sed -e 's/.*\/.*-//'`
      cpu=`grep ^Target ${dir}-*/configuration.txt | tail -1 | \
        sed -e 's/^.*Target//' | cut -d':' -f2 | cut -d'-' -f1`
      echo ${cpu}/${bsp}
    done | sort -u | sort -t / -k 1 -k 2 | cut -d'/' -f2
    # sort cpu,bsp alphabetically
}

cleanup()
{
  for bsp in ${BSPs}
  do
    count=`ls -1 ${bsp}*.tar.bz2 | wc -l`
    if [ ${count} -gt 20 ] ; then
      echo ${bsp} has ${count} entries.. cleaning it
      ls -1 ${bsp}-*.tar.bz2 |  sort -t - -k 3 -k 2 -r | sed -e '1,20d' | \
      while read f
      do
        dir=`echo ${f} | sed -e 's/.tar.bz2$//'`
        rm -rf ${f} ${dir}
      done
    fi

  done
}

# round up
round_up()
{
  num=$1
  round=$2
  echo ${num} ${num} ${round} + ${round} % - ${round} + p | dc
}

# round down
round_down()
{
  num=$1
  round=$2
  echo ${num} ${num} ${round} - ${round} % - ${round} - p| dc
}

# Generate the GNU Plot script
gen_plot()
{
  # Now merge the data
  datfiles=`ls -1 ${OUTDAT}/${bsp}-*${DEV}-${FIELD}.dat`
  first=`cat ${datfiles} | sort -t' ' -k1.3 -n | head -n 1 | cut -d' ' -f1`
  last=`cat ${datfiles} | sort -t' ' -k1.3 -n | tail -n 1 | cut -d' ' -f1`

  min=`cat ${datfiles} | sort -k2 -n | head -n 1 | cut -d' ' -f2`
  max=`cat ${datfiles} | sort -k2 -n | tail -n 1 | cut -d' ' -f2`
  round=
  case ${FIELD} in
    ranges)
      round=10
      min=`round_down ${min} 10 0`
      max=`round_up   ${max} 10 1000000`
      YLABEL=Ranges
      ;;
    covered_percent)
      max=100.0
      YLABEL=Covered
      ;;
    uncovered_percent)
      min=0
      YLABEL=Uncovered
      ;;
    uncovered_bytes)
      round=1000
      min=`round_down ${min} 1000 0`
      max=`round_up   ${max} 1000 1000000`
      YLABEL=Uncovered
      ;;
    total_bytes)
      round=5000
      min=`round_down ${min} 5000 0`
      max=`round_up   ${max} 5000 1000000`
      YLABEL=Total
      ;;
    *)
      echo "ERROR unknown FIELD ${FIELD}"
      exit 1
      ;;
  esac
  # No negative numbers. :=D
  if [ ${min} -lt 0 ]  ; then
    min=0
  fi
  if [ "X${round}" != "X" ] ; then   # definitely integer
    if [ ${min} -eq ${max} ] ; then
      max=`expr ${min} + ${round}`
    fi
  fi

  # Is this graph using data for developmental or core configurations?
  if [ ${DEV} = "D" ] ; then
    TITLE="${PATTERN} (Developmental)"
  else
    TITLE="${PATTERN} (Core)"
  fi

  Year=`echo ${first} | cut -c1-4`
  Month=`echo ${first} | cut -c6-7`
  Day=`echo ${first} | cut -c9-10`
  Hour=`echo ${first} | cut -c12-13`
  Minute=`echo ${first} | cut -c15-16`
  start="${Year}-${Month}-${Day}/${Hour}:${Minute}"

  Year=`echo ${last} | cut -c1-4`
  Month=`echo ${last} | cut -c6-7`
  Day=`echo ${last} | cut -c9-10`
  Hour=`echo ${last} | cut -c12-13`
  Minute=`echo ${last} | cut -c15-16`
  end="${Year}-${Month}-${Day}/${Hour}:${Minute}"

  echo "set terminal png size 1200,800"
  echo "set xdata time"
  echo "# time range must be in same format as data file"
  echo "# YYYYMMDD-HHMMSS"
  echo "set timefmt \"%Y-%m-%d/%H:%M:%S\""
  echo "set output \"${OUTFIG}/${bsp}-${FIELD}-${DEV}.png\""
  echo "set xrange [\""${start}"\":\""${end}"\"]"
  echo "set yrange [${min}:${max}]"
  echo "set grid"
  echo "set xlabel \"Date\""
  echo "set ylabel \"${YLABEL}\""
  echo "set title \"${TITLE}\""
  echo "set key left box"

  echo "plot \"${OUTDAT}/${bsp}-Osp${DEV}-${FIELD}.dat\" using 1:2 index 0 \\"
  echo "  title \"Osp${DEV}\" with lines lw 2, \\"
  echo "     \"${OUTDAT}/${bsp}-OsP${DEV}-${FIELD}.dat\" using 1:2 index 0 \\"
  echo "  title \"OsP${DEV}\" with lines lw 2, \\"
  echo "     \"${OUTDAT}/${bsp}-O2p${DEV}-${FIELD}.dat\" using 1:2 index 0 \\"
  echo "  title \"O2p${DEV}\" with lines lw 2, \\"
  echo "     \"${OUTDAT}/${bsp}-O2P${DEV}-${FIELD}.dat\" using 1:2 index 0 \\"
  echo "  title \"O2P${DEV}\" with lines lw 2"
}

gen_data()
{
  for s in `ls -1 ${bsp}/${bsp}-${CONF}-*/summary.txt | sort `
  do
    timestamp=`echo $s | cut -d'-' -f3-4 | cut -d'/' -f1`
    case ${FIELD} in
      ranges)
        num=`grep "${PATTERN}" $s | cut -d' ' -f1`
        if [ "X${num}" = "X" ] ; then
          num=`grep -i "${PATTERN}" $s | cut -d':' -f2`
        fi
        ;;
      *)      num=`grep "${PATTERN}" $s | cut -d':' -f2` ;;
    esac

    Year=`echo ${timestamp} | cut -c1-4`
    Month=`echo ${timestamp} | cut -c5-6`
    Day=`echo ${timestamp} | cut -c7-8`
    stamp="${Year}-${Month}-${Day}"

    echo ${stamp} ${num}
  done
}

gen_timeplot()
{
BSP=$1

LEGEND_TABLE_BODY="\
<table>\
<tr>\
  <td style="color:#ff0000">O2pd</td>\
  <td style="color:#D0A825">O2pD</td>\
  <td style="color:#336699">O2Pd</td>\
  <td style="color:#99FF00">O2PD</td>\
  <td style="color:#336666">Ospd</td>\
  <td style="color:#33CC33">OspD</td>\
  <td style="color:#990099">OsPd</td>\
  <td style="color:#ff0099">OsPD</td>\
</tr>\
</table>"

cat <<EOF
<HTML>
<HEAD>
<TITLE>${BSP} Timeplot Graphs</TITLE>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link rel="stylesheet" type="text/css" href="rtems/style.css" media="screen" />
EOF

cat << EOF

    <script src="http://api.simile-widgets.org/timeplot/1.1/timeplot-api.js"
       type="text/javascript"></script>
    <script type="text/javascript">
      var timeplot = [];
      var types  = ["O2pd", "O2pD", "O2Pd", "O2PD", "Ospd", "OspD", "OsPd", "OsPD"];
      var graphs = ["ranges", "total_bytes", "uncovered_bytes", "uncovered_percent"];
      var lineColors = ["#ff0000", "#D0A825", "#336699", "#99FF00", "#336666", "#33CC33", "#990099", "#FF0099"];
      var eventsources;
      var plotInfo;

      function onLoad() {
	for( i = 0; i<graphs.length; i++)
	{
	    var timeGeometry = new Timeplot.DefaultTimeGeometry({
	        gridColor: new Timeplot.Color("#000000"),
		axisLabelsPlacement: "top"
	    });

	    var valueGeometry = new Timeplot.DefaultValueGeometry({
	        gridColor: "#000000",
	        axisLabelsPlacement: "left"
	    });

	    eventsources = [];
	    plotInfo = [];
	    for( j = 0; j<types.length; j++)
	    {
	      eventsources[j] = new Timeplot.DefaultEventSource();
	      plotInfo[j] = Timeplot.createPlotInfo({
		 id: "plot"+(j+1),
		 dataSource: new Timeplot.ColumnSource(eventsources[j],1),
		 timeGeometry: timeGeometry,
		 valueGeometry: valueGeometry,
		 lineColor: lineColors[j]
	      });
	    }
	    timeplot[i] = Timeplot.create(document.getElementById(graphs[i]+"-timeplot"), plotInfo);
	    for( j = 0; j<types.length; j++)
	    {
	      timeplot[i].loadText("../plot_data/" + "${BSP}-" + types[j] + "-" + graphs[i] + ".dat", " ", eventsources[j]);
	    }
	  }
      }
      var resizeTimerID = null;
      function onResize() {
	if (resizeTimerID == null) {
	resizeTimerID = window.setTimeout(
		    function() {
			resizeTimerID = null;
			for( i = 0; i< timeplot.lenght; i++)
			{
			  timeplot[i].repaint();
			}
		    }, 100);
	  }
      }

    </script>
  </head>
  <body onload="onLoad();" onresize="onResize();">
    <h1>${BSP} Timeplot Graphs</h1>
    <li><a href="#uncovered_percent">Uncovered Percentage Graph</a></li>
    <li><a href="#total_bytes">Total Bytes Analyzed Graph</a></li>
    <li><a href="#ranges">Uncovered Ranges Graph</a></li>
    <li><a href="#uncovered_bytes">Uncovered Bytes Graph</a></li>

    <h2 id="uncovered_percent">Uncovered Percentage</h2>
    ${LEGEND_TABLE_BODY}
    <div id="uncovered_percent-timeplot" style="height: 500px;"></div>

    <h2 id="total_bytes">Total Bytes Analyzed</h2>
    ${LEGEND_TABLE_BODY}
    <div id="total_bytes-timeplot" style="height: 500px;"></div>
    <h2 id="ranges">Uncovered Ranges</h2>

    ${LEGEND_TABLE_BODY}
    <div id="ranges-timeplot" style="height: 500px;"></div>

    <h2 id="uncovered_bytes">Uncovered bytes</h2>
    ${LEGEND_TABLE_BODY}
    <div id="uncovered_bytes-timeplot" style="height: 500px;"></div>
  </body>
</html>
EOF
}

#
# Now start the non-method code
#

cd $1

good_dir="no"
for d in `ls -1 *.tar.bz2 */*.tar.bz2 2>/dev/null | sed -e 's/.tar.bz2$//'`
do
  good_dir="yes"
  if [ ! -d ${d} ] ; then
    tar xjf ${d}.tar.bz2
  fi
done

if [ ${good_dir} = "no" ]; then
  echo "No tarballs.  Is $1 really a coverage publishing directory?"
  exit 1
fi

echo "Generating HTML reports for RTEMS ${RTEMS_VERSION}"

# Put the style sheets in place
if [ ! -d rtems ] ; then
  mkdir rtems
fi

cp ${COVBASE}/style.css rtems/style.css

# Find the BSPs and make their directories
echo "Generating BSP list"
#BSPs=`find * -maxdepth 1 -type d | cut -d'-' -f1 | uniq | grep -v rtems`
BSPs=`genBSPList`
echo BSPs=${BSPs}

echo "Ensuring BSP specific content is in BSP subdirectory"
for bsp in ${BSPs}
do
  test -d ${bsp}           || mkdir ${bsp}
  test -d ${bsp}/rtems     || mkdir ${bsp}/rtems
  test -d ${bsp}/plot_data || mkdir ${bsp}/plot_data
  test -d ${bsp}/graphs    || mkdir ${bsp}/graphs
  cp ${COVBASE}/style.css ${bsp}/rtems/style.css
  cp ${COVBASE}/../covoar/table.js ${bsp}/rtems/table.js
  cp ${COVBASE}/../covoar/filter.gif ${bsp}/rtems
  cp ${COVBASE}/../covoar/05_ascending.gif ${bsp}/rtems
  cp ${COVBASE}/../covoar/05_descending.gif ${bsp}/rtems
  cp ${COVBASE}/../covoar/05_unsorted.gif ${bsp}/rtems
  mv ${bsp}-* ${bsp} 2>/dev/null
done

# Let them grow for a while
# cleanup

echo "Generating master index.html"
print_index >index.html

# now generate a page per BSP with plots and graphs

for bsp in ${BSPs}
do
  echo "Generating BSP Page for ${bsp}..."
  cd $1/${bsp}
  do_perBSPPage ${bsp} >${bsp}.html

  if [ ${do_plots} = "yes" ] ; then
    cd $1
    OUTFIG=${bsp}/graphs
    OUTDAT=${bsp}/plot_data
    echo "Generating Static Plots for ${bsp}..."
    for FIELD in ranges total_bytes uncovered_bytes \
      uncovered_percent #covered_percent
    do
      # Pattern to find in summary.txt
      case ${FIELD} in
        ranges)            PATTERN="Uncovered Ranges Found" ;;
        covered_percent)   PATTERN="Percentage Executed" ;;
        uncovered_percent) PATTERN="Percentage Not Executed" ;;
        total_bytes)       PATTERN="Bytes Analyzed" ;;
        uncovered_bytes)   PATTERN="Bytes Not Executed" ;;
        *)                 echo "Unknown field (${FIELD})"; exit 1 ;;
      esac

      for DEV in d D
      do
        for CONF in Osp${DEV} OsP${DEV} O2p${DEV} O2P${DEV}
        do
          gen_data ${bsp} ${CONF} >${OUTDAT}/${bsp}-${CONF}-${FIELD}.dat
        done

        pltfile=${OUTDAT}/${bsp}-${FIELD}-${DEV}.plt
        gen_plot >${pltfile}
        gnuplot ${pltfile}
      done
    done

    echo "Generating Time Plots for ${bsp}..."
    timeplotfile=${OUTFIG}/timeplot-${bsp}.html
    gen_timeplot ${bsp} > ${timeplotfile}
  fi
done
exit 0