diff options
author | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-05-25 17:50:59 +0000 |
---|---|---|
committer | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-05-25 17:50:59 +0000 |
commit | 75ab20e3fa9ce21286d1f329266d8b997500d590 (patch) | |
tree | 483e5750cc9529b85ca5a42bd72c8b9f6ce0c188 /covoar | |
parent | 2010-05-24 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff) | |
download | rtems-testing-75ab20e3fa9ce21286d1f329266d8b997500d590.tar.bz2 |
2010-05-25 Jennifer Averett <Jennifer.Averett@OARcorp.com>
* ReportsBase.cc, ReportsBase.h, ReportsHtml.cc, covoar.cc: Moved the
summary report to the covoar common reports in the report class and
out of the rtems specific items in the report index.
Diffstat (limited to 'covoar')
-rw-r--r-- | covoar/ChangeLog | 6 | ||||
-rw-r--r-- | covoar/ReportsBase.cc | 83 | ||||
-rw-r--r-- | covoar/ReportsBase.h | 11 | ||||
-rw-r--r-- | covoar/ReportsHtml.cc | 1 | ||||
-rw-r--r-- | covoar/covoar.cc | 66 |
5 files changed, 98 insertions, 69 deletions
diff --git a/covoar/ChangeLog b/covoar/ChangeLog index 6848236..86a2683 100644 --- a/covoar/ChangeLog +++ b/covoar/ChangeLog @@ -1,3 +1,9 @@ +2010-05-25 Jennifer Averett <Jennifer.Averett@OARcorp.com> + + * ReportsBase.cc, ReportsBase.h, ReportsHtml.cc, covoar.cc: Moved the + summary report to the covoar common reports in the report class and + out of the rtems specific items in the report index. + 2010-05-24 Joel Sherrill <joel.sherrilL@OARcorp.com> * ConfigFile.cc, ReportsBase.cc: Fix warnings. diff --git a/covoar/ReportsBase.cc b/covoar/ReportsBase.cc index 1402636..643df4a 100644 --- a/covoar/ReportsBase.cc +++ b/covoar/ReportsBase.cc @@ -423,6 +423,86 @@ void ReportsBase::WriteSymbolSummaryReport( CloseSymbolSummaryFile( report ); } +void ReportsBase::WriteSummaryReport( + const char* const fileName +) +{ + // Calculate coverage statistics and output results. + uint32_t a; + uint32_t endAddress; + Coverage::DesiredSymbols::symbolSet_t::iterator itr; + uint32_t notExecuted = 0; + double percentage; + Coverage::CoverageMapBase* theCoverageMap; + uint32_t totalBytes = 0; + FILE* report; + + // Open the report file. + report = OpenFile( fileName ); + if ( !report ) { + return; + } + + // Look at each symbol. + for (itr = SymbolsToAnalyze->set.begin(); + itr != SymbolsToAnalyze->set.end(); + itr++) { + + // If the symbol's unified coverage map exists, scan through it + // and count bytes. + theCoverageMap = itr->second.unifiedCoverageMap; + if (theCoverageMap) { + + endAddress = itr->second.stats.sizeInBytes - 1; + + for (a = 0; a <= endAddress; a++) { + totalBytes++; + if (!theCoverageMap->wasExecuted( a )) + notExecuted++; + } + } + } + + percentage = (double) notExecuted; + percentage /= (double) totalBytes; + percentage *= 100.0; + + fprintf( report, "Bytes Analyzed : %d\n", totalBytes ); + fprintf( report, "Bytes Not Executed : %d\n", notExecuted ); + fprintf( report, "Percentage Executed : %5.4g\n", 100.0 - percentage ); + fprintf( report, "Percentage Not Executed : %5.4g\n", percentage ); + fprintf( + report, + "Uncovered ranges found : %d\n", + SymbolsToAnalyze->getNumberUncoveredRanges() + ); + if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || + (BranchInfoAvailable == false) ) { + fprintf( report, "No branch information available\n" ); + } else { + fprintf( + report, + "Total branches found : %d\n", + SymbolsToAnalyze->getNumberBranchesFound() + ); + fprintf( + report, + "Uncovered branches found : %d\n", + SymbolsToAnalyze->getNumberBranchesAlwaysTaken() + + SymbolsToAnalyze->getNumberBranchesNeverTaken() + ); + fprintf( + report, + " %d branches always taken\n", + SymbolsToAnalyze->getNumberBranchesAlwaysTaken() + ); + fprintf( + report, + " %d branches never taken\n", + SymbolsToAnalyze->getNumberBranchesNeverTaken() + ); + } +} void GenerateReports() { @@ -492,7 +572,8 @@ void GenerateReports() reports = *ritr; delete reports; } - + + ReportsBase::WriteSummaryReport( "summary.txt" ); } } diff --git a/covoar/ReportsBase.h b/covoar/ReportsBase.h index b159dd9..aa304f3 100644 --- a/covoar/ReportsBase.h +++ b/covoar/ReportsBase.h @@ -91,6 +91,13 @@ class ReportsBase { ); /*! + * This method produces a sumary report for the overall test run. + */ + static void WriteSummaryReport( + const char* const fileName + ); + + /*! * This method returns the unique extension for the Report * type. If the extension is ".txt" files will be * named "annotated.txt", "branch.txt" ...... @@ -126,7 +133,7 @@ class ReportsBase { * * @param[in] fileName identifies the report file name */ - virtual FILE* OpenFile( + static FILE* OpenFile( const char* const fileName ); @@ -197,7 +204,7 @@ class ReportsBase { * * @param[in] aFile identifies the report file name */ - void CloseFile( + static void CloseFile( FILE* aFile ); diff --git a/covoar/ReportsHtml.cc b/covoar/ReportsHtml.cc index 7e41c13..b772313 100644 --- a/covoar/ReportsHtml.cc +++ b/covoar/ReportsHtml.cc @@ -86,6 +86,7 @@ namespace Coverage { fprintf( aFile, "<ul>\n" ); + PRINT_TEXT_ITEM( "Summary", "summary.txt" ); PRINT_ITEM( "Coverage Report", "uncovered" ); PRINT_ITEM( "Branch Report", "branch" ); PRINT_ITEM( "Annotated Assembly", "annotated" ); diff --git a/covoar/covoar.cc b/covoar/covoar.cc index 5b6478f..c040644 100644 --- a/covoar/covoar.cc +++ b/covoar/covoar.cc @@ -461,71 +461,5 @@ int main( AllExplanations->writeNotFound( notFound.c_str() ); } - // Calculate coverage statistics and output results. - { - uint32_t a; - uint32_t endAddress; - Coverage::DesiredSymbols::symbolSet_t::iterator itr; - uint32_t notExecuted = 0; - double percentage; - Coverage::CoverageMapBase* theCoverageMap; - uint32_t totalBytes = 0; - - // Look at each symbol. - for (itr = SymbolsToAnalyze->set.begin(); - itr != SymbolsToAnalyze->set.end(); - itr++) { - - // If the symbol's unified coverage map exists, scan through it - // and count bytes. - theCoverageMap = itr->second.unifiedCoverageMap; - if (theCoverageMap) { - - endAddress = itr->second.stats.sizeInBytes - 1; - - for (a = 0; a <= endAddress; a++) { - totalBytes++; - if (!theCoverageMap->wasExecuted( a )) - notExecuted++; - } - } - } - - percentage = (double) notExecuted; - percentage /= (double) totalBytes; - percentage *= 100.0; - - printf( "Bytes Analyzed : %d\n", totalBytes ); - printf( "Bytes Not Executed : %d\n", notExecuted ); - printf( "Percentage Executed : %5.4g\n", 100.0 - percentage ); - printf( "Percentage Not Executed : %5.4g\n", percentage ); - printf( - "Uncovered ranges found : %d\n", - SymbolsToAnalyze->getNumberUncoveredRanges() - ); - if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || - (BranchInfoAvailable == false) ) { - printf( "No branch information available\n" ); - } else { - printf( - "Total branches found : %d\n", - SymbolsToAnalyze->getNumberBranchesFound() - ); - printf( - "Uncovered branches found : %d\n", - SymbolsToAnalyze->getNumberBranchesAlwaysTaken() + - SymbolsToAnalyze->getNumberBranchesNeverTaken() - ); - printf( - " %d branches always taken\n", - SymbolsToAnalyze->getNumberBranchesAlwaysTaken() - ); - printf( - " %d branches never taken\n", - SymbolsToAnalyze->getNumberBranchesNeverTaken() - ); - } - } - return 0; } |