MemCheck should now work again in ctest
This commit is contained in:
parent
996bb51a1d
commit
b0b5ffcf5c
@ -249,15 +249,14 @@ int cmCTestMemCheckHandler::PostProcessHandler()
|
|||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void cmCTestMemCheckHandler::GenerateTestCommand(
|
void cmCTestMemCheckHandler::GenerateTestCommand(
|
||||||
std::vector<const char*>& args)
|
std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
std::vector<cmStdString>::size_type pp;
|
std::vector<cmStdString>::size_type pp;
|
||||||
args.push_back(this->MemoryTester.c_str());
|
|
||||||
std::string memcheckcommand = "";
|
std::string memcheckcommand = "";
|
||||||
memcheckcommand = this->MemoryTester;
|
memcheckcommand = this->MemoryTester;
|
||||||
for ( pp = 0; pp < this->MemoryTesterOptionsParsed.size(); pp ++ )
|
for ( pp = 0; pp < this->MemoryTesterOptionsParsed.size(); pp ++ )
|
||||||
{
|
{
|
||||||
args.push_back(this->MemoryTesterOptionsParsed[pp].c_str());
|
args.push_back(this->MemoryTesterOptionsParsed[pp]);
|
||||||
memcheckcommand += " ";
|
memcheckcommand += " ";
|
||||||
memcheckcommand += cmSystemTools::EscapeSpaces(
|
memcheckcommand += cmSystemTools::EscapeSpaces(
|
||||||
this->MemoryTesterOptionsParsed[pp].c_str());
|
this->MemoryTesterOptionsParsed[pp].c_str());
|
||||||
@ -867,27 +866,6 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//TODO ZACH move this logic into cmCTestRunTest
|
|
||||||
void
|
|
||||||
cmCTestMemCheckHandler::ProcessOneTest(cmCTestTestProperties *props,
|
|
||||||
std::vector<cmStdString> &passed,
|
|
||||||
std::vector<cmStdString> &failed,
|
|
||||||
int count, int tmsize)
|
|
||||||
{
|
|
||||||
// run parent test
|
|
||||||
cmCTestTestHandler::ProcessOneTest(props, passed, failed, count, tmsize);
|
|
||||||
cmCTestTestResult& res = this->TestResults[this->TestResults.size()-1];
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "process test output now: "
|
|
||||||
<< props->Name.c_str() << " " << res.Name.c_str() << std::endl);
|
|
||||||
if( this->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER)
|
|
||||||
{
|
|
||||||
this->PostProcessBoundsCheckerTest(res);
|
|
||||||
}
|
|
||||||
else if(this->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY )
|
|
||||||
{
|
|
||||||
this->PostProcessPurifyTest(res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method puts the bounds checker output file into the output
|
// This method puts the bounds checker output file into the output
|
||||||
// for the test
|
// for the test
|
||||||
|
@ -30,6 +30,7 @@ class cmMakefile;
|
|||||||
*/
|
*/
|
||||||
class cmCTestMemCheckHandler : public cmCTestTestHandler
|
class cmCTestMemCheckHandler : public cmCTestTestHandler
|
||||||
{
|
{
|
||||||
|
friend class cmCTestRunTest;
|
||||||
public:
|
public:
|
||||||
cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler);
|
cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler);
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual int PreProcessHandler();
|
virtual int PreProcessHandler();
|
||||||
virtual int PostProcessHandler();
|
virtual int PostProcessHandler();
|
||||||
virtual void GenerateTestCommand(std::vector<const char*>& args);
|
virtual void GenerateTestCommand(std::vector<std::string>& args);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -121,13 +122,7 @@ private:
|
|||||||
std::string& log, int* results);
|
std::string& log, int* results);
|
||||||
bool ProcessMemCheckBoundsCheckerOutput(const std::string& str,
|
bool ProcessMemCheckBoundsCheckerOutput(const std::string& str,
|
||||||
std::string& log, int* results);
|
std::string& log, int* results);
|
||||||
/**
|
|
||||||
* Run one test
|
|
||||||
*/
|
|
||||||
virtual void ProcessOneTest(cmCTestTestProperties *props,
|
|
||||||
std::vector<cmStdString> &passed,
|
|
||||||
std::vector<cmStdString> &failed,
|
|
||||||
int count, int tmsize);
|
|
||||||
void PostProcessPurifyTest(cmCTestTestResult& res);
|
void PostProcessPurifyTest(cmCTestTestResult& res);
|
||||||
void PostProcessBoundsCheckerTest(cmCTestTestResult& res);
|
void PostProcessBoundsCheckerTest(cmCTestTestResult& res);
|
||||||
};
|
};
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
|
|
||||||
#include "cmCTestRunTest.h"
|
#include "cmCTestRunTest.h"
|
||||||
|
#include "cmCTestMemCheckHandler.h"
|
||||||
#include "cmCTest.h"
|
#include "cmCTest.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
@ -245,10 +246,35 @@ bool cmCTestRunTest::EndTest(int completed, int total)
|
|||||||
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
|
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
|
||||||
this->TestHandler->TestResults.push_back( this->TestResult );
|
this->TestHandler->TestResults.push_back( this->TestResult );
|
||||||
|
|
||||||
|
this->MemCheckPostProcess();
|
||||||
|
|
||||||
delete this->TestProcess;
|
delete this->TestProcess;
|
||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
void cmCTestRunTest::MemCheckPostProcess()
|
||||||
|
{
|
||||||
|
if(!this->TestHandler->MemCheck)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index
|
||||||
|
<< ": process test output now: "
|
||||||
|
<< this->TestProperties->Name.c_str() << " "
|
||||||
|
<< this->TestResult.Name.c_str() << std::endl);
|
||||||
|
cmCTestMemCheckHandler * handler = static_cast<cmCTestMemCheckHandler*>
|
||||||
|
(this->TestHandler);
|
||||||
|
if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER)
|
||||||
|
{
|
||||||
|
handler->PostProcessBoundsCheckerTest(this->TestResult);
|
||||||
|
}
|
||||||
|
else if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY)
|
||||||
|
{
|
||||||
|
handler->PostProcessPurifyTest(this->TestResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cmCTestRunTest::SetTestHandler(cmCTestTestHandler * handler)
|
void cmCTestRunTest::SetTestHandler(cmCTestTestHandler * handler)
|
||||||
{
|
{
|
||||||
this->TestHandler = handler;
|
this->TestHandler = handler;
|
||||||
@ -292,21 +318,36 @@ bool cmCTestRunTest::StartTest()
|
|||||||
|
|
||||||
void cmCTestRunTest::ComputeArguments()
|
void cmCTestRunTest::ComputeArguments()
|
||||||
{
|
{
|
||||||
std::vector<std::string>& args = this->TestProperties->Args;
|
|
||||||
// find the test executable
|
|
||||||
this->ActualCommand
|
|
||||||
= this->TestHandler->FindTheExecutable(args[1].c_str());
|
|
||||||
this->TestCommand
|
|
||||||
= cmSystemTools::ConvertToOutputPath(this->ActualCommand.c_str());
|
|
||||||
// add the arguments
|
|
||||||
std::vector<std::string>::const_iterator j =
|
std::vector<std::string>::const_iterator j =
|
||||||
this->TestProperties->Args.begin();
|
this->TestProperties->Args.begin();
|
||||||
++j; // skip test name
|
++j; // skip test name
|
||||||
++j; // skip command as it is in actualCommand
|
|
||||||
|
|
||||||
//TODO ZACH the problem is here for memcheck. We need to call
|
// find the test executable
|
||||||
//memcheckhandler.GenerateTestCommand BEFORE we run the process.
|
if(this->TestHandler->MemCheck)
|
||||||
// this->TestHandler->GenerateTestCommand(this->Arguments);
|
{
|
||||||
|
cmCTestMemCheckHandler * handler = static_cast<cmCTestMemCheckHandler*>
|
||||||
|
(this->TestHandler);
|
||||||
|
this->ActualCommand = handler->MemoryTester.c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->ActualCommand =
|
||||||
|
this->TestHandler->FindTheExecutable(
|
||||||
|
this->TestProperties->Args[1].c_str());
|
||||||
|
++j; //skip the executable (it will be actualCommand)
|
||||||
|
}
|
||||||
|
this->TestCommand
|
||||||
|
= cmSystemTools::ConvertToOutputPath(this->ActualCommand.c_str());
|
||||||
|
|
||||||
|
//Prepends memcheck args to our command string
|
||||||
|
this->TestHandler->GenerateTestCommand(this->Arguments);
|
||||||
|
for(std::vector<std::string>::iterator i = this->Arguments.begin();
|
||||||
|
i != this->Arguments.end(); ++i)
|
||||||
|
{
|
||||||
|
this->TestCommand += " ";
|
||||||
|
this->TestCommand += cmSystemTools::EscapeSpaces(j->c_str());
|
||||||
|
}
|
||||||
|
|
||||||
for(;j != this->TestProperties->Args.end(); ++j)
|
for(;j != this->TestProperties->Args.end(); ++j)
|
||||||
{
|
{
|
||||||
this->TestCommand += " ";
|
this->TestCommand += " ";
|
||||||
|
@ -64,6 +64,8 @@ private:
|
|||||||
bool CreateProcess(double testTimeOut,
|
bool CreateProcess(double testTimeOut,
|
||||||
std::vector<std::string>* environment);
|
std::vector<std::string>* environment);
|
||||||
void WriteLogOutputTop(int completed, int total);
|
void WriteLogOutputTop(int completed, int total);
|
||||||
|
//Run post processing of the process output for MemCheck
|
||||||
|
void MemCheckPostProcess();
|
||||||
|
|
||||||
cmCTestTestHandler::cmCTestTestProperties * TestProperties;
|
cmCTestTestHandler::cmCTestTestProperties * TestProperties;
|
||||||
//Pointer back to the "parent"; the handler that invoked this test run
|
//Pointer back to the "parent"; the handler that invoked this test run
|
||||||
|
@ -709,7 +709,7 @@ void cmCTestTestHandler::PrintLabelSummary()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
|
void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
|
||||||
std::vector<cmStdString> &passed,
|
std::vector<cmStdString> &passed,
|
||||||
@ -791,9 +791,6 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
|
|||||||
}
|
}
|
||||||
arguments.push_back(0);
|
arguments.push_back(0);
|
||||||
|
|
||||||
/**
|
|
||||||
* Run an executable command and put the stdout in output.
|
|
||||||
*/
|
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
|
|
||||||
@ -1026,7 +1023,7 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
|
|||||||
cres.CompletionStatus = "Completed";
|
cres.CompletionStatus = "Completed";
|
||||||
this->TestResults.push_back( cres );
|
this->TestResults.push_back( cres );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it)
|
void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it)
|
||||||
{
|
{
|
||||||
@ -1363,7 +1360,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void cmCTestTestHandler::GenerateTestCommand(std::vector<const char*>&)
|
void cmCTestTestHandler::GenerateTestCommand(std::vector<std::string>&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ protected:
|
|||||||
// comput a final test list
|
// comput a final test list
|
||||||
virtual int PreProcessHandler();
|
virtual int PreProcessHandler();
|
||||||
virtual int PostProcessHandler();
|
virtual int PostProcessHandler();
|
||||||
virtual void GenerateTestCommand(std::vector<const char*>& args);
|
virtual void GenerateTestCommand(std::vector<std::string>& args);
|
||||||
int ExecuteCommands(std::vector<cmStdString>& vec);
|
int ExecuteCommands(std::vector<cmStdString>& vec);
|
||||||
|
|
||||||
void WriteTestResultHeader(std::ostream& os, cmCTestTestResult* result);
|
void WriteTestResultHeader(std::ostream& os, cmCTestTestResult* result);
|
||||||
@ -157,17 +157,6 @@ protected:
|
|||||||
bool MemCheck;
|
bool MemCheck;
|
||||||
int CustomMaximumPassedTestOutputSize;
|
int CustomMaximumPassedTestOutputSize;
|
||||||
int CustomMaximumFailedTestOutputSize;
|
int CustomMaximumFailedTestOutputSize;
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* Run one test
|
|
||||||
*/
|
|
||||||
virtual void ProcessOneTest(cmCTestTestProperties *props,
|
|
||||||
std::vector<cmStdString> &passed,
|
|
||||||
std::vector<cmStdString> &failed,
|
|
||||||
int count, int tmsize);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { // Program statuses
|
enum { // Program statuses
|
||||||
NOT_RUN = 0,
|
NOT_RUN = 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user