From b1f1118239cafe51ce69170c0d37e6727de8abe5 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 3 Nov 2003 15:38:23 -0500 Subject: ENH: Cleanup parsing of argument to help fix Bug #259 - CMake does not quote correctly in DartTestfile.txt --- Source/cmCTest.cxx | 26 +++++++++----------------- Source/cmCTest.h | 2 +- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 64af104..2fceb85 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1716,6 +1716,8 @@ void cmCTest::ProcessDirectory(std::vector &passed, std::string testCommand = this->FindTheExecutable(args[1].Value.c_str()); testCommand = cmSystemTools::ConvertToOutputPath(testCommand.c_str()); + std::string actualCommand = testCommand; + // continue if we did not find the executable if (testCommand == "") { @@ -1729,11 +1731,16 @@ void cmCTest::ProcessDirectory(std::vector &passed, std::vector::const_iterator j = args.begin(); ++j; ++j; + std::vector arguments; + arguments.push_back(actualCommand.c_str()); for(;j != args.end(); ++j) { testCommand += " "; testCommand += cmSystemTools::EscapeSpaces(j->Value.c_str()); + arguments.push_back(j->Value.c_str()); } + arguments.push_back(0); + /** * Run an executable command and put the stdout in output. */ @@ -1750,7 +1757,7 @@ void cmCTest::ProcessDirectory(std::vector &passed, int res = 0; if ( !m_ShowOnly ) { - res = this->RunTest(testCommand.c_str(), &output, &retVal); + res = this->RunTest(arguments, &output, &retVal); } clock_finish = cmSystemTools::GetTime(); @@ -2410,23 +2417,8 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output, return result; } -int cmCTest::RunTest( const char* command, std::string* output, int *retVal) +int cmCTest::RunTest(std::vector argv, std::string* output, int *retVal) { - std::vector args = cmSystemTools::ParseArguments(command); - - if(args.size() < 1) - { - return false; - } - - std::vector argv; - for(std::vector::const_iterator a = args.begin(); - a != args.end(); ++a) - { - argv.push_back(a->c_str()); - } - argv.push_back(0); - if ( output ) { *output = ""; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 44b15dc..ee19740 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -247,7 +247,7 @@ private: //! Run command specialized for tests. Returns process status and retVal is // return value or exception. - int RunTest( const char* command, std::string* output, int *retVal); + int RunTest(std::vector args, std::string* output, int *retVal); std::string GenerateRegressionImages(const std::string& xml); const char* GetTestStatus(int status); -- cgit v0.12