mirror of
https://git.rtems.org/rtems-tools/
synced 2025-06-10 23:13:10 +08:00
Remove BranchInfoAvailable global variable
- Removed BranchInfoAvailable from app_common - Created member variable in CoverageReaderBase and ReportsBase and a function to get the value of the member variable
This commit is contained in:
parent
a1d0e5515e
commit
b93e8dd9bd
@ -16,4 +16,9 @@ namespace Coverage {
|
|||||||
CoverageReaderBase::~CoverageReaderBase()
|
CoverageReaderBase::~CoverageReaderBase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CoverageReaderBase::getBranchInfoAvailable() const
|
||||||
|
{
|
||||||
|
return branchInfoAvailable_m;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,16 @@ namespace Coverage {
|
|||||||
const char* const file,
|
const char* const file,
|
||||||
ExecutableInfo* const executableInformation
|
ExecutableInfo* const executableInformation
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This method retrieves the branchInfoAvailable_m variable
|
||||||
|
*/
|
||||||
|
bool getBranchInfoAvailable() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable tells whether the branch info is available.
|
||||||
|
*/
|
||||||
|
bool branchInfoAvailable_m = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ namespace Coverage {
|
|||||||
|
|
||||||
CoverageReaderQEMU::CoverageReaderQEMU()
|
CoverageReaderQEMU::CoverageReaderQEMU()
|
||||||
{
|
{
|
||||||
BranchInfoAvailable = true;
|
branchInfoAvailable_m = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoverageReaderQEMU::~CoverageReaderQEMU()
|
CoverageReaderQEMU::~CoverageReaderQEMU()
|
||||||
|
@ -90,11 +90,11 @@ namespace Coverage {
|
|||||||
aCoverageMap->setWasExecuted( a + 3 );
|
aCoverageMap->setWasExecuted( a + 3 );
|
||||||
if ( cover & 0x08 ) {
|
if ( cover & 0x08 ) {
|
||||||
aCoverageMap->setWasTaken( a );
|
aCoverageMap->setWasTaken( a );
|
||||||
BranchInfoAvailable = true;
|
branchInfoAvailable_m = true;
|
||||||
}
|
}
|
||||||
if ( cover & 0x10 ) {
|
if ( cover & 0x10 ) {
|
||||||
aCoverageMap->setWasNotTaken( a );
|
aCoverageMap->setWasNotTaken( a );
|
||||||
BranchInfoAvailable = true;
|
branchInfoAvailable_m = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,16 @@ ReportsBase::ReportsBase(
|
|||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const DesiredSymbols& symbolsToAnalyze
|
const DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
): reportExtension_m( "" ),
|
): reportExtension_m( "" ),
|
||||||
symbolSetName_m( symbolSetName ),
|
symbolSetName_m( symbolSetName ),
|
||||||
timestamp_m( timestamp ),
|
timestamp_m( timestamp ),
|
||||||
allExplanations_m( allExplanations ),
|
allExplanations_m( allExplanations ),
|
||||||
projectName_m( projectName ),
|
projectName_m( projectName ),
|
||||||
outputDirectory_m( outputDirectory ),
|
outputDirectory_m( outputDirectory ),
|
||||||
symbolsToAnalyze_m( symbolsToAnalyze )
|
symbolsToAnalyze_m( symbolsToAnalyze ),
|
||||||
|
branchInfoAvailable_m( branchInfoAvailable )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +313,7 @@ void ReportsBase::WriteBranchReport( const std::string& fileName )
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
( symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) == 0 ) ||
|
( symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) == 0 ) ||
|
||||||
( BranchInfoAvailable == false )
|
( branchInfoAvailable_m == false )
|
||||||
) {
|
) {
|
||||||
hasBranches = false;
|
hasBranches = false;
|
||||||
}
|
}
|
||||||
@ -325,7 +327,7 @@ void ReportsBase::WriteBranchReport( const std::string& fileName )
|
|||||||
// If no branches were found then branch coverage is not supported
|
// If no branches were found then branch coverage is not supported
|
||||||
if (
|
if (
|
||||||
( symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0 ) &&
|
( symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0 ) &&
|
||||||
( BranchInfoAvailable == true )
|
( branchInfoAvailable_m == true )
|
||||||
) {
|
) {
|
||||||
// Process uncovered branches for each symbol in the set.
|
// Process uncovered branches for each symbol in the set.
|
||||||
const std::vector<std::string>& symbols =
|
const std::vector<std::string>& symbols =
|
||||||
@ -476,7 +478,8 @@ void ReportsBase::WriteSummaryReport(
|
|||||||
const std::string& fileName,
|
const std::string& fileName,
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const Coverage::DesiredSymbols& symbolsToAnalyze
|
const Coverage::DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Calculate coverage statistics and output results.
|
// Calculate coverage statistics and output results.
|
||||||
@ -546,7 +549,7 @@ void ReportsBase::WriteSummaryReport(
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
( symbolsToAnalyze.getNumberBranchesFound( symbolSetName ) == 0 ) ||
|
( symbolsToAnalyze.getNumberBranchesFound( symbolSetName ) == 0 ) ||
|
||||||
( BranchInfoAvailable == false )
|
( branchInfoAvailable == false )
|
||||||
) {
|
) {
|
||||||
report << "No branch information available" << std::endl;
|
report << "No branch information available" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
@ -580,7 +583,8 @@ void GenerateReports(
|
|||||||
bool verbose,
|
bool verbose,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const Coverage::DesiredSymbols& symbolsToAnalyze
|
const Coverage::DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
typedef std::list<ReportsBase *> reportList_t;
|
typedef std::list<ReportsBase *> reportList_t;
|
||||||
@ -599,7 +603,8 @@ void GenerateReports(
|
|||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
symbolsToAnalyze
|
symbolsToAnalyze,
|
||||||
|
branchInfoAvailable
|
||||||
);
|
);
|
||||||
reportList.push_back( reports );
|
reportList.push_back( reports );
|
||||||
reports = new ReportsHtml(
|
reports = new ReportsHtml(
|
||||||
@ -608,7 +613,8 @@ void GenerateReports(
|
|||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
symbolsToAnalyze
|
symbolsToAnalyze,
|
||||||
|
branchInfoAvailable
|
||||||
);
|
);
|
||||||
reportList.push_back( reports );
|
reportList.push_back( reports );
|
||||||
|
|
||||||
@ -661,7 +667,8 @@ void GenerateReports(
|
|||||||
"summary.txt",
|
"summary.txt",
|
||||||
symbolSetName,
|
symbolSetName,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
symbolsToAnalyze
|
symbolsToAnalyze,
|
||||||
|
branchInfoAvailable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ class ReportsBase {
|
|||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const DesiredSymbols& symbolsToAnalyze
|
const DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
);
|
);
|
||||||
virtual ~ReportsBase();
|
virtual ~ReportsBase();
|
||||||
|
|
||||||
@ -95,7 +96,8 @@ class ReportsBase {
|
|||||||
const std::string& fileName,
|
const std::string& fileName,
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const Coverage::DesiredSymbols& symbolsToAnalyze
|
const Coverage::DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
);
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -153,6 +155,11 @@ class ReportsBase {
|
|||||||
*/
|
*/
|
||||||
const Coverage::DesiredSymbols& symbolsToAnalyze_m;
|
const Coverage::DesiredSymbols& symbolsToAnalyze_m;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable tells whether the branch info is available
|
||||||
|
*/
|
||||||
|
bool branchInfoAvailable_m = false;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This method Opens a report file and verifies that it opened
|
* This method Opens a report file and verifies that it opened
|
||||||
* correctly. Upon failure NULL is returned.
|
* correctly. Upon failure NULL is returned.
|
||||||
@ -430,6 +437,7 @@ class ReportsBase {
|
|||||||
* @param[in] projectName specifies the name of the project
|
* @param[in] projectName specifies the name of the project
|
||||||
* @param[in] outputDirectory specifies the directory for the output
|
* @param[in] outputDirectory specifies the directory for the output
|
||||||
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
|
* @param[in] branchInfoAvailable tells if branch info is available
|
||||||
*/
|
*/
|
||||||
void GenerateReports(
|
void GenerateReports(
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
@ -437,7 +445,8 @@ void GenerateReports(
|
|||||||
bool verbose,
|
bool verbose,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const Coverage::DesiredSymbols& symbolsToAnalyze
|
const Coverage::DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,14 +43,16 @@ namespace Coverage {
|
|||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const Coverage::DesiredSymbols& symbolsToAnalyze
|
const Coverage::DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
): ReportsBase(
|
): ReportsBase(
|
||||||
timestamp,
|
timestamp,
|
||||||
symbolSetName,
|
symbolSetName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
symbolsToAnalyze
|
symbolsToAnalyze,
|
||||||
|
branchInfoAvailable
|
||||||
),
|
),
|
||||||
lastState_m( A_SOURCE )
|
lastState_m( A_SOURCE )
|
||||||
{
|
{
|
||||||
@ -442,7 +444,7 @@ namespace Coverage {
|
|||||||
bool ReportsHtml::PutNoBranchInfo( std::ofstream& report )
|
bool ReportsHtml::PutNoBranchInfo( std::ofstream& report )
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
BranchInfoAvailable &&
|
branchInfoAvailable_m &&
|
||||||
symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0
|
symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0
|
||||||
) {
|
) {
|
||||||
report << "All branch paths taken." << std::endl;
|
report << "All branch paths taken." << std::endl;
|
||||||
|
@ -31,7 +31,8 @@ class ReportsHtml: public ReportsBase {
|
|||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const Coverage::DesiredSymbols& symbolsToAnalyze
|
const Coverage::DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
);
|
);
|
||||||
~ReportsHtml();
|
~ReportsHtml();
|
||||||
|
|
||||||
|
@ -22,14 +22,16 @@ ReportsText::ReportsText(
|
|||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const DesiredSymbols& symbolsToAnalyze
|
const DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
): ReportsBase(
|
): ReportsBase(
|
||||||
timestamp,
|
timestamp,
|
||||||
symbolSetName,
|
symbolSetName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
symbolsToAnalyze
|
symbolsToAnalyze,
|
||||||
|
branchInfoAvailable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
reportExtension_m = ".txt";
|
reportExtension_m = ".txt";
|
||||||
@ -62,7 +64,7 @@ void ReportsText::PutAnnotatedLine(
|
|||||||
bool ReportsText::PutNoBranchInfo( std::ofstream& report )
|
bool ReportsText::PutNoBranchInfo( std::ofstream& report )
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
BranchInfoAvailable &&
|
branchInfoAvailable_m &&
|
||||||
symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0
|
symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0
|
||||||
) {
|
) {
|
||||||
report << "All branch paths taken." << std::endl;
|
report << "All branch paths taken." << std::endl;
|
||||||
|
@ -27,7 +27,8 @@ class ReportsText: public ReportsBase {
|
|||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory,
|
const std::string& outputDirectory,
|
||||||
const DesiredSymbols& symbolsToAnalyze
|
const DesiredSymbols& symbolsToAnalyze,
|
||||||
|
bool branchInfoAvailable
|
||||||
);
|
);
|
||||||
virtual ~ReportsText();
|
virtual ~ReportsText();
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables for the program
|
* Global variables for the program
|
||||||
*/
|
*/
|
||||||
bool BranchInfoAvailable = false;
|
|
||||||
Target::TargetBase* TargetInfo = NULL;
|
Target::TargetBase* TargetInfo = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "Explanations.h"
|
#include "Explanations.h"
|
||||||
#include "TargetBase.h"
|
#include "TargetBase.h"
|
||||||
|
|
||||||
extern bool BranchInfoAvailable;
|
|
||||||
extern Target::TargetBase* TargetInfo;
|
extern Target::TargetBase* TargetInfo;
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,6 +183,7 @@ int covoar(
|
|||||||
std::string projectName;
|
std::string projectName;
|
||||||
std::string outputDirectory = ".";
|
std::string outputDirectory = ".";
|
||||||
Coverage::DesiredSymbols symbolsToAnalyze;
|
Coverage::DesiredSymbols symbolsToAnalyze;
|
||||||
|
bool branchInfoAvailable = false;
|
||||||
Coverage::ObjdumpProcessor objdumpProcessor( symbolsToAnalyze );
|
Coverage::ObjdumpProcessor objdumpProcessor( symbolsToAnalyze );
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -486,13 +487,16 @@ int covoar(
|
|||||||
std::cerr << "Generate Reports" << std::endl;
|
std::cerr << "Generate Reports" << std::endl;
|
||||||
|
|
||||||
for (const auto& setName : symbolsToAnalyze.getSetNames()) {
|
for (const auto& setName : symbolsToAnalyze.getSetNames()) {
|
||||||
|
branchInfoAvailable = coverageReader->getBranchInfoAvailable();
|
||||||
|
|
||||||
Coverage::GenerateReports(
|
Coverage::GenerateReports(
|
||||||
setName,
|
setName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
verbose,
|
verbose,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
symbolsToAnalyze
|
symbolsToAnalyze,
|
||||||
|
branchInfoAvailable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user