summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmAddTestCommand.cxx15
-rw-r--r--Source/cmTest.cxx12
-rw-r--r--Source/cmTest.h12
-rw-r--r--Source/cmTestGenerator.cxx14
4 files changed, 21 insertions, 32 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 0bbf40e..e894bd8 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -33,15 +33,13 @@ bool cmAddTestCommand
this->SetError("called with incorrect number of arguments");
return false;
}
-
- // store the arguments for the final pass
- // also expand any CMake variables
- std::vector<cmStdString> arguments;
- std::vector<std::string>::const_iterator it;
- for ( it = args.begin() + 2; it != args.end(); ++ it )
+ // Collect the command with arguments.
+ std::vector<std::string> command;
+ for(std::vector<std::string>::const_iterator it = args.begin() + 1;
+ it != args.end(); ++it)
{
- arguments.push_back(*it);
+ command.push_back(*it);
}
// Create the test but add a generator only the first time it is
@@ -52,8 +50,7 @@ bool cmAddTestCommand
test = this->Makefile->CreateTest(args[0].c_str());
this->Makefile->AddTestGenerator(new cmTestGenerator(test));
}
- test->SetCommand(args[1].c_str());
- test->SetArguments(arguments);
+ test->SetCommand(command);
return true;
}
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index c7b1637..ac61984 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -38,19 +38,9 @@ void cmTest::SetName(const char* name)
this->Name = name;
}
-void cmTest::SetCommand(const char* command)
+void cmTest::SetCommand(std::vector<std::string> const& command)
{
- if ( !command )
- {
- command = "";
- }
this->Command = command;
- cmSystemTools::ConvertToUnixSlashes(this->Command);
-}
-
-void cmTest::SetArguments(const std::vector<cmStdString>& args)
-{
- this->Args = args;
}
const char *cmTest::GetProperty(const char* prop) const
diff --git a/Source/cmTest.h b/Source/cmTest.h
index d4945db..521981d 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -37,12 +37,11 @@ public:
///! Set the test name
void SetName(const char* name);
const char* GetName() const { return this->Name.c_str(); }
- void SetCommand(const char* command);
- const char* GetCommand() const { return this->Command.c_str(); }
- void SetArguments(const std::vector<cmStdString>& args);
- const std::vector<cmStdString>& GetArguments() const
+
+ void SetCommand(std::vector<std::string> const& command);
+ std::vector<std::string> const& GetCommand() const
{
- return this->Args;
+ return this->Command;
}
/**
@@ -67,8 +66,7 @@ public:
private:
cmPropertyMap Properties;
cmStdString Name;
- cmStdString Command;
- std::vector<cmStdString> Args;
+ std::vector<std::string> Command;
// The cmMakefile instance that owns this target. This should
// always be set.
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 75865a2..8581c96 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -16,6 +16,7 @@
=========================================================================*/
#include "cmTestGenerator.h"
+#include "cmSystemTools.h"
#include "cmTest.h"
//----------------------------------------------------------------------------
@@ -96,14 +97,17 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& fout,
{
this->TestGenerated = true;
- cmTest* test = this->Test;
+ // Get the test command line to be executed.
+ std::vector<std::string> const& command = this->Test->GetCommand();
+
+ std::string exe = command[0];
+ cmSystemTools::ConvertToUnixSlashes(exe);
fout << indent;
fout << "ADD_TEST(";
- fout << test->GetName() << " \"" << test->GetCommand() << "\"";
+ fout << this->Test->GetName() << " \"" << exe << "\"";
- std::vector<cmStdString>::const_iterator argit;
- for (argit = test->GetArguments().begin();
- argit != test->GetArguments().end(); ++argit)
+ for(std::vector<std::string>::const_iterator argit = command.begin()+1;
+ argit != command.end(); ++argit)
{
// Just double-quote all arguments so they are re-parsed
// correctly by the test system.