From f381f26e9b5c333f64e798f737e9d3dd2606cb65 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Tue, 20 Jan 2015 08:56:14 +1100 Subject: Fix covoar so it builds for Windows. --- tester/covoar/ReportsBase.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'tester/covoar/ReportsBase.cc') diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc index d401bdd..b9dcc51 100644 --- a/tester/covoar/ReportsBase.cc +++ b/tester/covoar/ReportsBase.cc @@ -14,6 +14,10 @@ #include "ReportsText.h" #include "ReportsHtml.h" +#if WIN32 +#include +#endif + namespace Coverage { ReportsBase::ReportsBase( time_t timestamp ): @@ -35,7 +39,11 @@ FILE* ReportsBase::OpenFile( std::string file; // Create the output directory if it does not already exist +#if WIN32 + sc = _mkdir( outputDirectory ); +#else sc = mkdir( outputDirectory,0755 ); +#endif if ( (sc == -1) && (errno != EEXIST) ) { fprintf(stderr, "Unable to create output directory %s\n", outputDirectory); return NULL; @@ -211,7 +219,7 @@ void ReportsBase::WriteAnnotatedReport( if ( itr->isInstruction ) { if (!theCoverageMap->wasExecuted( itr->address - bAddress )){ - annotation = "<== NOT EXECUTED"; + annotation = "<== NOT EXECUTED"; state = A_NEVER_EXECUTED; id = theRanges->getId( itr->address ); } else if (theCoverageMap->isBranch( itr->address - bAddress )) { @@ -230,8 +238,8 @@ void ReportsBase::WriteAnnotatedReport( sprintf( textLine, "%-70s", itr->line.c_str() ); line = textLine + annotation; - - PutAnnotatedLine( aFile, state, line, id); + + PutAnnotatedLine( aFile, state, line, id); } AnnotatedEnd( aFile ); @@ -253,7 +261,7 @@ void ReportsBase::WriteBranchReport( unsigned int count; bool hasBranches = true; - if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || + if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || (BranchInfoAvailable == false) ) hasBranches = false; @@ -263,7 +271,7 @@ void ReportsBase::WriteBranchReport( return; // If no branches were found of branch coverage is not supported - if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || + if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || (BranchInfoAvailable == false) ) { PutNoBranchInfo(report); @@ -359,7 +367,7 @@ void ReportsBase::WriteCoverageReport( */ void ReportsBase::WriteSizeReport( const char* const fileName -) +) { Coverage::DesiredSymbols::symbolSet_t::iterator ditr; FILE* report; @@ -475,7 +483,7 @@ void ReportsBase::WriteSummaryReport( "Uncovered ranges found : %d\n", SymbolsToAnalyze->getNumberUncoveredRanges() ); - if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || + if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) || (BranchInfoAvailable == false) ) { fprintf( report, "No branch information available\n" ); } else { @@ -514,7 +522,7 @@ void GenerateReports() time_t timestamp; - + timestamp = time(NULL); /* get current cal time */ reports = new ReportsText(timestamp); reportList.push_back(reports); -- cgit v1.2.3