Changeset 487cf09 in rtems-testing


Ignore:
Timestamp:
May 7, 2010, 6:01:51 PM (9 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.11, 8895273c193787f84c4585a10f6d6aceb3b25dc4
Children:
10a9e34
Parents:
fd68160
Message:

2010-05-07 Jennifer Averett <Jennifer.Averett>

Location:
rtems-coverage
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • rtems-coverage/ChangeLog

    rfd68160 r487cf09  
     12010-05-07      Jennifer Averett <Jennifer.Averett>
     2
     3        * Makefile, ReportsBase.cc, ReportsBase.h, ReportsText.cc,
     4        ReportsText.h: Added HTML reports.
     5        * ReportsHtml.cc, ReportsHtml.h, covoar.css: New files.
     6
    172010-05-06      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • rtems-coverage/Makefile

    rfd68160 r487cf09  
    2828  ReportsBase.o \
    2929  ReportsText.o \
     30  ReportsHtml.o \
    3031  SymbolTable.o \
    3132  Target_arm.o  \
     
    122123ReportsBase.o: ReportsBase.cc ReportsBase.h CoverageRanges.h DesiredSymbols.h \
    123124  Explanations.h ObjdumpProcessor.h
     125ReportsHtml.o: ReportsHtml.h ReportsText.cc
    124126ReportsText.o: ReportsBase.h ReportsText.cc
    125127SymbolTable.o: SymbolTable.cc SymbolTable.h
  • rtems-coverage/ReportsBase.cc

    rfd68160 r487cf09  
    1515
    1616#include "ReportsText.h"
     17#include "ReportsHtml.h"
    1718
    1819namespace Coverage {
     
    154155
    155156      std::string  annotation = "";
    156       std::string  line;
     157      std::string  line;
     158      char         textLine[100];
    157159
    158160      state = A_SOURCE;
     
    160162      if ( itr->isInstruction ) {
    161163        if (!theCoverageMap->wasExecuted( itr->address - bAddress )){
    162           annotation = "\t<== NOT EXECUTED";
     164          annotation = "<== NOT EXECUTED";
    163165          state = A_NEVER_EXECUTED;
    164166        } else if (theCoverageMap->isBranch( itr->address - bAddress )) {
    165167          if (theCoverageMap->wasAlwaysTaken( itr->address - bAddress )){
    166             annotation = "\t<== ALWAYS TAKEN";
     168            annotation = "<== ALWAYS TAKEN";
    167169            state = A_BRANCH_TAKEN;
    168170          } else if (theCoverageMap->wasNeverTaken( itr->address - bAddress )){
    169             annotation = "\t<== NEVER TAKEN";
     171            annotation = "<== NEVER TAKEN";
    170172            state = A_BRANCH_NOT_TAKEN;
    171173          }
     
    175177      }
    176178
     179      sprintf( textLine, "%-70s", itr->line.c_str() );
     180      line = textLine + annotation;
    177181     
    178       line = itr->line + annotation;
    179182      PutAnnotatedLine( aFile, state, line);
    180183    }
     
    194197  Coverage::CoverageRanges::ranges_t::iterator    ritr;
    195198  Coverage::CoverageRanges*                       theBranches;
     199  unsigned int                                    count;
    196200
    197201  // Open the branch report file
     
    208212
    209213    // Process uncovered branches for each symbol.
     214    count = 0;
    210215    for (ditr = SymbolsToAnalyze->set.begin();
    211216         ditr != SymbolsToAnalyze->set.end();
     
    219224             ritr != theBranches->set.end() ;
    220225             ritr++ ) {
    221           PutBranchEntry( report, ditr, ritr );
     226          count++;
     227          PutBranchEntry( report, count, ditr, ritr );
    222228        }
    223229      }
     
    238244  Coverage::CoverageRanges::ranges_t::iterator    ritr;
    239245  Coverage::CoverageRanges*                       theRanges;
     246  unsigned int                                    count;
    240247
    241248  // Open the coverage report file.
    242   report = fopen( fileName, "w" );
     249  report = OpenCoverageFile( fileName );
    243250  if ( !report ) {
    244     fprintf( stderr, "Unable to open %s\n\n", fileName );
    245251    return;
    246252  }
    247253
    248254  // Process uncovered ranges for each symbol.
     255  count = 0;
    249256  for (ditr = SymbolsToAnalyze->set.begin();
    250257       ditr != SymbolsToAnalyze->set.end();
     
    258265    // in the report.
    259266    if (theRanges == NULL) {
    260       putCoverageNoRange( report, ditr->first );
    261     }
    262 
    263     else if (!theRanges->set.empty()) {
     267      putCoverageNoRange( report, count, ditr->first );
     268      count++;
     269    }  else if (!theRanges->set.empty()) {
    264270
    265271      for (ritr =  theRanges->set.begin() ;
    266272           ritr != theRanges->set.end() ;
    267273           ritr++ ) {
    268 
    269         PutCoverageLine( report, ditr, ritr );
     274        PutCoverageLine( report, count, ditr, ritr );
     275        count++;
    270276      }
    271277    }
    272278  }
    273279
    274   fclose( report );
     280  CloseCoverageFile( report );
    275281}
    276282
     
    286292  Coverage::CoverageRanges::ranges_t::iterator    ritr;
    287293  Coverage::CoverageRanges*                       theRanges;
     294  unsigned int                                    count;
    288295
    289296  // Open the report file.
     
    294301
    295302  // Process uncovered ranges for each symbol.
     303  count = 0;
    296304  for (ditr = SymbolsToAnalyze->set.begin();
    297305       ditr != SymbolsToAnalyze->set.end();
     
    305313           ritr != theRanges->set.end() ;
    306314           ritr++ ) {
    307         PutSizeLine( report, ditr, ritr );
     315        PutSizeLine( report, count, ditr, ritr );
     316        count++;
    308317      }
    309318    }
     
    324333  reports = new ReportsText();
    325334  reportList.push_back(reports);
    326 
     335  reports = new ReportsHtml();
     336  reportList.push_back(reports);
    327337
    328338  for (ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
  • rtems-coverage/ReportsBase.h

    rfd68160 r487cf09  
    2525  public:
    2626    ReportsBase();
    27    ~ReportsBase();
    28 
    29   /*!
    30    *  This method produces an annotated assembly listing report containing
    31    *  the disassembly of each symbol that was not completely covered.
    32    *
    33    *  @param[in] fileName identifies the annotated report file name
    34    */
    35   void WriteAnnotatedReport(
    36     const char* const fileName
    37   );
    38 
    39   /*!
    40    *  This method produces a report that contains information about each
    41    *  uncovered branch statement.
    42    *
    43    *  @param[in] fileName identifies the branch report file name
    44    */
    45   void WriteBranchReport(
    46     const char* const fileName
    47   );
    48 
    49   /*!
    50    *  This method produces a report that contains information about each
    51    *  uncovered range of bytes.
    52    *
    53    *  @param[in] fileName identifies the coverage report file name
    54    */
    55   void WriteCoverageReport(
    56     const char* const fileName
    57   );
    58 
    59   /*!
    60    *  This method produces a summary report that lists each uncovered
    61    *  range of bytes.
    62    *
    63    *  @param[in] fileName identifies the size report file name
    64    */
    65   void WriteSizeReport(
    66     const char* const fileName
    67   );
    68 
    69 
    70   std::string ReportExtension() { return reportExtension_m; }
     27    ~ReportsBase();
     28
     29    /*!
     30     *  This method produces an annotated assembly listing report containing
     31     *  the disassembly of each symbol that was not completely covered.
     32     *
     33     *  @param[in] fileName identifies the annotated report file name
     34     */
     35    void WriteAnnotatedReport(
     36      const char* const fileName
     37    );
     38
     39    /*!
     40     *  This method produces a report that contains information about each
     41     *  uncovered branch statement.
     42     *
     43     *  @param[in] fileName identifies the branch report file name
     44     */
     45    void WriteBranchReport(
     46      const char* const fileName
     47    );
     48
     49    /*!
     50     *  This method produces a report that contains information about each
     51     *  uncovered range of bytes.
     52     *
     53     *  @param[in] fileName identifies the coverage report file name
     54     */
     55    void WriteCoverageReport(
     56      const char* const fileName
     57    );
     58
     59    /*!
     60     *  This method produces a summary report that lists each uncovered
     61     *  range of bytes.
     62     *
     63     *  @param[in] fileName identifies the size report file name
     64     */
     65    void WriteSizeReport(
     66      const char* const fileName
     67    );
     68
     69    /*!
     70     *  This method returns the unique extension for the Report
     71     *  type.  If the extension is ".txt" files will be
     72     *  named "annotated.txt", "branch.txt" ......
     73     *
     74     *  @param[in] fileName identifies the size report file name
     75     */
     76    std::string ReportExtension() { return reportExtension_m; }
    7177
    7278  protected:
    7379
     80    /*!
     81     * This type is used to track a state during the annotated output.
     82     */
    7483    typedef enum {
    7584      A_SOURCE,
     
    8089    }AnnotatedLineState_t;
    8190
     91    /*!
     92     *  This member variable contains the extension used for all reports.
     93     */
    8294    std::string reportExtension_m;
    8395
    8496
    85     FILE* OpenFile(
    86       const char* const fileName
    87     );
    88 
     97  /*!
     98   *  This method Opens a report file and verifies that it opended
     99   *  correctly.  Upon failure NULL is returned.
     100   *
     101   *  @param[in] fileName identifies the size report file name
     102   */
     103     virtual FILE* OpenFile(
     104      const char* const fileName
     105    );
     106
     107  /*!
     108   *  This method d Opens a report file and verifies that it opended.
     109   *  Then appedns any necessary header information onto the file.
     110   *
     111   *  @param[in] fileName identifies the size report file name
     112   */
    89113    virtual FILE* OpenAnnotatedFile(
    90114      const char* const fileName
    91115    );
    92116
     117  /*!
     118   *  This method d Opens a report file and verifies that it opended.
     119   *  Then appedns any necessary header information onto the file.
     120   *
     121   *  @param[in] fileName identifies the size report file name
     122   */
    93123    virtual FILE* OpenBranchFile(
    94124      const char* const fileName
    95125    );
    96126
     127  /*!
     128   *  This method d Opens a report file and verifies that it opended.
     129   *  Then appedns any necessary header information onto the file.
     130   *
     131   *  @param[in] fileName identifies the size report file name
     132   */
    97133    virtual FILE* OpenCoverageFile(
    98134      const char* const fileName
    99135    );
    100136
     137  /*!
     138   *  This method d Opens a report file and verifies that it opended.
     139   *  Then appedns any necessary header information onto the file.
     140   *
     141   *  @param[in] fileName identifies the size report file name
     142   */
    101143    virtual FILE* OpenSizeFile(
    102144      const char* const fileName
    103145    );
    104146
     147  /*!
     148   *  This method Closes a report file.
     149   *
     150   *  @param[in] fileName identifies the size report file name
     151   */
    105152    void CloseFile(
    106153      FILE*  aFile
    107154    );
    108155
     156  /*!
     157   *  This method puts any necessary footer information into
     158   *  the report then closes the file.
     159   *
     160   *  @param[in] fileName identifies the size report file name
     161   */
    109162    virtual void CloseAnnotatedFile(
    110163      FILE*  aFile
    111164    );
    112165
     166  /*!
     167   *  This method puts any necessary footer information into
     168   *  the report then closes the file.
     169   *
     170   *  @param[in] fileName identifies the size report file name
     171   */
    113172    virtual void CloseBranchFile(
    114173      FILE*  aFile
    115174    );
    116175
     176  /*!
     177   *  This method puts any necessary footer information into
     178   *  the report then closes the file.
     179   *
     180   *  @param[in] fileName identifies the size report file name
     181   */
    117182    virtual void CloseCoverageFile(
    118183      FILE*  aFile
    119184    );
    120185
     186  /*!
     187   *  This method puts any necessary footer information into
     188   *  the report then closes the file.
     189   *
     190   *  @param[in] fileName identifies the size report file name
     191   */
    121192    virtual void CloseSizeFile(
    122193      FILE*  aFile
    123194    );
    124195
     196  /*!
     197   *  This method puts any necessary footer information into
     198   *  the report then closes the file.
     199   *
     200   *  @param[in] fileName identifies the size report file name
     201   */
    125202    virtual void PutAnnotatedLine(
    126203      FILE*                aFile,
     
    129206    )=0;
    130207
     208  /*!
     209   *  This method puts any necessary footer information into
     210   *  the report then closes the file.
     211   *
     212   *  @param[in] fileName identifies the size report file name
     213   */
    131214    virtual bool PutNoBranchInfo(
    132215      FILE* report
    133216    ) = 0;
    134217
     218  /*!
     219   *  This method puts a branch entry into the branch report.
     220   *
     221   *  @param[in] fileName identifies the size report file name
     222   */
    135223    virtual bool PutBranchEntry(
    136       FILE*                                       report,
     224      FILE*                                            report,
     225      unsigned int                                     number,
    137226      Coverage::DesiredSymbols::symbolSet_t::iterator  symbolPtr,
    138227      Coverage::CoverageRanges::ranges_t::iterator     rangePtr
    139228    )=0;
    140229
     230  /*!
     231   *  This method reports when no range is available for
     232   *  a symbol in the coverage report.
     233   *
     234   *  @param[in] fileName identifies the size report file name
     235   */
    141236    virtual void putCoverageNoRange(
    142       FILE*       report,
    143       std::string symbol
    144     )=0;
    145 
     237      FILE*        report,
     238      unsigned int number,
     239      std::string  symbol
     240    )=0;
     241
     242  /*!
     243   *  This method puts a line in the coverage report.
     244   *
     245   *  @param[in] fileName identifies the size report file name
     246   */
    146247    virtual bool PutCoverageLine(
    147       FILE*                                      report,
     248      FILE*                                           report,
     249      unsigned int                                    number,
    148250      Coverage::DesiredSymbols::symbolSet_t::iterator ditr,
    149251      Coverage::CoverageRanges::ranges_t::iterator    ritr
    150252    )=0;
    151253
     254  /*!
     255   *  This method method puts a line into the size report.
     256   *
     257   *  @param[in] fileName identifies the size report file name
     258   */
    152259    virtual bool PutSizeLine(
    153       FILE*                                      report,
     260      FILE*                                           report,
     261      unsigned int                                    number,
    154262      Coverage::DesiredSymbols::symbolSet_t::iterator symbol,
    155263      Coverage::CoverageRanges::ranges_t::iterator    range
    156264    )=0;
    157 
    158265};
    159266
  • rtems-coverage/ReportsText.cc

    rfd68160 r487cf09  
    3232
    3333bool ReportsText::PutNoBranchInfo(
    34   FILE* report
     34  FILE*           report
    3535)
    3636{
     
    4242bool ReportsText::PutBranchEntry(
    4343  FILE*   report,
     44  unsigned int                                     number,
    4445  Coverage::DesiredSymbols::symbolSet_t::iterator  symbolPtr,
    4546  Coverage::CoverageRanges::ranges_t::iterator     rangePtr
     
    110111
    111112void ReportsText::putCoverageNoRange(
    112   FILE*       report,
    113   std::string symbol
     113  FILE*         report,
     114  unsigned int  number,
     115  std::string   symbol
    114116)
    115117{
     
    130132bool ReportsText::PutCoverageLine(
    131133  FILE*                                       report,
     134  unsigned int                                     number,
    132135  Coverage::DesiredSymbols::symbolSet_t::iterator ditr,
    133136  Coverage::CoverageRanges::ranges_t::iterator    ritr
     
    182185bool  ReportsText::PutSizeLine(
    183186  FILE*                                      report,
     187  unsigned int                                     number,
    184188  Coverage::DesiredSymbols::symbolSet_t::iterator symbol,
    185189  Coverage::CoverageRanges::ranges_t::iterator    range
     
    196200}
    197201
    198 }
     202
     203
     204}
  • rtems-coverage/ReportsText.h

    rfd68160 r487cf09  
    6969    virtual bool PutBranchEntry(
    7070      FILE*                                            report,
     71      unsigned int                                     number,
    7172      Coverage::DesiredSymbols::symbolSet_t::iterator  symbolPtr,
    7273      Coverage::CoverageRanges::ranges_t::iterator     rangePtr
     
    7475
    7576    virtual void putCoverageNoRange(
    76       FILE*       report,
    77       std::string symbol
     77      FILE*        report,
     78      unsigned int number,
     79      std::string  symbol
    7880    );
    7981
    8082    virtual bool PutCoverageLine(
    81       FILE*                                      report,
     83      FILE*                                           report,
     84      unsigned int                                    number,
    8285      Coverage::DesiredSymbols::symbolSet_t::iterator ditr,
    8386      Coverage::CoverageRanges::ranges_t::iterator    ritr
     
    8588
    8689    virtual bool PutSizeLine(
    87       FILE*                                      report,
     90      FILE*                                           report,
     91      unsigned int                                    number,
    8892      Coverage::DesiredSymbols::symbolSet_t::iterator symbol,
    8993      Coverage::CoverageRanges::ranges_t::iterator    range
Note: See TracChangeset for help on using the changeset viewer.