Commit 5b232ded authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

ENH: Add initial memory check support which works for Valgrind

parent ce8a3490
......@@ -69,7 +69,9 @@ IF(BUILD_TESTING)
DOC "Path to program used to compress files for transfer to the dart server")
FIND_PROGRAM(GUNZIPCOMMAND gunzip DOC "Path to gunzip executable")
FIND_PROGRAM(JAVACOMMAND java DOC "Path to java command, used by the Dart server to create html.")
FIND_PROGRAM(PURIFYCOMMAND purify
FIND_PROGRAM(MEMORYCHECK_COMMAND
NAMES purify valgrind boundscheck
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC "Path to Rational purify command, used for memory error detection."
)
......@@ -95,11 +97,25 @@ IF(BUILD_TESTING)
ELSE(WIN32)
SET(DART_NAME_COMPONENT "NAME")
ENDIF(WIN32)
SET(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
IF(WIN32)
SET(BUILD_NAME_SYSTEM_NAME "Win32")
ENDIF(WIN32)
IF(UNIX OR BORLAND)
GET_FILENAME_COMPONENT(DART_CXX_NAME "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT})
ELSE(UNIX OR BORLAND)
GET_FILENAME_COMPONENT(DART_CXX_NAME "${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT})
ENDIF(UNIX OR BORLAND)
IF(DART_CXX_NAME MATCHES "msdev")
SET(DART_CXX_NAME "vs60")
ENDIF(DART_CXX_NAME MATCHES "msdev")
IF(DART_CXX_NAME MATCHES "devenv")
IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
SET(DART_CXX_NAME "vs70")
ELSE(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
SET(DART_CXX_NAME "vs71")
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
ENDIF(DART_CXX_NAME MATCHES "devenv")
SET(BUILDNAME "${CMAKE_SYSTEM_NAME}-${DART_CXX_NAME}")
MESSAGE(STATUS "Using Buildname: ${BUILDNAME}")
ENDIF(NOT BUILDNAME)
......@@ -140,7 +156,7 @@ IF(BUILD_TESTING)
# configure files
CONFIGURE_FILE(
${DART_ROOT}/Source/Client/Utility.conf.in
${DART_ROOT}/Source/Client/Dart.conf.in
${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
#
......
......@@ -40,6 +40,8 @@ ScpCommand: @SCPCOMMAND@
PurifyCommand: @PURIFYCOMMAND@
ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
MemoryCheckCommand: @MEMORYCHECK_COMMAND@
MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
CoverageCommand: @COVERAGE_COMMAND@
# Compression commands
GunzipCommand: @GUNZIPCOMMAND@
......
......@@ -37,7 +37,7 @@ cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
}
if ( getenv("HTTP_PROXY_TYPE") )
{
std::string type = getenv("HTTP_PROXY_TYPE");
cmStdString type = getenv("HTTP_PROXY_TYPE");
// HTTP/SOCKS4/SOCKS5
if ( type == "HTTP" )
{
......@@ -66,7 +66,7 @@ cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
}
if ( getenv("FTP_PROXY_TYPE") )
{
std::string type = getenv("FTP_PROXY_TYPE");
cmStdString type = getenv("FTP_PROXY_TYPE");
// HTTP/SOCKS4/SOCKS5
if ( type == "HTTP" )
{
......@@ -92,10 +92,10 @@ cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
}
}
bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url)
bool cmCTestSubmit::SubmitUsingFTP(const cmStdString& localprefix,
const std::vector<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url)
{
CURL *curl;
CURLcode res;
......@@ -105,7 +105,7 @@ bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
std::string::size_type cc;
cmStdString::size_type cc;
for ( cc = 0; cc < files.size(); cc ++ )
{
/* get a curl handle */
......@@ -132,8 +132,8 @@ bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
// enable uploading
::curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ;
std::string local_file = localprefix + "/" + files[cc];
std::string upload_as = url + "/" + remoteprefix + files[cc];
cmStdString local_file = localprefix + "/" + files[cc];
cmStdString upload_as = url + "/" + remoteprefix + files[cc];
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
......@@ -184,10 +184,10 @@ bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
}
// Uploading files is simpler
bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url)
bool cmCTestSubmit::SubmitUsingHTTP(const cmStdString& localprefix,
const std::vector<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url)
{
CURL *curl;
CURLcode res;
......@@ -196,7 +196,7 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
std::string::size_type cc, kk;
cmStdString::size_type cc, kk;
for ( cc = 0; cc < files.size(); cc ++ )
{
/* get a curl handle */
......@@ -231,9 +231,9 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
}
std::string local_file = localprefix + "/" + files[cc];
std::string remote_file = remoteprefix + files[cc];
std::string ofile = "";
cmStdString local_file = localprefix + "/" + files[cc];
cmStdString remote_file = remoteprefix + files[cc];
cmStdString ofile = "";
for ( kk = 0; kk < remote_file.size(); kk ++ )
{
char c = remote_file[kk];
......@@ -256,7 +256,7 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
ofile.append(hex);
}
}
std::string upload_as = url + "?FileName=" + ofile;
cmStdString upload_as = url + "?FileName=" + ofile;
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
......@@ -301,16 +301,16 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
return true;
}
bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url)
bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url)
{
CURL *curl;
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
std::string::size_type cc, kk;
cmStdString::size_type cc, kk;
for ( cc = 0; cc < files.size(); cc ++ )
{
/* get a curl handle */
......@@ -339,8 +339,8 @@ bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files,
{
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
}
std::string file = remoteprefix + files[cc];
std::string ofile = "";
cmStdString file = remoteprefix + files[cc];
cmStdString ofile = "";
for ( kk = 0; kk < file.size(); kk ++ )
{
char c = file[kk];
......@@ -363,7 +363,7 @@ bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files,
ofile.append(hex);
}
}
std::string turl = url + "?xmlfile=" + ofile;
cmStdString turl = url + "?xmlfile=" + ofile;
if ( m_Verbose )
{
std::cout << " Trigger url: " << turl.c_str() << std::endl;
......@@ -386,10 +386,10 @@ bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files,
return true;
}
bool cmCTestSubmit::SubmitUsingSCP(const std::string&,
const std::vector<std::string>&,
const std::string&,
const std::string&)
bool cmCTestSubmit::SubmitUsingSCP(const cmStdString&,
const std::vector<cmStdString>&,
const cmStdString&,
const cmStdString&)
{
std::cout << "SubmitUsingSCP is not yet implemented" << std::endl;
return false;
......
......@@ -41,27 +41,27 @@ public:
/**
* Submit file using various ways
*/
bool SubmitUsingFTP(const std::string& localprefix,
const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url);
bool SubmitUsingHTTP(const std::string& localprefix,
const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url);
bool SubmitUsingSCP(const std::string& localprefix,
const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url);
bool SubmitUsingFTP(const cmStdString& localprefix,
const std::vector<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url);
bool SubmitUsingHTTP(const cmStdString& localprefix,
const std::vector<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url);
bool SubmitUsingSCP(const cmStdString& localprefix,
const std::vector<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url);
bool TriggerUsingHTTP(const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url);
bool TriggerUsingHTTP(const std::vector<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url);
private:
std::string m_HTTPProxy;
cmStdString m_HTTPProxy;
int m_HTTPProxyType;
std::string m_FTPProxy;
cmStdString m_FTPProxy;
int m_FTPProxyType;
bool m_Verbose;
};
......
......@@ -62,7 +62,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
{
glob = cstr + "*";
}
std::vector<std::string> dirs;
std::vector<cmStdString> dirs;
cmSystemTools::SimpleGlob(glob.c_str(), dirs, (m_Type == cmCacheManager::PATH?-1:0));
if ( m_CurrentIndex < dirs.size() )
......
This diff is collapsed.
......@@ -24,6 +24,8 @@
class cmCTest
{
public:
typedef std::vector<cmStdString> tm_VectorOfStrings;
/**
* Run a dashboard using a specified confiuration script
*/
......@@ -55,7 +57,7 @@ public:
/**
* Try to run tests of the project
*/
int TestDirectory();
int TestDirectory(bool memcheck);
/**
* Try to get coverage of the project
......@@ -86,8 +88,9 @@ public:
/**
* Run the test for a directory and any subdirectories
*/
void ProcessDirectory(std::vector<std::string> &passed,
std::vector<std::string> &failed);
void ProcessDirectory(tm_VectorOfStrings &passed,
tm_VectorOfStrings &failed,
bool memcheck);
/**
* Find the executable for a test
......@@ -143,7 +146,7 @@ private:
BUILD_TEST = 4,
TEST_TEST = 5,
COVERAGE_TEST = 6,
PURIFY_TEST = 7,
MEMCHECK_TEST = 7,
SUBMIT_TEST = 8,
ALL_TEST = 9,
LAST_TEST = 10
......@@ -162,6 +165,40 @@ private:
COMPLETED
};
enum { // Memory checkers
UNKNOWN = 0,
VALGRIND,
PURIFY,
BOUNDS_CHECKER
};
enum { // Memory faults
ABR = 0,
ABW,
ABWL,
COR,
EXU,
FFM,
FIM,
FMM,
FMR,
FMW,
FUM,
IPR,
IPW,
MAF,
MLK,
MPK,
NPR,
ODS,
PAR,
PLK,
UMC,
UMR,
NO_MEMORY_FAULT
};
struct cmCTestTestResult
{
std::string m_Name;
......@@ -235,10 +272,20 @@ private:
int m_TimeOut;
std::string m_MemoryTester;
std::string m_MemoryTesterOptions;
int m_MemoryTesterStyle;
std::string m_MemoryTesterOutputFile;
tm_VectorOfStrings m_MemoryTesterOptionsParsed;
int m_MemoryTesterGlobalResults[NO_MEMORY_FAULT];
int m_CompatibilityMode;
/**
* Generate the Dart compatible output
*/
void GenerateDartTestOutput(std::ostream& os);
void GenerateDartMemCheckOutput(std::ostream& os);
void GenerateDartBuildOutput(std::ostream& os,
std::vector<cmCTestBuildErrorWarning>);
......@@ -259,6 +306,20 @@ private:
std::string GenerateRegressionImages(const std::string& xml);
const char* GetTestStatus(int status);
//! Start CTest XML output file
void StartXML(ostream& ostr);
//! End CTest XML output file
void EndXML(ostream& ostr);
//! Parse Valgrind/Purify/Bounds Checker result out of the output string. After running,
// log holds the output and results hold the different memmory errors.
bool ProcessMemCheckOutput(const std::string& str, std::string& log, int* results);
bool ProcessMemCheckValgrindOutput(const std::string& str, std::string& log, int* results);
//! Initialize memory checking subsystem.
bool InitializeMemoryChecking();
};
#endif
......@@ -909,8 +909,8 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
}
}
bool cmSystemTools::SimpleGlob(const std::string& glob,
std::vector<std::string>& files,
bool cmSystemTools::SimpleGlob(const cmStdString& glob,
std::vector<cmStdString>& files,
int type /* = 0 */)
{
files.clear();
......
......@@ -139,7 +139,7 @@ public:
* want to find. 0 means all files, -1 means directories, 1 means
* files only. This method returns true if search was succesfull.
*/
static bool SimpleGlob(const std::string& glob, std::vector<std::string>& files,
static bool SimpleGlob(const cmStdString& glob, std::vector<cmStdString>& files,
int type = 0);
///! Copy a file.
......
......@@ -197,10 +197,10 @@ int main (int argc, char *argv[])
inst.SetTestModel(cmCTest::EXPERIMENTAL);
inst.SetTest("Test");
}
else if ( targ == "ExperimentalPurify" )
else if ( targ == "ExperimentalMemCheck" || targ == "ExperimentalPurify" )
{
inst.SetTestModel(cmCTest::EXPERIMENTAL);
inst.SetTest("Purify");
inst.SetTest("MemCheck");
}
else if ( targ == "ExperimentalCoverage" )
{
......@@ -248,10 +248,10 @@ int main (int argc, char *argv[])
inst.SetTestModel(cmCTest::CONTINUOUS);
inst.SetTest("Test");
}
else if ( targ == "ContinuousPurify" )
else if ( targ == "ContinuousMemCheck" || targ == "ContinuousPurify" )
{
inst.SetTestModel(cmCTest::CONTINUOUS);
inst.SetTest("Purify");
inst.SetTest("MemCheck");
}
else if ( targ == "ContinuousCoverage" )
{
......@@ -299,10 +299,10 @@ int main (int argc, char *argv[])
inst.SetTestModel(cmCTest::NIGHTLY);
inst.SetTest("Test");
}
else if ( targ == "NightlyPurify" )
else if ( targ == "NightlyMemCheck" || targ == "NightlyPurify" )
{
inst.SetTestModel(cmCTest::NIGHTLY);
inst.SetTest("Purify");
inst.SetTest("MemCheck");
}
else if ( targ == "NightlyCoverage" )
{
......@@ -320,7 +320,7 @@ int main (int argc, char *argv[])
inst.SetTest("Start");
inst.SetTest("Configure");
inst.SetTest("Build");
inst.SetTest("Purify");
inst.SetTest("MemCheck");
inst.SetTest("Coverage");
inst.SetTest("Submit");
}
......@@ -331,7 +331,7 @@ int main (int argc, char *argv[])
inst.SetTest("Update");
inst.SetTest("Configure");
inst.SetTest("Build");
inst.SetTest("Purify");
inst.SetTest("MemCheck");
inst.SetTest("Coverage");
inst.SetTest("Submit");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment